Post 2600 fix #2: new X?.STRESC shared code, IRQ fix, IPCONFIG....

This commit is contained in:
burniouf 2023-06-18 09:47:28 +02:00
parent f6cdf228ed
commit d4568be299
10 changed files with 241 additions and 56 deletions

Binary file not shown.

View File

@ -211,15 +211,15 @@ Wait.TimeOut sec
*--------------------------------------
CS.END
LIBETALK .AZ "LIBETALK"
hLIBETALK .BS 1
SSCANF.ADDR .AZ "%D.%d"
SSCANF.MAC .AZ "%h:%h:%h:%h:%h:%h"
MSG.Usage .AS "Usage : AARP, display AARP cache\r\n"
.AS " AARP network.nod, query cache or network\r\n"
.AZ " AARP network.nod HH:HH:HH:HH:HH:HH, add a static AARP record in Cache\r\n"
MSG0 .AZ "STS TTL MAC Address net.nod"
MSG1 .AZ "$%h %5D %h:%h:%h:%h:%h:%h %D.%d\r\n"
MSG2 .AZ "%D%d is at %h:%h:%h:%h:%h:%h\r\n"
hLIBETALK .BS 1
MSG.Usage .CS "Usage : AARP, display AARP cache\r\n"
.CS " AARP network.nod, query cache or network\r\n"
.CZ " AARP network.nod HH:HH:HH:HH:HH:HH, add a static AARP record in Cache\r\n"
MSG0 .CZ "STS TTL MAC Address net.nod"
MSG1 .CZ "$%h %5D %h:%h:%h:%h:%h:%h %D.%d\r\n"
MSG2 .CZ "%D%d is at %h:%h:%h:%h:%h:%h\r\n"
*--------------------------------------
.DUMMY
.OR 0

View File

@ -310,7 +310,7 @@ hLIBCRYPT .BS 1
OptionList .AS "DdKk"
OptionEnd
*--------------------------------------
MSG.USAGE .AZ "Usage : HMACMD5 [ -d input text | input file ] [ -k key ]\r\n"
MSG.USAGE .CZ "Usage : HMACMD5 [ -d input text | input file ] [ -k key ]\r\n"
*--------------------------------------
HMACMD5.IPAD .BS 65
HMACMD5.OPAD .BS 65

View File

@ -78,7 +78,7 @@ DHCP.RUN.ROFFER jsr DHCP.RUN.SKT.RECV
lda #1
jmp DHCP.RUN.KO
.1 jsr CheckDHCPOffer
.1 jsr DHCP.CheckOffer
bcs DHCP.RUN.ROFFER
lda #S.IPCFG.STATUS.ROFFER
@ -111,7 +111,7 @@ DHCP.RUN.RACK jsr DHCP.RUN.SKT.RECV
lda #2
bra DHCP.RUN.KO
.1 jsr CheckDHCPAck
.1 jsr DHCP.CheckAck
bcs DHCP.RUN.RACK
DHCP.RUN.OK lda #S.IPCFG.STATUS.OK
@ -186,7 +186,7 @@ DHCP.QUIT lda hSocket
.1 clc
rts
*--------------------------------------
CheckDHCPOffer jsr CheckDHCPXID
DHCP.CheckOffer jsr DHCP.CheckXID
bcs .9
cmp #S.DHCP.OPTIONS.DHCPOffer
@ -242,7 +242,7 @@ CheckDHCPOffer jsr CheckDHCPXID
cmp #S.DHCP.OPTIONS.END
beq .8
jsr GetDHCPOption May override SVRIP
jsr DHCP.GetOption May override SVRIP
bra .5
.8 clc
@ -255,23 +255,23 @@ CheckDHCPOffer jsr CheckDHCPXID
plp
rts
*--------------------------------------
GetDHCPOption cmp #S.DHCP.OPTIONS.MASK
DHCP.GetOption cmp #S.DHCP.OPTIONS.MASK
bne .1
ldx #S.IPCFG.MASK
bra GetDHCPOption.CopyIP
bra DHCP.GetOption.CopyIP
.1 cmp #S.DHCP.OPTIONS.GW
bne .2
ldx #S.IPCFG.GW
bra GetDHCPOption.CopyIP
bra DHCP.GetOption.CopyIP
.2 cmp #S.DHCP.OPTIONS.DNS
bne .3
ldx #S.IPCFG.DNS1
bra GetDHCPOption.CopyIP
bra DHCP.GetOption.CopyIP
.3 cmp #S.DHCP.OPTIONS.SRVID
bne .4
@ -309,7 +309,7 @@ GetDHCPOption cmp #S.DHCP.OPTIONS.MASK
.9 rts
*--------------------------------------
GetDHCPOption.CopyIP
DHCP.GetOption.CopyIP
ldy #1
lda (ZPFramePtr),y Get Byte count
cmp #9
@ -330,7 +330,7 @@ GetDHCPOption.CopyIP
rts
*--------------------------------------
CheckDHCPAck jsr CheckDHCPXID
DHCP.CheckAck jsr DHCP.CheckXID
bcs .9
cmp #S.DHCP.OPTIONS.DHCPAck
@ -346,7 +346,7 @@ CheckDHCPAck jsr CheckDHCPXID
plp
rts
*--------------------------------------
CheckDHCPXID ldy #S.DHCP.XID+3
DHCP.CheckXID ldy #S.DHCP.XID+3
ldx #3
.1 lda (ZPFrameBase),y

