mirror of
https://github.com/A2osX/A2osX.git
synced 2024-09-09 00:54:29 +00:00
154 lines
3.0 KiB
Plaintext
154 lines
3.0 KiB
Plaintext
|
PR#3
|
|||
|
PREFIX /DATA/A2OSX
|
|||
|
NEW
|
|||
|
INC 1
|
|||
|
AUTO 6
|
|||
|
.LIST OFF
|
|||
|
.OP 65C02
|
|||
|
.OR $2000
|
|||
|
.TF BIN/TEST
|
|||
|
*--------------------------------------
|
|||
|
.INB INC/MACROS.I
|
|||
|
.INB INC/A2OSX.I
|
|||
|
.INB INC/LIBSTR.I
|
|||
|
*--------------------------------------
|
|||
|
* Main entry point
|
|||
|
*--------------------------------------
|
|||
|
* Code signature and INIT table
|
|||
|
*--------------------------------------
|
|||
|
* CLD $D8
|
|||
|
* JMP (*,x) $7C
|
|||
|
* #JMPTABLE
|
|||
|
* /JMPTABLE
|
|||
|
*--------------------------------------
|
|||
|
CS.START cld
|
|||
|
jmp (.1,x)
|
|||
|
.1 .DA CS.INIT
|
|||
|
.DA CS.RUN
|
|||
|
.DA CS.EVENT
|
|||
|
.DA CS.QUIT
|
|||
|
L.LIBSTR .DA LIBSTR
|
|||
|
L.MSG0 .DA MSG0
|
|||
|
L.MSG1 .DA MSG1
|
|||
|
L.MSG2 .DA MSG2
|
|||
|
L.MSG3 .DA MSG3
|
|||
|
L.SSCANF.IP .DA SSCANF.IP
|
|||
|
L.DST.IP .DA DST.IP
|
|||
|
L.TEST1 .DA TEST1
|
|||
|
L.TEST2 .DA TEST2
|
|||
|
L.TEST3 .DA TEST3
|
|||
|
.DA 0
|
|||
|
.DA CS.END-CS.START Code Length To Relocate
|
|||
|
.DA 0 Data Segment to Allocate
|
|||
|
*--------------------------------------
|
|||
|
CS.INIT >LIBLOADP L.LIBSTR
|
|||
|
sta hLIBSTR
|
|||
|
|
|||
|
ldy #S.PS.hOUTDEV
|
|||
|
lda (TSKMGR.TSKPTR),y
|
|||
|
>SYSCALL SYS.DevSelectA
|
|||
|
|
|||
|
ldy #S.PS.hPREFIX
|
|||
|
lda (TSKMGR.TSKPTR),y
|
|||
|
>SYSCALL SYS.GetMemPtrA
|
|||
|
>PUSHYA
|
|||
|
>PUSHW L.MSG0
|
|||
|
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
|||
|
|
|||
|
ldy #S.PS.hCS
|
|||
|
lda (TSKMGR.TSKPTR),y
|
|||
|
>SYSCALL SYS.GetMemByIDA
|
|||
|
>STYA ZPQuickPtr1
|
|||
|
ldy #S.MEM.BIN
|
|||
|
lda (ZPQuickPtr1),y
|
|||
|
>SYSCALL SYS.GetMemPtrA
|
|||
|
>PUSHYA
|
|||
|
>PUSHW L.MSG1
|
|||
|
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
|||
|
|
|||
|
ldy #S.PS.hARGS
|
|||
|
lda (TSKMGR.TSKPTR),y
|
|||
|
>SYSCALL SYS.GetMemPtrA
|
|||
|
>PUSHYA
|
|||
|
ldy #S.PS.hCMD
|
|||
|
lda (TSKMGR.TSKPTR),y
|
|||
|
>SYSCALL SYS.GetMemPtrA
|
|||
|
>PUSHYA
|
|||
|
>PUSHW L.MSG2
|
|||
|
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
|||
|
|
|||
|
ldy #S.PS.hENV
|
|||
|
lda (TSKMGR.TSKPTR),y
|
|||
|
>SYSCALL SYS.GetMemPtrA
|
|||
|
>STYA ZPBIN
|
|||
|
|
|||
|
.1 lda (ZPBIN)
|
|||
|
beq .2
|
|||
|
>PUSHW ZPBIN
|
|||
|
>PUSHW L.MSG3
|
|||
|
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
|||
|
lda (ZPBIN)
|
|||
|
sec
|
|||
|
adc ZPBIN
|
|||
|
sta ZPBIN
|
|||
|
bcc .1
|
|||
|
inc ZPBIN+1
|
|||
|
bra .1
|
|||
|
|
|||
|
.2 >PUSHW L.DST.IP
|
|||
|
>PUSHW L.SSCANF.IP
|
|||
|
>PUSHW L.TEST1
|
|||
|
>LIBCALL hLIBSTR,LIBSTR.SSCANF
|
|||
|
|
|||
|
lda DST.IP+3
|
|||
|
jsr PRBYTE
|
|||
|
jsr CROUT
|
|||
|
|
|||
|
>PUSHW L.DST.IP
|
|||
|
>PUSHW L.SSCANF.IP
|
|||
|
>PUSHW L.TEST2
|
|||
|
>LIBCALL hLIBSTR,LIBSTR.SSCANF
|
|||
|
|
|||
|
lda DST.IP+3
|
|||
|
jsr PRBYTE
|
|||
|
jsr CROUT
|
|||
|
|
|||
|
>PUSHW L.DST.IP
|
|||
|
>PUSHW L.SSCANF.IP
|
|||
|
>PUSHW L.TEST3
|
|||
|
>LIBCALL hLIBSTR,LIBSTR.SSCANF
|
|||
|
|
|||
|
lda DST.IP+3
|
|||
|
jsr PRBYTE
|
|||
|
jsr CROUT
|
|||
|
|
|||
|
lda #0 tell TSKMGR that all done ok, but
|
|||
|
sec we do not want to stay in memory
|
|||
|
rts
|
|||
|
*--------------------------------------
|
|||
|
CS.RUN
|
|||
|
CS.EVENT clc
|
|||
|
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"
|
|||
|
TEST1 >PSTRING "198.168.1.1"
|
|||
|
TEST2 >PSTRING "198.168.1.23"
|
|||
|
TEST3 >PSTRING "198.168.1.4"
|
|||
|
SSCANF.IP >PSTRING "%d.%d.%d.%d"
|
|||
|
DST.IP .BS 4
|
|||
|
*--------------------------------------
|
|||
|
MAN
|
|||
|
SAVE BIN/TEST.S
|
|||
|
ASM
|