A2osX/A2osX.S.GP.txt

189 lines
4.1 KiB
Plaintext
Raw Normal View History

2015-03-14 21:48:35 +00:00
PR#3
2015-03-15 22:00:40 +00:00
PREFIX /A2OSX.BUILD
2015-03-14 21:48:35 +00:00
NEW
INC 1
AUTO 6
.LIST OFF
.OP 65C02
*--------------------------------------
* **** START OF A2osX Global Page ****
*--------------------------------------
A2osX.GP.B.start
.PH $BE00
*--------------------------------------
A2osX.GP.Start bra A2osX.SYSCALL1
bra A2osX.MLICALL1
bra A2osX.LIBCALL1
bra A2osX.SLEEP1
bra Kernel.MLICALL1
bra Kernel.DRVCALL1
bra Kernel.BINCALL1
bra Kernel.LIBCALL1
.BS A2osX.GPCODE-*
*--------------------------------------
* A2osX.SYSCALL (MAINLC to AUXLC)
* In:
* X = SYSfnc.Index
* Y,A = free for Inline param
*--------------------------------------
A2osX.SYSCALL1 jsr GO.AUXLC
jsr $E003
jsr GO.MAINLC
rts
*--------------------------------------
* A2osX.MLICALL (MAINLC to MAINLC)
* In:
* X = MLI Function
* A = Param Count
*--------------------------------------
A2osX.MLICALL1 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.LIBCALL1 pha
phx
tya
>SYSCALL SYS.GetMemPtrA
>STYA .1+1
plx
pla
.1 jmp $FFFF
*--------------------------------------
A2osX.SLEEP1 jmp A2osX.SLEEP2
*--------------------------------------
* SLEEP (MAINLC to AUXLC)
* In:
*--------------------------------------
* Kernel.MLICALL (AUXLC to MAINLC)
* In:
* X = MLI Function
* A = Param Count
*--------------------------------------
Kernel.MLICALL1 jsr GO.MAINLC
jsr A2osX.MLICALL1
jsr GO.AUXLC
rts
*--------------------------------------
* Kernel.DRVCALL (AUXLC to MAINLC)
* In:
* X = DRV Function Index
* Y,A = pDevContext
*--------------------------------------
Kernel.DRVCALL1 jsr GO.MAINLC
>STYA pDevContext
jsr GO.Kernel
jsr GO.AUXLC
rts
*--------------------------------------
* Kernel.BINCALL (AUXLC to MAINLC)
* In:
* X = BIN Function Index
* Y,A = pPsContext
*--------------------------------------
Kernel.BINCALL1 jsr GO.MAINLC
>STYA pPsContext
jsr GO.Kernel
jsr GO.AUXLC
rts
*--------------------------------------
* Kernel.LIBCALL (AUXLC to MAINLC)
* In:
* X = Lib Function Index
*--------------------------------------
Kernel.LIBCALL1 jsr GO.MAINLC
jsr GO.Kernel
jsr GO.AUXLC
rts
*--------------------------------------
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
bcs GO.AUXLC1
GO.MAINLC1 tsx
stx A2osX.SaveSX
stx CLRALTZP
ldx RROMBNK2
ldx A2osX.SaveSM
txs
sty R.SP
bra GO.EXIT
*--------------------------------------
GO.AUXLC1 tsx
stx A2osX.SaveSM
stx SETALTZP
ldx RRAMWRAMBNK1
ldx RRAMWRAMBNK1
ldx A2osX.SaveSX
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
*--------------------------------------
GO.Reset jsr GO.AUXLC
jsr $E000
*--------------------------------------
GO.Kernel jmp (Kernel.JMP)
*--------------------------------------
A2osX.SLEEP2 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
*--------------------------------------
A2osX.GP.End .EQ *
A2osX.GP.SIZE .EQ A2osX.GP.END-A2osX.GP.START
.BS A2osX.GP.START+$100-*
.EP
*--------------------------------------
MAN
SAVE A2OSX.S.GP
LOAD A2OSX.S
ASM