66 lines
2.4 KiB
NASM
66 lines
2.4 KiB
NASM
* peislam.asm - originally a PEI-slam helper, now hosts the GetTick
|
|
* and ReadBParam trampolines. The PEI-slam logic was rolled into
|
|
* iigsBlitStageToShr in joeyDraw.asm.
|
|
|
|
keep PEISLAM
|
|
case on
|
|
|
|
|
|
* Stub kept so the PEISLAM load segment stays present (the build's
|
|
* PORT_ASM_SRCS_ALL wildcard pulls in this file by name).
|
|
peislamStub start IIGSASM
|
|
rtl
|
|
end
|
|
|
|
|
|
****************************************************************
|
|
* uint16_t iigsGetTickWord(void)
|
|
*
|
|
* Calls Misc Toolset GetTick ($2503) and returns the low 16 bits of
|
|
* the 32-bit tick counter. The system increments this counter from
|
|
* the actual VBL hardware interrupt, so it stays accurate regardless
|
|
* of caller polling rate -- C-side polling of $C019 missed transitions
|
|
* for any op over ~1 ms.
|
|
*
|
|
* GetTick output convention: caller pushes 4 bytes of output space,
|
|
* tool dispatcher writes the LongWord into them. We pull the low 16
|
|
* bits into A (ORCA-C Word return convention -- A holds the result,
|
|
* not Y; verified against jIIgs.asm asmGetVbl) and discard the high
|
|
* 16 into X.
|
|
*
|
|
* ORCA-C cdecl ABI: caller has M=I=16. Word return in A.
|
|
****************************************************************
|
|
|
|
iigsGetTickWord start IIGSASM
|
|
pha ; output space high word
|
|
pha ; output space low word
|
|
ldx #$2503 ; _GetTick
|
|
jsl $E10000
|
|
|
|
pla ; A = low 16 bits (return value)
|
|
plx ; discard high 16 bits
|
|
rtl
|
|
end
|
|
|
|
|
|
****************************************************************
|
|
* uint16_t iigsReadHzParam(void)
|
|
*
|
|
* Reads battery RAM parameter hrtz50or60 ($1D) via _ReadBParam ($0C03)
|
|
* and returns the raw value: 0 = NTSC (60 Hz), 1 = PAL (50 Hz).
|
|
*
|
|
* GetTick fires from the hardware VBL ISR, so its rate matches the
|
|
* video field rate -- 60 Hz on NTSC, 50 Hz on PAL. halFrameHz must
|
|
* report whichever this machine actually runs so wall-clock math
|
|
* (frames * 1000 / halFrameHz) is correct on both.
|
|
****************************************************************
|
|
|
|
iigsReadHzParam start IIGSASM
|
|
pha ; output space (Word)
|
|
pea $001D ; hrtz50or60 parameter ID
|
|
ldx #$0C03 ; _ReadBParam
|
|
jsl $E10000
|
|
|
|
pla ; A = result (ORCA-C Word return)
|
|
rtl
|
|
end
|