TERMIBAL, PRINTF, SH, Piping....

This commit is contained in:
burniouf 2023-05-16 18:53:52 +02:00
parent 0ea8d62a96
commit 87b9078877
25 changed files with 907 additions and 776 deletions

View File

@ -1195,16 +1195,6 @@ Specifiers :
+ %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'

View File

@ -182,7 +182,7 @@ CS: A = EC
CC: Y,A = bytes written
CS: A = EC
# RecvFrom (RAW,DGRAM,SEQPKT)
# RecvFrom (RAW,DGRAM)
## C
`hMem recvfrom(hFD fd, struct sockaddr *addr);`

View File

@ -301,13 +301,15 @@ The **default** commands is used to select the block of commands to execute for
### ECHO
echo [-n] <value>...
echo [-e] [-n] <value>...
The **echo** command optional switch **-e** causes **echo** to process escape **\\** caracters.
The **echo** command is used to print <values> to an output device, by default the screen. The **echo** command optional switch **-n** causes **echo** to suppress output of the carriage return that normally occurs. Technically the format of the **echo** command is **echo [-n] [\<value\> ...]**. This means that the **echo** command can be followed by the optional switch **-n** and one or more optional \<values\>. In the case of **echo**, it is these \<values\> that are output by the command. Here, values are separated by spaces, so you can do ECHO $A HELLO $B and echo will output the value stored in the variable A and then the world HELLO and then the value stored in B. Please see \<values> for more information on how values are processed, especially in the handling of variables ($VAR) contained in a \<value>.
A word about values, command lines and spaces: **echo Hello World** is not the same as **echo "Hello World"**. In the first case **echo** treats Hello and World as separate values and in the second, "Hello World" as one value. Since **echo** takes multiple values, you might not notice the difference, but in the case of **if [ $A = "Hello World" ]** if you omitted the quotes you would get a syntax error because the = operator only accepts one value on each side. In addition, when not enclosed in quotes, extra spaces are removed so **echo Hello&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;World** would be output as **Hello World** as **echo** would treat Hello and World as values and output value space value.
In addition to the usual variable substitution that occurs with \<values> (see \<value> above), the **echo** command performs some special character substitutions while sending output to the screen or terminal. If placed inside a value like a string, **echo** will automatically substitute a backspace for the sequence **\b**, substitute an escape for **\e**, clear the screen for **\f**, send a newline for **\n**, send a \ for **\\\\** and send a % for **\\%**. The **\e** (escape) code is useful for sending VT100 escape sequences to the screen/terminal (see the VT100 example script). The **\\\\** and **\\%** are necessary to send those chars to the screen since normally those characters are interpreted as special command line arguments. There is also a special **\xHH** option, that will send explicitly the char represented by the HEX value HH to the output device (screen or file).
supported escaped chars : **\\a**,**\\b**,**\\e**,**\\f**,**\\n**,**\\r**,**\\t**,**\\v**,**\\\\**,**\\'**,**\\"**,**\\?**
In addition to the usual variable substitution that occurs with \<values> (see \<value> above), the **echo** command performs some special character substitutions while sending output to the screen or terminal. If placed inside a value like a string, **echo** will automatically substitute a backspace for the sequence **\b**, substitute an escape for **\e**, clear the screen for **\f**, send a newline for **\n**, send a \ for **\\\\** and send a % for **\\%**. The **\e** (escape) code is useful for sending VT100 escape sequences to the screen/terminal (see the VT100 example script). The **\\\\** and **\\%** are necessary to send those chars to the screen since normally those characters are interpreted as special command line arguments. There is also special **\xHH** and **\OOO** options, that will send explicitly the char represented by the HEX value HH or OCT value OOO to the output device (screen or file).
#!/bin/sh
#

View File

