mirror of
https://github.com/A2osX/A2osX.git
synced 2025-04-06 18:37:12 +00:00
Kernel version 0.8 : SHELL, many new features, Error messages...etc...see README.md
Important KERNEL.S.ENV.txt rewrite to implement env in SHELL
This commit is contained in:
parent
e6fe2048e3
commit
571fb59701
BIN
A2OSX.BOOT.po
BIN
A2OSX.BOOT.po
Binary file not shown.
BIN
A2OSX.DEV.po
BIN
A2OSX.DEV.po
Binary file not shown.
BIN
A2OSX.SRC.po
BIN
A2OSX.SRC.po
Binary file not shown.
@ -57,8 +57,8 @@ FIO.OpenFileA sta FIO.hFileName
|
||||
>STYA ZPPtr1
|
||||
|
||||
.1 >PUSHW ZPPtr1
|
||||
>PUSHW L.MSG.SRC.FILE
|
||||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||||
>LDYA L.MSG.SRC.FILE
|
||||
>SYSCALL PrintFYA
|
||||
|
||||
ldy #SRC.COUNT
|
||||
lda (pData),y
|
||||
@ -69,8 +69,12 @@ FIO.OpenFileA sta FIO.hFileName
|
||||
sec
|
||||
bra FIO.OpenFileA.Exit
|
||||
|
||||
.10 lda FIO.hFileName
|
||||
.10 >PUSHWI 0
|
||||
>PUSHBI 4
|
||||
>PUSHBI SYS.FOPEN.R+SYS.FOPEN.T
|
||||
lda FIO.hFileName
|
||||
>SYSCALL GetMemPtrA
|
||||
>PUSHYA
|
||||
>SYSCALL MLIOpenYA
|
||||
bcs .99
|
||||
|
||||
@ -78,29 +82,11 @@ FIO.OpenFileA sta FIO.hFileName
|
||||
ldy #SRC.COUNT
|
||||
lda (pData),y
|
||||
clc
|
||||
adc #SRC.hREFNUMS
|
||||
adc #SRC.hFILES
|
||||
tay
|
||||
pla
|
||||
sta (pData),y
|
||||
|
||||
ldy #SRC.COUNT
|
||||
lda (pData),y
|
||||
clc
|
||||
adc #SRC.hBUFFERS
|
||||
tay
|
||||
txa
|
||||
sta (pData),y
|
||||
|
||||
lda FIO.hFileName
|
||||
>SYSCALL GetMemPtrA
|
||||
>SYSCALL MLIGetFileInfoYA
|
||||
bcs .99
|
||||
|
||||
>STYA ZPPtr1
|
||||
ldy #1
|
||||
lda (ZPPtr1),y
|
||||
tax
|
||||
|
||||
ldy #SRC.COUNT
|
||||
lda (pData),y
|
||||
clc
|
||||
@ -110,25 +96,12 @@ FIO.OpenFileA sta FIO.hFileName
|
||||
txa
|
||||
sta (pData),y
|
||||
|
||||
cmp #$FA S-C/BAS?
|
||||
beq .8
|
||||
* cmp #$FA S-C/BAS?
|
||||
* beq .8
|
||||
|
||||
cmp #$04 TXT ?
|
||||
* cmp #$04 TXT ?
|
||||
|
||||
bne .98
|
||||
|
||||
>PUSHBI $0D Line separator for TXT file
|
||||
>PUSHBI $FF
|
||||
|
||||
ldy #SRC.COUNT
|
||||
lda (pData),y
|
||||
clc
|
||||
adc #SRC.hREFNUMS
|
||||
tay
|
||||
lda (pData),y
|
||||
>PUSHA
|
||||
>SYSCALL MLINewLine
|
||||
bcs .99
|
||||
* bne .98
|
||||
|
||||
.8 ldy #SRC.COUNT
|
||||
lda (pData),y
|
||||
@ -292,8 +265,8 @@ FIO.LOAD.ASM.T ldy #ASM.T.hMem
|
||||
sta (pData),y
|
||||
|
||||
.1 >PUSHW L.ASM.T.FILENAME
|
||||
>PUSHW L.MSG.T.FILE
|
||||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||||
>LDYA L.MSG.T.FILE
|
||||
>SYSCALL PrintFYA
|
||||
|
||||
>PUSHWI 0 Aux type
|
||||
>PUSHBI 6 S.FILEINFO.TYPE.BIN
|
||||
|
@ -24,8 +24,8 @@ SRC.PrintLine ldy #ASM.MACRO.ON
|
||||
>PUSHB (pData),y
|
||||
dey
|
||||
>PUSHB (pData),y
|
||||
>PUSHW L.MSG.SRCLINE
|
||||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||||
>LDYA L.MSG.SRCLINE
|
||||
>SYSCALL PrintFYA
|
||||
.9 rts
|
||||
*---------------------------------------
|
||||
SRC.PrintLineErr ldx #0
|
||||
|
@ -62,8 +62,8 @@ SYM.Quit ldy #SYM.pLastGBlock
|
||||
.8 clc
|
||||
rts
|
||||
*---------------------------------------
|
||||
SYM.Dump >PUSHW L.MSG.SYMBOLS
|
||||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||||
SYM.Dump >LDYA L.MSG.SYMBOLS
|
||||
>SYSCALL PrintFYA
|
||||
|
||||
ldy #SYM.DumpCount
|
||||
lda #20
|
||||
@ -102,8 +102,8 @@ SYM.Dump >PUSHW L.MSG.SYMBOLS
|
||||
lda SRC.GLabel.Value+2
|
||||
>PUSHA
|
||||
|
||||
>PUSHW L.MSG.GSYMBOL
|
||||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||||
>LDYA L.MSG.GSYMBOL
|
||||
>SYSCALL PrintFYA
|
||||
|
||||
bcs .9
|
||||
|
||||
@ -115,8 +115,8 @@ SYM.Dump >PUSHW L.MSG.SYMBOLS
|
||||
>PUSHA
|
||||
pla
|
||||
>PUSHA
|
||||
>PUSHW L.MSG.LSYMBOL
|
||||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||||
>LDYA L.MSG.LSYMBOL
|
||||
>SYSCALL PrintFYA
|
||||
bcc .4
|
||||
rts
|
||||
|
||||
|
@ -10,7 +10,6 @@ AUTO 6
|
||||
*---------------------------------------
|
||||
.INB /A2OSX.DEV/INC/MACROS.I
|
||||
.INB /A2OSX.DEV/INC/A2OSX.I
|
||||
.INB /A2OSX.DEV/INC/LIBSTR.I
|
||||
*---------------------------------------
|
||||
ZPPtr1 .EQ ZPBIN
|
||||
ZPPtr2 .EQ ZPBIN+2
|
||||
@ -71,7 +70,6 @@ CS.START cld
|
||||
.DA CS.RUN
|
||||
.DA CS.DOEVENT
|
||||
.DA CS.QUIT
|
||||
L.LIBSTR .DA LIBSTR
|
||||
L.MSG.HELP .DA MSG.HELP
|
||||
L.MSG.SRCLINE .DA MSG.SRCLINE
|
||||
L.MSG.ERROR .DA MSG.ERROR
|
||||
@ -151,11 +149,7 @@ J.EXP.OP .DA EXP.OP.EOR ^!|&<=>+-*/
|
||||
.DA EXP.OP.DIV
|
||||
.DA 0
|
||||
*---------------------------------------
|
||||
CS.INIT >LDYA L.LIBSTR
|
||||
>SYSCALL LoadLibYA
|
||||
sta hLIBSTR
|
||||
|
||||
>SYSCALL GetArgC
|
||||
CS.INIT >SYSCALL GetArgC
|
||||
cmp #1
|
||||
beq .99 No arg, new file....
|
||||
|
||||
@ -183,8 +177,8 @@ CS.INIT >LDYA L.LIBSTR
|
||||
clc
|
||||
rts
|
||||
|
||||
.99 >PUSHW L.MSG.HELP
|
||||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||||
.99 >LDYA L.MSG.HELP
|
||||
>SYSCALL PrintFYA
|
||||
lda #ERR.INV.ARGS
|
||||
sec
|
||||
.9 rts
|
||||
@ -205,8 +199,8 @@ CS.RUN ldy #bCANCEL
|
||||
lda (pData),y
|
||||
inc
|
||||
>PUSHA
|
||||
>PUSHW L.MSG.PASS
|
||||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||||
>LDYA L.MSG.PASS
|
||||
>SYSCALL PrintFYA
|
||||
|
||||
ldy #SRC.hFILENAME
|
||||
lda (pData),y
|
||||
@ -235,8 +229,8 @@ CS.RUN ldy #bCANCEL
|
||||
|
||||
.1 jsr SYM.Dump
|
||||
|
||||
>PUSHW L.MSG.SUMMARY
|
||||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||||
>LDYA L.MSG.SUMMARY
|
||||
>SYSCALL PrintFYA
|
||||
|
||||
lda #0 End of assembly, exit with no error
|
||||
.99 sec
|
||||
@ -256,8 +250,8 @@ CS.RUN ldy #bCANCEL
|
||||
pha
|
||||
>PUSHA
|
||||
>PUSHW SRC.LINENUM
|
||||
>PUSHW L.MSG.ERROR
|
||||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||||
>LDYA L.MSG.ERROR
|
||||
>SYSCALL PrintFYA
|
||||
pla
|
||||
sec
|
||||
rts
|
||||
@ -313,9 +307,7 @@ CS.QUIT jsr FIO.FileClose
|
||||
|
||||
>SYSCALL FreeMemA
|
||||
|
||||
.8 lda hLIBSTR
|
||||
>SYSCALL UnloadLibA
|
||||
clc
|
||||
.8 clc
|
||||
rts
|
||||
*---------------------------------------
|
||||
.INB BIN/ASM.S.DIR
|
||||
@ -422,7 +414,6 @@ T.LI .HS 03
|
||||
.AS "OFF"
|
||||
.HS 00
|
||||
*---------------------------------------
|
||||
LIBSTR >PSTR "libstr.o"
|
||||
MSG.HELP >CSTR "A2osX-Macro Assembler (S-C MASM 3.0 Based)\nUsage : ASM <src file> [type TXT ($04) or S-C/BAS ($FA)]\n"
|
||||
MSG.PASS >CSTR "Pass:#%d\n"
|
||||
MSG.SRC.FILE >CSTR "Reading SRC File:%S\n"
|
||||
@ -440,7 +431,6 @@ SRC.EXP.RESERVED >PSTR "^!|&<=>+-*/"
|
||||
ASM.T.DEFAULT .AS ".T.6502"
|
||||
ASM.T.FILENAMELEN .BS 1
|
||||
ASM.T.FILENAME .BS 65
|
||||
hLIBSTR .BS 1
|
||||
|
||||
FIO.hFileName .BS 1
|
||||
FIO.hFullPath .BS 1
|
||||
@ -489,8 +479,7 @@ bCANCEL .BS 1
|
||||
SRC.hFILENAME .BS 1
|
||||
|
||||
SRC.COUNT .BS 1
|
||||
SRC.hREFNUMS .BS SRC.IN.MAXDEPTH
|
||||
SRC.hBUFFERS .BS SRC.IN.MAXDEPTH
|
||||
SRC.hFILES .BS SRC.IN.MAXDEPTH
|
||||
SRC.hFILETYPES .BS SRC.IN.MAXDEPTH
|
||||
|
||||
DST.hFILENAME .BS 1
|
||||
|
@ -52,14 +52,14 @@ CS.INIT >LDYAI TSKMGR.TABLE+S.PS
|
||||
>SYSCALL GetMemPtrA
|
||||
>PUSHYA
|
||||
|
||||
ldy #S.PS.PID
|
||||
ldy #S.PS.PPID
|
||||
lda (ZPPTR1),y
|
||||
>PUSHA Parent PID
|
||||
|
||||
lda (ZPPTR1) push flags
|
||||
>PUSHA
|
||||
|
||||
ldy #S.PS.ID
|
||||
ldy #S.PS.PID
|
||||
lda (ZPPTR1),y
|
||||
>PUSHA PID
|
||||
>LDYA L.MSG1
|
||||
|
@ -65,6 +65,8 @@ KrnBuf256 .EQ $0C00 Main
|
||||
MLICALL.PARAMS .EQ $0D00 Main, $12 bytes min !!!!
|
||||
KrnSTAT .EQ $0D12
|
||||
*--------------------------------------
|
||||
KrnOut256 .EQ $0E00 Used to return Values to User Space
|
||||
*--------------------------------------
|
||||
*** Z80 Reserved $0F00-10FF***
|
||||
*--------------------------------------
|
||||
Z80STACK .EQ $0FFF (0FFFFh) Down to $0F00
|
||||
@ -170,7 +172,7 @@ SYS.FOPEN.A .EQ $04 Append
|
||||
SYS.FOPEN.T .EQ $08 Open/Append in Text mode
|
||||
SYS.FOPEN.X .EQ $80 Create if not exists
|
||||
|
||||
SYS.FCLOSEA .EQ $22
|
||||
SYS.FCloseA .EQ $22
|
||||
SYS.FREAD .EQ $24
|
||||
SYS.FWRITE .EQ $26
|
||||
|
||||
@ -367,8 +369,8 @@ S.PS.F.HOLD .EQ %00100000
|
||||
S.PS.F.SLEEP .EQ %00010000
|
||||
S.PS.F.EVENT .EQ %00001000
|
||||
S.PS.F.ENV .EQ %00000100
|
||||
S.PS.ID .EQ 1
|
||||
S.PS.PID .EQ 2
|
||||
S.PS.PID .EQ 1
|
||||
S.PS.PPID .EQ 2
|
||||
S.PS.hCS .EQ 3
|
||||
S.PS.hDS .EQ 4
|
||||
S.PS.hPREFIX .EQ 5
|
||||
@ -378,8 +380,8 @@ S.PS.UID .EQ 8
|
||||
S.PS.hINDEV .EQ 9
|
||||
S.PS.hOUTDEV .EQ 10
|
||||
S.PS.hERRDEV .EQ 11
|
||||
S.PS.CID .EQ 12
|
||||
S.PS.LASTERROR .EQ 13
|
||||
S.PS.CPID .EQ 12
|
||||
S.PS.RC .EQ 13
|
||||
S.PS.PC .EQ 14
|
||||
*
|
||||
S.PS .EQ 16
|
||||
@ -439,7 +441,7 @@ S.STAT.MODE.RG .EQ $0020
|
||||
S.STAT.MODE.XU .EQ $0040
|
||||
S.STAT.MODE.WU .EQ $0080
|
||||
S.STAT.MODE.RU .EQ $0100
|
||||
*S.STAT.MODE.SST .EQ $0200
|
||||
*S.STAT.MODE.SST .EQ $0200
|
||||
*S.STAT.MODE.SGID .EQ $0400
|
||||
*S.STAT.MODE.SUID .EQ $0800
|
||||
|
||||
|
@ -112,43 +112,43 @@ MLI.ERR.VOLFULL .EQ $49
|
||||
MLI.ERR.EOF .EQ $4C
|
||||
*--------------------------------------
|
||||
MLI .EQ $BF00
|
||||
JSPARE .EQ $BF03
|
||||
*JSPARE .EQ $BF03
|
||||
DATETIME .EQ $BF06
|
||||
SYSERR .EQ $BF09
|
||||
SYSDEATH .EQ $BF0C
|
||||
SERR .EQ $BF0F
|
||||
DEVPTRS0D1 .EQ $BF10
|
||||
DEVPTRS1D1 .EQ $BF12
|
||||
DEVPTRS2D1 .EQ $BF14
|
||||
DEVPTRS3D1 .EQ $BF16
|
||||
DEVPTRS4D1 .EQ $BF18
|
||||
DEVPTRS5D1 .EQ $BF1A
|
||||
DEVPTRS6D1 .EQ $BF1C
|
||||
DEVPTRS7D1 .EQ $BF1E
|
||||
DEVPTRS0D2 .EQ $BF20
|
||||
DEVPTRS1D2 .EQ $BF22
|
||||
DEVPTRS2D2 .EQ $BF24
|
||||
*DEVPTRS0D1 .EQ $BF10
|
||||
*DEVPTRS1D1 .EQ $BF12
|
||||
*DEVPTRS2D1 .EQ $BF14
|
||||
*DEVPTRS3D1 .EQ $BF16
|
||||
*DEVPTRS4D1 .EQ $BF18
|
||||
*DEVPTRS5D1 .EQ $BF1A
|
||||
*DEVPTRS6D1 .EQ $BF1C
|
||||
*DEVPTRS7D1 .EQ $BF1E
|
||||
*DEVPTRS0D2 .EQ $BF20
|
||||
*DEVPTRS1D2 .EQ $BF22
|
||||
*DEVPTRS2D2 .EQ $BF24
|
||||
DEVPTRS3D2 .EQ $BF26
|
||||
DEVPTRS4D2 .EQ $BF28
|
||||
DEVPTRS5D2 .EQ $BF2A
|
||||
DEVPTRS6D2 .EQ $BF2C
|
||||
DEVPTRS7D2 .EQ $BF2E
|
||||
*DEVPTRS4D2 .EQ $BF28
|
||||
*DEVPTRS5D2 .EQ $BF2A
|
||||
*DEVPTRS6D2 .EQ $BF2C
|
||||
*DEVPTRS7D2 .EQ $BF2E
|
||||
DEVNUM .EQ $BF30
|
||||
DEVCNT .EQ $BF31
|
||||
DEVLST .EQ $BF32 -> $BF3F
|
||||
DEVLST0END .EQ $BF40 A 0 was added to ensure list ended with 0 if 14 devices in list
|
||||
PRODOSCOPYRIGHT .EQ $BF41 ;free->$BF4B
|
||||
MEMTABL .EQ $BF58 -> $BF6F
|
||||
GL.BUFF .EQ $BF70
|
||||
INTRUPT1 .EQ $BF80
|
||||
INTRUPT2 .EQ $BF82
|
||||
INTRUPT3 .EQ $BF84
|
||||
INTRUPT4 .EQ $BF86
|
||||
*GL.BUFF .EQ $BF70
|
||||
*INTRUPT1 .EQ $BF80
|
||||
*INTRUPT2 .EQ $BF82
|
||||
*INTRUPT3 .EQ $BF84
|
||||
*INTRUPT4 .EQ $BF86
|
||||
DATELO .EQ $BF90
|
||||
TIMELO .EQ $BF92
|
||||
LEVEL .EQ $BF94
|
||||
BUBIT .EQ $BF95
|
||||
SPARE1 .EQ $BF96
|
||||
*SPARE1 .EQ $BF96
|
||||
MACHID .EQ $BF98
|
||||
MACHID.TYPE .EQ %11001000
|
||||
MACHID.TYPE.II .EQ %00000000
|
||||
@ -172,9 +172,9 @@ SAVEY .EQ $BF9F
|
||||
*--------------------------------------
|
||||
* code $BFA0 -> $BFF3
|
||||
*--------------------------------------
|
||||
BNKBYT1 .EQ $BFF4
|
||||
BNKBYT2 .EQ $BFF5
|
||||
SYS.RTS .EQ $BFF6 code -> $BFFB
|
||||
*BNKBYT1 .EQ $BFF4
|
||||
*BNKBYT2 .EQ $BFF5
|
||||
*SYS.RTS .EQ $BFF6 code -> $BFFB
|
||||
IBAKVER .EQ $BFFC
|
||||
IVERSION .EQ $BFFD
|
||||
KBAKVER .EQ $BFFE
|
||||
|
@ -9,11 +9,10 @@ AUTO 6
|
||||
*--------------------------------------
|
||||
Cmd.ExecYA stz Cmd.Exec.Mode
|
||||
Cmd.ExecYA.1 >SYSCALL ExpandPStrYA
|
||||
bcs .99
|
||||
stx hCmdLine
|
||||
|
||||
>STYA ZPPtr1
|
||||
|
||||
phx
|
||||
|
||||
ldy #1
|
||||
ldx #0 ARGS len
|
||||
|
||||
@ -48,7 +47,7 @@ Cmd.ExecYA.1 >SYSCALL ExpandPStrYA
|
||||
|
||||
.13 stx ARGS update ARGS len
|
||||
|
||||
lda hCmdLine Discard Expanded Cmd Line
|
||||
pla
|
||||
>SYSCALL FreeMemA
|
||||
|
||||
>LDYA L.CMDS
|
||||
@ -82,17 +81,14 @@ Cmd.ExecYA.1 >SYSCALL ExpandPStrYA
|
||||
bcc .1
|
||||
inc ZPPtr2+1
|
||||
bra .1
|
||||
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
Cmd.Exec.EXT ldy #1
|
||||
lda CMD,y
|
||||
cmp #'/' Command line is already full path, no search
|
||||
bne .10
|
||||
jmp .3
|
||||
beq .3
|
||||
|
||||
.10 >LDYA L.ENV.PATH push ENVNAME=PATH for search
|
||||
>SYSCALL GetEnvYA get value for ENV=PATH
|
||||
>LDYA L.ENV.PATH push ENVNAME=PATH for search
|
||||
>SYSCALL GetEnvYA get value for ENV=PATH
|
||||
bcs .1 No PATH, try in CD
|
||||
|
||||
>PUSHYA push search list
|
||||
@ -116,9 +112,9 @@ Cmd.Exec.EXT ldy #1
|
||||
>PUSHW L.CMD replace CMD in TmpBuffer with full path
|
||||
>SYSCALL PStrCpy
|
||||
pla
|
||||
>SYSCALL FreeMemA Discard this string...
|
||||
>SYSCALL FreeMemA Discard this string...
|
||||
|
||||
.3 stz UsrBuf256 reset UsrBuf256 for final CMDLINE
|
||||
.3 stz UsrBuf256 reset UsrBuf256 for final CMDLINE
|
||||
|
||||
>PUSHW L.STAT
|
||||
>PUSHW L.CMD
|
||||
@ -295,7 +291,7 @@ Cmd.Exec.CD1 stz UsrBuf256
|
||||
|
||||
ldy #S.PS.hPREFIX
|
||||
sta (pPs),y
|
||||
|
||||
jsr SetPWD
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
|
52
SBIN/SHELL.S.ERR.txt
Normal file
52
SBIN/SHELL.S.ERR.txt
Normal file
@ -0,0 +1,52 @@
|
||||
PR#3
|
||||
PREFIX /A2OSX.SRC
|
||||
NEW
|
||||
INC 1
|
||||
AUTO 6
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
ERR.Print >PUSHA Save EC for PrintF
|
||||
|
||||
ldx L.ERR.Codes
|
||||
stx ZPPTR1
|
||||
ldx L.ERR.Codes+1
|
||||
stx ZPPTR1+1
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 cmp (ZPPTR1),y
|
||||
beq .2
|
||||
iny
|
||||
cpy #ERR.Count
|
||||
bne .1
|
||||
|
||||
.2 sty .3+1
|
||||
|
||||
lda L.ERR.Messages
|
||||
sta ZPPTR1
|
||||
lda L.ERR.Messages+1
|
||||
sta ZPPTR1+1
|
||||
|
||||
ldy #0
|
||||
|
||||
.3 cpy #$ff Self Modified
|
||||
beq .8
|
||||
|
||||
lda (ZPPTR1)
|
||||
sec
|
||||
adc ZPPTR1
|
||||
sta ZPPTR1
|
||||
bcc .4
|
||||
inc ZPPTR1+1
|
||||
.4 iny
|
||||
bra .3
|
||||
|
||||
.8 >PUSHW ZPPTR1
|
||||
>LDYA L.MSG.ERROR
|
||||
>SYSCALL PrintFYA
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE SBIN/SHELL.S.ERR
|
||||
LOAD SBIN/SHELL.S
|
||||
ASM
|
@ -59,7 +59,7 @@ TXT.CloseFile ldy #hInputFile
|
||||
lda (pData),y
|
||||
beq .9
|
||||
|
||||
>SYSCALL FCLOSEA
|
||||
>SYSCALL FCloseA
|
||||
|
||||
.9 lda #0
|
||||
ldy #hInputFile
|
||||
|
@ -38,11 +38,14 @@ CS.START cld
|
||||
.DA CS.QUIT
|
||||
*--------------------------------------
|
||||
L.MSG.GREETINGS .DA MSG.GREETINGS
|
||||
L.MSG.PROMPT .DA MSG.PROMPT
|
||||
L.MSG.ECHO .DA MSG.ECHO
|
||||
L.MSG.ERROR .DA MSG.ERROR
|
||||
L.MSG.PSTR .DA MSG.PSTR
|
||||
L.MSG.PRINTENV .DA MSG.PRINTENV
|
||||
L.ENV.PATH .DA ENV.PATH
|
||||
L.ENV.PWD .DA ENV.PWD
|
||||
L.ENV.PS1 .DA ENV.PS1
|
||||
L.CMD .DA CMD
|
||||
L.ARGS .DA ARGS
|
||||
L.TIME .DA TIME
|
||||
@ -61,9 +64,13 @@ J.INTCMDS .DA Cmd.Exec.CD
|
||||
.DA Cmd.Exec.STARTPROC
|
||||
.DA Cmd.Exec.TIME
|
||||
.DA Cmd.Exec.TYPE
|
||||
L.ERR.Codes .DA ERR.Codes
|
||||
L.ERR.Messages .DA ERR.Messages
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
CS.INIT >SYSCALL GetArgC
|
||||
CS.INIT jsr SetPWD
|
||||
|
||||
>SYSCALL GetArgC
|
||||
cmp #1
|
||||
|
||||
beq CS.INIT.INTERACTIVE no arg, continue starting interactive
|
||||
@ -138,7 +145,11 @@ CS.RUN lda #0
|
||||
bcc .8
|
||||
tay
|
||||
beq .8
|
||||
jsr PrintError
|
||||
|
||||
pha
|
||||
jsr ERR.Print
|
||||
pla
|
||||
bcs .99
|
||||
|
||||
.8 ldy #bEXIT
|
||||
lda (pData),y
|
||||
@ -319,7 +330,7 @@ CS.QUIT jsr HIS.Quit
|
||||
ldy #hInputFile
|
||||
lda (pData),y
|
||||
beq .1
|
||||
>SYSCALL FCLOSEA
|
||||
>SYSCALL FCloseA
|
||||
|
||||
.1
|
||||
.8 clc
|
||||
@ -327,20 +338,25 @@ CS.QUIT jsr HIS.Quit
|
||||
*--------------------------------------
|
||||
* PRIVATE
|
||||
*--------------------------------------
|
||||
PrintPrompt lda #'$'
|
||||
>SYSCALL COutA
|
||||
bcs .9
|
||||
lda #' '
|
||||
>SYSCALL COutA
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
PrintError pha
|
||||
>PUSHA
|
||||
>LDYA L.MSG.ERROR
|
||||
>SYSCALL PrintFYA
|
||||
pla
|
||||
SetPWD ldy #S.PS.hPREFIX
|
||||
lda (pPs),y
|
||||
>SYSCALL GetMemPtrA
|
||||
>PUSHYA
|
||||
>PUSHW L.ENV.PWD
|
||||
>SYSCALL SetEnv
|
||||
rts
|
||||
*--------------------------------------
|
||||
PrintPrompt >LDYA L.ENV.PS1
|
||||
>SYSCALL GetEnvYA
|
||||
>SYSCALL ExpandPStrYA
|
||||
phx
|
||||
>PUSHYA
|
||||
pla
|
||||
>SYSCALL FreeMemA
|
||||
>LDYA L.MSG.PROMPT
|
||||
>SYSCALL PrintFYA
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
* Remove extra SPACE & comment
|
||||
*--------------------------------------
|
||||
CmdBuffer.Normalize
|
||||
@ -418,12 +434,15 @@ CmdBuffer.DEL lda (pData)
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
.INB SBIN/SHELL.S.CMD
|
||||
.INB SBIN/SHELL.S.ERR
|
||||
.INB SBIN/SHELL.S.HIS
|
||||
.INB SBIN/SHELL.S.TXT
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
*--------------------------------------
|
||||
ENV.PATH >PSTR "PATH"
|
||||
ENV.PWD >PSTR "PWD"
|
||||
ENV.PS1 >PSTR "PS1"
|
||||
CMDS >PSTR "CD"
|
||||
>PSTR "DATE"
|
||||
>PSTR "ECHO"
|
||||
@ -438,12 +457,15 @@ CMDS >PSTR "CD"
|
||||
.HS 00
|
||||
*--------------------------------------
|
||||
MSG.GREETINGS >CSTR "\nA2osX-Shell on Dev=%h\n\n"
|
||||
MSG.PROMPT >CSTR "%S$ "
|
||||
MSG.ECHO >CSTR ">%S\n"
|
||||
MSG.ERROR >CSTR "[%h]\n"
|
||||
MSG.ERROR >CSTR "%S ($%h)\n"
|
||||
FMT.DATE >PSTR "%A, %B %d %Y"
|
||||
FMT.TIME >PSTR "%H:%M:%S (%I:%M:%S%p)"
|
||||
MSG.PSTR >CSTR "%S\n"
|
||||
MSG.PRINTENV >CSTR "%S=%S\n"
|
||||
*--------------------------------------
|
||||
.INB X.ERRORS.S
|
||||
*--------------------------------------
|
||||
EscChars >PSTR "DBAC"
|
||||
EscAscii .HS 04080A0B15
|
||||
|
@ -7,7 +7,7 @@ AUTO 6
|
||||
*--------------------------------------
|
||||
* BIN.LoadExeYA
|
||||
* in :
|
||||
* A = hMem of FilePath (PSTRING)
|
||||
* A = hMem of FilePath (PSTR)
|
||||
* out :
|
||||
* Y,A = MEMPTR
|
||||
* X = hMem of Code Segment
|
||||
|
@ -9,9 +9,9 @@ AUTO 6
|
||||
* Scan a PStr (in progress)
|
||||
* ##In:
|
||||
* PUSHW PTR to target buffer
|
||||
* PUSHW PString pattern (ex: "%d.%d.%d.%d")
|
||||
* PUSHW PSTR pattern (ex: "%d.%d.%d.%d")
|
||||
* %d : byte
|
||||
* PUSHW PString to scan (ex: "192.168.1.5")
|
||||
* PUSHW PSTR to scan (ex: "192.168.1.5")
|
||||
* ##Out:
|
||||
*\--------------------------------------
|
||||
K.SScanF jsr PullPtr1Ptr2Ptr3
|
||||
@ -473,58 +473,6 @@ K.COutA phx
|
||||
plx
|
||||
rts
|
||||
*--------------------------------------
|
||||
* Convert HEXBUF to ASCBUF decimal padded with 0
|
||||
*--------------------------------------
|
||||
HEX2DEC ldx #4
|
||||
|
||||
.1 stz BCDBUF,x Clear all 5 bytes
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
sed switch to BCD mode
|
||||
|
||||
ldx #32 let's roll 32 bits
|
||||
|
||||
.2 asl HEXBUF
|
||||
rol HEXBUF+1
|
||||
rol HEXBUF+2
|
||||
rol HEXBUF+3
|
||||
|
||||
ldy #4
|
||||
|
||||
.3 lda BCDBUF,y
|
||||
adc BCDBUF,y
|
||||
sta BCDBUF,y
|
||||
dey
|
||||
bpl .3
|
||||
|
||||
dex
|
||||
bne .2
|
||||
|
||||
cld
|
||||
|
||||
ldy #4
|
||||
ldx #9
|
||||
|
||||
.4 lda BCDBUF,y
|
||||
pha
|
||||
and #$0F
|
||||
ora #$30
|
||||
sta ASCBUF,x
|
||||
dex
|
||||
pla
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
ora #$30
|
||||
sta ASCBUF,x
|
||||
dey
|
||||
dex
|
||||
bpl .4
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
PRINTDEC lda PADLEN any Len format ?
|
||||
beq .1 no
|
||||
|
||||
@ -569,84 +517,8 @@ PRINTDEC lda PADLEN any Len format ?
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
* Convert ASCBUF decimal to HEXBUF
|
||||
*--------------------------------------
|
||||
DEC2HEX stz HEXBUF
|
||||
stz HEXBUF+1
|
||||
stz HEXBUF+2
|
||||
stz HEXBUF+3
|
||||
|
||||
ldx #0
|
||||
|
||||
.1 lda HEXBUF+3 save HEXBUF for 4+1
|
||||
pha
|
||||
lda HEXBUF+2
|
||||
pha
|
||||
lda HEXBUF+1
|
||||
pha
|
||||
lda HEXBUF
|
||||
pha
|
||||
|
||||
asl HEXBUF HEXBUF * 2 -> HEXBUF
|
||||
rol HEXBUF+1
|
||||
rol HEXBUF+2
|
||||
rol HEXBUF+3
|
||||
* bcs .9 overflow!!!
|
||||
|
||||
asl HEXBUF HEXBUF * 4 -> HEXBUF
|
||||
rol HEXBUF+1
|
||||
rol HEXBUF+2
|
||||
rol HEXBUF+3
|
||||
* bcs .9 overflow!!!
|
||||
|
||||
pla HEXBUF * 4 + HEXBUF -> HEXBUF
|
||||
adc HEXBUF
|
||||
sta HEXBUF
|
||||
pla
|
||||
adc HEXBUF+1
|
||||
sta HEXBUF+1
|
||||
pla
|
||||
adc HEXBUF+2
|
||||
sta HEXBUF+2
|
||||
pla
|
||||
adc HEXBUF+3
|
||||
sta HEXBUF+3
|
||||
* bcs .99 overflow!!!
|
||||
|
||||
asl HEXBUF HEXBUF * 10 -> HEXBUF
|
||||
rol HEXBUF+1
|
||||
rol HEXBUF+2
|
||||
rol HEXBUF+3
|
||||
* bcs .99 overflow!!!
|
||||
|
||||
inx
|
||||
lda ASCBUF,x
|
||||
and #$0F
|
||||
|
||||
adc HEXBUF
|
||||
sta HEXBUF
|
||||
bcc .2
|
||||
inc HEXBUF+1
|
||||
bne .2
|
||||
inc HEXBUF+2
|
||||
bne .2
|
||||
inc HEXBUF+3
|
||||
|
||||
.2 cpx ASCBUF
|
||||
bne .1
|
||||
rts
|
||||
|
||||
*.9 pla discard saved HEXBUF
|
||||
* pla
|
||||
* pla
|
||||
* pla
|
||||
*.99 rts
|
||||
*--------------------------------------
|
||||
TYPES .AS "-pcbdls"
|
||||
ACCESS .AS "rwxrwxrwx"
|
||||
HEXBUF .BS 4 32 bits max
|
||||
BCDBUF .BS 5 5, enough to handle 10 digits (32bits)
|
||||
ASCBUF .BS 12 LEN + sign + 10 digits ($FFFFFFFF=4.294.967.295)
|
||||
SIGN .BS 1
|
||||
PADLEN .BS 1
|
||||
PADCHAR .BS 1
|
||||
|
140
SYS/KERNEL.S.CNV.txt
Normal file
140
SYS/KERNEL.S.CNV.txt
Normal file
@ -0,0 +1,140 @@
|
||||
PR#3
|
||||
PREFIX /A2OSX.SRC
|
||||
NEW
|
||||
INC 1
|
||||
AUTO 6
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
* Convert HEXBUF to ASCBUF decimal padded with 0
|
||||
*--------------------------------------
|
||||
HEX2DEC ldx #4
|
||||
|
||||
.1 stz BCDBUF,x Clear all 5 bytes
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
sed switch to BCD mode
|
||||
|
||||
ldx #32 let's roll 32 bits
|
||||
|
||||
.2 asl HEXBUF
|
||||
rol HEXBUF+1
|
||||
rol HEXBUF+2
|
||||
rol HEXBUF+3
|
||||
|
||||
ldy #4
|
||||
|
||||
.3 lda BCDBUF,y
|
||||
adc BCDBUF,y
|
||||
sta BCDBUF,y
|
||||
dey
|
||||
bpl .3
|
||||
|
||||
dex
|
||||
bne .2
|
||||
|
||||
cld
|
||||
|
||||
ldy #4
|
||||
ldx #9
|
||||
|
||||
.4 lda BCDBUF,y
|
||||
pha
|
||||
and #$0F
|
||||
ora #$30
|
||||
sta ASCBUF,x
|
||||
dex
|
||||
pla
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
ora #$30
|
||||
sta ASCBUF,x
|
||||
dey
|
||||
dex
|
||||
bpl .4
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
* Convert ASCBUF decimal to HEXBUF
|
||||
*--------------------------------------
|
||||
DEC2HEX stz HEXBUF
|
||||
stz HEXBUF+1
|
||||
stz HEXBUF+2
|
||||
stz HEXBUF+3
|
||||
|
||||
ldx #0
|
||||
|
||||
.1 lda HEXBUF+3 save HEXBUF for 4+1
|
||||
pha
|
||||
lda HEXBUF+2
|
||||
pha
|
||||
lda HEXBUF+1
|
||||
pha
|
||||
lda HEXBUF
|
||||
pha
|
||||
|
||||
asl HEXBUF HEXBUF * 2 -> HEXBUF
|
||||
rol HEXBUF+1
|
||||
rol HEXBUF+2
|
||||
rol HEXBUF+3
|
||||
* bcs .9 overflow!!!
|
||||
|
||||
asl HEXBUF HEXBUF * 4 -> HEXBUF
|
||||
rol HEXBUF+1
|
||||
rol HEXBUF+2
|
||||
rol HEXBUF+3
|
||||
* bcs .9 overflow!!!
|
||||
|
||||
pla HEXBUF * 4 + HEXBUF -> HEXBUF
|
||||
adc HEXBUF
|
||||
sta HEXBUF
|
||||
pla
|
||||
adc HEXBUF+1
|
||||
sta HEXBUF+1
|
||||
pla
|
||||
adc HEXBUF+2
|
||||
sta HEXBUF+2
|
||||
pla
|
||||
adc HEXBUF+3
|
||||
sta HEXBUF+3
|
||||
* bcs .99 overflow!!!
|
||||
|
||||
asl HEXBUF HEXBUF * 10 -> HEXBUF
|
||||
rol HEXBUF+1
|
||||
rol HEXBUF+2
|
||||
rol HEXBUF+3
|
||||
* bcs .99 overflow!!!
|
||||
|
||||
inx
|
||||
lda ASCBUF,x
|
||||
and #$0F
|
||||
|
||||
adc HEXBUF
|
||||
sta HEXBUF
|
||||
bcc .2
|
||||
inc HEXBUF+1
|
||||
bne .2
|
||||
inc HEXBUF+2
|
||||
bne .2
|
||||
inc HEXBUF+3
|
||||
|
||||
.2 cpx ASCBUF
|
||||
bne .1
|
||||
rts
|
||||
|
||||
*.9 pla discard saved HEXBUF
|
||||
* pla
|
||||
* pla
|
||||
* pla
|
||||
*.99 rts
|
||||
*--------------------------------------
|
||||
HEXBUF .BS 4 32 bits max
|
||||
BCDBUF .BS 5 5, enough to handle 10 digits (32bits)
|
||||
ASCBUF .BS 12 LEN + sign + 10 digits ($FFFFFFFF=4.294.967.295)
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE SYS/KERNEL.S.CNV
|
||||
LOAD SYS/KERNEL.S
|
||||
ASM
|
@ -13,6 +13,8 @@ TSKMGR.LASTID .BS 1
|
||||
ENV.DRV >PSTR "DRV"
|
||||
ENV.LIB >PSTR "LIB"
|
||||
*--------------------------------------
|
||||
EmptyPSTR .DA #0
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE SYS/KERNEL.S.DAT
|
||||
LOAD SYS/KERNEL.S
|
||||
|
@ -4,19 +4,21 @@ NEW
|
||||
INC 1
|
||||
AUTO 6
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
* K.ExpandPStrYA
|
||||
* In:
|
||||
* Y,A = PTR to String to Expand (PSTRING)
|
||||
* Out:
|
||||
* X = hMem to Expanded String (PSTRING)
|
||||
* Y,A = PTR to Expanded String
|
||||
*--------------------------------------
|
||||
K.ExpandPStrYA
|
||||
>STYA ZPQuickPtr3
|
||||
|
||||
stz KrnBuf256 init Expanded String len=0
|
||||
*/--------------------------------------
|
||||
* #ExpandPStrYA
|
||||
* ##In:
|
||||
* Y,A = PTR to String to Expand (PSTR)
|
||||
* ##Out:
|
||||
* X = hMem to Expanded String (PSTR)
|
||||
* Y,A = PTR to Expanded String
|
||||
*\--------------------------------------
|
||||
K.ExpandPStrYA stz K.ExpandPStr.hPStr Reset Intermediate string...
|
||||
|
||||
.11 >STYA ZPQuickPtr3
|
||||
|
||||
stz KrnBuf256 init Expanded String len=0
|
||||
stz K.ExpandPStr.bFound No var found yet
|
||||
stz K.ExpandPStr.bNoExp Reset no expand flag
|
||||
ldy #0
|
||||
|
||||
.10 stz K.ExpandPStr.Start
|
||||
@ -27,29 +29,43 @@ K.ExpandPStrYA
|
||||
|
||||
iny
|
||||
lda (ZPQuickPtr3),y
|
||||
|
||||
cmp #'''
|
||||
bne .21
|
||||
|
||||
lda K.ExpandPStr.bNoExp
|
||||
eor #$ff
|
||||
sta K.ExpandPStr.bNoExp toggle flag
|
||||
bra .1
|
||||
|
||||
.21 bit K.ExpandPStr.bNoExp
|
||||
bmi .22
|
||||
|
||||
ldx K.ExpandPStr.Start
|
||||
bne .3 already in a var?
|
||||
|
||||
cmp #'$' no, found one ?
|
||||
beq .2
|
||||
|
||||
inc KrnBuf256 no, copy char
|
||||
.22 inc KrnBuf256 no, copy char
|
||||
ldx KrnBuf256
|
||||
sta KrnBuf256,x
|
||||
bra .1
|
||||
|
||||
.2 sty K.ExpandPStr.Start save var start
|
||||
.2 sec
|
||||
ror K.ExpandPStr.bFound Toggle flag
|
||||
|
||||
sty K.ExpandPStr.Start save var start
|
||||
stz K.ExpandPStr.End
|
||||
bra .1 skip this char
|
||||
|
||||
.3 cmp #'{' in var, "{" after "$"?
|
||||
.3 cmp #'{' we are in var, "{" after "$"?
|
||||
beq .2
|
||||
|
||||
cmp #'}' end of var?
|
||||
beq .5
|
||||
|
||||
.4 jsr K.ExpandPStr.VC valid char ?
|
||||
jsr K.ExpandPStr.VC we are in var, is char valid?
|
||||
bcs .5 no, end here
|
||||
sty K.ExpandPStr.End yes, save end
|
||||
bra .1
|
||||
@ -64,13 +80,26 @@ K.ExpandPStrYA
|
||||
|
||||
.6 sty K.ExpandPStr.End end of PSTR
|
||||
lda K.ExpandPStr.Start are we in a var?
|
||||
beq .7 no...exit...
|
||||
beq .8 no...exit...
|
||||
|
||||
jsr K.ExpandPStr.AV yes, expand and add to STR
|
||||
|
||||
.7 >LDYAI KrnBuf256
|
||||
.8 lda K.ExpandPStr.hPStr working from our temp string ?
|
||||
beq .81 no...
|
||||
|
||||
jsr K.FreeMemA yes, discard....
|
||||
|
||||
.81 >LDYAI KrnBuf256
|
||||
jsr K.NewPStrYA
|
||||
rts
|
||||
bcs .9
|
||||
stx K.ExpandPStr.hPStr save this as temp string, in case of recurse
|
||||
bit K.ExpandPStr.bFound Did we expand something ?
|
||||
bpl .9
|
||||
jmp .11 Yes, start over with hPStr
|
||||
|
||||
* or exit with Y,A & X from K.NewPStrYA
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
K.ExpandPStr.AV lda K.ExpandPStr.End
|
||||
sec
|
||||
@ -138,9 +167,15 @@ K.ExpandPStr.VC cmp #'0'
|
||||
*--------------------------------------
|
||||
K.ExpandPStr.Start .BS 1
|
||||
K.ExpandPStr.End .BS 1
|
||||
*--------------------------------------
|
||||
* K.PutEnvYA
|
||||
*--------------------------------------
|
||||
K.ExpandPStr.bFound .BS 1
|
||||
K.ExpandPStr.bNoExp .BS 1
|
||||
K.ExpandPStr.hPStr .BS 1
|
||||
*/--------------------------------------
|
||||
* #PutEnvYA
|
||||
* ##In:
|
||||
* Y,A = PTR to String NAME=VALUE (PSTR)
|
||||
* ##Out:
|
||||
*\--------------------------------------
|
||||
K.PutEnvYA >STYA ZPQuickPtr2 NAME=VALUE
|
||||
lda (ZPQuickPtr2)
|
||||
beq .9
|
||||
@ -192,13 +227,13 @@ K.PutEnvYA >STYA ZPQuickPtr2 NAME=VALUE
|
||||
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
* K.SetEnv
|
||||
* In:
|
||||
* PULLW = PTR To Name (PSTRING)
|
||||
* PULLW = PTR To Value (PSTRING)
|
||||
* Out:
|
||||
*--------------------------------------
|
||||
*/--------------------------------------
|
||||
* #SetEnv
|
||||
* ##In:
|
||||
* PUSHW = PTR To Value (PSTR)
|
||||
* PUSHW = PTR To Name (PSTR)
|
||||
* ##Out:
|
||||
*\--------------------------------------
|
||||
K.SetEnv >PULLW ZPQuickPtr2 NAME...
|
||||
>PULLW ZPQuickPtr3 ...VALUE
|
||||
|
||||
@ -272,30 +307,33 @@ K.SetEnvPtr2Ptr3
|
||||
.99 lda #SYSMGR.ERRENVF
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
* K.GetEnvYA
|
||||
* In:
|
||||
* Y,A = PTR to NAME (PSTRING)
|
||||
* Out:
|
||||
* CC : Y,A = PTR to VALUE (PSTRING)
|
||||
*/--------------------------------------
|
||||
* #GetEnvYA
|
||||
* ##In:
|
||||
* Y,A = PTR to NAME (PSTR)
|
||||
* ##Out:
|
||||
* CC : Y,A = PTR to VALUE (PSTR)
|
||||
* CS : not found
|
||||
*--------------------------------------
|
||||
*\--------------------------------------
|
||||
K.GetEnvYA >STYA ZPQuickPtr2
|
||||
jsr ENV.CheckSysVarPtr2
|
||||
bcc .9
|
||||
bcc .8
|
||||
|
||||
jsr ENV.FindVarPtr2
|
||||
bcs .9
|
||||
jsr ENV.NextEnvPtr1 Skip NAME
|
||||
>LDYA ZPQuickPtr1
|
||||
clc just in case ADC in NextEnvPtr1 disturb CC
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
* K.UnsetEnvYA
|
||||
* In:
|
||||
* YA = PTR To Name (PSTRING)
|
||||
* Out:
|
||||
*--------------------------------------
|
||||
.8 rts
|
||||
|
||||
.9 >LDYAI EmptyPSTR
|
||||
rts
|
||||
*/--------------------------------------
|
||||
* #UnsetEnvYA
|
||||
* ##In:
|
||||
* Y,A = PTR To Name (PSTR)
|
||||
* ##Out:
|
||||
*\--------------------------------------
|
||||
K.UnsetEnvYA >STYA ZPQuickPtr2 Store VAR Name
|
||||
S.UnsetEnvPtr2 jsr ENV.FindVarPtr2
|
||||
bcs .8 not found, quit
|
||||
@ -325,24 +363,74 @@ ENV.CheckSysVarPtr2
|
||||
cmp #'0' $0...$9 ??
|
||||
bcc .1 no,
|
||||
cmp #'9'+1
|
||||
bcs .99
|
||||
bcs .1
|
||||
and #$0F
|
||||
jmp K.GetArgA
|
||||
|
||||
.1 cmp #'*' $* : All ARGS
|
||||
bne .9
|
||||
|
||||
cmp #'#' $# : ARGC
|
||||
bne .9
|
||||
|
||||
cmp #'?' $? : RC
|
||||
bne .9
|
||||
|
||||
cmp #'$' $$ : PID
|
||||
bne .9
|
||||
.1 ldx #ENV.SysVarsJmp-ENV.SysVars-1
|
||||
|
||||
.2 cmp ENV.SysVars,x
|
||||
beq .3
|
||||
dex
|
||||
bpl .2
|
||||
|
||||
.9 sec
|
||||
.99 rts
|
||||
rts
|
||||
|
||||
.3 txa
|
||||
asl
|
||||
tax
|
||||
jmp (ENV.SysVarsJmp,x)
|
||||
*--------------------------------------
|
||||
ENV.SysVars .AS "*#?$!"
|
||||
ENV.SysVarsJmp .DA ENV.SysVarsArgs
|
||||
.DA ENV.SysVarsArgC
|
||||
.DA ENV.SysVarsRC
|
||||
.DA ENV.SysVarsPID
|
||||
.DA ENV.SysVarsCPID
|
||||
*--------------------------------------
|
||||
ENV.SysVarsArgs sec
|
||||
rts
|
||||
ENV.SysVarsArgC jsr K.GetArgC
|
||||
bra ENV.SysVarsA
|
||||
ENV.SysVarsRC ldy #S.PS.RC
|
||||
.HS 2C
|
||||
ENV.SysVarsPID ldy #S.PS.PID
|
||||
.HS 2C
|
||||
ENV.SysVarsCPID ldy #S.PS.CPID
|
||||
lda (pPS),y
|
||||
ENV.SysVarsA sta HEXBUF
|
||||
stz HEXBUF+1
|
||||
stz HEXBUF+2
|
||||
stz HEXBUF+3
|
||||
jsr HEX2DEC
|
||||
|
||||
ldx #0
|
||||
|
||||
.1 lda ASCBUF,x
|
||||
cmp #'0'
|
||||
bne .2
|
||||
inx
|
||||
cpx #10
|
||||
bne .1
|
||||
|
||||
sta KrnOut256+1
|
||||
ldy #1
|
||||
bne .8 always
|
||||
|
||||
.2 ldy #0
|
||||
|
||||
.3 lda ASCBUF,x
|
||||
iny
|
||||
sta KrnOut256,y
|
||||
inx
|
||||
cpx #10
|
||||
bne .3
|
||||
|
||||
.8 sty KrnOut256
|
||||
>LDYAI KrnOut256
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
* ENV.FindVarPtr2
|
||||
* In:
|
||||
|
@ -102,7 +102,7 @@ K.FOPEN jsr PFT.CheckPathSTK
|
||||
rts CC
|
||||
|
||||
.98 pha save MLI error
|
||||
jsr K.FCLOSEA.1
|
||||
jsr K.FCloseA.1
|
||||
pla get back MLI error
|
||||
sec
|
||||
.99 rts
|
||||
@ -141,9 +141,9 @@ K.FCloseA.1 ldy #S.FILE.PRODOS.REF
|
||||
* #FRead
|
||||
* Read bytes from file
|
||||
* ##In :
|
||||
* PULLB = hFILE
|
||||
* PULLW = Bytes To Read
|
||||
* PULLW = Dest Ptr
|
||||
* PUSHW = Dest Ptr
|
||||
* PUSHW = Bytes To Read
|
||||
* PUSHB = hFILE
|
||||
* ##Out :
|
||||
* Y,A = Bytes Read
|
||||
*\--------------------------------------
|
||||
@ -153,9 +153,9 @@ K.FRead jsr PFT.CheckFileSTK
|
||||
*/--------------------------------------
|
||||
* #FWrite
|
||||
* ##In:
|
||||
* PULLB = hFILE
|
||||
* PULLW = Bytes To Write
|
||||
* PULLW = Src Ptr
|
||||
* PUSHW = Src Ptr
|
||||
* PUSHW = Bytes To Write
|
||||
* PUSHB = hFILE
|
||||
* #Out:
|
||||
* Y,A = Bytes Written
|
||||
*\--------------------------------------
|
||||
|
@ -7,10 +7,10 @@ AUTO 6
|
||||
*/--------------------------------------
|
||||
* #FileSearch
|
||||
* ##In:
|
||||
* PUSHW = PSTR to Search Path (PSTRING) %LIB%;/SYS/SLIB
|
||||
* PUSHW = PSTR to File Name (PSTRING)
|
||||
* PUSHW = Ptr to Search Path (PSTR) %LIB%;/SYS/SLIB
|
||||
* PUSHW = Ptr to File Name (PSTR)
|
||||
* #Out:
|
||||
* Y,A = PSTR to FilePath (PSTRING)
|
||||
* Y,A = PSTR to FilePath (PSTR)
|
||||
* X = hMem to FilePath
|
||||
*\--------------------------------------
|
||||
K.FileSearch >PULLW ZPQuickPtr4 ZPQuickPtr1 trashed by ExpandPStrYA
|
||||
@ -77,9 +77,9 @@ K.FileSearch.Index .BS 1
|
||||
*/--------------------------------------
|
||||
* #GetFullPathYA
|
||||
* ##In :
|
||||
* Y,A = Filename (PSTRING)
|
||||
* Y,A = Filename (PSTR)
|
||||
* #Out :
|
||||
* Y,A = FullPath (PSTRING)
|
||||
* Y,A = FullPath (PSTR)
|
||||
* X = hMem of FullPath
|
||||
*\--------------------------------------
|
||||
K.GetFullPathYA >STYA ZPQuickPtr3 Ptr1 & 2 used by StrCpy
|
||||
@ -173,7 +173,7 @@ K.LoadFile jsr K.FOPEN
|
||||
|
||||
.99 pha
|
||||
lda K.LoadFile.hFile
|
||||
jsr K.FCLOSEA
|
||||
jsr K.FCloseA
|
||||
pla
|
||||
sec
|
||||
rts
|
||||
@ -209,7 +209,7 @@ K.SaveFile jsr K.FOPEN
|
||||
|
||||
.99 pha
|
||||
lda K.LoadFile.hFile
|
||||
jsr K.FCLOSEA
|
||||
jsr K.FCloseA
|
||||
pla
|
||||
sec
|
||||
rts
|
||||
|
@ -30,7 +30,7 @@ KERNEL.SYSCALL
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
.DA K.FOPEN $20
|
||||
.DA K.FCLOSEA
|
||||
.DA K.FCloseA
|
||||
.DA K.FREAD
|
||||
.DA K.FWRITE
|
||||
.DA K.FFLUSHA
|
||||
|
@ -126,7 +126,7 @@ K.GetMem >PULLB MemMgr.ReqFlags store requested flags
|
||||
ldy #S.MEM.REFCNT
|
||||
sta (ZPMemMgrSPtr),y
|
||||
|
||||
ldy #S.PS.ID
|
||||
ldy #S.PS.PID
|
||||
lda (pPs),y
|
||||
ldy #S.MEM.OWNERPID
|
||||
sta (ZPMemMgrSPtr),y
|
||||
|
@ -89,7 +89,7 @@ K.GetPSByIDA sta K.GetPSByIDA.PS
|
||||
.2 lda (ZPQuickPtr1)
|
||||
bpl .3
|
||||
|
||||
ldy #S.PS.ID
|
||||
ldy #S.PS.PID
|
||||
lda (ZPQuickPtr1),y
|
||||
cmp K.GetPSByIDA.PS
|
||||
beq .8
|
||||
@ -165,7 +165,7 @@ PS.CreateChild >LDYAI TskMgr.Table+S.PS
|
||||
jsr K.GetPSByIDA
|
||||
bcc .4
|
||||
|
||||
ldy #S.PS.ID
|
||||
ldy #S.PS.PID
|
||||
lda TSKMGR.LASTID
|
||||
sta (ZPQuickPtr3),y
|
||||
|
||||
@ -218,13 +218,13 @@ PS.CreateChild >LDYAI TskMgr.Table+S.PS
|
||||
cpy #S.PS.hERRDEV+1
|
||||
bne .81
|
||||
|
||||
ldy #S.PS.ID
|
||||
ldy #S.PS.PID
|
||||
lda (pPs),y
|
||||
|
||||
ldy #S.PS.PID
|
||||
ldy #S.PS.PPID
|
||||
sta (ZPQuickPtr3),y
|
||||
|
||||
ldy #S.PS.CID
|
||||
ldy #S.PS.CPID
|
||||
lda TSKMGR.LASTID
|
||||
sta (pPs),y
|
||||
|
||||
|
@ -12,7 +12,7 @@ AUTO 6
|
||||
* ##Out:
|
||||
* CC : success
|
||||
* Y,A = PTR to String
|
||||
* X = hMem (PSTRING)
|
||||
* X = hMem (PSTR)
|
||||
* CS : error
|
||||
* A = SYS error code
|
||||
*\--------------------------------------
|
||||
@ -34,15 +34,15 @@ K.NewPStrYA >STYA ZPQuickPtr2
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
*/--------------------------------------
|
||||
* #PStrCpy
|
||||
* Copy string
|
||||
* ##In:
|
||||
* PUSHW = PSTR to SRC (PSTRING)
|
||||
* PUSHW = PSTR to DST (PSTRING)
|
||||
* PUSHW = Ptr to SRC (PSTR)
|
||||
* PUSHW = Ptr to DST (PSTR)
|
||||
* ##Out:
|
||||
* DST = SRC (PSTRING)
|
||||
*--------------------------------------
|
||||
* DST = SRC (PSTR)
|
||||
*\--------------------------------------
|
||||
K.PStrCpy jsr PullPtr1Ptr2
|
||||
|
||||
K.PStrCpyPtr2Ptr1
|
||||
@ -58,15 +58,15 @@ K.PStrCpyPtr2Ptr1
|
||||
|
||||
.2 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
*/--------------------------------------
|
||||
* #PStrCat
|
||||
* Append SRC to DST
|
||||
* ##In:
|
||||
* PUSHW = PSTR to SRC (PSTRING)
|
||||
* PUSHW = PSTR to DST (PSTRING)
|
||||
* PUSHW = Ptr to SRC (PSTR)
|
||||
* PUSHW = Ptr to DST (PSTR)
|
||||
* ##Out:
|
||||
* DST = DST+SRC (PSTRING)
|
||||
*--------------------------------------
|
||||
* DST = DST+SRC (PSTR)
|
||||
*\--------------------------------------
|
||||
K.PStrCat jsr PullPtr1Ptr2
|
||||
|
||||
lda (ZPQuickPtr2)
|
||||
@ -171,7 +171,7 @@ K.PStrMatch jsr PullPtr1Ptr2
|
||||
* #PStrUprYA/PStrLwrYA
|
||||
* Convert string to UPPERCASE/lowercase
|
||||
* ##In:
|
||||
* Y,A = PTR to String (PSTRING)
|
||||
* Y,A = PTR to String (PSTR)
|
||||
* ##Out:
|
||||
* Uppercased/lowercased String in Buffer
|
||||
*\--------------------------------------
|
||||
|
@ -22,7 +22,7 @@ TSK.TskMgrRun >LDYAI TskMgr.Table+S.PS skip PS 0
|
||||
bit #S.PS.F.HOLD Waiting for Another Task to Terminate?
|
||||
beq .2
|
||||
|
||||
ldy #S.PS.CID
|
||||
ldy #S.PS.CPID
|
||||
lda (pPs),y
|
||||
jsr K.GetPSByIDA
|
||||
bcc .7 yes, running....
|
||||
@ -71,7 +71,7 @@ TSK.TskMgrRun >LDYAI TskMgr.Table+S.PS skip PS 0
|
||||
ldx #TSKMGR.QUIT yes, quit this process
|
||||
jsr pCodeJmp Call QUIT function
|
||||
|
||||
ldy #S.PS.ID
|
||||
ldy #S.PS.PID
|
||||
lda (pPs),y
|
||||
jsr PS.FreeA
|
||||
bcs *
|
||||
|
@ -84,6 +84,7 @@ A2osX.D002 .EQ *
|
||||
.INB SYS/KERNEL.S.ARG
|
||||
.INB SYS/KERNEL.S.ENV
|
||||
*--------------------------------------
|
||||
.INB SYS/KERNEL.S.CNV
|
||||
.INB SYS/KERNEL.S.RUN
|
||||
.INB SYS/KERNEL.S.EVT
|
||||
.INB SYS/KERNEL.S.TSK
|
||||
|
45
X.ERRORS.S.txt
Normal file
45
X.ERRORS.S.txt
Normal file
@ -0,0 +1,45 @@
|
||||
PR#3
|
||||
PREFIX /A2OSX.SRC
|
||||
NEW
|
||||
INC 1
|
||||
AUTO 6
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
ERR.Codes .DA #MLI.ERR.IO
|
||||
.DA #MLI.ERR.NODEV
|
||||
.DA #MLI.ERR.WRTPROT
|
||||
.DA #MLI.ERR.DSKSWIT
|
||||
.DA #MLI.ERR.INVPATH
|
||||
.DA #MLI.ERR.PNOTFND
|
||||
.DA #MLI.ERR.VNOTFND
|
||||
.DA #MLI.ERR.FNOTFND
|
||||
.DA #MLI.ERR.DUPFILE
|
||||
.DA #MLI.ERR.OVERRUN
|
||||
.DA #MLI.ERR.VOLFULL
|
||||
.DA #MLI.ERR.EOF
|
||||
*--------------------------------------
|
||||
.DA #SYSMGR.ERRSYN
|
||||
.DA #SYSMGR.ERRFNF
|
||||
*--------------------------------------
|
||||
ERR.Count .EQ *-ERR.Codes
|
||||
*--------------------------------------
|
||||
ERR.Messages >PSTR "I/O Error"
|
||||
>PSTR "No Device"
|
||||
>PSTR "Disk Write-Protected"
|
||||
>PSTR "Disk Switched"
|
||||
>PSTR "Invalid Path"
|
||||
>PSTR "Path Not Found"
|
||||
>PSTR "Volume Not Found"
|
||||
>PSTR "File Not Found"
|
||||
>PSTR "Duplicate Filename"
|
||||
>PSTR "Buffer Overrun"
|
||||
>PSTR "Volume Is Full"
|
||||
>PSTR "End Of File"
|
||||
*--------------------------------------
|
||||
>PSTR "Syntax Error"
|
||||
>PSTR "Command Not Found"
|
||||
*--------------------------------------
|
||||
>PSTR "Unknown Error"
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE X.ERRORS.S
|
Loading…
x
Reference in New Issue
Block a user