2015-03-14 21:47:37 +00:00
|
|
|
|
PR#3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
PREFIX /A2OSX.SRC
|
2015-03-14 21:47:37 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.TF /A2OSX.BOOT/BIN/TEST
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.INB INC/MACROS.I
|
|
|
|
|
.INB INC/A2OSX.I
|
|
|
|
|
.INB INC/LIBSTR.I
|
|
|
|
|
*--------------------------------------
|
2016-03-13 21:51:50 +00:00
|
|
|
|
ZPPTR1 .EQ ZPBIN
|
|
|
|
|
*--------------------------------------
|
2015-11-22 22:30:06 +00:00
|
|
|
|
* File Header (16 Bytes)
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.START cld
|
|
|
|
|
jmp (.1,x)
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.DA #$61 6502,Level 1 (65c02)
|
|
|
|
|
.DA #1 BIN Layout Version 1
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA CS.END-CS.START Code Length To Relocate
|
2016-03-13 21:51:50 +00:00
|
|
|
|
.DA DS.END-DS.START Data Segment to Allocate
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
|
|
|
|
*--------------------------------------
|
2015-03-14 21:47:37 +00:00
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
2016-03-13 21:51:50 +00:00
|
|
|
|
.DA CS.DOEVENT
|
2015-03-14 21:47:37 +00:00
|
|
|
|
.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
|
|
|
|
|
*--------------------------------------
|
2015-11-22 22:30:06 +00:00
|
|
|
|
CS.INIT >LDYA L.LIBSTR
|
|
|
|
|
>SYSCALL SYS.LoadLibYA
|
2015-03-14 21:47:37 +00:00
|
|
|
|
sta hLIBSTR
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.hPREFIX
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda (pPs),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
>SYSCALL SYS.GetMemPtrA
|
|
|
|
|
>PUSHYA
|
|
|
|
|
>PUSHW L.MSG0
|
|
|
|
|
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.hCS
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda (pPs),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
>SYSCALL SYS.GetMemByIDA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
>STYA ZPPTR1
|
2015-03-14 21:47:37 +00:00
|
|
|
|
ldy #S.MEM.BIN
|
2016-03-13 21:51:50 +00:00
|
|
|
|
lda (ZPPTR1),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
>SYSCALL SYS.GetMemPtrA
|
|
|
|
|
>PUSHYA
|
|
|
|
|
>PUSHW L.MSG1
|
|
|
|
|
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.hARGS
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda (pPs),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
>SYSCALL SYS.GetMemPtrA
|
|
|
|
|
>PUSHYA
|
|
|
|
|
ldy #S.PS.hCMD
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda (pPs),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
>SYSCALL SYS.GetMemPtrA
|
|
|
|
|
>PUSHYA
|
|
|
|
|
>PUSHW L.MSG2
|
|
|
|
|
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.hENV
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda (pPs),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
>SYSCALL SYS.GetMemPtrA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
>STYA ZPPTR1
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-13 21:51:50 +00:00
|
|
|
|
.1 lda (ZPPTR1)
|
2015-03-14 21:47:37 +00:00
|
|
|
|
beq .2
|
2016-03-13 21:51:50 +00:00
|
|
|
|
>PUSHW ZPPTR1
|
2015-03-14 21:47:37 +00:00
|
|
|
|
>PUSHW L.MSG3
|
|
|
|
|
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
2016-03-13 21:51:50 +00:00
|
|
|
|
lda (ZPPTR1)
|
2015-03-14 21:47:37 +00:00
|
|
|
|
sec
|
2016-03-13 21:51:50 +00:00
|
|
|
|
adc ZPPTR1
|
|
|
|
|
sta ZPPTR1
|
2015-03-14 21:47:37 +00:00
|
|
|
|
bcc .1
|
2016-03-13 21:51:50 +00:00
|
|
|
|
inc ZPPTR1+1
|
2015-03-14 21:47:37 +00:00
|
|
|
|
bra .1
|
|
|
|
|
|
2016-03-13 21:51:50 +00:00
|
|
|
|
.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)
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-13 21:51:50 +00:00
|
|
|
|
>DEBUG
|
|
|
|
|
|
|
|
|
|
bpl .1 is it a TIMER event?
|
|
|
|
|
|
|
|
|
|
ora #'T'
|
|
|
|
|
>SYSCALL SYS.COutA
|
|
|
|
|
bra .9
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-13 21:51:50 +00:00
|
|
|
|
.1 bit #S.EVT.F.KEY is it a KEY event?
|
|
|
|
|
beq .9
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-13 21:51:50 +00:00
|
|
|
|
ldy #S.EVT.DATAHI is it an O or SAPPLE key ?
|
|
|
|
|
lda (pEvent),y
|
|
|
|
|
bne .9
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-13 21:51:50 +00:00
|
|
|
|
ldy #S.EVT.DATALO
|
|
|
|
|
lda (pEvent),y
|
|
|
|
|
cmp #$03 Ctrl-C
|
|
|
|
|
bne .8
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-13 21:51:50 +00:00
|
|
|
|
lda #$FF
|
|
|
|
|
ldy #bCTRLC
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
.8 clc
|
2015-03-14 21:47:37 +00:00
|
|
|
|
rts
|
2016-03-13 21:51:50 +00:00
|
|
|
|
|
|
|
|
|
.9 sec
|
2015-03-14 21:47:37 +00:00
|
|
|
|
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"
|
2016-03-13 21:51:50 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
DS.START
|
|
|
|
|
bCTRLC .BS 1
|
|
|
|
|
DS.END
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE BIN/TEST.S
|
|
|
|
|
ASM
|