mirror of
https://github.com/A2osX/A2osX.git
synced 2025-04-02 20:30:24 +00:00
Kernel 0.94
This commit is contained in:
parent
eb1f631ce9
commit
10732cb5ce
.Floppies
BIN
ARP.S.txtCAT.S.txtCHMOD.S.txtCHTYP.S.txtCMP.S.txtCSH.S.CORE.txtCSH.S.EXEC.txtCSH.S.txtCUT.S.txtDNSINFO.S.txtEDIT.S.CTRL.txtEDIT.S.SCRN.txtEDIT.S.txtFORMAT.S.txtGREP.S.txtHTTPGET.S.txtIPCONFIG.S.DHCP.txtIPCONFIG.S.ETC.txtIPCONFIG.S.txtKCONFIG.S.txtKILL.S.txtLS.S.txtLSDEV.S.txtLSOF.S.txtMD5.S.txtMEM.S.txtMORE.S.txtPS.S.txtSH.S.CL.txtSH.S.CMD.txtSH.S.EXP.txtSH.S.txtWHO.S.txtX.CPMVRM.S.txt
DRV
INC
SBIN
SYS
Binary file not shown.
@ -68,16 +68,18 @@ CS.RUN >LIBCALL hLIBTCPIP,LIBTCPIP.GETCFG
|
||||
bcs .2
|
||||
jmp CS.RUN.DUMP
|
||||
|
||||
.2 >PUSHEA.G DST.IP+3
|
||||
>PUSHEA.G DST.IP+2
|
||||
>PUSHEA.G DST.IP+1
|
||||
>PUSHEA.G DST.IP
|
||||
>PUSHBI 8 4 Ptrs
|
||||
>PUSHW L.SSCANF.IP
|
||||
lda #1
|
||||
.2 lda #1
|
||||
>SYSCALL ArgV
|
||||
>PUSHYA
|
||||
>PUSHW L.SSCANF.IP
|
||||
>PUSHEA.G DST.IP
|
||||
>PUSHEA.G DST.IP+1
|
||||
>PUSHEA.G DST.IP+2
|
||||
>PUSHEA.G DST.IP+3
|
||||
>PUSHBI 8 4 Ptrs
|
||||
>SYSCALL sscanf
|
||||
bcs CS.RUN.ERR
|
||||
|
||||
ldy #S.PS.ARGC
|
||||
lda (pPs),y
|
||||
cmp #1
|
||||
@ -88,7 +90,7 @@ CS.RUN >LIBCALL hLIBTCPIP,LIBTCPIP.GETCFG
|
||||
|
||||
CS.RUN.ERR >PUSHW L.MSG.Usage
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
lda #E.SYN
|
||||
sec
|
||||
rts
|
||||
@ -127,21 +129,22 @@ CS.RUN.QUERY jsr Init.Timeout
|
||||
bne .3
|
||||
|
||||
>PUSHBI 10
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
.8 lda #0
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.ADD >PUSHEA.G DST.MAC+5
|
||||
>PUSHEA.G DST.MAC+4
|
||||
>PUSHEA.G DST.MAC+3
|
||||
>PUSHEA.G DST.MAC+2
|
||||
>PUSHEA.G DST.MAC+1
|
||||
>PUSHEA.G DST.MAC
|
||||
>PUSHBI 12 6 Ptrs
|
||||
>PUSHW L.SSCANF.MAC
|
||||
lda #2
|
||||
CS.RUN.ADD lda #2
|
||||
>SYSCALL ArgV
|
||||
>PUSHYA
|
||||
>PUSHW L.SSCANF.MAC
|
||||
>PUSHEA.G DST.MAC
|
||||
>PUSHEA.G DST.MAC+1
|
||||
>PUSHEA.G DST.MAC+2
|
||||
>PUSHEA.G DST.MAC+3
|
||||
>PUSHEA.G DST.MAC+4
|
||||
>PUSHEA.G DST.MAC+5
|
||||
>PUSHBI 12 6 Ptrs
|
||||
>SYSCALL sscanf
|
||||
bcs .9
|
||||
|
||||
@ -187,7 +190,7 @@ CS.RUN.DUMP >LIBCALL hLIBTCPIP,LIBTCPIP.ARP.GETCACHE
|
||||
bne .2
|
||||
|
||||
>PUSHBI 13
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
.4 lda ZPPTR1
|
||||
clc
|
||||
|
@ -82,7 +82,7 @@ CS.RUN
|
||||
|
||||
.99 >PUSHW L.MSG.USAGE
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
lda #E.SYN
|
||||
sec
|
||||
.9 rts
|
||||
@ -156,12 +156,11 @@ CS.RUN.LOOP ldy #S.PS.hStdIn
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.OPEN pha
|
||||
stz bPrintedBlankLine Reset this flag for the new file
|
||||
>PUSHWZ Aux type
|
||||
>PUSHBI S.FI.T.TXT
|
||||
CS.RUN.OPEN stz bPrintedBlankLine Reset this flag for the new file
|
||||
>PUSHYA
|
||||
>PUSHBI O.RDONLY+O.TEXT
|
||||
pla
|
||||
>PUSHBI S.FI.T.TXT
|
||||
>PUSHWZ Aux type
|
||||
>SYSCALL FOpen
|
||||
rts
|
||||
*--------------------------------------
|
||||
@ -227,14 +226,14 @@ CS.RUN.PRINT inc LineNum
|
||||
.61 >PUSHW L.MSG.CTRLCHAR
|
||||
>PUSHW ZPPtr1
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
.62 inc ByteIndex
|
||||
bne .4
|
||||
|
||||
.7 >PUSHW L.MSG.CRLF
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
@ -245,7 +244,7 @@ CS.RUN.PRINTNUM clc
|
||||
>PUSHW L.MSG.LINENUM
|
||||
>PUSHW LineNum
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
CS.QUIT lda hBuf
|
||||
|
@ -75,7 +75,7 @@ CS.RUN >INC.G ArgIndex
|
||||
|
||||
.9 >PUSHW L.MSG.USAGE
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
lda #E.SYN
|
||||
sec
|
||||
.99 rts
|
||||
@ -173,7 +173,7 @@ CS.RUN.DIR >LDA.G bRecurse
|
||||
>PUSHW L.MSG.DIR
|
||||
>PUSHW ZPFullPath
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
|
||||
>PUSHW ZPMode
|
||||
@ -195,7 +195,7 @@ CS.RUN.FILE jsr FilterMatch
|
||||
>PUSHW L.MSG.FILE
|
||||
>PUSHW ZPFullPath
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
|
||||
>PUSHW ZPMode
|
||||
@ -251,7 +251,7 @@ CS.RUN.CheckErr bcs .1
|
||||
pha
|
||||
>PUSHA
|
||||
>PUSHBI 1
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
>LDA.G bContinue
|
||||
eor #$80
|
||||
asl
|
||||
|
@ -66,7 +66,7 @@ CS.INIT
|
||||
|
||||
.99 >PUSHW L.MSG.USAGE
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
lda #E.SYN
|
||||
sec
|
||||
rts
|
||||
@ -159,7 +159,7 @@ CS.RUN.FILE jsr CS.RUN.GetFilePath
|
||||
>PUSHW L.MSG.FILE
|
||||
>PUSHW ZPFullPath
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
|
||||
ldy #HexFileType
|
||||
@ -190,7 +190,7 @@ CS.RUN.CheckErr bcs .1
|
||||
pha
|
||||
>PUSHA
|
||||
>PUSHBI 1
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
>LDA.G bContinue
|
||||
eor #$80
|
||||
asl
|
||||
|
@ -78,7 +78,7 @@ CS.RUN
|
||||
|
||||
.99 >PUSHW L.MSG.USAGE
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
lda #E.SYN
|
||||
sec
|
||||
.9 rts
|
||||
@ -251,7 +251,7 @@ CS.RUN.Print phy
|
||||
>PUSHB (ZPBufPtr1),y
|
||||
>PUSHB (ZPBufPtr2),y
|
||||
>PUSHBI 5
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
ply
|
||||
rts
|
||||
|
@ -835,15 +835,15 @@ CSH.GetNumOnStack
|
||||
clc
|
||||
rts
|
||||
|
||||
.1 >PUSHBI 10
|
||||
|
||||
.1 >PUSHW ZPFileBufPtr
|
||||
>PUSHWI ZPFileBufPtr
|
||||
>LDYA ZPFileBufPtr
|
||||
>PUSHBI 10
|
||||
phx
|
||||
cpx #CSH.T.UCHAR
|
||||
bcc .2
|
||||
>SYSCALL StrToUL
|
||||
bra .3
|
||||
|
||||
.2 >SYSCALL StrToL
|
||||
|
||||
.3 plx
|
||||
|
@ -242,7 +242,7 @@ EXEC.puts >PULLYA
|
||||
>PUSHYA
|
||||
rts
|
||||
*--------------------------------------
|
||||
EXEC.printf >SYSCALL printf2
|
||||
EXEC.printf >SYSCALL printf
|
||||
>PUSHYA
|
||||
rts
|
||||
*--------------------------------------
|
||||
|
@ -80,7 +80,7 @@ CS.RUN >PUSHW L.MSG.GREETINGS
|
||||
>PUSHB #K.VER
|
||||
>PUSHB /K.VER
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs CS.INIT.RTS
|
||||
|
||||
jsr CS.RUN.ARGS
|
||||
@ -146,10 +146,10 @@ CS.RUN.ARGS inc ArgIndex
|
||||
.4 >LDA.G hFileBuf
|
||||
bne .90
|
||||
|
||||
>PUSHWZ Aux type
|
||||
>PUSHBI S.FI.T.TXT
|
||||
>PUSHW ZPPtr1
|
||||
>PUSHBI O.RDONLY
|
||||
>LDYA ZPPtr1
|
||||
>PUSHBI S.FI.T.TXT
|
||||
>PUSHWZ Aux type
|
||||
>SYSCALL LoadTxtFile
|
||||
bcs .9
|
||||
|
||||
@ -168,7 +168,7 @@ CS.RUN.ARGS inc ArgIndex
|
||||
|
||||
.90 >PUSHW L.MSG.USAGE
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
lda #E.SYN
|
||||
sec QUIT Process
|
||||
@ -246,7 +246,7 @@ PrintErrMsg lda ZPhMacro
|
||||
PrintDebugMsg >PUSHW L.MSG.DEBUG
|
||||
>PUSHW pStack
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
rts
|
||||
*--------------------------------------
|
||||
PrintTraceMsg >STYA ZPPtr3
|
||||
|
@ -110,7 +110,7 @@ CS.RUN lda #C.SPACE
|
||||
.98 pha
|
||||
>PUSHW L.MSG.USAGE
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
pla
|
||||
sec
|
||||
.9 rts
|
||||
@ -214,7 +214,7 @@ CS.RUN.OUT ldx FieldNum
|
||||
*--------------------------------------
|
||||
CS.RUN.PRINTCR >PUSHW L.MSG.CRLF
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
|
@ -77,21 +77,23 @@ CS.RUN.IPOK ldy #S.PS.ARGC
|
||||
|
||||
>PUSHW L.MSG.USAGE
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
lda #E.SYN
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.ADD >PUSHEA.G DST.IP+3
|
||||
>PUSHEA.G DST.IP+2
|
||||
>PUSHEA.G DST.IP+1
|
||||
CS.RUN.ADD lda #2
|
||||
>SYSCALL ArgV
|
||||
>PUSHYA
|
||||
>PUSHW L.SSCANF.IP
|
||||
|
||||
>PUSHEA.G DST.IP
|
||||
>PUSHEA.G DST.IP+1
|
||||
>PUSHEA.G DST.IP+2
|
||||
>PUSHEA.G DST.IP+3
|
||||
|
||||
>PUSHBI 8 4 PTRs
|
||||
>PUSHW L.SSCANF.IP
|
||||
lda #2
|
||||
>SYSCALL ArgV
|
||||
>SYSCALL sscanf
|
||||
bcs .9
|
||||
|
||||
@ -158,7 +160,7 @@ CS.RUN.DUMP >LIBCALL hLIBTCPIP,LIBTCPIP.DNS.GetCache
|
||||
bne .2
|
||||
|
||||
>PUSHBI 14
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
.6 lda ZPPTR1
|
||||
clc
|
||||
|
@ -64,7 +64,7 @@ Ctrl.A >STZ.G bUpdateStatus
|
||||
>PUSHW L.MSG.HELPLINE
|
||||
>PUSHW ZPPTR1
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
|
||||
inc TmpByte
|
||||
@ -630,7 +630,7 @@ Ctrl.Z jsr BUF.ComputeCOffset
|
||||
dec
|
||||
>PUSHA
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
|
||||
jsr SCRN.ResetScrollRgn
|
||||
|
@ -7,7 +7,7 @@ SCRN.Init >PUSHW L.SEQ.INIT
|
||||
dec
|
||||
>PUSHA
|
||||
>PUSHBI 1
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs SCRN.Init.9
|
||||
|
||||
jsr SCRN.Home
|
||||
@ -43,7 +43,7 @@ SCRN.ResetScrollRgn
|
||||
dec
|
||||
>PUSHA
|
||||
>PUSHBI 1
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
rts
|
||||
*--------------------------------------
|
||||
SCRN.UnSaved >LDA.G bUnSaved
|
||||
@ -86,6 +86,9 @@ SCRN.UpdateTopBar.1
|
||||
|
||||
>PUSHW LineBufPtr
|
||||
>PUSHW L.MSG.TOPBAR
|
||||
>PUSHB #K.VER
|
||||
>PUSHB /K.VER
|
||||
|
||||
>LDA.G hFileName
|
||||
>SYSCALL GetMemPtr
|
||||
>PUSHYA
|
||||
@ -93,7 +96,7 @@ SCRN.UpdateTopBar.1
|
||||
tax
|
||||
>PUSHW L.MSG.FILETYPES,x
|
||||
|
||||
>PUSHBI 4
|
||||
>PUSHBI 6
|
||||
jsr SCRN.LineBufSprintf
|
||||
bcs .9
|
||||
|
||||
@ -260,7 +263,7 @@ SCRN.UpdateMain.1
|
||||
|
||||
>PUSHW L.SEQ.CEOL
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs SCRN.UpdateMain.9
|
||||
|
||||
inc TmpByte
|
||||
@ -497,12 +500,12 @@ SCRN.GotoXY >PUSHW L.MSG.GOTOXY
|
||||
>PUSHA
|
||||
>PUSHBI 2
|
||||
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
rts
|
||||
*--------------------------------------
|
||||
SCRN.scrollUp >PUSHW L.SEQ.SCROLLUP
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
|
||||
>LDA.G ScreenY+1
|
||||
@ -528,7 +531,7 @@ SCRN.scrollUp >PUSHW L.SEQ.SCROLLUP
|
||||
*--------------------------------------
|
||||
SCRN.scrollDn >PUSHW L.SEQ.SCROLLDN
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
|
||||
>LDA.G ScreenY+1
|
||||
@ -619,7 +622,7 @@ SCRN.LineBufOut lda #0
|
||||
|
||||
>PUSHW.G LineBufBase
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
|
@ -145,7 +145,7 @@ CS.INIT.RTS rts
|
||||
*--------------------------------------
|
||||
CS.RUN >PUSHW L.MSG.DETECT
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2 Send Query for term W & H
|
||||
>SYSCALL printf Send Query for term W & H
|
||||
bcs CS.INIT.RTS
|
||||
|
||||
.1 >SYSCALL GetChar
|
||||
@ -218,7 +218,7 @@ CS.RUN.LOOP jsr GetCh
|
||||
.9 pha
|
||||
>PUSHW L.SEQ.RESET
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
pla
|
||||
sec
|
||||
CS.RUN.RTS rts
|
||||
@ -483,7 +483,7 @@ SEQ.SCROLLCURDN .AS "\e[?7l\e[%d;%dr"
|
||||
SEQ.SCROLLDN .AZ "\eM"
|
||||
*--------------------------------------
|
||||
MSG.DETECT .AZ "Querying term caps...\e[999;999H\e[6n"
|
||||
MSG.TOPBAR .AZ "A2osX Edit:%s (%s)"
|
||||
MSG.TOPBAR .AZ "A2osX Edit %d.%d:%s (%s)"
|
||||
MSG.TXTCR .AZ "TXT/CR"
|
||||
MSG.TXTCRLF .AZ "TXT/CRLF"
|
||||
MSG.TXTASM .AZ "S-C/ASM"
|
||||
|
@ -121,7 +121,7 @@ CS.RUN ldy #S.PS.ARGC
|
||||
|
||||
.99 >PUSHW L.MSG.USAGE
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
lda #E.SYN
|
||||
sec
|
||||
.9 rts
|
||||
@ -162,7 +162,7 @@ CS.RUN.Format jsr CS.RUN.GetDevStatus
|
||||
>PUSHEA.G VolName
|
||||
|
||||
>PUSHBI 6
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
|
||||
bit bLL
|
||||
@ -192,7 +192,7 @@ CS.RUN.Format jsr CS.RUN.GetDevStatus
|
||||
pha
|
||||
>PUSHA
|
||||
>PUSHBI 1
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
pla
|
||||
sec
|
||||
rts
|
||||
@ -231,7 +231,7 @@ CS.RUN.LL >LDA.G DIB+S.DIB.T
|
||||
|
||||
>PUSHW L.MSG.LL
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
|
||||
>PUSHEA.G IOCTL
|
||||
@ -254,7 +254,7 @@ CS.RUN.LL.DISKII
|
||||
.1 >PUSHW L.MSG.LLDISK2
|
||||
>PUSHB Index
|
||||
>PUSHBI 1
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
|
||||
|
||||
@ -267,7 +267,7 @@ CS.RUN.LL.DISKII
|
||||
|
||||
>PUSHW L.MSG.CRLF
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CS.RUN.InitCat lda CatSize
|
||||
@ -333,7 +333,7 @@ CS.RUN.BuildCat jsr .7
|
||||
*--------------------------------------
|
||||
CS.RUN.WriteCat >PUSHW L.MSG.WRITECAT
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
.1 >PUSHEA.G IOCTL
|
||||
>PUSHBI IOCTL.WRITEBLOCK
|
||||
|
@ -100,7 +100,7 @@ CS.RUN
|
||||
.98 pha
|
||||
>PUSHW L.MSG.USAGE
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
pla
|
||||
sec
|
||||
.9 rts
|
||||
@ -192,7 +192,7 @@ CS.RUN.PRINT >LDYA ZPBufPtr
|
||||
>PUSHW L.MSG.NUMLINE
|
||||
>PUSHW LineNum
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
.7 >LDYA ZPBufPtr
|
||||
>SYSCALL puts
|
||||
|
@ -112,12 +112,12 @@ CS.RUN.IPOK ldy #S.IPCFG.IP+3
|
||||
>PUSHW L.MSG.UNKNOWN
|
||||
>PUSHW ZPHostPtr
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bra CS.RUN.ESYN
|
||||
|
||||
.9 >PUSHW L.MSG.USAGE
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
CS.RUN.ESYN lda #E.SYN
|
||||
sec
|
||||
@ -202,7 +202,7 @@ CS.RUN.PORTOK >PUSHW L.MSG.CONNECT
|
||||
>PUSHW ZPHostPtr
|
||||
|
||||
>PUSHBI 8
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
CS.RUN.OPENSKT >PUSHBI 0 no protocol
|
||||
lda #S.SOCKET.T.STREAM
|
||||
@ -276,7 +276,7 @@ CS.RUN.SKTERR pha
|
||||
pha
|
||||
>PUSHA
|
||||
>PUSHBI 1
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
pla
|
||||
sec
|
||||
rts
|
||||
@ -287,7 +287,7 @@ CS.RUN.IOERR pha
|
||||
pha
|
||||
>PUSHA
|
||||
>PUSHBI 1
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
pla
|
||||
sec
|
||||
rts
|
||||
|
@ -87,7 +87,7 @@ DHCP.RUN.SREQ >PUSHW L.MSG.DHCP.CFG2
|
||||
cpx #4
|
||||
bne .1
|
||||
>PUSHBI 4
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHW L.SA.DEST
|
||||
>PUSHWI DHCP.REQ.LEN
|
||||
@ -132,7 +132,7 @@ DHCP.RUN.OK lda #S.IPCFG.STATUS.OK
|
||||
bne .2
|
||||
|
||||
>PUSHBI 8
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
lda #0 Leave with NO ERROR
|
||||
sec
|
||||
rts
|
||||
@ -142,7 +142,7 @@ DHCP.RUN.KO pha
|
||||
pha
|
||||
>PUSHA
|
||||
>PUSHBI 1
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
pla
|
||||
sec
|
||||
rts
|
||||
|
@ -46,7 +46,7 @@ CFG.Read.PrintF pha
|
||||
pla
|
||||
>PUSHYA
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
rts
|
||||
*--------------------------------------
|
||||
CFG.Read.HOSTNAME
|
||||
@ -142,8 +142,18 @@ CFG.Read.nameserver
|
||||
ldx #S.IPCFG.DNS1+3
|
||||
lda IPCFG,x
|
||||
beq CFG.Read.IP
|
||||
ldx #S.IPCFG.DNS2+3
|
||||
CFG.Read.IP ldy #3
|
||||
|
||||
CFG.Read.IP lda (ZPTmpPtr2)
|
||||
sec
|
||||
adc ZPTmpPtr1
|
||||
tay
|
||||
lda ZPTmpPtr1+1
|
||||
adc #0
|
||||
>PUSHYA
|
||||
>PUSHW L.CFG.IP.SScanF
|
||||
|
||||
ldx #S.IPCFG.DNS2
|
||||
ldy #4
|
||||
|
||||
.1 txa
|
||||
clc
|
||||
@ -154,18 +164,11 @@ CFG.Read.IP ldy #3
|
||||
>PUSHA @IP[3][2][1][0]
|
||||
pla
|
||||
>PUSHA
|
||||
dex
|
||||
inx
|
||||
dey
|
||||
bpl .1
|
||||
>PUSHBI 8 4 PTRs on stack
|
||||
>PUSHW L.CFG.IP.SScanF
|
||||
lda (ZPTmpPtr2)
|
||||
sec
|
||||
adc ZPTmpPtr1
|
||||
tay
|
||||
lda ZPTmpPtr1+1
|
||||
adc #0
|
||||
bne .1
|
||||
|
||||
>PUSHBI 8 4 PTRs on stack
|
||||
>SYSCALL SScanF
|
||||
rts
|
||||
|
||||
@ -241,23 +244,29 @@ CFG.Read.HOSTS stz CFG.hBuf2
|
||||
.91 jmp CFG.Read.Close2
|
||||
*--------------------------------------
|
||||
CFG.Read.HOSTS.Scan
|
||||
>PUSHW ZPTmpPtr3
|
||||
>PUSHW ZPTmpPtr2
|
||||
ldx #3
|
||||
|
||||
>PUSHW L.CFG.HOST.SScanF
|
||||
>LDYA ZPTmpPtr1
|
||||
|
||||
ldx #0
|
||||
|
||||
.2 txa
|
||||
clc
|
||||
adc L.CFG.IP
|
||||
tay
|
||||
lda L.CFG.IP+1
|
||||
adc #0
|
||||
>PUSHYA @IP[3][2][1][0]
|
||||
>PUSHYA @IP[].....
|
||||
|
||||
dex
|
||||
bpl .2
|
||||
inx
|
||||
cpx #4
|
||||
bne .2
|
||||
|
||||
>PUSHW ZPTmpPtr2
|
||||
>PUSHW ZPTmpPtr3
|
||||
|
||||
>PUSHBI 12 6 PTRs on stack
|
||||
>PUSHW L.CFG.HOST.SScanF
|
||||
>LDYA ZPTmpPtr1
|
||||
|
||||
|
||||
>SYSCALL SScanF
|
||||
rts
|
||||
*--------------------------------------
|
||||
@ -275,7 +284,7 @@ CFG.Read.Result bcc .1
|
||||
pla
|
||||
>PUSHA
|
||||
>PUSHBI 1
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
sec
|
||||
rts
|
||||
|
||||
|
@ -150,7 +150,7 @@ CS.RUN.SETUP
|
||||
|
||||
.99 >PUSHW L.MSG.USAGE
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
lda #E.SYN
|
||||
sec
|
||||
rts
|
||||
@ -231,7 +231,7 @@ CS.RUN.DUMPNIC >PUSHW L.MSG1.DEV
|
||||
|
||||
>PUSHBI 11
|
||||
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHW L.MSG1.DEV.ARP
|
||||
|
||||
@ -242,7 +242,7 @@ CS.RUN.DUMPNIC >PUSHW L.MSG1.DEV
|
||||
.2 >PUSHA
|
||||
>PUSHBI 1
|
||||
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHW L.MSG1.DEV.IP
|
||||
|
||||
@ -256,7 +256,7 @@ CS.RUN.DUMPNIC >PUSHW L.MSG1.DEV
|
||||
>PUSHA
|
||||
>PUSHBI 1
|
||||
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
>LDA.G DCB.NIC+S.DCB.NIC.LINK
|
||||
and #S.DCB.NIC.LINK.OK
|
||||
@ -270,7 +270,7 @@ CS.RUN.LINK >LDYA L.MSG1.LINK.OK
|
||||
|
||||
>PUSHW L.MSG1.LINKSPEED
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
>LDA.G DCB.NIC+S.DCB.NIC.SPEED
|
||||
and #$0F
|
||||
@ -291,7 +291,7 @@ CS.RUN.LINK >LDYA L.MSG1.LINK.OK
|
||||
|
||||
CS.RUN.DUMPIP >PUSHW L.MSG2
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
lda IPCFG+S.NETCFG.STATUS
|
||||
and #S.IPCFG.STATUS.OK
|
||||
@ -311,7 +311,7 @@ CS.RUN.DUMPIP >PUSHW L.MSG2
|
||||
|
||||
>PUSHBI 4
|
||||
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHW L.MSG2.IPMASK
|
||||
|
||||
@ -322,7 +322,7 @@ CS.RUN.DUMPIP >PUSHW L.MSG2
|
||||
bne .3
|
||||
>PUSHBI 8
|
||||
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHW L.MSG2.GW
|
||||
|
||||
@ -332,7 +332,7 @@ CS.RUN.DUMPIP >PUSHW L.MSG2
|
||||
cpx #4
|
||||
bne .4
|
||||
>PUSHBI 4
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHW L.MSG2.DNS
|
||||
|
||||
@ -343,14 +343,14 @@ CS.RUN.DUMPIP >PUSHW L.MSG2
|
||||
bne .5
|
||||
>PUSHBI 8
|
||||
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHW L.MSG2.HOSTNAME
|
||||
>PUSHW L.IPCFG.HOSTNAME
|
||||
>PUSHW L.IPCFG.DOMAIN
|
||||
|
||||
>PUSHBI 4
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
lda #0 tell TSKMGR that all done ok, but
|
||||
sec we do not want to stay in memory
|
||||
rts
|
||||
|
@ -74,33 +74,34 @@ L.MSG.PROMPT .DA MSG.PROMPT
|
||||
CS.INIT clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN >PUSHBI 0
|
||||
>LDYA L.MSG.TOPBAR
|
||||
CS.RUN >PUSHW L.MSG.TOPBAR
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf
|
||||
jsr CS.RUN.Load
|
||||
bcs .1
|
||||
>PUSHBI 0
|
||||
|
||||
>LDYA L.MSG.TOPBAR.OK
|
||||
bra .2
|
||||
|
||||
.1 >PUSHBI 0
|
||||
>LDYA L.MSG.TOPBAR.KO
|
||||
|
||||
.2 >SYSCALL printf
|
||||
.1 >LDYA L.MSG.TOPBAR.KO
|
||||
|
||||
.2 >PUSHYA
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHW L.MSG.KCONF
|
||||
>PUSHBI 0
|
||||
>LDYA L.MSG.KCONF
|
||||
>SYSCALL printf
|
||||
|
||||
>LDYAI A2osX.KCONFIG
|
||||
jsr CS.RUN.DumpConfYA
|
||||
|
||||
>PUSHW L.MSG.STATUSBAR
|
||||
>PUSHBI 0
|
||||
>LDYA L.MSG.STATUSBAR
|
||||
>SYSCALL printf
|
||||
|
||||
CS.RUN.REPaint >PUSHBI 0
|
||||
>LDYA L.MSG.FCONF
|
||||
CS.RUN.REPaint >PUSHW L.MSG.FCONF
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf
|
||||
|
||||
>LDYA ZPCfgPtr
|
||||
@ -110,19 +111,22 @@ CS.RUN.Loop >SYSCALL GetChar
|
||||
bcs .99
|
||||
|
||||
cmp #17 Ctrl-Q
|
||||
beq .8
|
||||
cmp #19 Ctrl-S
|
||||
bne .11
|
||||
jmp .8
|
||||
|
||||
.11 cmp #19 Ctrl-S
|
||||
bne .1
|
||||
jsr CS.RUN.Save
|
||||
bcc .10
|
||||
tax
|
||||
>PUSHW L.MSG.QUIT.ERR
|
||||
txa
|
||||
>PUSHA
|
||||
>PUSHBI 1
|
||||
>LDYA L.MSG.QUIT.ERR
|
||||
|
||||
bra .9
|
||||
.10 >PUSHBI 1
|
||||
>LDYA L.MSG.QUIT.SAVED
|
||||
bra .9
|
||||
|
||||
.10 >PUSHW L.MSG.QUIT.SAVED
|
||||
bra .80
|
||||
.99 rts
|
||||
|
||||
.1 cmp #20 Ctrl-T
|
||||
@ -132,22 +136,23 @@ CS.RUN.Loop >SYSCALL GetChar
|
||||
eor #3
|
||||
sta (ZPCfgPtr)
|
||||
bra CS.RUN.REPaint
|
||||
|
||||
.2 cmp #3 Ctrl-C
|
||||
bne .3
|
||||
ldy #8
|
||||
lda (ZPCfgPtr),y
|
||||
eor #A2osX.F.CHROOT
|
||||
sta (ZPCfgPtr),y
|
||||
bra CS.RUN.REPaint
|
||||
|
||||
lda #A2osX.F.CHROOT
|
||||
bra .31
|
||||
|
||||
.3 cmp #16 Ctrl-P
|
||||
bne .4
|
||||
ldy #8
|
||||
lda (ZPCfgPtr),y
|
||||
eor #A2osX.F.PMODE
|
||||
sta (ZPCfgPtr),y
|
||||
bra CS.RUN.REPaint
|
||||
|
||||
lda #A2osX.F.PMODE
|
||||
.31 jsr CS.RUN.ToggleA
|
||||
jmp CS.RUN.REPaint
|
||||
|
||||
.4 cmp #25 Ctrl-Y
|
||||
bne .5
|
||||
|
||||
ldy #1
|
||||
lda (ZPCfgPtr),y
|
||||
and #7
|
||||
@ -159,37 +164,34 @@ CS.RUN.Loop >SYSCALL GetChar
|
||||
bcc CS.RUN.Loop
|
||||
cmp #'8'
|
||||
bcs CS.RUN.Loop
|
||||
|
||||
and #$0f
|
||||
clc
|
||||
adc #8
|
||||
ora #8
|
||||
tay
|
||||
|
||||
lda (ZPCfgPtr),y
|
||||
eor #$FF
|
||||
sta (ZPCfgPtr),y
|
||||
lda #$FF
|
||||
jsr CS.RUN.ToggleAatY
|
||||
jmp CS.RUN.REPaint
|
||||
|
||||
.8 >PUSHBI 0
|
||||
>LDYA L.MSG.QUIT
|
||||
.8 >PUSHW L.MSG.QUIT
|
||||
.80 >PUSHBI 0
|
||||
|
||||
.9 >SYSCALL printf
|
||||
lda #0
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.ToggleA ldy #8
|
||||
CS.RUN.ToggleAatY
|
||||
eor (ZPCfgPtr),y
|
||||
sta (ZPCfgPtr),y
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.Load >PUSHEA.G StatBuf
|
||||
>LDYA L.FILENAME
|
||||
>SYSCALL Stat
|
||||
bcs .99
|
||||
* >LDA.G StatBuf+S.STAT.SIZE
|
||||
* eor #16
|
||||
* bne .99
|
||||
* iny
|
||||
* lda (pData),y
|
||||
* iny
|
||||
* ora (pData),y
|
||||
* iny
|
||||
* ora (pData),y
|
||||
* bne .99
|
||||
|
||||
>LDA.G StatBuf+S.STAT.P.TYPE
|
||||
eor #S.FI.T.SYS
|
||||
bne .99
|
||||
@ -260,23 +262,28 @@ CS.RUN.Save >PUSHWI A2osX.KCONFIG
|
||||
*--------------------------------------
|
||||
CS.RUN.DumpConfYA
|
||||
>STYA ZPTmp1
|
||||
|
||||
>PUSHW L.MSG.HZ
|
||||
>PUSHB (ZPTmp1)
|
||||
>PUSHBI 1
|
||||
>LDYA L.MSG.HZ
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHW L.MSG.CHROOT
|
||||
|
||||
ldy #8
|
||||
lda (ZPTmp1),y
|
||||
and #A2osX.F.CHROOT
|
||||
bne .10
|
||||
>LDYA L.MSG.DISABLED
|
||||
bra .12
|
||||
|
||||
.10 >LDYA L.MSG.ENABLED
|
||||
.12 >PUSHYA
|
||||
>PUSHBI 2
|
||||
>LDYA L.MSG.CHROOT
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHW L.MSG.PMODE
|
||||
|
||||
ldy #8
|
||||
lda (ZPTmp1),y
|
||||
and #A2osX.F.PMODE
|
||||
@ -286,17 +293,22 @@ CS.RUN.DumpConfYA
|
||||
.13 >LDYA L.MSG.ENABLED
|
||||
.14 >PUSHYA
|
||||
>PUSHBI 2
|
||||
>LDYA L.MSG.PMODE
|
||||
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHW L.MSG.TTYS
|
||||
|
||||
ldy #1
|
||||
lda (ZPTmp1),y
|
||||
>PUSHA
|
||||
>PUSHBI 1
|
||||
>LDYA L.MSG.TTYS
|
||||
>SYSCALL printf
|
||||
|
||||
ldy #9 Slot 1
|
||||
.1 lda (ZPTmp1),y
|
||||
|
||||
.1 >PUSHW L.MSG.SLOT
|
||||
|
||||
lda (ZPTmp1),y
|
||||
ldx #SLOTS.MAX-1
|
||||
|
||||
.2 cmp SLOTS,x
|
||||
@ -305,24 +317,24 @@ CS.RUN.DumpConfYA
|
||||
bne .2
|
||||
|
||||
.3 phy
|
||||
txa
|
||||
asl
|
||||
tax
|
||||
>PUSHB T.MSG.SLOT.DESC+1,x
|
||||
>PUSHB T.MSG.SLOT.DESC,x
|
||||
pla
|
||||
pha
|
||||
tya
|
||||
sec
|
||||
sbc #8
|
||||
>PUSHA Slot
|
||||
|
||||
txa
|
||||
asl
|
||||
tax
|
||||
>PUSHW T.MSG.SLOT.DESC,x
|
||||
|
||||
>PUSHBI 3
|
||||
>LDYA L.MSG.SLOT
|
||||
>SYSCALL printf
|
||||
|
||||
ply
|
||||
iny
|
||||
cpy #16
|
||||
bne .1
|
||||
|
||||
>PUSHBI 0
|
||||
>LDYA L.MSG.PROMPT
|
||||
>SYSCALL printf
|
||||
|
@ -71,16 +71,16 @@ CS.RUN ldy #S.PS.ARGC
|
||||
|
||||
.9 >PUSHW L.MSG.USAGE
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
lda #E.SYN
|
||||
sec
|
||||
rts
|
||||
|
||||
.2 >PUSHEA.G PID
|
||||
>PUSHBI 2 1 Ptr
|
||||
.2 >PUSHW ZPTmpPtr
|
||||
>PUSHW L.SSCANF.PID
|
||||
>LDYA ZPTmpPtr
|
||||
>PUSHEA.G PID
|
||||
>PUSHBI 2 1 Ptr
|
||||
>SYSCALL sscanf
|
||||
bcs .9
|
||||
|
||||
|
16
BIN/LS.S.txt
16
BIN/LS.S.txt
@ -202,7 +202,7 @@ CS.RUN.PRINT.DEV
|
||||
|
||||
>PUSHBI 8
|
||||
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
|
||||
ldy #bRecurse
|
||||
@ -250,7 +250,7 @@ CS.RUN.PRINT.DIR
|
||||
.22 >PUSHW L.MSG.DIR
|
||||
>PUSHW ZPFileName
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
|
||||
ldy #0
|
||||
@ -282,7 +282,7 @@ CS.RUN.PRINT.DIR
|
||||
jsr CS.RUN.PUSHDATES
|
||||
>PUSHW ZPFileName
|
||||
>PUSHBI 12
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
bcs .90
|
||||
|
||||
@ -319,7 +319,7 @@ CS.RUN.PRINT.FILE
|
||||
.22 >PUSHW L.MSG.FILE
|
||||
>PUSHW ZPFileName
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
jmp CS.RUN.UpdateColCnt
|
||||
*--------------------------------------
|
||||
@ -356,7 +356,7 @@ CS.RUN.PRINT.FILE
|
||||
>PUSHW ZPFileName
|
||||
|
||||
>PUSHBI 20
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
@ -366,7 +366,7 @@ CS.RUN.PRINT.SRCPATH
|
||||
>SYSCALL GetMemPtr
|
||||
>PUSHYA
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.PushGidUid
|
||||
@ -508,7 +508,7 @@ CS.RUN.NewLine >LDA.G ColCount
|
||||
CS.RUN.NewLine.1
|
||||
>PUSHW L.MSG.CRLF
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
rts
|
||||
CS.RUN.NewLine.8
|
||||
clc
|
||||
@ -522,7 +522,7 @@ CS.RUN.ENTER.MSG
|
||||
>PUSHYA
|
||||
>PUSHBI 2
|
||||
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.DOEVENT sec
|
||||
|
@ -98,7 +98,7 @@ DumpDev >LDYA L.MSG0
|
||||
pla
|
||||
>PUSHA
|
||||
>PUSHBI 1
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
|
||||
bra .7
|
||||
@ -136,7 +136,7 @@ DumpDevFD >PUSHW L.MSG1
|
||||
|
||||
>PUSHBI 6
|
||||
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
rts
|
||||
*--------------------------------------
|
||||
DumpDevDIB >PUSHW L.MSG2
|
||||
@ -168,7 +168,7 @@ DumpDevDIB >PUSHW L.MSG2
|
||||
|
||||
>PUSHBI 8
|
||||
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
|
||||
>LDA.G DEV.DIB+S.DIB.S
|
||||
@ -186,7 +186,7 @@ DumpDevDIB >PUSHW L.MSG2
|
||||
.4 >PUSHW L.MSG2.C
|
||||
>PUSHBI 0
|
||||
|
||||
.8 >SYSCALL printf2
|
||||
.8 >SYSCALL printf
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
DumpNod >LDYA L.MSG3
|
||||
@ -221,7 +221,7 @@ DumpNod >LDYA L.MSG3
|
||||
>PUSHYA
|
||||
>PUSHBI 6
|
||||
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
.7 inc index
|
||||
|
||||
|
@ -98,7 +98,7 @@ CS.RUN >LDYA L.MSG0
|
||||
|
||||
>PUSHBI 6
|
||||
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
.7 inc FILE.ID
|
||||
ldx FILE.ID
|
||||
|
@ -79,7 +79,7 @@ CS.RUN ldy #S.PS.ARGC
|
||||
|
||||
.99 >PUSHW L.MSG.USAGE
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
lda #E.SYN
|
||||
sec
|
||||
rts
|
||||
|
@ -59,7 +59,7 @@ CS.RUN >LDYA L.MemStat
|
||||
tay
|
||||
lda MemStat+S.MSTAT.MF+1
|
||||
sbc MemStat+S.MSTAT.ML+1
|
||||
ldx #S.MSTAT.MH+1
|
||||
ldx #S.MSTAT.ML
|
||||
jsr CS.RUN.PRINT
|
||||
>SLEEP
|
||||
|
||||
@ -72,7 +72,7 @@ CS.RUN >LDYA L.MemStat
|
||||
tay
|
||||
lda MemStat+S.MSTAT.XF+1
|
||||
sbc MemStat+S.MSTAT.XL+1
|
||||
ldx #S.MSTAT.XH+1
|
||||
ldx #S.MSTAT.XL
|
||||
jsr CS.RUN.PRINT
|
||||
>SLEEP
|
||||
|
||||
@ -85,7 +85,7 @@ CS.RUN >LDYA L.MemStat
|
||||
tay
|
||||
lda MemStat+S.MSTAT.DH+1
|
||||
sbc MemStat+S.MSTAT.DF+1
|
||||
ldx #S.MSTAT.DH+1
|
||||
ldx #S.MSTAT.DL
|
||||
jsr CS.RUN.PRINT
|
||||
>LDYA L.MSG.END
|
||||
>SYSCALL puts
|
||||
@ -93,15 +93,23 @@ CS.RUN >LDYA L.MemStat
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.PRINT >PUSHYA
|
||||
|
||||
ldy #6
|
||||
.1 >PUSHB MemStat,x
|
||||
dex
|
||||
CS.RUN.PRINT pha
|
||||
phy
|
||||
>PUSHW L.MSG.Stat
|
||||
|
||||
ldy #3
|
||||
|
||||
.1 >PUSHW MemStat,x
|
||||
>PUSHW MemStat,x
|
||||
inx
|
||||
inx
|
||||
dey
|
||||
bne .1
|
||||
>PUSHBI 8
|
||||
>LDYA L.MSG.Stat
|
||||
|
||||
ply
|
||||
pla
|
||||
>PUSHYA
|
||||
>PUSHBI 14
|
||||
>SYSCALL printf
|
||||
rts
|
||||
*--------------------------------------
|
||||
@ -112,14 +120,14 @@ CS.QUIT clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
MSG.Main .AZ "--- Main Memory ---------------"
|
||||
MSG.Aux .AZ "--- Aux Memory ----------------"
|
||||
MSG.Kernel .AZ "--- Kernel (Drivers) Memory ---"
|
||||
MSG.Stat .AS " Low : $%H\r\n"
|
||||
.AS " Free Ptr : $%H\r\n"
|
||||
.AS " High : $%H\r\n"
|
||||
.AZ " Available Memory : %05D Bytes\r\n"
|
||||
MSG.End .AZ "-------------------------------"
|
||||
MSG.Main .AZ "--- Main Memory ----------------"
|
||||
MSG.Aux .AZ "--- Aux Memory -----------------"
|
||||
MSG.Kernel .AZ "--- Kernel (Drivers) Memory ----"
|
||||
MSG.Stat .AS " Low : %5D (%H)\r\n"
|
||||
.AS " Free Ptr : %5D (%H)\r\n"
|
||||
.AS " High : %5D (%H)\r\n"
|
||||
.AZ " Available Memory : %5D Bytes\r\n"
|
||||
MSG.End .AZ "--------------------------------"
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR 0
|
||||
|
@ -3,7 +3,7 @@ NEW
|
||||
.LIST OFF
|
||||
.OP 65C02
|
||||
.OR $2000
|
||||
.TF BIN/MORE
|
||||
.TF bin/more
|
||||
*--------------------------------------
|
||||
.INB INC/MACROS.I
|
||||
.INB INC/A2OSX.I
|
||||
@ -79,12 +79,14 @@ CS.RUN
|
||||
beq .3
|
||||
dex
|
||||
bne .2
|
||||
.99 >PUSHBI 0
|
||||
>LDYA L.MSG.USAGE
|
||||
|
||||
.99 >PUSHW L.MSG.USAGE
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf
|
||||
lda #E.SYN
|
||||
sec
|
||||
.9 rts
|
||||
|
||||
.3 ldy OptionVars-1,x
|
||||
lda #$80
|
||||
sta (pData),y
|
||||
@ -109,6 +111,7 @@ CS.RUN
|
||||
lda OF.Table.hFD-1,x
|
||||
>SYSCALL GetMemPtr
|
||||
>STYA ZPPtr1
|
||||
|
||||
lda (ZPPtr1)
|
||||
cmp #S.FD.T.PIPE
|
||||
bne .71
|
||||
@ -118,9 +121,11 @@ CS.RUN
|
||||
bcs .9
|
||||
>STYA ZPBufPtr
|
||||
stx hBuf
|
||||
|
||||
>PUSHW L.MSG.Init
|
||||
>PUSHBI 0
|
||||
>LDYA L.MSG.Init
|
||||
>SYSCALL printf
|
||||
|
||||
CS.RUN.LOOP jsr CS.RUN.GETLINE
|
||||
bcs .9
|
||||
.1 inc LineNum
|
||||
@ -147,11 +152,11 @@ CS.RUN.LOOP jsr CS.RUN.GETLINE
|
||||
.99 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.OPEN pha
|
||||
>PUSHWZ Aux type
|
||||
>PUSHBI S.FI.T.TXT
|
||||
CS.RUN.OPEN >PUSHYA
|
||||
>PUSHBI O.RDONLY+O.TEXT
|
||||
pla
|
||||
>PUSHBI S.FI.T.TXT
|
||||
>PUSHWZ Aux type
|
||||
|
||||
>SYSCALL FOpen
|
||||
bcs .9
|
||||
sta hFile
|
||||
@ -230,9 +235,9 @@ CS.RUN.GETLINE >PUSHWI 256
|
||||
CS.RUN.PRINT lda bLineNum
|
||||
bpl .1
|
||||
|
||||
>PUSHW L.MSG.NUMLINE
|
||||
>PUSHW LineNum
|
||||
>PUSHBI 2
|
||||
>LDYA L.MSG.NUMLINE
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
.1 lda bEscCodes
|
||||
@ -241,12 +246,14 @@ CS.RUN.PRINT lda bLineNum
|
||||
>LDYA ZPBufPtr
|
||||
>SYSCALL puts
|
||||
rts
|
||||
.2 >PUSHBI 0
|
||||
>LDYA ZPBufPtr
|
||||
|
||||
.2 >PUSHW ZPBufPtr
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
|
||||
>PUSHW L.MSG.CRLF
|
||||
>PUSHBI 0
|
||||
>LDYA L.MSG.CRLF
|
||||
>SYSCALL printf
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
|
@ -78,7 +78,7 @@ CS.RUN lda #1
|
||||
|
||||
.10 >PUSHW L.MSG0
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
ldx Index
|
||||
|
||||
.1 lda PS.Table.hPS,x
|
||||
@ -141,7 +141,7 @@ CS.RUN.DUMP >SYSCALL GetMemPtr
|
||||
|
||||
>PUSHBI 10
|
||||
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
jmp CS.RUN.PrintArgs
|
||||
.9 rts
|
||||
@ -175,7 +175,7 @@ CS.RUN.PrintArgs
|
||||
>PUSHW L.MSG2
|
||||
>PUSHW ZPArgV
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
.2 inc ZPArgV
|
||||
bne .3
|
||||
@ -189,7 +189,7 @@ CS.RUN.PrintArgs
|
||||
|
||||
.8 >PUSHW L.MSG3
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CS.DOEVENT sec
|
||||
|
@ -20,13 +20,13 @@ CL.PrintPrompt >PUSHW L.PS1
|
||||
>PUSHYA
|
||||
>PUSHBI 0
|
||||
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
pla
|
||||
>SYSCALL FreeMem
|
||||
|
||||
.1 >PUSHW L.MSG.PROMPT
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CL.READN0A tax
|
||||
|
@ -335,7 +335,7 @@ CMD.ECHO stz ZPPtr1 echo -N
|
||||
|
||||
>PUSHW L.MSG.ECHOCRLF
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
.9 rts
|
||||
|
||||
.8 clc
|
||||
@ -1212,7 +1212,7 @@ CMD.IsSwitch lda (ZPArgVBufPtr)
|
||||
CMD.PrintArgVBufPtr
|
||||
>PUSHW ZPArgVBufPtr
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
|
@ -295,10 +295,9 @@ EXP.GetInt8YA jsr EXP.GetInt32YA
|
||||
*--------------------------------------
|
||||
EXP.GetInt32Arg >LDYA ZPArgVBufPtr
|
||||
|
||||
EXP.GetInt32YA pha
|
||||
>PUSHBI 10
|
||||
EXP.GetInt32YA >PUSHYA
|
||||
>PUSHWI ZPPtr1
|
||||
pla
|
||||
>PUSHBI 10
|
||||
>SYSCALL strtol
|
||||
bcs EXP.E.ESYN
|
||||
|
||||
|
@ -226,7 +226,7 @@ CS.RUN jsr CL.Init
|
||||
>PUSHB #K.VER
|
||||
>PUSHB /K.VER
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs CS.INIT.RTS
|
||||
|
||||
>LDYA L.HOME.PROFILE
|
||||
@ -324,7 +324,7 @@ CS.RUN.INTERACTIVE
|
||||
|
||||
>PUSHW L.MSG.PROMPTCRLF
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
lda (ZPCLBuf)
|
||||
beq .8 Empty line
|
||||
@ -366,7 +366,7 @@ CS.RUN.BATCH >LDA.G bSET.X
|
||||
.4 >PUSHW L.MSG.TRACE
|
||||
>PUSHW ZPCLBuf
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs CS.RUN.LOOP.RTS
|
||||
|
||||
.5 jsr CORE.Run
|
||||
|
@ -87,7 +87,7 @@ CS.RUN >LDYA L.MSG0
|
||||
|
||||
>PUSHBI 9 total = 9 ... bytes
|
||||
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .9
|
||||
|
||||
.7 inc SessionID
|
||||
|
@ -66,7 +66,7 @@ CS.INIT
|
||||
|
||||
.99 >PUSHW L.MSG.USAGE
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
lda #E.SYN
|
||||
sec
|
||||
rts
|
||||
@ -275,7 +275,7 @@ CS.RUN.LEAVE jsr LeaveSubDir exit this sub dir....
|
||||
>PUSHB (pData),y
|
||||
>PUSHBI 2
|
||||
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
.91 ldy #RC
|
||||
lda (pData),y get global RC in case of bContinue
|
||||
@ -442,7 +442,7 @@ CS.RUN.FILE.MSG clc
|
||||
|
||||
.FIN
|
||||
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
rts
|
||||
|
||||
.8 clc
|
||||
@ -459,13 +459,13 @@ CS.RUN.OVERWRITE.MSG
|
||||
jsr CS.RUN.GetPathY
|
||||
>PUSHYA
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
rts
|
||||
.FIN
|
||||
*--------------------------------------
|
||||
CS.RUN.CR >PUSHW L.MSG.CRLF
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
rts
|
||||
*--------------------------------------
|
||||
.DO X.COPY.TO.DEST=1
|
||||
@ -600,7 +600,7 @@ CS.RUN.CheckErr bcs .1
|
||||
pha
|
||||
>PUSHA
|
||||
>PUSHBI 1
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
>LDA.G bContinue
|
||||
eor #$80
|
||||
|
@ -77,19 +77,19 @@ Dev.Detect >STYA ARGS
|
||||
sty DEVSLOT0x
|
||||
|
||||
jsr Dev.ParseArgs
|
||||
bcs .9
|
||||
bcs .99
|
||||
|
||||
.8 >PUSHW L.MSG.DETECT.OK
|
||||
>PUSHW L.FD.DEV.NAME
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHWI DRV.END
|
||||
>PUSHWI DRV.CS.END-DRV.CS.START
|
||||
>PUSHWI DRV.CS.START
|
||||
>LDYA L.DRV.CS.START
|
||||
>SYSCALL InsDrv
|
||||
bcs .9
|
||||
.99 bcs .9
|
||||
|
||||
>STYA FD.DEV+S.FD.DEV.DRVPTR
|
||||
>PUSHW L.FD.DEV.NAME
|
||||
@ -118,7 +118,10 @@ Dev.ParseArgs >LDYA ARGS
|
||||
clc
|
||||
rts
|
||||
|
||||
.1 ldx #10
|
||||
.1 >PUSHW ZPArgPtr
|
||||
>PUSHW L.SSCANF.MAC
|
||||
|
||||
ldx #10
|
||||
|
||||
.2 >PUSHW L.MAC0,x
|
||||
dex
|
||||
@ -126,8 +129,6 @@ Dev.ParseArgs >LDYA ARGS
|
||||
bpl .2
|
||||
|
||||
>PUSHBI 12 6 x byte PTRs
|
||||
>PUSHW L.SSCANF.MAC
|
||||
>LDYA ZPArgPtr
|
||||
>SYSCALL sscanf
|
||||
bcc .8
|
||||
|
||||
|
@ -92,7 +92,7 @@ Dev.Detect >STYA ARGS
|
||||
.8 >PUSHW L.MSG.DETECT.OK
|
||||
>PUSHW L.FD.DEV.NAME
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHWI DRV.END
|
||||
>PUSHWI DRV.CS.END-DRV.CS.START
|
||||
@ -127,7 +127,10 @@ Dev.ParseArgs >LDYA ARGS
|
||||
clc
|
||||
rts
|
||||
|
||||
.1 ldx #10
|
||||
.1 >PUSHW ZPArgPtr
|
||||
>PUSHW L.SSCANF.MAC
|
||||
|
||||
ldx #10
|
||||
|
||||
.2 >PUSHW L.MAC0,x
|
||||
dex
|
||||
@ -135,8 +138,6 @@ Dev.ParseArgs >LDYA ARGS
|
||||
bpl .2
|
||||
|
||||
>PUSHBI 12 6 x byte PTRs
|
||||
>PUSHW L.SSCANF.MAC
|
||||
>LDYA ZPArgPtr
|
||||
>SYSCALL sscanf
|
||||
bcc .8
|
||||
lda #E.SYN
|
||||
|
@ -133,14 +133,16 @@ Dev.ParseArgs >LDYA ARGS
|
||||
.2 bcs .90
|
||||
>STYA ZPControlPtr
|
||||
stx ZPhControl
|
||||
|
||||
>PUSHW ZPArgPtr
|
||||
>PUSHW L.SSCANF.ARGS
|
||||
|
||||
>PUSHW ZPControlPtr
|
||||
>PUSHW ZPParityPtr
|
||||
>PUSHW L.DCB.STOP
|
||||
>PUSHW L.DCB.DATA
|
||||
>PUSHW L.DCB.BAUD
|
||||
>PUSHBI 10 5 x byte PTRs
|
||||
>PUSHW L.SSCANF.ARGS
|
||||
>LDYA ZPArgPtr
|
||||
>SYSCALL sscanf
|
||||
|
||||
bcs .90
|
||||
|
@ -101,19 +101,19 @@ Dev.Detect >STYA ARGS
|
||||
sta A2osX.S,y
|
||||
|
||||
jsr Dev.ParseArgs
|
||||
bcs .9
|
||||
bcs .99
|
||||
|
||||
>PUSHW L.MSG.DETECT.OK
|
||||
>PUSHW L.FD.DEV.NAME
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHWI DRV.END
|
||||
>PUSHWI DRV.CS.END-DRV.CS.START
|
||||
>PUSHWI DRV.CS.START
|
||||
>LDYA L.DRV.CS.START
|
||||
>SYSCALL InsDrv
|
||||
bcs .9
|
||||
.99 bcs .9
|
||||
|
||||
>STYA FD.DEV+S.FD.DEV.DRVPTR
|
||||
>PUSHW L.FD.DEV.NAME
|
||||
@ -142,7 +142,10 @@ Dev.ParseArgs >LDYA ARGS
|
||||
clc
|
||||
rts
|
||||
|
||||
.1 ldx #10
|
||||
.1 >PUSHW ZPArgPtr
|
||||
>PUSHW L.SSCANF.MAC
|
||||
|
||||
ldx #10
|
||||
|
||||
.2 >PUSHW L.MAC0,x
|
||||
dex
|
||||
@ -150,8 +153,7 @@ Dev.ParseArgs >LDYA ARGS
|
||||
bpl .2
|
||||
|
||||
>PUSHBI 12 6 x byte PTRs
|
||||
>PUSHW L.SSCANF.MAC
|
||||
>LDYA ZPArgPtr
|
||||
|
||||
>SYSCALL sscanf
|
||||
bcc .8
|
||||
|
||||
|
@ -23,18 +23,18 @@ K.IRQDEV.MAX .EQ 4
|
||||
ZPDRV .EQ $20 32 bytes
|
||||
ZPLIB .EQ $40 32 bytes
|
||||
*--------------------------------------
|
||||
* PS Context : 48 bytes MAX
|
||||
*--------------------------------------
|
||||
CORE.PSIndex .EQ $D0
|
||||
CORE.PSCount .EQ $D1
|
||||
|
||||
pPs .EQ $D2
|
||||
pEvent .EQ $D4
|
||||
*--------------------------------------
|
||||
* PS Context : 40 bytes MAX
|
||||
*--------------------------------------
|
||||
pCode .EQ $D8
|
||||
pData .EQ $DA
|
||||
pStack .EQ $DC
|
||||
pLocal .EQ $DE 10 Bytes
|
||||
pLocal .EQ $DE 8 Bytes
|
||||
|
||||
ZPBIN .EQ $E0 32 bytes
|
||||
ZPBIN.SIZE .EQ 32
|
||||
@ -164,7 +164,8 @@ SEEK.END .EQ $02
|
||||
*--------------------------------------
|
||||
* A2osX.SYSCALL Functions Indexes
|
||||
*--------------------------------------
|
||||
* .EQ $00
|
||||
* STAT
|
||||
SYS.ChTyp .EQ $00
|
||||
SYS.ChMod .EQ $02
|
||||
SYS.FStat .EQ $04
|
||||
SYS.Stat .EQ $06
|
||||
@ -172,16 +173,18 @@ SYS.MKDir .EQ $08
|
||||
SYS.MKNod .EQ $0A
|
||||
SYS.MKFIFO .EQ $0C
|
||||
SYS.Pipe .EQ $0E
|
||||
|
||||
* DIRENT
|
||||
SYS.OpenDir .EQ $10
|
||||
SYS.ReadDir .EQ $12
|
||||
SYS.CloseDir .EQ $14
|
||||
* UNISTD
|
||||
SYS.Open .EQ $16
|
||||
SYS.Close .EQ $18
|
||||
SYS.Read .EQ $1A
|
||||
SYS.Write .EQ $1C
|
||||
* IO
|
||||
SYS.IOCTL .EQ $1E
|
||||
|
||||
* STDIO
|
||||
SYS.FPutC .EQ $20
|
||||
SYS.PutChar .EQ $22
|
||||
SYS.GetC .EQ $24
|
||||
@ -204,23 +207,23 @@ SYS.Remove .EQ $40
|
||||
SYS.Rename .EQ $42
|
||||
* .EQ $44
|
||||
* .EQ $46
|
||||
|
||||
* DEV
|
||||
* .EQ $48
|
||||
SYS.GetDevByName .EQ $4A
|
||||
SYS.GetDevStatus .EQ $4C
|
||||
SYS.MKDev .EQ $4E
|
||||
|
||||
* STDIO2
|
||||
* .EQ $50
|
||||
SYS.SScanF .EQ $52
|
||||
* .EQ $54
|
||||
SYS.PrintF2 .EQ $56
|
||||
* .EQ $56
|
||||
SYS.PrintF .EQ $58
|
||||
SYS.SPrintF .EQ $5A
|
||||
SYS.FPrintF .EQ $5C
|
||||
* .EQ $5E
|
||||
|
||||
* .EQ $60
|
||||
SYS.ChTyp .EQ $62
|
||||
* .EQ $62
|
||||
* .EQ $64
|
||||
* .EQ $66
|
||||
|
||||
@ -228,7 +231,8 @@ SYS.ChTyp .EQ $62
|
||||
* .EQ $6A
|
||||
* .EQ $6C
|
||||
* .EQ $6E
|
||||
|
||||
*--------------------------------------
|
||||
* STDLIB
|
||||
SYS.AToF .EQ $70
|
||||
SYS.AToI .EQ $72
|
||||
SYS.AToL .EQ $74
|
||||
@ -237,7 +241,7 @@ SYS.StrToL .EQ $78
|
||||
SYS.StrToUL .EQ $7A
|
||||
SYS.RealPath .EQ $7C
|
||||
SYS.Expand .EQ $7E
|
||||
*--------------------------------------
|
||||
* STRING
|
||||
SYS.StrLen .EQ $80
|
||||
SYS.StrCpy .EQ $82
|
||||
SYS.StrCat .EQ $84
|
||||
@ -251,52 +255,53 @@ SYS.StrCaseCmp .EQ $8E
|
||||
* .EQ $92
|
||||
* .EQ $94
|
||||
* .EQ $96
|
||||
|
||||
* BIN
|
||||
SYS.LoadLib .EQ $98
|
||||
SYS.UnloadLib .EQ $9A
|
||||
SYS.LoadDrv .EQ $9C
|
||||
SYS.InsDrv .EQ $9E
|
||||
*--------------------------------------
|
||||
* PS
|
||||
SYS.ExecL .EQ $A0
|
||||
SYS.ExecV .EQ $A2
|
||||
SYS.Fork .EQ $A4
|
||||
SYS.Kill .EQ $A6
|
||||
|
||||
SYS.LoadFile .EQ $A8
|
||||
SYS.LoadTxtFile .EQ $AA
|
||||
SYS.FileSearch .EQ $AC
|
||||
SYS.GetMemStat .EQ $AE
|
||||
|
||||
* ARG
|
||||
SYS.Shift .EQ $B0
|
||||
SYS.ArgV .EQ $B2
|
||||
SYS.ArgVDup .EQ $B4
|
||||
* .EQ $B6
|
||||
|
||||
*--------------------------------------
|
||||
* ENV / ENVX
|
||||
SYS.PutEnv .EQ $B8
|
||||
SYS.SetEnv .EQ $BA
|
||||
SYS.GetEnv .EQ $BC
|
||||
SYS.UnsetEnv .EQ $BE
|
||||
*--------------------------------------
|
||||
* TIME / TIMEX
|
||||
SYS.Time .EQ $C0
|
||||
SYS.StrFTime .EQ $C2
|
||||
SYS.PTime2Time .EQ $C4
|
||||
SYS.CTime2Time .EQ $C6
|
||||
|
||||
* MD5 / MD5X
|
||||
SYS.MD5 .EQ $C8
|
||||
SYS.MD5Init .EQ $CA
|
||||
SYS.MD5Update .EQ $CC
|
||||
SYS.MD5Finalize .EQ $CE
|
||||
|
||||
* PWD / PWDX
|
||||
SYS.GetPWUID .EQ $D0
|
||||
SYS.GetPWName .EQ $D2
|
||||
SYS.PutPW .EQ $D4
|
||||
SYS.FlushEtcPasswd .EQ $D6
|
||||
|
||||
* STRV / STRVX
|
||||
SYS.StrVShift .EQ $D8
|
||||
SYS.StrVGet .EQ $DA
|
||||
SYS.StrVAdd .EQ $DC
|
||||
* .EQ $DE
|
||||
*--------------------------------------
|
||||
* MEM
|
||||
SYS.GetMem .EQ $E0
|
||||
SYS.Realloc .EQ $E2
|
||||
SYS.GetMemPtr .EQ $E4
|
||||
@ -306,7 +311,7 @@ SYS.NewStkObj .EQ $E8
|
||||
SYS.LoadStkObj .EQ $EA
|
||||
SYS.GetStkObjPtr .EQ $EC
|
||||
SYS.FreeStkObj .EQ $EE
|
||||
|
||||
* SLISTX
|
||||
SYS.SListGetData .EQ $F0
|
||||
SYS.SListAddData .EQ $F2
|
||||
SYS.SListSetData .EQ $F4
|
||||
|
@ -93,7 +93,7 @@ CS.RUN ldy #S.PS.ARGC
|
||||
|
||||
.9 >PUSHW L.MSG.USAGE
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
lda #E.SYN
|
||||
sec
|
||||
.99 rts
|
||||
@ -260,7 +260,7 @@ CS.RUN.GREETINGS
|
||||
>SYSCALL ArgV
|
||||
>PUSHYA
|
||||
>PUSHBI 4
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.DOEVENT lda (pEvent)
|
||||
|
@ -207,7 +207,7 @@ CS.RUN.SERVER lda hSrvSocket
|
||||
bpl .1
|
||||
|
||||
>PUSHBI 5
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
jsr CS.RUN.CLIENT
|
||||
.8 clc
|
||||
|
@ -48,7 +48,7 @@ CS.RUN ldy #S.PS.ARGC
|
||||
>PUSHYA
|
||||
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
bcs .99
|
||||
|
||||
lda #1 get PTR to ARG[1] (Driver name)
|
||||
|
@ -384,7 +384,7 @@ CS.RUN.GetLine sta ZPGetLineMax
|
||||
*--------------------------------------
|
||||
CS.RUN.StrOut >PUSHYA
|
||||
>PUSHBI 0
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.DumpFile >PUSHYA
|
||||
|
@ -96,7 +96,7 @@ CS.INIT.DEV >PUSHBI 0
|
||||
>PUSHW L.MSG.DEV.OK
|
||||
>PUSHW L.DEVNAME
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
>LDYA L.DCB.NIC
|
||||
>STYA IOCTL+S.IOCTL.BUFPTR
|
||||
@ -122,7 +122,7 @@ CS.INIT.LIBS lda LibCnt
|
||||
pha
|
||||
>PUSHYA
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
pla
|
||||
ply
|
||||
@ -204,7 +204,7 @@ CS.INIT.CONF >LDYAI 64
|
||||
>PUSHW L.MSG.EXEC
|
||||
>PUSHW pBuf
|
||||
>PUSHBI 2
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHW pBuf
|
||||
>PUSHBI 0 S.PS.F.HOLD+S.PS.F.NOHUP
|
||||
|
@ -177,7 +177,7 @@ CS.RUN.CLIENT >SLEEP give some time for TCPIP SYN/ACK
|
||||
bpl .1
|
||||
|
||||
>PUSHBI 5
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHEA.G NodBuf
|
||||
>PUSHW L.NOD.Template
|
||||
@ -207,7 +207,7 @@ CS.RUN.CLIENT1 >PUSHB hClientSocket
|
||||
pla
|
||||
>PUSHA
|
||||
>PUSHBI 1
|
||||
>SYSCALL printf2
|
||||
>SYSCALL printf
|
||||
|
||||
.8 clc
|
||||
.9 rts
|
||||
|
@ -1,51 +0,0 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*/--------------------------------------
|
||||
* # ChTyp
|
||||
* Change The type of a ProDOS File
|
||||
* ## C
|
||||
* `int chtyp(const char *filepath, int filetype);`
|
||||
* ## ASM
|
||||
* **In:**
|
||||
* `>PUSHW filepath`
|
||||
* `>PUSHB filetype`
|
||||
* `>SYSCALL chtyp`
|
||||
* ## RETURN VALUE
|
||||
*\--------------------------------------
|
||||
K.ChTyp jsr PFT.CheckPath2
|
||||
bcs .99
|
||||
>PULLB .1+1
|
||||
|
||||
inc pStack
|
||||
inc pStack
|
||||
|
||||
>MLICALL MLIGETFILEINFO
|
||||
bcs .9
|
||||
|
||||
.1 lda #$ff
|
||||
sta K.MLI.PARAMS+S.FI.T
|
||||
>MLICALL MLISETFILEINFO
|
||||
.9 rts
|
||||
|
||||
.99 >RET 1 discard filetype
|
||||
*/--------------------------------------
|
||||
* # ChOwn
|
||||
* **In:**
|
||||
* PUSHW = mod
|
||||
* PUSHW = PATH
|
||||
*\--------------------------------------
|
||||
K.ChOwn
|
||||
*/--------------------------------------
|
||||
* # ChGrp
|
||||
* **In:**
|
||||
* PUSHW = GID
|
||||
* PUSHW = PATH
|
||||
*\--------------------------------------
|
||||
K.ChGrp
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE USR/SRC/SYS/KERNEL.S.FIO
|
||||
LOAD USR/SRC/SYS/KERNEL.S
|
||||
ASM
|
@ -131,7 +131,7 @@ Kernel.Init3 sta SETALTZP
|
||||
*--------------------------------------
|
||||
Kernel.Init3C >PUSHWI MSG.Init3
|
||||
>PUSHBI 0
|
||||
>SYSCALL2 printf2
|
||||
>SYSCALL2 printf
|
||||
|
||||
jsr HW.Detect
|
||||
|
||||
@ -159,14 +159,14 @@ Kernel.Init3C >PUSHWI MSG.Init3
|
||||
|
||||
>PUSHWI MSG.CTRLR
|
||||
>PUSHBI 0
|
||||
>SYSCALL2 printf2
|
||||
>SYSCALL2 printf
|
||||
>PUSHWI CTRLR.SHELL
|
||||
bra .8
|
||||
|
||||
.7 >PUSHWI MSG.EtcInit
|
||||
>PUSHWI ETCINIT.CMDLINE
|
||||
>PUSHBI 2
|
||||
>SYSCALL2 printf2
|
||||
>SYSCALL2 printf
|
||||
|
||||
>PUSHWI ETCINIT.CMDLINE
|
||||
|
||||
@ -176,7 +176,7 @@ Kernel.Init3C >PUSHWI MSG.Init3
|
||||
|
||||
>PUSHWI MSG.Init3.OK
|
||||
>PUSHBI 0
|
||||
>SYSCALL2 printf2
|
||||
>SYSCALL2 printf
|
||||
>DEBUGOA
|
||||
|
||||
jmp CORE.Run
|
||||
@ -186,7 +186,7 @@ Kernel.Init3.Err
|
||||
pla
|
||||
>PUSHA
|
||||
>PUSHBI 1
|
||||
>SYSCALL2 printf2
|
||||
>SYSCALL2 printf
|
||||
bra * No need to discard Expanded CMDLINE
|
||||
*--------------------------------------
|
||||
* INIT2 Subs
|
||||
@ -372,7 +372,7 @@ SysScrInit.TTYPtrs
|
||||
*--------------------------------------
|
||||
HW.Detect >PUSHWI MSG.HW
|
||||
>PUSHBI 0
|
||||
>SYSCALL2 printf2
|
||||
>SYSCALL2 printf
|
||||
|
||||
bit RROMBNK1
|
||||
|
||||
@ -422,13 +422,13 @@ HW.Detect >PUSHWI MSG.HW
|
||||
>PUSHB A2osX.HWType
|
||||
>PUSHB A2osX.HWSubT
|
||||
>PUSHBI 2
|
||||
>SYSCALL2 printf2
|
||||
>SYSCALL2 printf
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
CPU.Init.6502 >PUSHWI MSG.CPU
|
||||
>PUSHBI 0
|
||||
>SYSCALL2 printf2
|
||||
>SYSCALL2 printf
|
||||
jsr Detect6502 A = CPU type
|
||||
sta A2osX.CPUTYPE
|
||||
and #$F
|
||||
@ -440,7 +440,7 @@ CPU.Init.6502 >PUSHWI MSG.CPU
|
||||
|
||||
>PUSHWI MSG.CPU.SPEED
|
||||
>PUSHBI 0
|
||||
>SYSCALL2 printf2
|
||||
>SYSCALL2 printf
|
||||
|
||||
stz A2osX.RANDOM16
|
||||
stz A2osX.RANDOM16+1
|
||||
@ -540,12 +540,12 @@ CPU.Init.6502 >PUSHWI MSG.CPU
|
||||
lda A2osX.CPUSPEED+1
|
||||
>PUSHA push CPU speed LO
|
||||
>PUSHBI 2
|
||||
>SYSCALL2 printf2
|
||||
>SYSCALL2 printf
|
||||
rts
|
||||
*--------------------------------------
|
||||
CPU.Init.Z80 >PUSHWI MSG.Z80
|
||||
>PUSHBI 0
|
||||
>SYSCALL2 printf2
|
||||
>SYSCALL2 printf
|
||||
jsr DetectZ80
|
||||
bcs .9
|
||||
sta A2osX.Z80SLOT
|
||||
@ -557,7 +557,7 @@ CPU.Init.Z80 >PUSHWI MSG.Z80
|
||||
lda A2osX.Z80SLOT
|
||||
>PUSHA
|
||||
>PUSHBI 1
|
||||
>SYSCALL2 printf2
|
||||
>SYSCALL2 printf
|
||||
rts
|
||||
.9 >LDYAI MSG.Z80.KO
|
||||
>SYSCALL2 puts
|
||||
@ -752,7 +752,7 @@ DevMgrInit.AddBDev
|
||||
>PUSHW FD.BDEV+S.FD.DEV.BUSPTR
|
||||
>PUSHW MSG.BLKDEV.TBL,x
|
||||
>PUSHBI 6
|
||||
>SYSCALL2 printf2
|
||||
>SYSCALL2 printf
|
||||
|
||||
>PUSHWI FD.BDEV.NAME
|
||||
>LDYAI FD.BDEV
|
||||
|
@ -5,7 +5,7 @@ NEW
|
||||
*--------------------------------------
|
||||
* Bank 1
|
||||
*--------------------------------------
|
||||
K.SYSCALL .DA 0 $00 : STAT
|
||||
K.SYSCALL .DA K.ChTyp $00 : STAT
|
||||
.DA K.ChMod
|
||||
.DA K.FStat
|
||||
.DA K.Stat
|
||||
@ -53,20 +53,20 @@ K.SYSCALL .DA 0 $00 : STAT
|
||||
.DA 0 $50
|
||||
.DA K.SScanF
|
||||
.DA 0
|
||||
.DA K.PrintF2
|
||||
.DA 0
|
||||
.DA K.PrintF
|
||||
.DA K.SPrintF2
|
||||
.DA K.FPrintF2
|
||||
.DA K.SPrintF
|
||||
.DA K.FPrintF
|
||||
.DA 0
|
||||
|
||||
.DA 0 $60
|
||||
.DA K.ChTyp
|
||||
.DA 0
|
||||
.DA 0
|
||||
.DA 0
|
||||
.DA 0
|
||||
.DA K.ChOwn
|
||||
.DA K.ChGrp
|
||||
.DA 0
|
||||
.DA 0
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
* Bank 2
|
||||
*--------------------------------------
|
||||
|
@ -124,11 +124,6 @@ SHARED.SPtr1PPtr2
|
||||
>PULLW ZPPtr2
|
||||
rts
|
||||
*--------------------------------------
|
||||
SHARED.SPtr2PPtr1
|
||||
>STYA ZPPtr2
|
||||
>PULLW ZPPtr1
|
||||
rts
|
||||
*--------------------------------------
|
||||
SHARED.GetCharPtr1
|
||||
lda (ZPPtr1)
|
||||
beq SHARED.RTS
|
||||
|
@ -1,5 +1,33 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*/--------------------------------------
|
||||
* # ChTyp
|
||||
* Change The type of a ProDOS File
|
||||
* ## C
|
||||
* `int chtyp(const char *filepath, short int filetype);`
|
||||
* ## ASM
|
||||
* **In:**
|
||||
* `>PUSHW filepath`
|
||||
* `>PUSHB filetype`
|
||||
* `>SYSCALL chtyp`
|
||||
* ## RETURN VALUE
|
||||
*\--------------------------------------
|
||||
K.ChTyp jsr PFT.CheckPath2
|
||||
bcs .99
|
||||
>PULLB .1+1
|
||||
|
||||
inc pStack
|
||||
inc pStack
|
||||
|
||||
>MLICALL MLIGETFILEINFO
|
||||
bcs .9
|
||||
|
||||
.1 lda #$ff
|
||||
sta K.MLI.PARAMS+S.FI.T
|
||||
>MLICALL MLISETFILEINFO
|
||||
.9 rts
|
||||
|
||||
.99 >RET 1 discard filetype
|
||||
*--------------------------------------
|
||||
* # ChMod
|
||||
* change permissions of a file
|
||||
|
@ -1,8 +1,5 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
K.PrintF.PadL .EQ FAC+5
|
||||
K.PrintF.PadC .EQ ARG.SIGN
|
||||
*/--------------------------------------
|
||||
* # putchar (BLOCKING)
|
||||
* Print A (char) to StdOut
|
||||
@ -159,446 +156,7 @@ K.FPutS jsr PFT.CheckNodeA set IO.hFD
|
||||
bpl K.PutS.RET2 IO Erorr
|
||||
inc 0 = BLOCKING
|
||||
* sec
|
||||
rts
|
||||
*/--------------------------------------
|
||||
* # PrintF (BLOCKING)
|
||||
* # FPrintF (BLOCKING)
|
||||
* # SPrintF
|
||||
* Prints C-Style String
|
||||
* ## C
|
||||
* `int printf ( const char * format, ... );`
|
||||
* `int fprintf ( hFILE stream, const char * format, ... );`
|
||||
* `int sprintf ( char * str, const char * format, ... );`
|
||||
* ## ASM
|
||||
* **In:**
|
||||
* PrintF : (example is for printing Y,A as integer : format="%I", 2 bytes)
|
||||
* `>PUSHW format`
|
||||
* `>PUSHW i`
|
||||
* `...`
|
||||
* `>PUSHBI 2` #bytecount
|
||||
* `>SYSCALL printf`
|
||||
* FPrintF :
|
||||
* `>PUSHB hFILE`
|
||||
* `>PUSHW format`
|
||||
* `>PUSHW i`
|
||||
* `...`
|
||||
* `>PUSHBI 2` #bytecount
|
||||
* `>SYSCALL fprintf`
|
||||
* SPrintF :
|
||||
* `>PUSHW str`
|
||||
* `>PUSHW format`
|
||||
* `>PUSHW i`
|
||||
* `...`
|
||||
* `>PUSHBI 2` #bytecount
|
||||
* `>SYSCALL sprintf`
|
||||
* ## RETURN VALUE
|
||||
* CC : success, Y,A = bytes sent
|
||||
* CS : error, A = code from Output
|
||||
* Specifiers :
|
||||
* + %b : pull 1 byte to Print BIN
|
||||
* + %d : pull 1 byte unsigned DEC 0..255
|
||||
* + %D : pull 2 bytes unsigned DEC 0..65535
|
||||
* + %u : pull 4 bytes long unsigned DEC 0..4294967295
|
||||
* + %e : pull 5 Bytes float (-)1.23456789e+12
|
||||
* + %f : pull 5 Bytes float (-)3.1415
|
||||
* + %h : pull 1 byte to Print HEX
|
||||
* + %H : pull 2 bytes to Print HEX
|
||||
* + %i : pull 1 byte to Print signed DEC -128..127
|
||||
* + %I : pull 2 bytes to Print signed DEC -32768..32767
|
||||
* + %L : pull 4 bytes signed DEC -2147483648..2147483647
|
||||
* + %s : pull 2 bytes ptr to C-Style String
|
||||
* + %S : pull 2 bytes ptr to P-Style String
|
||||
* + \b : Print 'BS' (08)
|
||||
* + \e : Print 'ESC' ($1B,27)
|
||||
* + \f : Print 'FF' ($0C,12)
|
||||
* + \n : Print 'LF' ($0A,10)
|
||||
* + \r : Print 'CR' ($0D,13)
|
||||
* + \t : Print 'TAB' ($09,09)
|
||||
* + \v : Print 'VT' ($0B,11)
|
||||
* + \xHH : Print byte with hexadecimal value HH (1 to 2 digits)
|
||||
* + \\\\ : Print \
|
||||
* + \\% : Print %
|
||||
* Modifiers for len and padding :
|
||||
* + %d : '9' '12'
|
||||
* + %2d : ' 9' '12'
|
||||
* + %02d : '09' '12'
|
||||
* + %11s : 'ABCDEFGH '
|
||||
* + %011s : 'ABCDEFGH000'
|
||||
* + %2f : '3.14'
|
||||
*\--------------------------------------
|
||||
.DUMMY
|
||||
.OR ZPTMP+5 3 Bytes
|
||||
PrintF.Cnt .BS 2
|
||||
PrintF.hFILE .BS 1
|
||||
.ED
|
||||
*--------------------------------------
|
||||
K.SPrintF stz PrintF.hFILE
|
||||
>STYA pIOBuf str
|
||||
jsr K.PrintF.GetFormat
|
||||
bra K.PrintF.1
|
||||
K.FPrintF sta PrintF.hFILE
|
||||
jsr K.PrintF.GetFormat
|
||||
bra K.PrintF.0
|
||||
|
||||
K.PrintF >STYA ZPPtr2 format
|
||||
|
||||
lda pStack
|
||||
sta pLocal
|
||||
|
||||
ldy #S.PS.hStdOut
|
||||
lda (pPs),y
|
||||
sta PrintF.hFILE
|
||||
|
||||
K.PrintF.0 >LDYAI K.IOBuf
|
||||
>STYA pIOBuf
|
||||
K.PrintF.1 stz PrintF.Cnt
|
||||
stz PrintF.Cnt+1
|
||||
|
||||
stz PrintF.LocalGetByte+1
|
||||
|
||||
.1 jsr SHARED.GetCharPtr2
|
||||
bne .22
|
||||
|
||||
jmp .8 end of format..
|
||||
|
||||
.22 cmp #'%'
|
||||
bne .10
|
||||
stz K.PrintF.PadL
|
||||
stz K.PrintF.PadC
|
||||
lda (ZPPtr2)
|
||||
beq .7 end of format... print % and exit
|
||||
|
||||
jsr ZP.IsDigit
|
||||
bcs .6 no digit....go check specifier
|
||||
cmp #'0' ...a 0...mmm... padding char?
|
||||
bne .4
|
||||
sta K.PrintF.PadC
|
||||
jsr SHARED.NextCharPtr2 skip 0 ...
|
||||
lda (ZPPtr2)
|
||||
beq .7
|
||||
|
||||
jsr ZP.IsDigit
|
||||
bcs .6 %0x ??????
|
||||
|
||||
.4 jsr MATH.Dec2ACC32
|
||||
bcs .99
|
||||
lda ACC32
|
||||
sta K.PrintF.PadL
|
||||
lda K.PrintF.PadC
|
||||
bne .5
|
||||
lda #C.SPACE
|
||||
sta K.PrintF.PadC
|
||||
|
||||
.5 jsr SHARED.AddYToPtr2 skip all processed chars
|
||||
|
||||
lda (ZPPtr2)
|
||||
beq .7
|
||||
|
||||
.6 ldx #PrintFTBL1.Cnt-1 do we have a %x command?
|
||||
.61 cmp PrintFTBL1,x
|
||||
beq .62
|
||||
dex
|
||||
bpl .61
|
||||
bra .20 unknown ...
|
||||
|
||||
.62 jsr SHARED.NextCharPtr2
|
||||
txa yes, jmp to it!
|
||||
asl
|
||||
tax
|
||||
jsr PrintF.ESC
|
||||
.11 bcc .1
|
||||
bra .99
|
||||
.7 lda #'%'
|
||||
bra .20
|
||||
*--------------------------------------
|
||||
.10 cmp #'\'
|
||||
bne .20
|
||||
|
||||
jsr SHARED.GetCharPtr2
|
||||
beq .99
|
||||
ldx #PrintFTBL2.Cnt-1
|
||||
.12 cmp PrintFTBL2,x
|
||||
beq .19
|
||||
dex
|
||||
bpl .12
|
||||
|
||||
cmp #'x' \xHH
|
||||
bne .1
|
||||
|
||||
jsr MATH.Hex2ACC32
|
||||
bcs .99
|
||||
jsr SHARED.AddYToPtr2
|
||||
.14 lda ACC32
|
||||
bra .20
|
||||
|
||||
.19 lda PrintFTBL2.OUT,x
|
||||
|
||||
.20 jsr PrintF.COut
|
||||
bcc .11
|
||||
*--------------------------------------
|
||||
.99 bra PrintF.LocalCleanUp
|
||||
*--------------------------------------
|
||||
.8 ldx PrintF.hFILE
|
||||
beq .80 Writing to buffer, append \0
|
||||
>PUSHW PrintF.Cnt Writing to File/dev...
|
||||
>PUSHWI K.IOBuf
|
||||
|
||||
txa
|
||||
jsr K.FWrite
|
||||
bcc .81
|
||||
|
||||
tay
|
||||
bne .99
|
||||
|
||||
>RET 4 0=BLOCKING
|
||||
.80 ldy PrintF.Cnt A=0, Writing to buffer, append \0
|
||||
sta (pIOBuf),y
|
||||
|
||||
.81 >LDYA PrintF.Cnt
|
||||
* clc
|
||||
*--------------------------------------
|
||||
PrintF.LocalCleanUp
|
||||
php
|
||||
pha
|
||||
lda pLocal
|
||||
sec ByteCnt byte
|
||||
adc (pLocal) ... ByteCnt
|
||||
sta pStack CC
|
||||
pla
|
||||
plp
|
||||
PrintF.LocalCleanUp.RTS
|
||||
rts
|
||||
*--------------------------------------
|
||||
PrintF.LocalGetPtr
|
||||
jsr PrintF.LocalGetByte
|
||||
bcs PrintF.LocalCleanUp.RTS
|
||||
tay
|
||||
*--------------------------------------
|
||||
PrintF.LocalGetByte
|
||||
lda #$FF SELF MODIFIED LStack Ptr
|
||||
cmp (pLocal)
|
||||
beq .9 CS
|
||||
|
||||
phy
|
||||
|
||||
tay
|
||||
iny
|
||||
lda (pLocal),y
|
||||
sty PrintF.LocalGetByte+1
|
||||
|
||||
ply
|
||||
* clc
|
||||
rts
|
||||
|
||||
.9 lda #E.STACK
|
||||
* sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
PrintF.ESC jmp (.1,x)
|
||||
.1 .DA PrintF.B
|
||||
.DA PrintF.D,PrintF.DD,PrintF.U
|
||||
.DA PrintF.E,PrintF.F
|
||||
.DA PrintF.H,PrintF.HH
|
||||
.DA PrintF.I,PrintF.II,PrintF.L
|
||||
.DA PrintF.S,PrintF.SS
|
||||
*--------------------------------------
|
||||
PrintFTBL1 .AS "bdDuefhHiILsS"
|
||||
PrintFTBL1.Cnt .EQ *-PrintFTBL1
|
||||
PrintFTBL2 .AS "abefnrtv\%"
|
||||
PrintFTBL2.Cnt .EQ *-PrintFTBL2
|
||||
PrintFTBL2.OUT .HS 07.08.1B.0C.0A.0D.09.0B \a\b\e\f\n\r\t\v
|
||||
.DA #'\' \\
|
||||
.DA #'%' \%
|
||||
*--------------------------------------
|
||||
PrintF.B jsr PrintF.LocalGetByte
|
||||
bcs PrintF.B.RTS
|
||||
ldy #8
|
||||
|
||||
.1 asl
|
||||
pha
|
||||
lda #'0'/2
|
||||
rol
|
||||
jsr PrintF.COut
|
||||
bcs .9
|
||||
pla
|
||||
dey
|
||||
bne .1
|
||||
rts
|
||||
|
||||
.9 ply
|
||||
PrintF.B.RTS
|
||||
rts
|
||||
*--------------------------------------
|
||||
PrintF.I sec signed short
|
||||
.HS 90 BCC
|
||||
PrintF.D clc unsigned short (BYTE)
|
||||
|
||||
ldy #1
|
||||
bra PrintF.NUM
|
||||
PrintF.II sec signed int
|
||||
.HS 90 BCC
|
||||
PrintF.DD clc unsigned int (WORD)
|
||||
|
||||
ldy #2
|
||||
bra PrintF.NUM
|
||||
|
||||
PrintF.L sec signed long
|
||||
.HS 90 BCC
|
||||
PrintF.U clc unsigned long (DWORD)
|
||||
|
||||
ldy #4
|
||||
|
||||
PrintF.NUM ror ACC32.Sign
|
||||
ldx #0
|
||||
.1 jsr PrintF.LocalGetByte
|
||||
bcs PrintF.B.RTS
|
||||
sta ACC32,x
|
||||
inx
|
||||
dey
|
||||
bne .1
|
||||
|
||||
.2 cpx #4
|
||||
beq .3
|
||||
|
||||
stz ACC32,x
|
||||
inx
|
||||
bra .2
|
||||
|
||||
.3 ldx K.PrintF.PadL
|
||||
ldy K.PrintF.PadC
|
||||
rol ACC32.Sign
|
||||
jsr MATH.ACC322STR10
|
||||
bra PrintF.StrNum
|
||||
*--------------------------------------
|
||||
* EXP(8) 1(s) 1significants(31)
|
||||
* http://apple2.org.za/gswv/a2zine/GS.WorldView/Resources/GS.TECH.INFO/AppleSoft/
|
||||
*--------------------------------------
|
||||
PrintF.E sec Force "E+12"
|
||||
.HS 90 BCC
|
||||
PrintF.F clc
|
||||
|
||||
lda PrintF.LocalGetByte+1 get current stack Ptr
|
||||
tay
|
||||
clc at least 5 bytes remaining ?
|
||||
adc #5
|
||||
|
||||
cmp (pStack)
|
||||
bcc .1
|
||||
bne PrintF.StrNum.RTS
|
||||
.1 sta PrintF.LocalGetByte+1
|
||||
|
||||
tya
|
||||
sec +1 for bytecount byte
|
||||
adc pStack
|
||||
ldy pStack+1 A,Y = float
|
||||
ldx #FPU.SETFAC
|
||||
jsr GP.ROMCALL
|
||||
ldy #A2osX.NumStrBuf+1 FOUT.1 will do a DEY
|
||||
ldx #FPU.FOUT
|
||||
jsr GP.ROMCALL
|
||||
|
||||
PrintF.StrNum ldy #0
|
||||
.2 lda A2osX.NumStrBuf,y
|
||||
beq .8
|
||||
iny
|
||||
jsr PrintF.COut
|
||||
bcc .2
|
||||
|
||||
.9 rts
|
||||
.8 clc
|
||||
PrintF.StrNum.RTS
|
||||
rts
|
||||
*--------------------------------------
|
||||
PrintF.S ldy #$ff CSTR
|
||||
.HS 2C bit abs
|
||||
PrintF.SS ldy #$00 PSTR
|
||||
|
||||
sty .1+1
|
||||
|
||||
jsr PrintF.LocalGetPtr
|
||||
bcs .9
|
||||
|
||||
sty ZPPtr1
|
||||
sta ZPPtr1+1
|
||||
|
||||
lda (ZPPtr1) if CSTR:last char=0, if PSTR:len=0
|
||||
beq .8
|
||||
ldy .1+1
|
||||
.1 lda #$ff Self Modified
|
||||
bne .11 CSTR
|
||||
tya PSTR
|
||||
cmp (ZPPtr1) len check
|
||||
beq .2
|
||||
.11 iny
|
||||
lda (ZPPtr1),y
|
||||
beq .2
|
||||
|
||||
jsr PrintF.COut
|
||||
bcs .9
|
||||
|
||||
lda K.PrintF.PadL
|
||||
beq .1
|
||||
cpy K.PrintF.PadL
|
||||
bne .1
|
||||
.8 clc
|
||||
rts
|
||||
.2 lda K.PrintF.PadL
|
||||
beq .8
|
||||
.3 cpy K.PrintF.PadL
|
||||
beq .8
|
||||
lda K.PrintF.PadC
|
||||
jsr PrintF.COut
|
||||
bcs .9
|
||||
iny
|
||||
bne .3
|
||||
|
||||
* clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
PrintF.HH jsr PrintF.LocalGetByte
|
||||
bcs PrintF.COut.RTS
|
||||
pha LO byte
|
||||
jsr PrintF.H
|
||||
plx
|
||||
bcs PrintF.COut.RTS
|
||||
txa
|
||||
bra PrintF.H.1
|
||||
*--------------------------------------
|
||||
PrintF.H jsr PrintF.LocalGetByte
|
||||
bcs PrintF.COut.RTS
|
||||
PrintF.H.1 jsr MATH.AToHexAX
|
||||
jsr PrintF.COut
|
||||
bcs PrintF.COut.RTS
|
||||
txa
|
||||
*--------------------------------------
|
||||
PrintF.COut phy
|
||||
ldy PrintF.Cnt
|
||||
sta (pIOBuf),y
|
||||
ply
|
||||
inc PrintF.Cnt
|
||||
bne .8
|
||||
lda PrintF.hFILE
|
||||
bne .9
|
||||
|
||||
inc pIOBuf+1
|
||||
inc PrintF.Cnt+1
|
||||
.8 clc
|
||||
rts
|
||||
.9 lda #E.BUF
|
||||
sec
|
||||
PrintF.COut.RTS rts
|
||||
*--------------------------------------
|
||||
K.PrintF.GetFormat
|
||||
lda (pStack)
|
||||
sta ZPPtr2
|
||||
ldy #1
|
||||
lda (pStack),y
|
||||
sta ZPPtr2+1
|
||||
lda pStack
|
||||
inc
|
||||
inc
|
||||
sta pLocal
|
||||
rts
|
||||
K.FPutS.RTS rts
|
||||
*/--------------------------------------
|
||||
* # fgets (BLOCKING)
|
||||
* read bytes from stream into the array
|
||||
@ -621,7 +179,7 @@ K.PrintF.GetFormat
|
||||
* (pStack)+0 s
|
||||
*--------------------------------------
|
||||
K.FGetS jsr PFT.CheckNodeA
|
||||
bcs PrintF.COut.RTS
|
||||
bcs K.FPutS.RTS
|
||||
|
||||
lda (pStack)
|
||||
sta ZPPtr2 s LO
|
||||
@ -753,144 +311,6 @@ STDIO.Read.1 lda #0
|
||||
>PUSHWI K.IOBuf
|
||||
jmp UNISTD.READ
|
||||
*/--------------------------------------
|
||||
* # SScanF
|
||||
* Read formatted data from string
|
||||
* ## C
|
||||
* `int sscanf ( const char * s, const char * format, ... );`
|
||||
* ## ASM
|
||||
* **In:**
|
||||
* `>PUSHW ptr`
|
||||
* `...`
|
||||
* `>PUSHBI bytecount`
|
||||
* `>PUSHWI format`
|
||||
* + %i : short int
|
||||
* + %d : byte
|
||||
* + %I : int
|
||||
* + %D : word
|
||||
* + %L : long int
|
||||
* + %U : dword
|
||||
* + %h : HEX byte
|
||||
* + %H : HEX word
|
||||
* + %s : string
|
||||
* TODO : %10s
|
||||
* `>LDYA s`
|
||||
* `>SYSCALL sscanf`
|
||||
* ## RETURN VALUE
|
||||
* A = Number of arguments filled.
|
||||
*\--------------------------------------
|
||||
K.SScanF jsr SHARED.SPtr2PPtr1 ptr2=String to Scan,Ptr1=format
|
||||
|
||||
lda pStack
|
||||
sta pLocal
|
||||
|
||||
stz .8+1 rest Arg processed
|
||||
stz PrintF.LocalGetByte+1
|
||||
|
||||
.1 jsr SHARED.GetCharPtr1 End Of format?
|
||||
beq .8
|
||||
|
||||
cmp #'%' Escape ?
|
||||
beq .2
|
||||
|
||||
cmp #' ' Space ?
|
||||
beq .12
|
||||
|
||||
cmp (ZPPtr2) Same char in string?
|
||||
bne .9
|
||||
|
||||
jsr SHARED.NextCharPtr2
|
||||
bra .1
|
||||
|
||||
.12 jsr SHARED.NextCharPtr2 Space....
|
||||
cmp (ZPPtr2) another one ?
|
||||
beq .12
|
||||
bne .1
|
||||
|
||||
.2 jsr SHARED.GetCharPtr1 Get specifier after %
|
||||
beq .9 unexpected End of format after "%" ?
|
||||
|
||||
ldx #K.SScanFJMP-K.SScanFTBL-2
|
||||
|
||||
.3 cmp K.SScanFTBL,x
|
||||
beq .4
|
||||
dex
|
||||
dex
|
||||
bpl .3
|
||||
|
||||
.9 lda #MLI.E.EOF
|
||||
sec
|
||||
jmp PrintF.LocalCleanUp
|
||||
|
||||
.4 jsr PrintF.LocalGetPtr
|
||||
bcs .9
|
||||
sty ZPPtr3
|
||||
sta ZPPtr3+1
|
||||
jsr .5
|
||||
bcs .9 out of Ptr on stack
|
||||
|
||||
inc .8+1 parsed one more arg!
|
||||
bra .1
|
||||
|
||||
.8 lda #$ff SELF MODIFIED Arg processed
|
||||
clc
|
||||
jmp PrintF.LocalCleanUp
|
||||
*--------------------------------------
|
||||
.5 jmp (K.SScanFJMP,x)
|
||||
*--------------------------------------
|
||||
K.SScanFTBL .DA #'i,#1,#'d,#1,#'I,#2,#'D,#2,#'l,#4,#'u,#4,#'h,#1,#'H,#2,#'s,#2
|
||||
K.SScanFJMP .DA K.SScanF.I
|
||||
.DA K.SScanF.D
|
||||
.DA K.SScanF.II
|
||||
.DA K.SScanF.DD
|
||||
.DA K.SScanF.L
|
||||
.DA K.SScanF.U
|
||||
.DA K.SScanF.H
|
||||
.DA K.SScanF.HH
|
||||
.DA K.SScanF.S
|
||||
*--------------------------------------
|
||||
K.SScanF.I
|
||||
K.SScanF.D
|
||||
K.SScanF.II
|
||||
K.SScanF.DD
|
||||
K.SScanF.L
|
||||
K.SScanF.U lda K.SScanFTBL+1,x Get VAR size
|
||||
pha Save VAL size
|
||||
|
||||
jsr MATH.Dec2ACC32
|
||||
bra K.SScanF.GetVAL
|
||||
*--------------------------------------
|
||||
K.SScanF.HH
|
||||
K.SScanF.H lda K.SScanFTBL+1,x Get VAR size
|
||||
pha
|
||||
|
||||
jsr MATH.Hex2ACC32
|
||||
|
||||
K.SScanF.GetVAL jsr SHARED.AddYToPtr2 Y=char count parsed
|
||||
|
||||
.1 ply get back VAL size
|
||||
|
||||
.2 lda ACC32-1,y
|
||||
dey
|
||||
sta (ZPPtr3),y
|
||||
bne .2
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
K.SScanF.S ldy #$ff
|
||||
|
||||
.1 iny
|
||||
lda (ZPPtr2),y Get char in string to scan
|
||||
sta (ZPPtr3),y store in param ptr
|
||||
beq K.SScanF.Fwd end of string to scan ?
|
||||
cmp (ZPPtr1) match format next char ?
|
||||
beq .2
|
||||
cmp #' ' is it a space ?
|
||||
bne .1
|
||||
.2 lda #0 add \0 to param ptr
|
||||
sta (ZPPtr3),y
|
||||
|
||||
K.SScanF.Fwd jmp SHARED.AddYToPtr2 Y=char count parsed
|
||||
*/--------------------------------------
|
||||
* # FOpen
|
||||
* Open a file
|
||||
* ## C
|
||||
|
@ -1,7 +1,81 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*/--------------------------------------
|
||||
* # PrintF (BLOCKING)
|
||||
* # FPrintF (BLOCKING)
|
||||
* # SPrintF
|
||||
* Prints C-Style String
|
||||
* ## C
|
||||
* `int printf ( const char * format, ... );`
|
||||
* `int fprintf ( hFILE stream, const char * format, ... );`
|
||||
* `int sprintf ( char * str, const char * format, ... );`
|
||||
* ## ASM
|
||||
* **In:**
|
||||
* PrintF : (example is for printing Y,A as integer : format="%I", 2 bytes)
|
||||
* `>PUSHW format`
|
||||
* `>PUSHW i`
|
||||
* `...`
|
||||
* `>PUSHBI 2` #bytecount
|
||||
* `>SYSCALL printf`
|
||||
* FPrintF :
|
||||
* `>PUSHB hFILE`
|
||||
* `>PUSHW format`
|
||||
* `>PUSHW i`
|
||||
* `...`
|
||||
* `>PUSHBI 2` #bytecount
|
||||
* `>SYSCALL fprintf`
|
||||
* SPrintF :
|
||||
* `>PUSHW str`
|
||||
* `>PUSHW format`
|
||||
* `>PUSHW i`
|
||||
* `...`
|
||||
* `>PUSHBI 2` #bytecount
|
||||
* `>SYSCALL sprintf`
|
||||
* ## RETURN VALUE
|
||||
* CC : success, Y,A = bytes sent
|
||||
* CS : error, A = code from Output
|
||||
* Specifiers :
|
||||
* + %b : pull 1 byte to Print BIN
|
||||
* + %d : pull 1 byte unsigned DEC 0..255
|
||||
* + %D : pull 2 bytes unsigned DEC 0..65535
|
||||
* + %u : pull 4 bytes long unsigned DEC 0..4294967295
|
||||
* + %e : pull 5 Bytes float (-)1.23456789e+12
|
||||
* + %f : pull 5 Bytes float (-)3.1415
|
||||
* + %h : pull 1 byte to Print HEX
|
||||
* + %H : pull 2 bytes to Print HEX
|
||||
* + %i : pull 1 byte to Print signed DEC -128..127
|
||||
* + %I : pull 2 bytes to Print signed DEC -32768..32767
|
||||
* + %L : pull 4 bytes signed DEC -2147483648..2147483647
|
||||
* + %s : pull 2 bytes ptr to C-Style String
|
||||
* + %S : pull 2 bytes ptr to P-Style String
|
||||
* + \b : Print 'BS' (08)
|
||||
* + \e : Print 'ESC' ($1B,27)
|
||||
* + \f : Print 'FF' ($0C,12)
|
||||
* + \n : Print 'LF' ($0A,10)
|
||||
* + \r : Print 'CR' ($0D,13)
|
||||
* + \t : Print 'TAB' ($09,09)
|
||||
* + \v : Print 'VT' ($0B,11)
|
||||
* + \xHH : Print byte with hexadecimal value HH (1 to 2 digits)
|
||||
* + \\\\ : Print \
|
||||
* + \\% : Print %
|
||||
* Modifiers for len and padding :
|
||||
* + %d : '9' '12'
|
||||
* + %2d : ' 9' '12'
|
||||
* + %02d : '09' '12'
|
||||
* + %11s : 'ABCDEFGH '
|
||||
* + %011s : 'ABCDEFGH000'
|
||||
* + %2f : '3.14'
|
||||
*\--------------------------------------
|
||||
.DUMMY
|
||||
.OR ZPTMP+5 3 Bytes
|
||||
PrintF.Cnt .BS 2
|
||||
PrintF.hFILE .BS 1
|
||||
.ED
|
||||
*--------------------------------------
|
||||
K.PrintF2 >LDYAI K.IOBuf
|
||||
K.PrintF.PadL .EQ FAC+5
|
||||
K.PrintF.PadC .EQ ARG.SIGN
|
||||
*--------------------------------------
|
||||
K.PrintF >LDYAI K.IOBuf
|
||||
>STYA pIOBuf
|
||||
ldy #S.PS.hStdOut
|
||||
lda (pPs),y
|
||||
@ -17,9 +91,9 @@ K.PrintF2 >LDYAI K.IOBuf
|
||||
lda (pStack),y format HI
|
||||
sta ZPPtr2+1
|
||||
|
||||
bra K.PrintF2.1
|
||||
|
||||
K.FPrintf2 >LDYAI K.IOBuf
|
||||
bra K.PrintF.1
|
||||
*--------------------------------------
|
||||
K.FPrintf >LDYAI K.IOBuf
|
||||
>STYA pIOBuf
|
||||
lda (pStack) Bytecount
|
||||
inc
|
||||
@ -35,9 +109,9 @@ K.FPrintf2 >LDYAI K.IOBuf
|
||||
lda (pStack),y hFILE
|
||||
sta PrintF.hFILE
|
||||
|
||||
bra K.PrintF2.1
|
||||
|
||||
K.SPrintf2 stz PrintF.hFILE
|
||||
bra K.PrintF.1
|
||||
*--------------------------------------
|
||||
K.SPrintf stz PrintF.hFILE
|
||||
lda (pStack) Bytecount
|
||||
inc
|
||||
tay
|
||||
@ -55,7 +129,7 @@ K.SPrintf2 stz PrintF.hFILE
|
||||
lda (pStack),y str HI
|
||||
sta pIOBuf+1
|
||||
*--------------------------------------
|
||||
K.PrintF2.1 sty PrintF2.Exit.Cnt+1 Total bytes to POP
|
||||
K.PrintF.1 sty PrintF.Exit.Cnt+1 Total bytes to POP
|
||||
|
||||
stz PrintF.Cnt
|
||||
stz PrintF.Cnt+1
|
||||
@ -109,7 +183,7 @@ K.PrintF2.1 sty PrintF2.Exit.Cnt+1 Total bytes to POP
|
||||
txa yes, jmp to it!
|
||||
asl
|
||||
tax
|
||||
jsr PrintF2.ESC
|
||||
jsr PrintF.ESC
|
||||
.11 bcc .1
|
||||
bra .99
|
||||
.7 lda #'%'
|
||||
@ -139,7 +213,7 @@ K.PrintF2.1 sty PrintF2.Exit.Cnt+1 Total bytes to POP
|
||||
.20 jsr PrintF.COut
|
||||
bcc .11
|
||||
*--------------------------------------
|
||||
.99 bra PrintF2.Exit
|
||||
.99 bra PrintF.Exit
|
||||
*--------------------------------------
|
||||
.8 ldx PrintF.hFILE
|
||||
beq .80 Writing to buffer, append \0
|
||||
@ -160,48 +234,35 @@ K.PrintF2.1 sty PrintF2.Exit.Cnt+1 Total bytes to POP
|
||||
.81 >LDYA PrintF.Cnt
|
||||
* clc
|
||||
*--------------------------------------
|
||||
PrintF2.Exit php
|
||||
PrintF.Exit php
|
||||
pha
|
||||
lda pStack
|
||||
sec +Bytecount byte
|
||||
PrintF2.Exit.Cnt
|
||||
adc #$ff SELF MODIFIED
|
||||
PrintF.Exit.Cnt adc #$ff SELF MODIFIED
|
||||
sta pStack
|
||||
pla
|
||||
plp
|
||||
PrintF2.Exit.RTS
|
||||
PrintF.Exit.RTS
|
||||
rts
|
||||
*--------------------------------------
|
||||
PrintF2.LocalGetByte
|
||||
lda (pStack)
|
||||
beq .9
|
||||
|
||||
phy
|
||||
|
||||
tay
|
||||
dec
|
||||
sta (pStack)
|
||||
lda (pStack),y
|
||||
|
||||
ply
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 lda #E.STACK
|
||||
sec
|
||||
rts
|
||||
PrintFTBL1 .AS "bdDuefhHiILsS"
|
||||
PrintFTBL1.Cnt .EQ *-PrintFTBL1
|
||||
PrintFTBL2 .AS "abefnrtv\%"
|
||||
PrintFTBL2.Cnt .EQ *-PrintFTBL2
|
||||
PrintFTBL2.OUT .HS 07.08.1B.0C.0A.0D.09.0B \a\b\e\f\n\r\t\v
|
||||
.DA #'\' \\
|
||||
.DA #'%' \%
|
||||
*--------------------------------------
|
||||
PrintF2.ESC jmp (.1,x)
|
||||
.1 .DA PrintF2.B
|
||||
.DA PrintF2.D,PrintF2.DD,PrintF2.U
|
||||
.DA PrintF2.E,PrintF2.F
|
||||
.DA PrintF2.H,PrintF2.HH
|
||||
.DA PrintF2.I,PrintF2.II,PrintF2.L
|
||||
.DA PrintF2.S,PrintF2.SS
|
||||
PrintF.ESC jmp (.1,x)
|
||||
.1 .DA PrintF.B
|
||||
.DA PrintF.D,PrintF.DD,PrintF.U
|
||||
.DA PrintF.E,PrintF.F
|
||||
.DA PrintF.H,PrintF.HH
|
||||
.DA PrintF.I,PrintF.II,PrintF.L
|
||||
.DA PrintF.S,PrintF.SS
|
||||
*--------------------------------------
|
||||
PrintF2.B jsr PrintF2.LocalGetByte
|
||||
bcs PrintF2.B.RTS
|
||||
PrintF.B jsr PrintF.LocalGetByte
|
||||
bcs PrintF.B.RTS
|
||||
ldy #8
|
||||
|
||||
.1 asl
|
||||
@ -216,32 +277,32 @@ PrintF2.B jsr PrintF2.LocalGetByte
|
||||
rts
|
||||
|
||||
.9 ply
|
||||
PrintF2.B.RTS
|
||||
PrintF.B.RTS
|
||||
rts
|
||||
*--------------------------------------
|
||||
PrintF2.I sec signed short
|
||||
PrintF.I sec signed short
|
||||
.HS 90 BCC
|
||||
PrintF2.D clc unsigned short (BYTE)
|
||||
PrintF.D clc unsigned short (BYTE)
|
||||
|
||||
ldy #1
|
||||
bra PrintF2.NUM
|
||||
PrintF2.II sec signed int
|
||||
bra PrintF.NUM
|
||||
PrintF.II sec signed int
|
||||
.HS 90 BCC
|
||||
PrintF2.DD clc unsigned int (WORD)
|
||||
PrintF.DD clc unsigned int (WORD)
|
||||
|
||||
ldy #2
|
||||
bra PrintF2.NUM
|
||||
bra PrintF.NUM
|
||||
|
||||
PrintF2.L sec signed long
|
||||
PrintF.L sec signed long
|
||||
.HS 90 BCC
|
||||
PrintF2.U clc unsigned long (DWORD)
|
||||
PrintF.U clc unsigned long (DWORD)
|
||||
|
||||
ldy #4
|
||||
|
||||
PrintF2.NUM ror ACC32.Sign
|
||||
PrintF.NUM ror ACC32.Sign
|
||||
jsr MATH.ACC32ZERO
|
||||
.1 jsr PrintF2.LocalGetByte
|
||||
bcs PrintF2.B.RTS
|
||||
.1 jsr PrintF.LocalGetByte
|
||||
bcs PrintF.B.RTS
|
||||
|
||||
sta ACC32-1,y
|
||||
dey
|
||||
@ -251,19 +312,19 @@ PrintF2.NUM ror ACC32.Sign
|
||||
ldy K.PrintF.PadC
|
||||
rol ACC32.Sign
|
||||
jsr MATH.ACC322STR10
|
||||
bra PrintF2.StrNum
|
||||
bra PrintF.StrNum
|
||||
*--------------------------------------
|
||||
* EXP(8) 1(s) 1significants(31)
|
||||
* http://apple2.org.za/gswv/a2zine/GS.WorldView/Resources/GS.TECH.INFO/AppleSoft/
|
||||
*--------------------------------------
|
||||
PrintF2.E sec Force "E+12"
|
||||
PrintF.E sec Force "E+12"
|
||||
.HS 90 BCC
|
||||
PrintF2.F clc
|
||||
PrintF.F clc
|
||||
|
||||
lda (pStack) get current stack Ptr
|
||||
sec at least 5 bytes remaining ?
|
||||
sbc #5
|
||||
bcc PrintF2.StrNum.Err
|
||||
bcc PrintF.StrNum.Err
|
||||
sta (pStack)
|
||||
|
||||
* sec
|
||||
@ -275,7 +336,7 @@ PrintF2.F clc
|
||||
ldx #FPU.FOUT
|
||||
jsr GP.ROMCALL
|
||||
|
||||
PrintF2.StrNum ldy #0
|
||||
PrintF.StrNum ldy #0
|
||||
.2 lda A2osX.NumStrBuf,y
|
||||
beq .8
|
||||
iny
|
||||
@ -285,21 +346,21 @@ PrintF2.StrNum ldy #0
|
||||
.9 rts
|
||||
.8 clc
|
||||
rts
|
||||
PrintF2.StrNum.Err
|
||||
PrintF.StrNum.Err
|
||||
lda #E.STACK
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
PrintF2.S ldy #$ff CSTR
|
||||
PrintF.S ldy #$ff CSTR
|
||||
.HS 2C bit abs
|
||||
PrintF2.SS ldy #$00 PSTR
|
||||
PrintF.SS ldy #$00 PSTR
|
||||
|
||||
sty .1+1
|
||||
|
||||
jsr PrintF2.LocalGetByte
|
||||
jsr PrintF.LocalGetByte
|
||||
bcs .9
|
||||
sta ZPPtr1+1
|
||||
jsr PrintF2.LocalGetByte
|
||||
jsr PrintF.LocalGetByte
|
||||
bcs .9
|
||||
sta ZPPtr1
|
||||
|
||||
@ -337,28 +398,239 @@ PrintF2.SS ldy #$00 PSTR
|
||||
* clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
PrintF2.HH jsr PrintF2.LocalGetByte
|
||||
bcs PrintF2.COut.RTS
|
||||
PrintF.HH jsr PrintF.LocalGetByte
|
||||
bcs PrintF.COut.RTS
|
||||
pha LO byte
|
||||
jsr PrintF2.LocalGetByte
|
||||
jsr PrintF.LocalGetByte
|
||||
plx
|
||||
bcs PrintF2.COut.RTS
|
||||
bcs PrintF.COut.RTS
|
||||
pha
|
||||
txa
|
||||
jsr PrintF2.H.1
|
||||
jsr PrintF.H.1
|
||||
plx
|
||||
bcs PrintF2.COut.RTS
|
||||
bcs PrintF.COut.RTS
|
||||
txa
|
||||
bra PrintF2.H.1
|
||||
bra PrintF.H.1
|
||||
*--------------------------------------
|
||||
PrintF2.H jsr PrintF2.LocalGetByte
|
||||
bcs PrintF2.COut.RTS
|
||||
PrintF2.H.1 jsr MATH.AToHexAX
|
||||
PrintF.H jsr PrintF.LocalGetByte
|
||||
bcs PrintF.COut.RTS
|
||||
PrintF.H.1 jsr MATH.AToHexAX
|
||||
jsr PrintF.COut
|
||||
bcs PrintF2.COut.RTS
|
||||
bcs PrintF.COut.RTS
|
||||
txa
|
||||
jmp PrintF.COut
|
||||
PrintF2.COut.RTS
|
||||
*--------------------------------------
|
||||
PrintF.COut phy
|
||||
ldy PrintF.Cnt
|
||||
sta (pIOBuf),y
|
||||
ply
|
||||
inc PrintF.Cnt
|
||||
bne .8
|
||||
lda PrintF.hFILE
|
||||
bne .9
|
||||
|
||||
inc pIOBuf+1
|
||||
inc PrintF.Cnt+1
|
||||
.8 clc
|
||||
rts
|
||||
.9 lda #E.BUF
|
||||
sec
|
||||
PrintF.COut.RTS rts
|
||||
*--------------------------------------
|
||||
K.PrintF.GetFormat
|
||||
lda (pStack)
|
||||
sta ZPPtr2
|
||||
ldy #1
|
||||
lda (pStack),y
|
||||
sta ZPPtr2+1
|
||||
lda pStack
|
||||
inc
|
||||
inc
|
||||
sta pLocal
|
||||
rts
|
||||
*/--------------------------------------
|
||||
* # SScanF
|
||||
* Read formatted data from string
|
||||
* ## C
|
||||
* `int sscanf ( const char *s, const char *format, ... );`
|
||||
* ## ASM
|
||||
* **In:**
|
||||
* `>PUSHW s`
|
||||
* `>PUSHW format`
|
||||
* + %i : short int
|
||||
* + %d : byte
|
||||
* + %I : int
|
||||
* + %D : word
|
||||
* + %L : long int
|
||||
* + %U : dword
|
||||
* + %h : HEX byte
|
||||
* + %H : HEX word
|
||||
* + %s : string
|
||||
* TODO : %10s
|
||||
* `>PUSHW ptr`
|
||||
* `...`
|
||||
* `>PUSHB bytecount`
|
||||
* `>SYSCALL sscanf`
|
||||
* ## RETURN VALUE
|
||||
* A = Number of arguments filled.
|
||||
*\--------------------------------------
|
||||
K.SScanF lda (pStack) Bytecount
|
||||
inc
|
||||
tay
|
||||
|
||||
lda (pStack),y format LO
|
||||
sta ZPPtr2
|
||||
iny
|
||||
lda (pStack),y format HI
|
||||
sta ZPPtr2+1
|
||||
|
||||
iny
|
||||
lda (pStack),y str LO
|
||||
sta ZPPtr1
|
||||
iny
|
||||
lda (pStack),y str HI
|
||||
sta ZPPtr1+1
|
||||
|
||||
sty PrintF.Exit.Cnt+1 Total bytes to POP
|
||||
|
||||
.1 jsr SHARED.GetCharPtr2 End Of format?
|
||||
beq .8
|
||||
|
||||
cmp #'%' Escape ?
|
||||
beq .2
|
||||
|
||||
cmp #C.SPACE Space ?
|
||||
beq .12
|
||||
|
||||
cmp (ZPPtr1) Same char in string?
|
||||
bne .9
|
||||
|
||||
inc ZPPtr1
|
||||
bne .1
|
||||
inc ZPPtr1+1
|
||||
bra .1
|
||||
|
||||
.12 inc ZPPtr1
|
||||
bne .13
|
||||
inc ZPPtr1+1
|
||||
|
||||
.13 cmp (ZPPtr1) another one ?
|
||||
beq .12
|
||||
|
||||
bne .1
|
||||
|
||||
.2 jsr SHARED.GetCharPtr2 Get specifier after %
|
||||
beq .9 unexpected End of format after "%" ?
|
||||
|
||||
ldx #K.SScanFJMP-K.SScanFTBL-2
|
||||
|
||||
.3 cmp K.SScanFTBL,x
|
||||
beq .4
|
||||
dex
|
||||
dex
|
||||
bpl .3
|
||||
|
||||
.9 lda #MLI.E.EOF
|
||||
sec
|
||||
jmp PrintF.Exit
|
||||
|
||||
.4 jsr PrintF.LocalGetPtr
|
||||
bcs .9
|
||||
sty ZPPtr3
|
||||
sta ZPPtr3+1
|
||||
jsr .5
|
||||
bcs .9 out of Ptr on stack
|
||||
|
||||
inc .8+1 parsed one more arg!
|
||||
bra .1
|
||||
|
||||
.8 lda #$ff SELF MODIFIED Arg processed
|
||||
clc
|
||||
jmp PrintF.Exit
|
||||
*--------------------------------------
|
||||
.5 jmp (K.SScanFJMP,x)
|
||||
*--------------------------------------
|
||||
K.SScanFTBL .DA #'i,#1,#'d,#1,#'I,#2,#'D,#2,#'l,#4,#'u,#4,#'h,#1,#'H,#2,#'s,#2
|
||||
K.SScanFJMP .DA K.SScanF.I
|
||||
.DA K.SScanF.D
|
||||
.DA K.SScanF.II
|
||||
.DA K.SScanF.DD
|
||||
.DA K.SScanF.L
|
||||
.DA K.SScanF.U
|
||||
.DA K.SScanF.H
|
||||
.DA K.SScanF.HH
|
||||
.DA K.SScanF.S
|
||||
*--------------------------------------
|
||||
K.SScanF.I
|
||||
K.SScanF.D
|
||||
K.SScanF.II
|
||||
K.SScanF.DD
|
||||
K.SScanF.L
|
||||
K.SScanF.U lda K.SScanFTBL+1,x Get VAR size
|
||||
pha Save VAL size
|
||||
|
||||
jsr MATH.Dec2ACC32
|
||||
bra K.SScanF.GetVAL
|
||||
*--------------------------------------
|
||||
K.SScanF.HH
|
||||
K.SScanF.H lda K.SScanFTBL+1,x Get VAR size
|
||||
pha
|
||||
|
||||
jsr MATH.Hex2ACC32
|
||||
|
||||
K.SScanF.GetVAL jsr SHARED.AddYToPtr1 Y=char count parsed
|
||||
|
||||
.1 ply get back VAL size
|
||||
|
||||
.2 lda ACC32-1,y
|
||||
dey
|
||||
sta (ZPPtr3),y
|
||||
bne .2
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
K.SScanF.S ldy #$ff
|
||||
|
||||
.1 iny
|
||||
lda (ZPPtr1),y Get char in string to scan
|
||||
sta (ZPPtr3),y store in param ptr
|
||||
beq K.SScanF.Fwd end of string to scan ?
|
||||
|
||||
cmp (ZPPtr2) match format next char ?
|
||||
beq .2
|
||||
|
||||
cmp #C.SPACE is it a space ?
|
||||
bne .1
|
||||
|
||||
.2 lda #0 add \0 to param ptr
|
||||
sta (ZPPtr3),y
|
||||
|
||||
K.SScanF.Fwd jmp SHARED.AddYToPtr1 Y=char count parsed
|
||||
*--------------------------------------
|
||||
PrintF.LocalGetPtr
|
||||
jsr PrintF.LocalGetByte
|
||||
bcs PrintF.LocalGetByte.RTS
|
||||
tay
|
||||
*--------------------------------------
|
||||
PrintF.LocalGetByte
|
||||
lda (pStack)
|
||||
beq .9
|
||||
|
||||
phy
|
||||
|
||||
tay
|
||||
dec
|
||||
sta (pStack)
|
||||
lda (pStack),y
|
||||
|
||||
ply
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 lda #E.STACK
|
||||
sec
|
||||
PrintF.LocalGetByte.RTS
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
|
@ -53,9 +53,9 @@ K.AToF >STYA TXTPTR Ptr to source string
|
||||
* `unsigned long strtoul (const char* str, char** endptr, int base);`
|
||||
* ## ASM
|
||||
* **In:**
|
||||
* `>PUSHW str`
|
||||
* `>PUSHW EndPtr`
|
||||
* `>PUSHB Base`
|
||||
* `>PUSHWI EndPtr`
|
||||
* `>LDYAI str`
|
||||
* `>SYSCALL strtol`
|
||||
* ## RETURN VALUE
|
||||
* On stack (long)
|
||||
@ -63,8 +63,10 @@ K.AToF >STYA TXTPTR Ptr to source string
|
||||
K.StrToL sec Signed
|
||||
.HS 90 BCC
|
||||
K.StrToUL clc Unsigned
|
||||
jsr SHARED.SPtr2PPtr1
|
||||
|
||||
>PULLA Base
|
||||
>PULLW ZPPtr1 EndPtr
|
||||
>PULLW ZPPtr2 str
|
||||
|
||||
jsr K.AToL.I
|
||||
bcs K.StrToUL.rts
|
||||
|
@ -1,6 +1,20 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*/--------------------------------------
|
||||
* # ChOwn
|
||||
* ## C
|
||||
* `short int chown(const char *pathname, short int owner, short int group);`
|
||||
* ## ASM
|
||||
* **In:**
|
||||
* `>PUSHW pathname`
|
||||
* `>PUSHB owner`
|
||||
* `>PUSHB group`
|
||||
* `>SYSCALL chown`
|
||||
* ## RETURN VALUE
|
||||
*\--------------------------------------
|
||||
K.ChOwn clc
|
||||
rts
|
||||
*/--------------------------------------
|
||||
* # open
|
||||
* ## C
|
||||
* `hFD open(const char *pathname, short int flags);`
|
||||
|
@ -72,8 +72,8 @@ A2osX.D1.B .PH $D000
|
||||
.INB USR/SRC/SYS/KERNEL.S.DIRENT
|
||||
.INB USR/SRC/SYS/KERNEL.S.UNISTD
|
||||
.INB USR/SRC/SYS/KERNEL.S.STDIO
|
||||
.INB USR/SRC/SYS/KERNEL.S.STDIO2
|
||||
.INB USR/SRC/SYS/KERNEL.S.DEV
|
||||
.INB USR/SRC/SYS/KERNEL.S.FIO
|
||||
.INB USR/SRC/SYS/KERNEL.S.PFT
|
||||
.EP
|
||||
A2osX.D1.S .EQ *-A2osX.D1.B
|
||||
@ -108,7 +108,6 @@ A2osX.E0.B .PH $E000
|
||||
.INB USR/SRC/SYS/KERNEL.S.STRV
|
||||
.INB USR/SRC/SYS/KERNEL.S.MEM
|
||||
* go to A2osX.D1
|
||||
.INB USR/SRC/SYS/KERNEL.S.STDIO2
|
||||
.INB USR/SRC/SYS/KERNEL.S.IO
|
||||
.INB USR/SRC/SYS/KERNEL.S.PIPE
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user