View File

@ -16,7 +16,8 @@ NEW
.INB inc/net.tcpip.i
.INB inc/net.dhcp.i
*--------------------------------------
TIMEOUT.MAX .EQ 200 20 sec.
RETRY.MAX .EQ 3
TIMEOUT.MAX .EQ 50 5 sec.
*--------------------------------------
.DUMMY
.OR ZPBIN
@ -205,7 +206,7 @@ CS.RUN.SETUP
jsr DHCP.INIT
bcs CS.RUN.SETUP.RTS
lda #3
lda #RETRY.MAX
sta RetryCount
.7 jsr DHCP.RUN
@ -452,10 +453,10 @@ hLIBTCPIP .BS 1
OptionList .AS "DdEeSs"
OptionVars .DA #bDHCP,#bDHCP,#bETC,#bETC,#bSET,#bSET
*--------------------------------------
MSG.USAGE .AS "Usage : IPCONFIG <switches>\r\n"
.AS " -D : Try to get IP address from DHCP\r\n"
.AS " -E : Read ETC files\r\n"
.AZ " -S : Set/Reset TCPIP configuration (-E, then -D if required)\r\n"
MSG.USAGE .CS "Usage : IPCONFIG <switches>\r\n"
.CS " -D : Try to get IP address from DHCP\r\n"
.CS " -E : Read ETC files\r\n"
.CZ " -S : Set/Reset TCPIP configuration (-E, then -D if required)\r\n"
*--------------------------------------
MSG.NODEV .AZ "TCP/IP not bound to any device."
*--------------------------------------

View File

