mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-22 16:31:07 +00:00
186 lines
3.8 KiB
Plaintext
186 lines
3.8 KiB
Plaintext
|
PR#3
|
|||
|
PREFIX /DATA/A2OSX
|
|||
|
NEW
|
|||
|
INC 1
|
|||
|
AUTO 6
|
|||
|
.LIST OFF
|
|||
|
.OP 65C02
|
|||
|
*--------------------------------------
|
|||
|
* **** START OF A2osX Global Page ****
|
|||
|
*--------------------------------------
|
|||
|
A2osX.GP.start .EQ *
|
|||
|
*--------------------------------------
|
|||
|
.PH $300
|
|||
|
*--------------------------------------
|
|||
|
A2osX.GP bra A2osX.SYSCALL3
|
|||
|
bra A2osX.MLICALL3
|
|||
|
bra A2osX.LIBCALL3
|
|||
|
bra A2osX.SLEEP3
|
|||
|
bra Kernel.MLICALL3
|
|||
|
bra Kernel.DRVCALL3
|
|||
|
bra Kernel.BINCALL3
|
|||
|
bra Kernel.LIBCALL3
|
|||
|
.BS A2osX.300CODE-*
|
|||
|
*--------------------------------------
|
|||
|
* A2osX.SYSCALL (MAINLC to AUXLC)
|
|||
|
* In:
|
|||
|
* X = SYSfnc.Index
|
|||
|
* Y,A = free for Inline param
|
|||
|
*--------------------------------------
|
|||
|
A2osX.SYSCALL3 jsr GO.AUXLC
|
|||
|
jsr $E003
|
|||
|
jsr GO.MAINLC
|
|||
|
rts
|
|||
|
*--------------------------------------
|
|||
|
* A2osX.MLICALL (MAINLC to MAINLC)
|
|||
|
* In:
|
|||
|
* X = MLI Function
|
|||
|
* A = Param Count
|
|||
|
*--------------------------------------
|
|||
|
A2osX.MLICALL3 stx .1
|
|||
|
sta MLICALL.PARAMS
|
|||
|
jsr MLI
|
|||
|
.1 .BS 1
|
|||
|
.DA MLICALL.PARAMS
|
|||
|
rts
|
|||
|
*--------------------------------------
|
|||
|
* LIBCALL (MAINLC to MAINLC)
|
|||
|
* In:
|
|||
|
* Y = LIB.ID
|
|||
|
* X = LIBfnc.Index
|
|||
|
* A = free for Inline param
|
|||
|
*--------------------------------------
|
|||
|
A2osX.LIBCALL3 pha
|
|||
|
phx
|
|||
|
tya
|
|||
|
>SYSCALL SYS.GetMemPtrA
|
|||
|
>STYA .1+1
|
|||
|
plx
|
|||
|
pla
|
|||
|
.1 jmp $FFFF
|
|||
|
*--------------------------------------
|
|||
|
A2osX.SLEEP3 jmp A2osX.SLEEP31
|
|||
|
*--------------------------------------
|
|||
|
* SLEEP (MAINLC to AUXLC)
|
|||
|
* In:
|
|||
|
*--------------------------------------
|
|||
|
* Kernel.MLICALL (AUXLC to MAINLC)
|
|||
|
* In:
|
|||
|
* X = MLI Function
|
|||
|
* A = Param Count
|
|||
|
*--------------------------------------
|
|||
|
Kernel.MLICALL3 jsr GO.MAINLC
|
|||
|
jsr A2osX.MLICALL3
|
|||
|
jsr GO.AUXLC
|
|||
|
rts
|
|||
|
*--------------------------------------
|
|||
|
* Kernel.DRVCALL (AUXLC to MAINLC)
|
|||
|
* In:
|
|||
|
* X = DRV Function Index
|
|||
|
* Y,A = pDevContext
|
|||
|
*--------------------------------------
|
|||
|
Kernel.DRVCALL3 jsr GO.MAINLC
|
|||
|
>STYA pDevContext
|
|||
|
jsr Kernel.JMP3
|
|||
|
jsr GO.AUXLC
|
|||
|
rts
|
|||
|
*--------------------------------------
|
|||
|
* Kernel.BINCALL (AUXLC to MAINLC)
|
|||
|
* In:
|
|||
|
* X = BIN Function Index
|
|||
|
* Y,A = pPsContext
|
|||
|
*--------------------------------------
|
|||
|
Kernel.BINCALL3 jsr GO.MAINLC
|
|||
|
>STYA pPsContext
|
|||
|
jsr Kernel.JMP3
|
|||
|
jsr GO.AUXLC
|
|||
|
rts
|
|||
|
*--------------------------------------
|
|||
|
* Kernel.LIBCALL (AUXLC to MAINLC)
|
|||
|
* In:
|
|||
|
* X = Lib Function Index
|
|||
|
*--------------------------------------
|
|||
|
Kernel.LIBCALL3 jsr GO.MAINLC
|
|||
|
jsr Kernel.JMP3
|
|||
|
jsr GO.AUXLC
|
|||
|
rts
|
|||
|
*--------------------------------------
|
|||
|
Kernel.JMP3 jmp (Kernel.JMP)
|
|||
|
*--------------------------------------
|
|||
|
GO.MAINLC php
|
|||
|
clc
|
|||
|
bra GO.SAVE.REG
|
|||
|
|
|||
|
GO.AUXLC php
|
|||
|
sec
|
|||
|
|
|||
|
GO.SAVE.REG sta A2osX.SaveA
|
|||
|
pla keep P in A for later
|
|||
|
stx A2osX.SaveX
|
|||
|
sty A2osX.SaveY
|
|||
|
plx
|
|||
|
ply
|
|||
|
inx
|
|||
|
bne .1
|
|||
|
iny
|
|||
|
.1 stx GO.EXIT.JMP+1
|
|||
|
sty GO.EXIT.JMP+2
|
|||
|
sei
|
|||
|
ldy R.SP
|
|||
|
tsx
|
|||
|
stx A2osX.SaveS
|
|||
|
bcs GO.AUXLC1
|
|||
|
|
|||
|
GO.MAINLC1 stx CLRALTZP
|
|||
|
ldx RROMBNK2
|
|||
|
ldx A2osX.SaveS
|
|||
|
txs
|
|||
|
sty R.SP
|
|||
|
bra GO.EXIT
|
|||
|
*--------------------------------------
|
|||
|
GO.AUXLC1 stx SETALTZP
|
|||
|
ldx RRAMWRAMBNK2
|
|||
|
ldx RRAMWRAMBNK2
|
|||
|
ldx A2osX.SaveS
|
|||
|
txs
|
|||
|
sty R.SP
|
|||
|
*--------------------------------------
|
|||
|
GO.EXIT pha push P on stack
|
|||
|
|
|||
|
ldy A2osX.SaveY
|
|||
|
ldx A2osX.SaveX
|
|||
|
lda A2osX.SaveA
|
|||
|
plp
|
|||
|
|
|||
|
GO.EXIT.JMP jmp $FFFF
|
|||
|
*--------------------------------------
|
|||
|
A2osX.SLEEP31 ldy #S.PS.hCS
|
|||
|
lda (pPsContext),y
|
|||
|
>SYSCALL SYS.GetMemPtrA
|
|||
|
>STYA Kernel.JMP
|
|||
|
ldy #S.PS.PC
|
|||
|
pla get PC LO
|
|||
|
plx get PC HI
|
|||
|
inc Advance PC one Byte
|
|||
|
bne .1
|
|||
|
inx
|
|||
|
|
|||
|
.1 sec
|
|||
|
sbc Kernel.JMP
|
|||
|
sta (pPsContext),y
|
|||
|
iny
|
|||
|
txa
|
|||
|
sbc Kernel.JMP+1
|
|||
|
sta (pPsContext),y
|
|||
|
clc No error,
|
|||
|
rts back to Kernel
|
|||
|
*--------------------------------------
|
|||
|
.EP
|
|||
|
*--------------------------------------
|
|||
|
A2osX.GP.End
|
|||
|
*--------------------------------------
|
|||
|
MAN
|
|||
|
SAVE A2OSX.S.GP
|
|||
|
LOAD A2OSX.S
|
|||
|
ASM
|