mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-23 07:35:19 +00:00
108 lines
2.4 KiB
Plaintext
108 lines
2.4 KiB
Plaintext
NEW
|
||
PREFIX
|
||
AUTO 4,1
|
||
*--------------------------------------
|
||
Z80.pPs .EQ pPs+0F000H
|
||
|
||
Z80.pCode .EQ pCode+0F000H
|
||
Z80.pData .EQ pData+0F000H
|
||
Z80.pStack .EQ pStack+0F000H
|
||
Z80.pLocal .EQ pLocal+0F000H
|
||
*--------------------------------------
|
||
Z80.6502P.N .EQ %10000000
|
||
Z80.6502P.V .EQ %01000000
|
||
Z80.6502P.B .EQ %00010000
|
||
Z80.6502P.D .EQ %00001000
|
||
Z80.6502P.I .EQ %00000100
|
||
Z80.6502P.Z .EQ %00000010
|
||
Z80.6502P.C .EQ %00000001
|
||
*--------------------------------------
|
||
.OP Z80
|
||
.OR 0
|
||
*--------------------------------------
|
||
* First time entry point after reset
|
||
* Called from Kernel.Init2
|
||
*--------------------------------------
|
||
Z80.Init ld SP,000FFH Init Stack to 000FFH ($10ff)
|
||
ld A,0FFH Set Flag...
|
||
ld Z80.6502A,A ...in 6502 A reg
|
||
|
||
im 1
|
||
|
||
ei
|
||
|
||
jr Z80.Exit
|
||
*--------------------------------------
|
||
.BS 00038h-*
|
||
*--------------------------------------
|
||
Z80.Irq push AF
|
||
push BC
|
||
push DE
|
||
push HL
|
||
push IX
|
||
push IY
|
||
|
||
ld (Z80.pStack),SP
|
||
*--------------------------------------
|
||
Z80.Exit ld Z80.IOz,A exit to 6502, falling in main loop for next call
|
||
*--------------------------------------
|
||
* Called from :
|
||
* - CORE.PSExec : Z80.6502X = PS.INIT/PS.RUN/PS.DOEVENT/PS.QUIT
|
||
* - CORE.PSExec : Resume
|
||
* - SYSCALL Return
|
||
* - LIBCALL Return
|
||
* -
|
||
*--------------------------------------
|
||
Z80.Enter ld A,(Z80.6502X) get 6502,X
|
||
cp A,PS.RESUME
|
||
jpz Z80.Resume
|
||
|
||
ld L,A
|
||
ld H,0 HL=offset in jump table
|
||
ld DE,(Z80.pCode) DE=Code Base
|
||
add DE,4 skip header
|
||
add HL,DE HL=CodeBase+4+X
|
||
ld A,(HL) get jmp lo at X
|
||
inc HL
|
||
ld H,(HL) get jmp hi at X+1
|
||
ld L,A
|
||
|
||
call Z80.JumpHL
|
||
|
||
ld Z80.6502A,A
|
||
|
||
|
||
|
||
*--------------------------------------
|
||
Z80.Resume ld SP,(Z80.pStack)
|
||
|
||
pop IY
|
||
pop IX
|
||
pop HL
|
||
pop DE
|
||
pop BC
|
||
pop AF
|
||
|
||
ei
|
||
|
||
reti
|
||
*--------------------------------------
|
||
|
||
*--------------------------------------
|
||
Z80.SYSCALL ld
|
||
*--------------------------------------
|
||
Z80.LIBCALL
|
||
*--------------------------------------
|
||
Z80.JumpHL jp (HL)
|
||
*--------------------------------------
|
||
Z80.IOz .DA 0E100H
|
||
Z80.6502A .BS 1
|
||
Z80.6502X .BS 1
|
||
Z80.6502Y .BS 1
|
||
Z80.6502P .BS 1
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE USR/SRC/SYS/KERNEL.S.Z80
|
||
LOAD USR/SRC/SYS/KERNEL.S
|
||
ASM
|