@ -26,13 +26,11 @@ NEW
*\-------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
*--------------------------------------
* Defines / Consts
*--------------------------------------
DIR_INCREMENT .EQ 1
DIR_DECREMENT .EQ 0
*--------------------------------------
* Zero Page Segment, up to 32 bytes
*--------------------------------------
@ -53,6 +51,13 @@ bString .BS 1 ; flag that the string -s option was spe
ZPPtrString .BS 2 ; pointer to string -s string
bTerminating .BS 1 ; flag that the terminating -t option was specified
ZPPtrTerm .BS 2 ; pointer to terminating -t string
*--------------------------------------
* X.STRESC
*--------------------------------------
*ZPPtr1 .BS 2
ZPPtr2 .BS 2
ZPTmpByte .BS 1
*--------------------------------------
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
@ -240,14 +245,12 @@ CS.RUN
*--------------------------------------
CS.DOEVENT sec ; we don't use this since we don't have timer events
rts
*--------------------------------------
* Called once, when RUN exited with CS
* Put code for unloading LIB here
*--------------------------------------
CS.QUIT clc ; nothing to do on exit except clear carry and return
rts
*--------------------------------------
* CheckOpt assumes a set ZPPtr1 which is the address of the command line argument being examined.
* We start at 1 to look past the '-' as position 0 since that was checked by the caller.
@ -293,9 +296,8 @@ CS.DoSeq
>SYSCALL PrintF ; print the current seq count.
*--- Print the string sepators --------
>PUSHW ZPPtrString
>PUSHBI 0
>SYSCALL PrintF ; print string separator
>LDYA ZPPtrString
jsr CS.PrintFEscYA ; print string separator
lda Direction ; check which direction we're counting
cmp #DIR_INCREMENT ; going up?
@ -344,30 +346,34 @@ CS.DoSeq
*--- Done with sequence, finish up ----
.9
>PUSHW ZPPtrTerm ; set up terminating string
>PUSHBI 0
>SYSCALL PrintF ; print terminating string
>LDYA ZPPtrTerm ; set up terminating string
jsr CS.PrintFEscYA ; print terminating string
rts ; done with SEQ!
* TODO: negatives in incr shouldn't be allowed.
*--------------------------------------
CS.PrintFEscYA jsr X.STRESC
>PUSHYA
>PUSHBI 0
>SYSCALL PrintF
rts
*--------------------------------------
* CS.DetermineDir - checks that increment value in relation +/- to
* wFirst / wLast, and then sets the Direction flag.
*--------------------------------------
CS.DetermineDir jsr CS.CmpFirstLast ; compare first/last values
bcc .1 ; if first < last, then we're counting forward
lda #DIR_INCREMENT
jmp .2
.1 lda #DIR_DECREMENT
.2 sta Direction ; set the direction
rts ; and return to caller.
*--------------------------------------
* CS.CmpFirstLast - compares wFirst to wLast value and sets carry based on
* if wFirst greater than or equal to wLast, or clear carry
@ -381,6 +387,7 @@ CS.CmpFirstLast >PUSHW wFirst ; using FPU macro, so push first,
>FPU iGE
lda (pStack) ; get result from stack
bne .1 ; yes, wFirst is >= wLast
>POP 2 ; wFirst < wLast
sec ; return to caller with carry set
rts
@ -388,8 +395,8 @@ CS.CmpFirstLast >PUSHW wFirst ; using FPU macro, so push first,
.1 >POP 2 ; wFirst is >= wLast
clc ; return to caller with carry clear
rts
*--------------------------------------
.INB usr/src/shared/x.stresc.s
*--------------------------------------
CS.END
*--------------------------------------
@ -400,11 +407,13 @@ MSG.USAGE .CS "Usage : SEQ [options] [first [incr]] last\r\n"
MSG.MSG.NEWLINE .CZ "\r\n"
*--------------------------------------
FMT.FORMAT .AZ "%I"
FMT.STRING .AZ "\r\n"
FMT.STRING .CZ "\r\n"
FMT.TERM .AZ ""
*--------------------------------------
OptionList .AS "FfSsTtHh"
OptionVars .DA #bFormat,#bFormat,#bString,#bString,#bTerminating,#bTerminating,#bHelp,#bHelp
*--------------------------------------
.INB usr/src/shared/x.stresc.g
*--------------------------------------
* Per Process DATA segment (0 filled before INIT)
*--------------------------------------

View File

@ -71,8 +71,6 @@ CS.RUN .DO INITDDBG=1
cmp #1
bne .9
* bra .55
ldy #S.PS.hStdIn
lda (pPS),y
>SYSCALL FEOF
@ -87,7 +85,7 @@ CS.RUN .DO INITDDBG=1
cmp #18 CTRL-R for Root mode
bne .1
.55 >LDYA L.MSG.CTRLR
>LDYA L.MSG.CTRLR
>SYSCALL PutS
ldx #0

14
SHARED/X.STRESC.G.txt Normal file
View File

@ -0,0 +1,14 @@
NEW
AUTO 3,1
*--------------------------------------
X.STRESC.EscChars
.AS "abefnrtv"
.HS 5C27223F \'"?
X.STRESC.EscCharsCnt .EQ *-X.STRESC.EscChars
X.STRESC.EscCodes
.HS 07081B0C0A0D090B
.HS 5C27223F
*--------------------------------------
MAN
SAVE usr/src/shared/x.stresc.g
ASM

