A2osX/BIN/SH.S.HIS.txt
2020-02-07 13:53:46 +01:00

94 lines
1.6 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
History.RTS rts
*--------------------------------------
HIS.GetPrev >LDA.G HIS.hBuf
beq HISTORY.RTS
>LDA.G HIS.Count
beq HISTORY.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 HISTORY.RTS
>LDA.G HIS.Count
beq HISTORY.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