mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-25 05:32:20 +00:00
SH: I/O Fix
This commit is contained in:
parent
6b5ca3da2f
commit
8f059cb64b
Binary file not shown.
289
BIN/MAN.S.txt
Normal file
289
BIN/MAN.S.txt
Normal file
@ -0,0 +1,289 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
.OP 65C02
|
||||
.OR $2000
|
||||
.TF bin/man
|
||||
*--------------------------------------
|
||||
.INB inc/macros.i
|
||||
.INB inc/mli.i
|
||||
.INB inc/a2osx.i
|
||||
.INB inc/libtui.i
|
||||
*--------------------------------------
|
||||
TIMEOUT.MAX .EQ 250 25 sec.
|
||||
BUFSIZE .EQ 4096
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR ZPBIN
|
||||
ZS.START
|
||||
hBuf .BS 1
|
||||
|
||||
TimeOut .BS 1
|
||||
|
||||
hCTX .BS 1
|
||||
hSCR .BS 1
|
||||
hTBOX .BS 1
|
||||
|
||||
ZPPtr1 .BS 2
|
||||
ZS.END .ED
|
||||
*--------------------------------------
|
||||
* File Header (16 Bytes)
|
||||
*--------------------------------------
|
||||
CS.START cld
|
||||
jmp (.1,x)
|
||||
.DA #$61 6502,Level 1 (65c02)
|
||||
.DA #1 BIN Layout Version 1
|
||||
.DA #S.PS.F.EVENT S.PS.F
|
||||
.DA #0
|
||||
.DA CS.END-CS.START Code Size (without Constants)
|
||||
.DA DS.END-DS.START Data Segment Size
|
||||
.DA #64 Stack Size
|
||||
.DA #ZS.END-ZS.START Zero Page Size
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
.1 .DA CS.INIT
|
||||
.DA CS.RUN
|
||||
.DA CS.DOEVENT
|
||||
.DA CS.QUIT
|
||||
|
||||
L.LIBTUI .DA LIBTUI
|
||||
|
||||
L.MSG.ScrTitle .DA MSG.ScrTitle
|
||||
|
||||
L.MSG.USAGE .DA MSG.USAGE
|
||||
L.MSG.CRLF .DA MSG.CRLF
|
||||
L.MSG.NULL .DA MSG.NULL
|
||||
L.MSG.GOTO .DA MSG.GOTO
|
||||
L.MSG.OK .DA MSG.OK
|
||||
L.MSG.ERROR .DA MSG.ERROR
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
CS.INIT >LDYA L.LIBTUI
|
||||
>SYSCALL LoadLib
|
||||
bcs .9
|
||||
|
||||
sta hLIBTUI
|
||||
|
||||
.9
|
||||
CS.INIT.RTS rts
|
||||
*--------------------------------------
|
||||
CS.RUN.USAGE >LDYA L.MSG.USAGE
|
||||
>SYSCALL PutS
|
||||
lda #E.SYN
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN lda #1
|
||||
>SYSCALL ArgV
|
||||
bcs CS.RUN.USAGE
|
||||
|
||||
phy
|
||||
pha
|
||||
|
||||
>PUSHEA.G NET.HyperLink+1
|
||||
|
||||
pla
|
||||
>PUSHA
|
||||
pla
|
||||
>PUSHA
|
||||
>SYSCALL strcpy
|
||||
|
||||
>LDYAI BUFSIZE
|
||||
>SYSCALL GetMem
|
||||
bcs CS.INIT.RTS
|
||||
|
||||
stx hBuf
|
||||
|
||||
>LDYAI 256
|
||||
>SYSCALL GetMem
|
||||
bcs CS.INIT.RTS
|
||||
|
||||
>STYA ZPLinePtr
|
||||
stx hLine
|
||||
|
||||
jsr CS.Scr.Init
|
||||
bcs CS.INIT.RTS
|
||||
*--------------------------------------
|
||||
CS.RUN.LOOP0 jsr CS.Scr.SetTitle
|
||||
jsr CS.Scr.SetBuf
|
||||
jsr CS.Scr.SetStatusOkErr
|
||||
*--------------------------------------
|
||||
CS.RUN.LOOP >SLEEP
|
||||
|
||||
lda hSCR
|
||||
>LIBCALL hLIBTUI,LIBTUI.Exec
|
||||
bcs CS.RUN.LOOP.9
|
||||
|
||||
tay
|
||||
beq CS.RUN.LOOP No Event
|
||||
|
||||
cmp #3
|
||||
beq CS.RUN.LOOP.9
|
||||
|
||||
cmp #EV.HL.SELECTED
|
||||
bne .1
|
||||
|
||||
jsr CS.Scr.SetStatusGoto
|
||||
bcc CS.RUN.LOOP
|
||||
|
||||
rts
|
||||
|
||||
.1 cmp #EV.HL.PRESSED
|
||||
bne CS.RUN.LOOP
|
||||
|
||||
jsr CS.Net.GetHL
|
||||
bcc CS.RUN.LOOP0
|
||||
|
||||
tay
|
||||
beq CS.RUN.LOOP
|
||||
|
||||
CS.RUN.LOOP.9 rts
|
||||
*--------------------------------------
|
||||
CS.DOEVENT lda (pEvent)
|
||||
bpl .9 is it a TIMER event?
|
||||
|
||||
lda TimeOut
|
||||
beq .9
|
||||
|
||||
dec TimeOut
|
||||
|
||||
.9 sec do not discard TIMER event
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.QUIT lda hCTX
|
||||
beq .1
|
||||
|
||||
>LIBCALL hLIBTUI,LIBTUI.Close
|
||||
|
||||
.1 lda hLIBTUI
|
||||
beq .8
|
||||
|
||||
>SYSCALL UnloadLib
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.Scr.Init >LIBCALL hLIBTUI,LIBTUI.Init
|
||||
bcs .99
|
||||
|
||||
sta hCTX
|
||||
|
||||
>PUSHA hCTX
|
||||
>PUSHBI S.OBJ.F.bTitle+S.OBJ.F.bStatus
|
||||
>LIBCALL hLIBTUI,LIBTUI.NewScrn
|
||||
bcs .99
|
||||
|
||||
sta hSCR
|
||||
|
||||
jsr CS.Scr.SetTitle0
|
||||
jsr CS.Scr.SetStatus
|
||||
|
||||
>PUSHB hSCR
|
||||
>PUSHBI 0 X1
|
||||
>PUSHBI 0 Y1
|
||||
>PUSHBI 80 W
|
||||
>PUSHBI 22 H
|
||||
>PUSHBI 0 F
|
||||
lda hBuf
|
||||
>SYSCALL GetMemPtr
|
||||
>PUSHYA
|
||||
>PUSHWI BUFSIZE
|
||||
>LIBCALL hLIBTUI,LIBTUI.NewTBox
|
||||
.99 bcs .9
|
||||
|
||||
sta hTBOX
|
||||
|
||||
>LIBCALL hLIBTUI,LIBTUI.Activate
|
||||
bcs .9
|
||||
|
||||
>PUSHB hTBOX
|
||||
>PUSHBI S.OBJ.pVar
|
||||
>PUSHEA.G NET.HyperLink
|
||||
>LIBCALL hLIBTUI,LIBTUI.SetProp
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CS.Scr.SetTitle >PUSHB hSCR
|
||||
>PUSHBI S.OBJ.pTITLE
|
||||
>PUSHW L.MSG.ScrTitle
|
||||
>LIBCALL hLIBTUI,LIBTUI.SetProp
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.Scr.SetBuf >PUSHB hTBOX
|
||||
>PUSHBI S.OBJ.pBuf
|
||||
lda hBuf
|
||||
>SYSCALL GetMemPtr
|
||||
>PUSHYA
|
||||
>LIBCALL hLIBTUI,LIBTUI.SetProp
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.Scr.SetStatusGoto
|
||||
>PUSHEA.G SCR.StatusBuf skip type
|
||||
>PUSHW L.MSG.GOTO
|
||||
>PUSHEA.G NET.HyperLink+1
|
||||
>PUSHBI 2
|
||||
>SYSCALL SPrintF
|
||||
bra CS.Scr.SetStatus
|
||||
*--------------------------------------
|
||||
CS.Scr.SetStatusOkErr
|
||||
bcc .1
|
||||
|
||||
pha
|
||||
>PUSHEA.G SCR.StatusBuf
|
||||
>PUSHW L.MSG.ERROR
|
||||
pla
|
||||
pha
|
||||
>PUSHA
|
||||
>PUSHBI 1
|
||||
>SYSCALL SPrintF
|
||||
jsr CS.Scr.SetStatus
|
||||
pla
|
||||
sec
|
||||
rts
|
||||
|
||||
.1 >PUSHEA.G SCR.StatusBuf
|
||||
>PUSHW L.MSG.OK
|
||||
>PUSHBI 0
|
||||
>SYSCALL SPrintF
|
||||
*--------------------------------------
|
||||
CS.Scr.SetStatus
|
||||
>PUSHB hSCR
|
||||
>PUSHBI S.OBJ.pSTATUS
|
||||
>PUSHEA.G SCR.StatusBuf
|
||||
>LIBCALL hLIBTUI,LIBTUI.SetProp
|
||||
rts
|
||||
*--------------------------------------
|
||||
* [[text]host:port/path#htag]
|
||||
*--------------------------------------
|
||||
CS.GetHLink
|
||||
|
||||
CS.SplitLink
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
LIBTUI .AZ "libtui"
|
||||
hLIBTUI .BS 1
|
||||
ENV.MANPATH .AZ "${MANPATH}"
|
||||
*--------------------------------------
|
||||
MSG.ScrTitle .CZ "A2osX-MAN - <Ctrl-Q>uit"
|
||||
*--------------------------------------
|
||||
MSG.USAGE .CS "Usage : MAN <manfile>[#htag]"
|
||||
MSG.CRLF .CS "\r\n"
|
||||
MSG.NULL .HS 00
|
||||
MSG.GOTO .CZ "Goto: %s"
|
||||
MSG.OK .CZ "Ok"
|
||||
MSG.ERROR .CZ "Error: $%h"
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR 0
|
||||
DS.START
|
||||
TextBuf .BS 32
|
||||
HostBuf .BS 32
|
||||
PortBuf .BS 2
|
||||
PathBuf .BS MLI.MAXPATH+1
|
||||
HTagBuf .BS 80
|
||||
SCR.StatusBuf .BS 80
|
||||
DS.END .ED
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/bin/man.s
|
||||
ASM
|
@ -120,9 +120,7 @@ CORE.Run.EOF jsr STK.Pull
|
||||
|
||||
CORE.Run.RTS rts
|
||||
*--------------------------------------
|
||||
CORE.Run jsr IO.Reset
|
||||
|
||||
>LDYAI 256
|
||||
CORE.Run >LDYAI 256
|
||||
>SYSCALL GetMem
|
||||
bcs CORE.Run.RTS
|
||||
|
||||
@ -162,9 +160,7 @@ CORE.Run.1 >LDYA ZPInputBufPtr Save Actual ptr for looping
|
||||
|
||||
.12 jsr CORE.SkipLine
|
||||
|
||||
.8 lda #0
|
||||
clc
|
||||
.9 jmp CORE.Run.Exit EOL, CS,A=0
|
||||
.8 jmp CORE.Run.Exit0 EOL, CS,A=0
|
||||
*--------------------------------------
|
||||
CORE.Run.3 >LDA.G hAliases
|
||||
beq CORE.Run.4
|
||||
@ -228,8 +224,7 @@ CORE.Run.4 >LDYA L.CMD internal command ?
|
||||
bra .43
|
||||
|
||||
.44 jsr CORE.GetNextCharNB Skip EoL char
|
||||
clc
|
||||
jmp CORE.Run.Exit
|
||||
jmp CORE.Run.Exit0
|
||||
*--------------------------------------
|
||||
CORE.Run.5 jsr CORE.GetCharNB
|
||||
bcs CORE.Run.6 Nothing to skip
|
||||
@ -289,9 +284,7 @@ CORE.Run.5 jsr CORE.GetCharNB
|
||||
bcc .60
|
||||
|
||||
jsr CORE.SkipLine
|
||||
clc
|
||||
lda #0
|
||||
jmp CORE.Run.Exit
|
||||
jmp CORE.Run.Exit0
|
||||
|
||||
.60 jmp CORE.Run.1
|
||||
|
||||
@ -326,7 +319,7 @@ CORE.Run.6 lda bState
|
||||
lda bState
|
||||
|
||||
.2 bit #bState.PipeOut
|
||||
beq .8
|
||||
beq CORE.Run.Exit0
|
||||
|
||||
jsr IO.Pipe.In Set previous Pipe Out to StdIn for next CMD
|
||||
bcs CORE.Run.Exit
|
||||
@ -347,9 +340,9 @@ CORE.Run.6 lda bState
|
||||
|
||||
.7 jmp CORE.Run.1 Loop with Pipe IN
|
||||
|
||||
.8 lda #0
|
||||
CORE.Run.Exit0 lda #0
|
||||
clc
|
||||
*--------------------------------------
|
||||
|
||||
CORE.Run.Exit php
|
||||
pha
|
||||
>LDA.G CORE.hArgVBuf
|
||||
@ -359,7 +352,9 @@ CORE.Run.Exit php
|
||||
|
||||
>STZ.G CORE.hArgVBuf
|
||||
|
||||
.1 pla
|
||||
.1 jsr IO.Reset
|
||||
|
||||
pla
|
||||
plp
|
||||
rts
|
||||
*--------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user