164
SHARED/X.STRESC.S.txt Normal file
View File

@ -0,0 +1,164 @@
NEW
AUTO 3,1
*--------------------------------------
*
*
*
*--------------------------------------
X.STRESC >STYA ZPPtr1 In
>STYA ZPPtr2 Out
ldy #0
.1 lda (ZPPtr1)
beq .8
jsr X.STRESC.IncPtr1
cmp #'\'
bne .6
lda (ZPPtr1)
beq .7
ldx #X.STRESC.EscCharsCnt-1
.2 cmp X.STRESC.EscChars,x
beq .5
dex
bpl .2
stz ZPTmpByte
jsr X.STRESC.ToUC
cmp #'X'
bne .3
.20 jsr X.STRESC.IncPtr1
lda (ZPPtr1)
beq .40
jsr X.STRESC.IsHex
bcs .40
asl ZPTmpByte
asl ZPTmpByte
asl ZPTmpByte
asl ZPTmpByte
ora ZPTmpByte
sta ZPTmpByte
bra .20
.3 jsr X.STRESC.IsOct
bcs .40
jsr X.STRESC.IncPtr1
asl ZPTmpByte
asl ZPTmpByte
asl ZPTmpByte
ora ZPTmpByte
sta ZPTmpByte
lda (ZPPtr1)
bne .3
.40 lda ZPTmpByte
bra .6
.4 tax
lda #'\'
sta (ZPPtr2),y
iny
txa
bra .6
.5 lda X.STRESC.EscCodes,x
jsr X.STRESC.IncPtr1
.6 sta (ZPPtr2),y
iny
bra .1
.7 lda #'\'
sta (ZPPtr2),y
iny
lda #0
.8 sta (ZPPtr2),y
>LDYA ZPPtr2
rts
*--------------------------------------
X.STRESC.IncPtr1
inc ZPPtr1
bne .8
inc ZPPtr1+1
.8 rts
*--------------------------------------
X.STRESC.ToUC cmp #'a'
bcc .8
cmp #'z'+1
bcs .8
eor #$20
.8 rts
*--------------------------------------
X.STRESC.IsOct cmp #'0'
bcc .9
cmp #'7'+1
bcs .9
and #%00000111
clc
rts
.9 sec
rts
*--------------------------------------
X.STRESC.IsHex cmp #'0'
bcc .9
cmp #'9'+1
bcc .8
cmp #'A'
bcc .9
cmp #'Z'+1
bcc .7
cmp #'a'
bcc .9
cmp #'z'+1
bcc .9
* sec
sbc #$20
.7 sec
sbc #'A'-10
.8 and #$0F
clc
rts
.9 sec
rts
*--------------------------------------
MAN
SAVE usr/src/shared/x.stresc.s
ASM

View File

@ -10,7 +10,7 @@ NEW
* if A2osX Drivers cannot clear IRQ,
* must call regular System Handler
*--------------------------------------
*MSLOT .EQ $7f8
MSLOT .EQ $7f8
*--------------------------------------
*IRQ.BRK jmp IRQ.6
*--------------------------------------
@ -39,8 +39,8 @@ IRQ.Handler cld
pha
sta CLRWRITEAUX Driver may R/W in screen holes
* lda MSLOT Save MSLOT
* pha
lda MSLOT Save MSLOT
sta IRQ.2+2
* lda RDCXROM C100-C7ff state
* pha
@ -57,17 +57,16 @@ IRQ.JSR jsr CORE.IRQ.DEV SELF MODIFIED
*.3 sta $C000,x
* pla Get back MSLOT
* sta MSLOT
* sta IRQ.2+2
lda IRQ.2+2 Get back MSLOT
sta MSLOT
* and #$F0
* eor #$C0 ....mmm...not looking like Cn....
* bne IRQ.3
and #$F0
eor #$C0 ....mmm...not looking like Cn....
bne IRQ.3
* sta CLRC8ROM Release $C800
sta CLRC8ROM Release $C800
*IRQ.2 lda $ff00 SELF MODIFIED
IRQ.2 lda $ff00 SELF MODIFIED
IRQ.3 pla Must keep Carry
bpl .1