A2osX/SYS/KERNEL.S.Z80.txt

95 lines
2.3 KiB
Plaintext
Raw Normal View History

2018-07-04 14:59:12 +00:00
NEW
2020-02-23 20:01:48 +00:00
AUTO 3,1
2018-07-04 14:59:12 +00:00
*--------------------------------------
Z80.pPs .EQ pPs+0F000H
Z80.pCode .EQ pCode+0F000H
Z80.pData .EQ pData+0F000H
Z80.pStack .EQ pStack+0F000H
2020-02-23 20:01:48 +00:00
Z80.pBase .EQ pBase+0F000H
2018-07-04 14:59:12 +00:00
*--------------------------------------
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
2020-12-15 13:23:22 +00:00
SAVE usr/src/sys/kernel.s.z80
LOAD usr/src/sys/kernel.s
2018-07-04 14:59:12 +00:00
ASM