A2osX/BIN/SH.S.HIS.txt

163 lines
2.5 KiB
Plaintext
Raw Normal View History

NEW
2019-06-02 08:58:46 +00:00
AUTO 3,1
2021-04-29 11:56:34 +00:00
.LIST OFF
2015-10-19 20:35:00 +00:00
*--------------------------------------
2019-04-01 06:07:56 +00:00
HIS.Init >LDYAI HISTORY.MAX Get a buffer for History
2021-04-29 11:56:34 +00:00
>SYSCALL StrVNew
2015-10-19 20:35:00 +00:00
bcs .9
>STA.G HIS.hBuf
2020-02-02 18:24:40 +00:00
2021-05-14 20:58:20 +00:00
* >STZ.G HIS.Count
* >STA.G HIS.Index
* >STA.G HIS.LRU
2015-10-19 20:35:00 +00:00
.9 rts
*--------------------------------------
HIS.Add >LDA.G HIS.hBuf
2015-10-19 20:35:00 +00:00
beq .9
2020-01-28 16:42:51 +00:00
2021-04-29 11:56:34 +00:00
>LDA.G HIS.Count
cmp #HIS.MAX
bcc .2
>LDA.G HIS.LRU
cmp #HIS.MAX
bne .1
lda #0
2021-05-14 20:58:20 +00:00
.1 inc
>STA.G HIS.LRU
2021-04-29 11:56:34 +00:00
bra .7
2021-05-14 20:58:20 +00:00
.2 inc
>STA.G HIS.Count
2021-04-29 11:56:34 +00:00
2021-05-15 14:35:24 +00:00
.7 tax
>PUSHB.G HIS.hBuf
2021-04-29 11:56:34 +00:00
>PUSHBI 0
txa
2020-02-02 14:58:01 +00:00
>PUSHA
>PUSHW ZPCLBuf
2021-04-29 11:56:34 +00:00
>SYSCALL StrVSet
>STZ.G HIS.Index Reset Index
.9 rts
*--------------------------------------
HIS.Select >LDA.G HIS.Count
2021-05-09 17:04:44 +00:00
bne .10
clc
.99 rts
2021-04-29 11:56:34 +00:00
2021-05-14 20:58:20 +00:00
.10 jsr CL.Reset
>STZ.G HIS.Index
2021-04-29 11:56:34 +00:00
2021-05-14 20:58:20 +00:00
.1 >INC.G HIS.Index
jsr HIS.GetIndex
2021-05-09 17:04:44 +00:00
bcs .99
2021-04-29 11:56:34 +00:00
2021-05-09 17:04:44 +00:00
>PUSHW L.MSG.HIS
2021-05-14 20:58:20 +00:00
>LDA.G HIS.Index
dec
>PUSHA
2021-04-29 11:56:34 +00:00
>PUSHW ZPCLBuf
>PUSHBI 3
>SYSCALL PrintF
bcs .9
2021-05-14 20:58:20 +00:00
>LDA.G HIS.Index
2021-04-29 11:56:34 +00:00
>CMP.G HIS.Count
bne .1
2021-05-09 17:04:44 +00:00
>PUSHW L.MSG.HISPROMPT
2021-04-29 11:56:34 +00:00
>PUSHBI 0
>SYSCALL PrintF
2021-05-09 17:04:44 +00:00
>STZ.G HIS.Index
2021-05-15 14:35:24 +00:00
lda #0
sta (ZPCLBuf)
2021-04-29 11:56:34 +00:00
>SYSCALL GetChar
bcs HIS.Select.RTS
2021-05-09 17:04:44 +00:00
cmp #'0'
bcc .7
cmp #'9'+1
bcs .7
and #$f
2021-05-14 20:58:20 +00:00
inc
2021-05-09 17:04:44 +00:00
>STA.G HIS.Index
.7 >PUSHW L.MSG.HISROMPTCLR
>PUSHBI 0
>SYSCALL PrintF
2021-04-29 11:56:34 +00:00
jsr CL.PrintPrompt
2021-05-14 20:58:20 +00:00
bcc HIS.GetToCL1
2021-05-09 17:04:44 +00:00
.9
2021-04-29 11:56:34 +00:00
HIS.Select.RTS rts
2015-10-19 20:35:00 +00:00
*--------------------------------------
2021-05-14 20:58:20 +00:00
HIS.GetPrev >LDA.G HIS.Count
2021-04-29 11:56:34 +00:00
beq HIS.Select.RTS empty history,nothing to do
2020-02-02 14:58:01 +00:00
>LDA.G HIS.Index
bne .1
2020-02-02 14:58:01 +00:00
>LDA.G HIS.Count
2021-05-14 20:58:20 +00:00
bra HIS.GetToCL
2021-04-29 11:56:34 +00:00
.1 dec
2021-04-29 11:56:34 +00:00
bra HIS.GetToCL
2015-10-19 20:35:00 +00:00
*--------------------------------------
2021-05-14 20:58:20 +00:00
HIS.GetNext >LDA.G HIS.Count
2021-04-29 11:56:34 +00:00
beq HIS.Select.RTS empty history,nothing to do
2020-02-02 14:58:01 +00:00
2021-05-14 20:58:20 +00:00
>EOR.G HIS.Index
beq HIS.GetToCL
>LDA.G HIS.Index
inc
*--------------------------------------
2021-04-29 11:56:34 +00:00
HIS.GetToCL >STA.G HIS.Index
2021-05-14 20:58:20 +00:00
jsr CL.CLR
HIS.GetToCL1 >LDA.G HIS.Index
beq .9
2020-02-02 14:58:01 +00:00
2021-04-29 11:56:34 +00:00
jsr HIS.GetIndex
bcs .9
2020-02-02 14:58:01 +00:00
2020-02-02 15:56:46 +00:00
ldy #$ff
2021-04-29 11:56:34 +00:00
2020-02-02 15:56:46 +00:00
.1 iny
lda (ZPCLBuf),y
bne .1
2021-04-29 11:56:34 +00:00
2020-02-02 15:56:46 +00:00
tya
2021-04-29 11:56:34 +00:00
2020-02-02 15:56:46 +00:00
>STA.G CL.Ptr
2018-11-10 14:30:09 +00:00
>STA.G CL.Len
2021-05-14 20:58:20 +00:00
jmp CL.Print
2021-04-29 11:56:34 +00:00
.9 rts
*--------------------------------------
HIS.GetIndex >PUSHB.G HIS.hBuf
>PUSHBI 0
>PUSHB.G HIS.Index
>PUSHW ZPCLBuf
>SYSCALL StrVGet
rts
2015-10-19 20:35:00 +00:00
*--------------------------------------
MAN
2020-05-26 14:23:09 +00:00
SAVE usr/src/bin/sh.s.his
LOAD usr/src/bin/sh.s
2015-10-19 20:35:00 +00:00
ASM