A2osX/BIN/FORTH.S.HIS.txt
2021-04-29 13:56:34 +02:00

93 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 clc
rts
>LDYAI HISTORY.MAX Get a buffer for History
>SYSCALL StrVNew
bcs .9
txa
>STA.G HIS.hBuf
>STZ.G HIS.Count
>STA.G HIS.Index
.9 rts
*--------------------------------------
HIS.Add >LDA.G HIS.hBuf
beq .9
>PUSHA
>PUSHW ZPCLBuf
>SYSCALL StrVSet
bcc .1
>PUSHB.G HIS.hBuf
>PUSHWZ
>SYSCALL StrVSet
>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
>PUSHBI 0
>PUSHB.G HIS.Index
>PUSHW ZPCLBuf
>SYSCALL StrVGet
ldy #$ff
.1 iny
lda (ZPCLBuf),y
bne .1
tya
sta CL.Ptr
sta CL.Len
jmp CL.PrintCLBuf
*--------------------------------------
MAN
SAVE usr/src/bin/forth.s.his
LOAD usr/src/bin/forth.s
ASM