@ -1,6 +1,6 @@
# A2osX Terminal Codes Guide
### Updated Apr. 15, 2023
### Updated May. 14, 2023
A2osX terminal capabilities are based off of the standard VT-100 Terminal. This applies to users connected via Super Serial Cards, Telnet (via TelnetD server daemon) and the Apple console (physical keyboard/screen). All programs can use this facility to create rich interactive text mode applications. This includes both programs written in Assembly or Scripts written for the Shell (SH). The table below lists the codes you can use in your applications and their function. Consult the A2osX Shell Developers Guide for information on using these codes in scripts. Note, the Apple Console implementation only supports a subset of the VT-100 codes, these are noted in the last column as OK.
@ -15,6 +15,7 @@ A2osX terminal capabilities are based off of the standard VT-100 Terminal. This
|Esc[?7h |Set auto-wrap mode|DECAWM|OK| |
|Esc[?8h |Set auto-repeat mode|DECARM|| |
|Esc[?9h |Set interlacing mode|DECINLM|| |
|Esc[?25h |Show cursor| DECTCEM |OK||
|Esc[20l |Reset line feed mode|LMN|OK| |
|Esc[?1l |Reset cursor key to cursor|DECCKM|| |
|Esc[?2l |Reset VT52 (versus ANSI) |DECANM|| |
@ -25,6 +26,7 @@ A2osX terminal capabilities are based off of the standard VT-100 Terminal. This
|Esc[?7l |Reset auto-wrap mode| DECAWM |OK||
|Esc[?8l |Reset auto-repeat mode| DECARM || |
|Esc[?9l |Reset interlacing mode| DECINLM |||
|Esc[?25l |Hide cursor| DECTCEM |OK||
|Esc= |Set alternate keypad mode| DECKPAM |||
|Esc> |Set numeric keypad mode| DECKPNM |||
|Esc(A |Set United Kingdom G0 character set| setukg0 |OK||

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -117,17 +117,23 @@ BSX.MoveHead sta BSX.TargetQTrack
cmp BSX.TargetQTrack
bne .3
lsr CS if X,Y on
* lsr CS if X,Y on
jsr BSX.Wait25600usec
ldy BSX.Slotn0
lda IO.D2.Ph0Off+2,y
lda IO.D2.Ph0Off+6,y
lda IO.D2.Ph0Off,y
lda IO.D2.Ph0Off+4,y
bcc .10
* lda IO.D2.Ph0Off,y
clc
* bcc .10
lda IO.D2.Ph0Off,x
* lda IO.D2.Ph0Off,x
* clc
* lda IO.D2.Ph0Off,y
.10 rts
*--------------------------------------

View File

@ -364,25 +364,17 @@ SCRN.UpdateLineAtBufPtr
jsr SCRN.ToggleSel
.5 lda (BufPtr)
cmp #'\'
beq .50
cmp #'%'
bne .51
.50 pha
lda #'\'
jsr SCRN.ToLineBuf
pla
.51 jsr SCRN.ToLineBuf
inc BufPtr
bne .6
inc BufPtr+1
.6 inc BUF.COffset
bne .7
inc BUF.COffset+1
.7 dex
bne .2

View File

@ -215,7 +215,7 @@ DumpFD.PIPE >PUSHW L.MSG.PIPE
jsr DumpFD.Name
>PUSHBI 5
>PUSHBI 6
>SYSCALL PrintF
clc
rts
@ -263,7 +263,7 @@ MSG.DEV.ERR .CZ "[%h] Device Error.\r\n"
MSG.DEV.DIB .CZ "%s %h.%h %16S %3d.%3d "
MSG.DEV.B .CZ "%10u\r\n"
MSG.DEV.C .CZ "n/a\r\n"
MSG.PIPE .CZ "%3d %5s %s\r\n"
MSG.PIPE .CZ "%3d %h %4s %s\r\n"
*--------------------------------------
MSG.SFLAGS .AS "bwrlneio"
NO.PATH .AZ "(no path)"

View File

@ -36,9 +36,9 @@ CS.START cld
.DA CS.RUN
.DA CS.EVENT
.DA CS.QUIT
L.MSG0 .DA MSG0
L.MSG1 .DA MSG1
L.MSG.NA .DA MSG.NA
L.MSG.HEADER .DA MSG.HEADER
L.MSG.BODY .DA MSG.REGDIR
.DA MSG.SPECIAL
L.FD.T .DA FD.T.REG
.DA FD.T.DIR
.DA FD.T.CDEV
@ -52,7 +52,7 @@ L.FD.T .DA FD.T.REG
CS.INIT clc
rts
*--------------------------------------
CS.RUN >LDYA L.MSG0
CS.RUN >LDYA L.MSG.HEADER
>SYSCALL PutS
ldx #1
@ -62,7 +62,23 @@ CS.RUN >LDYA L.MSG0
lda hFDs-1,x
beq .7
>PUSHW L.MSG1
>SYSCALL GetMemPtr
>STYA ZPFDPtr
ldx FILE.ID
lda hFDs.oCnt-1,x
beq .7
ldy #0
lda (ZPFDPtr)
cmp #S.FD.T.DIR+1
bcc .2
iny
iny
.2 >PUSHW L.MSG.BODY,y
txa
>PUSHA
@ -70,27 +86,16 @@ CS.RUN >LDYA L.MSG0
lda hFDs-1,x
>PUSHA
>SYSCALL GetMemPtr
>STYA ZPFDPtr
ldx FILE.ID
lda hFDs.oCnt-1,x
>PUSHA
lda (ZPFDPtr)
tax
>PUSHW L.FD.T,x
tay
>PUSHW L.FD.T,y
ldx FILE.ID
lda hFDs.hName-1,x
bne .5
jsr CS.RUN.GetName
>LDYA L.MSG.NA
bra .6
.5 >SYSCALL GetMemPtr
.6 >PUSHYA
>PUSHYA
>PUSHBI 7
@ -105,6 +110,22 @@ CS.RUN >LDYA L.MSG0
sec
.9 rts
*--------------------------------------
CS.RUN.GetName lda hFDs.hName-1,x
bne .1
lda ZPFDPtr
clc
adc #S.FD.DEV
tay
lda ZPFDPtr+1
adc /S.FD.DEV
rts
.1 >SYSCALL GetMemPtr
rts
*--------------------------------------
CS.EVENT sec
rts
*--------------------------------------
@ -112,9 +133,9 @@ CS.QUIT clc
rts
*--------------------------------------
CS.END
MSG0 .CZ "hFILE hFD Cnt Type Filepath"
MSG1 .CZ "%3d %3d %3d %4s %s\r\n"
MSG.NA .CZ "n/a"
MSG.HEADER .CZ "hFILE hFD Cnt Type Filepath"
MSG.REGDIR .CZ "%3d %3d %3d %4s %s\r\n"
MSG.SPECIAL .CZ "%3d %3d %3d %4s /dev/%s\r\n"
FD.T.REG .CZ "REG"
FD.T.DIR .CZ "DIR"
FD.T.CDEV .CZ "CDEV"

View File

@ -128,16 +128,23 @@ CS.RUN inc ArgCount
ldy #S.PS.hStdIn
lda (pPS),y
pha
tax
lda hFDs-1,x
>SYSCALL GetMemPtr
>STYA ZPPtr1
plx
lda (ZPPtr1)
cmp #S.FD.T.PIPE
bne .71
stx hFile
.80 >LDYAI 256
>SYSCALL GetMem
bcs .9
@ -203,7 +210,9 @@ CS.RUN.PAUSE ldy #S.PS.hStdErr
>PUSHW L.MSG.Pause
>SYSCALL FPutS
.10 jsr CS.RUN.GETC
.10 ldy #S.PS.hStdErr
lda (pPS),y
>SYSCALL GetC
bcs .99
cmp #'Q'
@ -251,24 +260,7 @@ CS.RUN.ERASE ldy #S.PS.hStdErr
>SYSCALL FPutS
rts
*--------------------------------------
CS.RUN.GETC lda hFile
bne .1
ldy #S.PS.hStdErr
lda (pPS),y
>SYSCALL GetC
rts
.1 >SYSCALL GetChar
rts
*--------------------------------------
CS.RUN.GETLINE lda hFile
bne .1
ldy #S.PS.hStdIn
lda (pPS),y
.1 >PUSHA
CS.RUN.GETLINE >PUSHB hFile
>PUSHW ZPBufPtr
>PUSHWI 256

View File

@ -114,7 +114,8 @@ CS.RUN.LOOP lda bPipe If reading from pipe
.9 sec
CS.RUN.LOOP.RTS rts
*--------------------------------------
CS.RUN.CheckArgs jsr CS.RUN.NextArg
CS.RUN.CheckArgs
jsr CS.RUN.NextArg
bcs .4
lda (ZPPtr1)
@ -333,10 +334,10 @@ CS.END
OptionList .AS "x"
OptionList.Cnt .EQ *-OptionList
*--------------------------------------
MSG.USAGE .AS "Usage : OD <File> or CMD|OD"
MSG.CRLF .AZ "\r\n"
MSG.OFFSET .AZ "%h%h%h "
MSG.HEXBYTE .AZ "%h "
MSG.USAGE .CS "Usage : OD <File> or CMD|OD"
MSG.CRLF .CZ "\r\n"
MSG.OFFSET .CZ "%h%h%h "
MSG.HEXBYTE .CZ "%h "
*--------------------------------------
.DUMMY
.OR 0

View File

@ -188,13 +188,13 @@ CS.RUN.NextArg inc ArgIndex
.9 rts
*--------------------------------------
CS.RUN.SEDParser
* On entry, the expression is in ZPPatternPtr
* We are looking for "s/search string/replace string/"
* The '/' delimiter can be any char
* On exit. ZPPatternPtr points to delimiter-terminated search string,
* replace idx contains the offset to the start of replacement str
CS.RUN.SEDParser
stz LineNum Reusing this as cntr
lda (ZPPatternPtr)
@ -368,10 +368,10 @@ CS.END
OptionList .AS "HhIi"
OptionList.Cnt .EQ *-OptionList
*--------------------------------------
MSG.USAGE .AS "Usage : SED [-I] s/pattern/replacement/ <File>\r\n"
.AS " or : CMD|SED [-I] s/pattern/replacement/\r\n"
.AS " -I : Ignore Case"
MSG.CRLF .AZ "\r\n"
MSG.USAGE .CS "Usage : SED [-I] s/pattern/replacement/ <File>\r\n"
.CS " or : CMD|SED [-I] s/pattern/replacement/\r\n"
.CS " -I : Ignore Case"
MSG.CRLF .CZ "\r\n"
*--------------------------------------
.DUMMY
.OR 0
@ -379,5 +379,5 @@ DS.START
DS.END .ED
*--------------------------------------
MAN
SAVE usr/src/bin/od.s
SAVE usr/src/bin/sed.s
ASM

View File

@ -12,19 +12,18 @@ CL.Init >LDYAI 256
.9 rts
*--------------------------------------
CL.PrintPrompt >PUSHW L.PS1
>PUSHWZ
>PUSHW ZPCLBuf
>SYSCALL Expand
bcs .9
phx
>LDYA ZPCLBuf
jsr IO.EscOutYA
jsr PrintYANoCR
pla
>SYSCALL FreeMem
lda #0
sta (ZPCLBuf)
.1 >LDYA L.MSG.PROMPT
jsr PrintYANoCR
jsr IO.OutYA
.9 rts
*--------------------------------------
CL.READN0A tax
@ -281,7 +280,7 @@ CL.FS >LDA.G CL.Ptr
bmi CL.BS.8
CL.FS.OUT >LDYA L.MSG.FS
jmp PrintYANoCR
jmp IO.OutYA
*--------------------------------------
CL.CLR >STZ.G HIS.Ptr
@ -311,7 +310,7 @@ CL.CLR.1 lda (ZPCLBuf)
bne .3
>LDYA ZPCLBuf
jsr PrintYANoCR
jsr IO.OutYA
*--------------------------------------
CL.Reset lda #0
sta (ZPCLBuf)
@ -336,6 +335,7 @@ CL.ReadReset lda #$ff
iny CL.bSilent
sta (pData),y
rts
*--------------------------------------
MAN

View File

@ -368,45 +368,75 @@ CMD.DATE.PRINT >LDYA ZPCLBuf
>SYSCALL PutS
rts
*--------------------------------------
CMD.ECHO stz ZPPtr1 echo -N
stz ZPPtr1+1 Token Cnt
CMD.ECHO stz ZPPtr1 echo -E
stz ZPPtr1+1 echo -N
stz ZPPtr2 index in buffer
lda (ZPArgVBufPtr)
beq .7
.1 jsr CMD.IsSwitch
bcs .2
bcs .3
ldx #0
cmp #'E'
beq .2
inx
cmp #'N'
bne CMD.ECHO.CSYN
lda #$ff
eor ZPPtr1
sta ZPPtr1
bra .4
.2 ror ZPPtr1,x
bra .6
.2 lda ZPPtr1+1
beq .3
.3 ldy ZPPtr2
beq .4
lda #C.SPACE
>SYSCALL PutChar
sta (ZPCLBuf),y
inc ZPPtr2
.3 >LDYA ZPArgVBufPtr
jsr PrintYANoCR
bcs .9
.4 ldy #$ff
inc ZPPtr1+1
.5 iny
lda (ZPArgVBufPtr),y
beq .6
.4 jsr CORE.ArgV.Next
phy
ldy ZPPtr2
sta (ZPCLBuf),y
inc ZPPtr2
ply
bra .5
.6 jsr CORE.ArgV.Next
bne .1
.7 bit ZPPtr1
.7 ldy ZPPtr2
bit ZPPtr1+1 -N
bmi .8
>LDYA L.MSG.ECHOCRLF
jmp PrintYANoCR
lda #C.CR
sta (ZPCLBuf),y
iny
lda #C.LF
sta (ZPCLBuf),y
iny
.8 lda #0
sta (ZPCLBuf),y
>LDYA ZPCLBuf
bit ZPPtr1
bmi .80
jmp IO.OutYA
.80 jmp IO.EscOutYA
.8 clc
.9 rts
CMD.ECHO.CSYN lda #E.CSYN
@ -438,7 +468,7 @@ CMD.READ lda (ZPArgVBufPtr)
beq CMD.ECHO.CSYN
>LDYA ZPArgVBufPtr
jsr PrintYANoCR
jsr IO.OutYA
bcs CMD.ECHO.RTS
bra .5
@ -573,6 +603,7 @@ CMD.REN lda (ZPArgVBufPtr)
.4 iny
lda (ZPPtr1),y
beq .5
sta (ZPPtr2),y
cmp #'/'
bne .4

View File

@ -130,9 +130,9 @@ CORE.Run jsr IO.Reset
txa
>STA.G CORE.hArgVBuf
lda #bState.PipeIn
lda #bState.PipeIn+bState.PipeOut
trb bState
*--------------------------------------
CORE.Run.1 >LDYA ZPInputBufPtr Save Actual ptr for looping
>STYA ZPInputCmdPtr
@ -232,7 +232,7 @@ CORE.Run.4 >LDYA L.CMD internal command ?
jmp CORE.Run.Exit
*--------------------------------------
CORE.Run.5 jsr CORE.GetCharNB
bcs .8 Nothing to skip
bcs CORE.Run.6 Nothing to skip
jsr CORE.IsEndCmd
bcc .3
@ -254,7 +254,7 @@ CORE.Run.5 jsr CORE.GetCharNB
.9 lda #E.SYN
sec
jmp CORE.Run.Exit
*--------------------------------------
.3 cmp #C.CR
beq .7
@ -281,7 +281,7 @@ CORE.Run.5 jsr CORE.GetCharNB
.50 lda #S.PS.F.HOLD Run in the background...
trb CORE.PSFlags
bra .8
bra CORE.Run.6
.6 jsr CORE.GetNextChar Skip '&&'
@ -296,21 +296,10 @@ CORE.Run.5 jsr CORE.GetCharNB
.60 jmp CORE.Run.1
.7 jsr CORE.GetNextCharNB Skip EoL char
.8 lda #bState.PipeOut
trb bState
*--------------------------------------
CORE.Run.6 lda bState
bit #bState.PipeIn
beq .1
jsr IO.Pipe.In
bcs CORE.Run.Exit
lda bState
.1 bit #bState.PipeOut
beq .7
bit #bState.PipeOut
beq .3
jsr IO.Pipe.Out
bcs CORE.Run.Exit
@ -318,36 +307,46 @@ CORE.Run.6 lda bState
lda #S.PS.F.HOLD Run in the background...
trb CORE.PSFlags
lda #S.PS.F.CLOSEONX ...and close PIPE OUT on exit
lda #S.PS.F.CLOSEONX ...and child PS must close StdOut on exit
tsb CORE.PSFlags
jsr CORE.ExecCmd
.3 jsr CORE.ExecCmd
php
pha
lda CORE.IntCmd $ff if external
eor #$80
asl if cc Was external...
jsr IO.Reset.OutC restore Output, NO close if EXTERNAL
bcs CORE.Run.Exit
lda bState
and #bState.PipeIn
.5 bit #bState.PipeIn
beq .6
jsr IO.Pop.In restore Input
jsr IO.Pop.In restore Input piping app must close it
.6 pla
plp
lda #bState.PipeIn
trb bState
lda bState
.6 bit #bState.PipeOut
beq .7
jsr IO.Pipe.In Set previous Pipe Out to StdIn for next CMD
bcs CORE.Run.Exit
lda #bState.PipeIn
tsb bState
jmp CORE.Run.1 Loop with Pipe IN
bit CORE.IntCmd
bmi .60
.7 jsr CORE.ExecCmd
jsr IO.Reset.Out Internal : CLOSE output
bra .61
.60 jsr IO.Pop.Out External : DONT Close Output, child process will close it
.61 lda #bState.PipeOut
trb bState
.7 jmp CORE.Run.1 Loop with Pipe IN
*--------------------------------------
CORE.Run.Exit php
pha
@ -403,6 +402,7 @@ CORE.ExecExtCmd >PUSHW ZPArgVBuf
rts
.4 >SLEEP Suspend this PID
sec
ldy #S.PS.RC CPID will update S.PS.RC
lda (pPS),y
@ -584,6 +584,7 @@ CORE.ArgV.Next lda (ZPArgVBufPtr)
CORE.ArgV.NextChar
inc ZPArgVBufPtr
bne .8
inc ZPArgVBufPtr+1
.8 rts
*--------------------------------------

View File

@ -74,7 +74,7 @@ HIS.Select >LDA.G HIS.Count
bne .1
>LDYA L.MSG.HISPROMPT
jsr PrintYANoCR
jsr IO.OutYA
bcs .9
lda #0
@ -97,7 +97,7 @@ HIS.Select >LDA.G HIS.Count
>STA.G HIS.Ptr
.7 >LDYA L.MSG.HISROMPTCLR
jsr PrintYANoCR
jsr IO.OutYA
bcs .9
jsr CL.PrintPrompt
@ -154,7 +154,7 @@ HIS.GetToCL1 >LDA.G HIS.Ptr
>STA.G CL.Len
>LDYA ZPCLBuf
jmp PrintYANoCR
jmp IO.OutYA
.9 rts
*--------------------------------------

View File

@ -38,6 +38,7 @@ IO.Pop.In clc
IO.Reset.In sec
>LDA.G IO.hIn
beq .8
bcc .1
ldy #S.PS.hStdIn
@ -83,7 +84,7 @@ IO.Pop.Out clc
.HS B0 BCS
*--------------------------------------
IO.Reset.Out sec
IO.Reset.OutC >LDA.G IO.hOut
>LDA.G IO.hOut
beq .8
bcc .1
@ -124,11 +125,11 @@ IO.Close.Y pha
rts
*--------------------------------------
IO.Pipe.OpenR ldx #O.RDONLY+O.TEXT
.HS 2C BIT ABS
bra IO.Pipe.Open
IO.Pipe.OpenW ldx #O.WRONLY+O.TEXT
>LEA.G IO.DEVFIFO
IO.Pipe.Open >LEA.G IO.DEVFIFO
*--------------------------------------
IO.FOpenYAX >PUSHYA
txa
@ -151,50 +152,10 @@ IO.StatYA >PUSHYA
.9 rts
*--------------------------------------
* set A = `sh -C ls|grep test`
IO.Exec >PUSHW ZPArgVBufPtr
>PUSHBI S.PS.F.CLOSEONX
>SYSCALL ExecL
rts
* >LDYAI 256
* >SYSCALL GetMem
* bcs .99
* >STYA ZPPtr1
* phx
* >PUSHYA
* >PUSHW L.EXECC
* >PUSHW.G SH
* >PUSHW ZPArgVBufPtr
* >PUSHBI 4
* >SYSCALL sprintf
* bcs .98
* ldy #S.PS.hStdErr
* lda (pPS),y
* >PUSHA
* >PUSHW ZPPtr1
* >SYSCALL fputs
* >DEBUG
* >PUSHW ZPPtr1
* >PUSHBI S.PS.F.CLOSEONX
* >SYSCALL ExecL
*.98 plx
* php
* pha
* txa
* >SYSCALL freemem
* pla
* plp
*.99 rts
*--------------------------------------
IO.PrintBatchErrMsg
>LDYA ZPInputBuf
@ -319,6 +280,144 @@ IO.PrintErrMsg ldy #S.PS.RC
rts
*--------------------------------------
IO.EscOutYA >STYA ZPPtr1 In
>STYA ZPPtr2 Out
ldy #0
.1 jsr GetPtr1NextChar
beq .8
cmp #'\'
bne .6
lda (ZPPtr1)
beq .7
ldx #OUT.EscCharsCnt-1
.2 cmp OUT.EscChars,x
beq .5
dex
bpl .2
stz ZPTmpW
jsr ToUpperCase
cmp #'X'
bne .3
.20 jsr IncPtr1
lda (ZPPtr1)
beq .40
jsr IO.IsHexDigit
bcs .40
asl ZPTmpW
asl ZPTmpW
asl ZPTmpW
asl ZPTmpW
ora ZPTmpW
sta ZPTmpW
bra .20
.3 jsr IO.IsOctDigit
bcs .40
jsr IncPtr1
asl ZPTmpW
asl ZPTmpW
asl ZPTmpW
ora ZPTmpW
sta ZPTmpW
lda (ZPPtr1)
bne .3
.40 lda ZPTmpW
bra .6
.4 tax
lda #'\'
sta (ZPPtr2),y
iny
txa
bra .6
.5 lda OUT.EscCodes,x
jsr IncPtr1
.6 sta (ZPPtr2),y
iny
bra .1
.7 lda #'\'
sta (ZPPtr2),y
iny
lda #0
.8 sta (ZPPtr2),y
>LDYA ZPPtr2
*--------------------------------------
IO.OutYA >PUSHYA
>PUSHBI 0
>SYSCALL PrintF
rts
*--------------------------------------
IO.IsOctDigit cmp #'0'
bcc .9
cmp #'7'+1
bcs .9
and #%00000111
clc
rts
.9 sec
rts
*--------------------------------------
IO.IsHexDigit 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/bin/sh.s.io
LOAD usr/src/bin/sh.s

View File

@ -89,7 +89,7 @@ bState.ExitOnEOF .EQ %10000000
bState.Pause .EQ %01000000
bState.PipeIn .EQ %00100000
bState.PipeOut .EQ %00010000
bState.PipeOutInt .EQ %00001000
bState.SET.C .EQ %00000100
bState.SET.E .EQ %00000010
bState.SET.X .EQ %00000001
@ -357,11 +357,10 @@ CS.RUN.LOOP >SLEEP
CS.RUN.INTERACTIVE
jsr IO.Reset
jsr CL.Reset
jsr CL.ReadResetV
>STZ.G HIS.Ptr
jsr CL.ReadResetV
jsr CL.PrintPrompt
bcs CS.RUN.CMDLINE.9
@ -377,7 +376,7 @@ CS.RUN.INTERACTIVE
bpl .1
>LDYA L.MSG.PROMPTCRLF
jsr PrintYANoCR
jsr IO.OutYA
bcs CS.RUN.CMDLINE.9
lda (ZPCLBuf)
@ -539,6 +538,7 @@ CheckLFAfterCR ldy #S.PS.hStdIn Check for any extra LF
tay
bne .9
>SYSCALL GetChar
.9 rts
@ -558,13 +558,17 @@ GetPtr1NextChar lda (ZPPtr1)
IncPtr1 inc ZPPtr1
bne IncPtr1.8
inc ZPPtr1+1
IncPtr1.8 rts
*--------------------------------------
GetPtr1LenY ldy #$ff
.1 iny
lda (ZPPtr1),y
bne .1
rts
*--------------------------------------
GetPtr1NextString
@ -576,6 +580,7 @@ AddAp1Ptr1 sec
adc ZPPtr1
sta ZPPtr1
bcc .8
inc ZPPtr1+1
.8 rts
*--------------------------------------
@ -595,11 +600,6 @@ IncPStack3 inc pStack
inc pStack
inc pStack
rts
*--------------------------------------
PrintYANoCR >PUSHYA
>PUSHBI 0
>SYSCALL PrintF
rts
*--------------------------------------
.INB usr/src/bin/sh.s.cl
.INB usr/src/bin/sh.s.cmd
@ -637,7 +637,7 @@ HOME .AZ "${HOME}"
EXECC .AZ "%s -C %s"
*--------------------------------------
IN.EscChars .AS "DABC"
IN.EscCharsCnt .EQ *-EscChars
IN.EscCharsCnt .EQ *-IN.EscChars
IN.EscCodes .DA #C.BS,#C.VT,#C.LF,#21
*--------------------------------------
* \e[1~ - Home

View File

@ -162,19 +162,25 @@ D2.MoveHead >PULLB D2.TargetQTrack
cmp D2.TargetQTrack
bne .3
lsr CS if X,Y on
* lsr CS if X,Y on
jsr D2.Wait25600usec
ldy D2.Slotn0
lda IO.D2.Ph0Off+2,y
lda IO.D2.Ph0Off+6,y
lda IO.D2.Ph0Off,y
lda IO.D2.Ph0Off+4,y
bcc .10
* lda IO.D2.Ph0Off,y
clc
* bcc .10
lda IO.D2.Ph0Off,x
* lda IO.D2.Ph0Off,x
* clc
* lda IO.D2.Ph0Off,y
.10 jsr D2.Wait25600usec
*.10 jsr D2.Wait25600usec
plp
clc

View File

@ -716,13 +716,19 @@ XRW.TrackSelect lda #2
ora A2L
tay y = n0/n2
lda IO.D2.Ph0On,y
lda IO.D2.Ph0On+4,y
iny
jsr XRW.Ph04Off
* lda IO.D2.Ph0On,y
* lda IO.D2.Ph0On+4,y
jsr XRW.Wait100usec
lda IO.D2.Ph0Off,y
lda IO.D2.Ph0Off+4,y
dey
jsr XRW.Ph04Off
*
* lda IO.D2.Ph0Off,y
* lda IO.D2.Ph0Off+4,y
lda XRW.AddrField.T
sta XRW.D2Trk-1,x
@ -834,17 +840,24 @@ XRW.SeekYA sta XRW.D2Trk-1,x will be current track at the end
cmp XRW.TargetQTrack
bne .3
lsr CS if X,Y on
* lsr CS if X,Y on
jsr XRW.Wait25600usec
lda IO.D2.Ph0Off,y
ldy A2L
lda IO.D2.Ph0Off+2,y
lda IO.D2.Ph0Off+6,y
XRW.Ph04Off lda IO.D2.Ph0Off,y
lda IO.D2.Ph0Off+4,y
bcc .10
* lda IO.D2.Ph0Off,y
* bcc .10
* lda IO.D2.Ph0Off,x
clc Exit wit CC (recalibrate)
lda IO.D2.Ph0Off,x
* lda IO.D2.Ph0Off,y
.10 rts
*--------------------------------------

View File

@ -319,20 +319,26 @@ BB.FX2.SeekReadD2
cmp BB.TargetQTrack
bne .3
lsr CS if X,Y on
* lsr CS if X,Y on
lda #0
jsr BB.Wait100usecA
ldy ROM.D2.Slotn0
lda IO.D2.Ph0Off+2,y
lda IO.D2.Ph0Off+6,y
lda IO.D2.Ph0Off,y
lda IO.D2.Ph0Off+4,y
bcc .10
* lda IO.D2.Ph0Off,y
clc
* bcc .10
lda IO.D2.Ph0Off,x
* clc
.10
* lda IO.D2.Ph0Off,x
*.10
*--------------------------------------
BB.FX2.ReadSectD2
ldx ROM.D2.Slotn0

View File

@ -763,16 +763,6 @@ K.Rename jsr PFT.CheckPath2
* + %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'
@ -818,7 +808,8 @@ K.PrintF.1 sec format string->ptr2
jmp .8 end of format..
.22 cmp #'%'
bne .10
bne .20
stz K.PrintF.PadL
stz K.PrintF.PadC
lda (ZPPtr2)
@ -851,10 +842,13 @@ K.PrintF.1 sec format string->ptr2
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.NextCP2
@ -862,35 +856,16 @@ K.PrintF.1 sec format string->ptr2
asl
tax
jsr PrintF.ESC
.11 bcc .1
bcc .1
bra .99
.7 lda #'%'
bra .20
*--------------------------------------
.10 cmp #'\'
bne .20
jsr SHARED.GetCP2
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.AddY2P2
.14 lda ACC32
bra .20
.19 lda PrintFTBL2.OUT,x
.20 jsr PrintF.PutC
bcc .11
bcc .1
jmp STDIO.Exit
*--------------------------------------
.99 lda #E.BADARG
sec
@ -921,11 +896,6 @@ K.PrintF.1 sec format string->ptr2
*--------------------------------------
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.ESC jmp (.1,x)
.1 .DA PrintF.B

View File

@ -575,27 +575,27 @@ TERMX.RM clc
ldy #S.DCB.TTY.bDECAWM
bra .8
.2 cmp #25
*--------------------------------------
.2 eor #25
bne .98
ldy #S.DCB.TTY.bCURON
plp
ror
ror A = 0
sta (ZPDCBPtr),y
bmi .80
bmi .3 let it starts blinking..
jsr TERMX.CUROFF
clc
.3 clc
rts
.8 plp
ror
sta (ZPDCBPtr),y
.80 clc
clc
rts
.98 plp
@ -989,6 +989,8 @@ TERMX.CUU clc no scroll
TERMX.CBLNK jsr TERMX.CCheck
bcs TERMX.RTS
* ldy #S.DCB.TTY.bCURON
lda DevMgr.Timer
and #CURBLNK.SPEED
eor (ZPDCBPtr),y
@ -1001,7 +1003,7 @@ TERMX.CBLNK jsr TERMX.CCheck
asl
beq TERMX.CUROFF.1
jsr GetCharAtCurPos
TERMX.CURON jsr GetCharAtCurPos
bcs TERMX.RTS Out of screen
and #$80
@ -1011,9 +1013,6 @@ TERMX.CBLNK jsr TERMX.CCheck
TERMX.CUROFF jsr TERMX.CCheck
bcs TERMX.RTS
asl
beq TERMX.RTS already off
TERMX.CUROFF.1 jsr GetCharAtCurPos
bcs TERMX.RTS Out of screen