mirror of
https://github.com/A2osX/A2osX.git
synced 2024-09-10 22:54:59 +00:00
161 lines
3.1 KiB
Plaintext
161 lines
3.1 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
.OP 65C02
|
||
.OR $2000
|
||
.TF /A2OSX.BOOT/BIN/TEST
|
||
*--------------------------------------
|
||
.INB INC/MACROS.I
|
||
.INB INC/A2OSX.I
|
||
.INB INC/LIBSTR.I
|
||
*--------------------------------------
|
||
ZPPTR1 .EQ ZPBIN
|
||
*--------------------------------------
|
||
* File Header (16 Bytes)
|
||
*--------------------------------------
|
||
CS.START cld
|
||
jmp (.1,x)
|
||
.DA #$61 6502,Level 1 (65c02)
|
||
.DA #1 BIN Layout Version 1
|
||
.DA 0
|
||
.DA CS.END-CS.START Code Length To Relocate
|
||
.DA DS.END-DS.START Data Segment to Allocate
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
* Relocation Table
|
||
*--------------------------------------
|
||
.1 .DA CS.INIT
|
||
.DA CS.RUN
|
||
.DA CS.DOEVENT
|
||
.DA CS.QUIT
|
||
L.LIBSTR .DA LIBSTR
|
||
L.MSG0 .DA MSG0
|
||
L.MSG1 .DA MSG1
|
||
L.MSG2 .DA MSG2
|
||
L.MSG3 .DA MSG3
|
||
.DA 0
|
||
*--------------------------------------
|
||
CS.INIT >LDYA L.LIBSTR
|
||
>SYSCALL SYS.LoadLibYA
|
||
sta hLIBSTR
|
||
|
||
ldy #S.PS.hPREFIX
|
||
lda (pPs),y
|
||
>SYSCALL SYS.GetMemPtrA
|
||
>PUSHYA
|
||
>PUSHW L.MSG0
|
||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||
|
||
ldy #S.PS.hCS
|
||
lda (pPs),y
|
||
>SYSCALL SYS.GetMemByIDA
|
||
>STYA ZPPTR1
|
||
ldy #S.MEM.BIN
|
||
lda (ZPPTR1),y
|
||
>SYSCALL SYS.GetMemPtrA
|
||
>PUSHYA
|
||
>PUSHW L.MSG1
|
||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||
|
||
ldy #S.PS.hARGS
|
||
lda (pPs),y
|
||
>SYSCALL SYS.GetMemPtrA
|
||
>PUSHYA
|
||
ldy #S.PS.hCMD
|
||
lda (pPs),y
|
||
>SYSCALL SYS.GetMemPtrA
|
||
>PUSHYA
|
||
>PUSHW L.MSG2
|
||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||
|
||
ldy #S.PS.hENV
|
||
lda (pPs),y
|
||
>SYSCALL SYS.GetMemPtrA
|
||
>STYA ZPPTR1
|
||
|
||
.1 lda (ZPPTR1)
|
||
beq .2
|
||
>PUSHW ZPPTR1
|
||
>PUSHW L.MSG3
|
||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||
lda (ZPPTR1)
|
||
sec
|
||
adc ZPPTR1
|
||
sta ZPPTR1
|
||
bcc .1
|
||
inc ZPPTR1+1
|
||
bra .1
|
||
|
||
.2 ldy #bCTRLC
|
||
lda #0
|
||
sta (pData),y
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.RUN ldy #bCTRLC
|
||
lda (pData),y
|
||
beq .1
|
||
sec
|
||
rts
|
||
|
||
.1 clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.DOEVENT lda (pEvent)
|
||
|
||
>DEBUG
|
||
|
||
bpl .1 is it a TIMER event?
|
||
|
||
ora #'T'
|
||
>SYSCALL SYS.COutA
|
||
bra .9
|
||
|
||
.1 bit #S.EVT.F.KEY is it a KEY event?
|
||
beq .9
|
||
|
||
ldy #S.EVT.DATAHI is it an O or SAPPLE key ?
|
||
lda (pEvent),y
|
||
bne .9
|
||
|
||
ldy #S.EVT.DATALO
|
||
lda (pEvent),y
|
||
cmp #$03 Ctrl-C
|
||
bne .8
|
||
|
||
lda #$FF
|
||
ldy #bCTRLC
|
||
sta (pData),y
|
||
|
||
.8 clc
|
||
rts
|
||
|
||
.9 sec
|
||
rts
|
||
*--------------------------------------
|
||
CS.QUIT lda hLIBSTR
|
||
>SYSCALL SYS.FreeMemA
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.END
|
||
hLIBSTR .BS 1
|
||
LIBSTR >PSTRING "libstr.o"
|
||
MSG0 >CSTRING "PREFIX=%S\n"
|
||
MSG1 >CSTRING "BIN={%S}\n"
|
||
MSG2 >CSTRING "CMD={%S},ARGS={%S}\nENV:\n"
|
||
MSG3 >CSTRING " %S\n"
|
||
*--------------------------------------
|
||
DS.START
|
||
bCTRLC .BS 1
|
||
DS.END
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE BIN/TEST.S
|
||
ASM
|