mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-19 12:31:56 +00:00
94 lines
1.6 KiB
Plaintext
94 lines
1.6 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
.LIST OFF
|
||
*--------------------------------------
|
||
HIS.Init >LDYAI HISTORY.MAX Get a buffer for History
|
||
>SYSCALL NewStkObj
|
||
bcs .9
|
||
|
||
txa
|
||
>STA.G HIS.hBuf
|
||
|
||
>PUSHA
|
||
>PUSHWI 0
|
||
>SYSCALL StrVAdd Reset Buffer
|
||
|
||
>STZ.G HIS.Count
|
||
>STA.G HIS.Index
|
||
.9 rts
|
||
*--------------------------------------
|
||
HIS.Add >LDA.G HIS.hBuf
|
||
beq .9
|
||
|
||
>PUSHA
|
||
>PUSHW ZPCLBuf
|
||
>SYSCALL StrVAdd
|
||
bcc .1
|
||
|
||
>PUSHB.G HIS.hBuf
|
||
lda #0
|
||
>PUSHA
|
||
>SYSCALL StrVShift
|
||
>DEC.G HIS.Count
|
||
bra HIS.Add
|
||
|
||
.1 >STZ.G HIS.Index Reset Index
|
||
>INC.G HIS.Count
|
||
.9
|
||
HIS.Add.RTS rts
|
||
*--------------------------------------
|
||
HIS.GetPrev >LDA.G HIS.hBuf
|
||
beq HIS.Add.RTS
|
||
|
||
>LDA.G HIS.Count
|
||
beq HIS.Add.RTS empty history,nothing to do
|
||
|
||
>LDA.G HIS.Index
|
||
bne .1
|
||
|
||
>LDA.G HIS.Count
|
||
.1 dec
|
||
bra HIS.GetToCl
|
||
*--------------------------------------
|
||
HIS.GetNext >LDA.G HIS.hBuf
|
||
beq HIS.Add.RTS
|
||
|
||
>LDA.G HIS.Count
|
||
beq HIS.Add.RTS empty history,nothing to do
|
||
|
||
>LDA.G HIS.Index
|
||
inc
|
||
>CMP.G HIS.Count
|
||
bne HIS.GetToCl
|
||
|
||
lda #0
|
||
>STA.G HIS.Index
|
||
jmp CL.CLR
|
||
*--------------------------------------
|
||
HIS.GetToCl >STA.G HIS.Index
|
||
|
||
jsr CL.CLR
|
||
|
||
>PUSHB.G HIS.hBuf
|
||
>PUSHB.G HIS.Index
|
||
>PUSHW ZPCLBuf
|
||
|
||
>SYSCALL StrVGet
|
||
|
||
ldy #$ff
|
||
|
||
.1 iny
|
||
lda (ZPCLBuf),y
|
||
bne .1
|
||
|
||
tya
|
||
|
||
>STA.G CL.Ptr
|
||
>STA.G CL.Len
|
||
jmp CL.PrintCLBuf
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE usr/src/bin/sh.s.his
|
||
LOAD usr/src/bin/sh.s
|
||
ASM
|