A2osX/BIN/FORTH.S.HIS.txt

93 lines
1.6 KiB
Plaintext
Raw Normal View History

2021-04-11 19:47:48 +00:00
NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
2021-04-29 11:56:34 +00:00
HIS.Init clc
rts
>LDYAI HISTORY.MAX Get a buffer for History
>SYSCALL StrVNew
2021-04-11 19:47:48 +00:00
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
2021-04-29 11:56:34 +00:00
>SYSCALL StrVSet
2021-04-11 19:47:48 +00:00
bcc .1
>PUSHB.G HIS.hBuf
2021-04-29 11:56:34 +00:00
>PUSHWZ
>SYSCALL StrVSet
2021-04-11 19:47:48 +00:00
>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
2021-04-29 11:56:34 +00:00
>PUSHBI 0
2021-04-11 19:47:48 +00:00
>PUSHB.G HIS.Index
>PUSHW ZPCLBuf
>SYSCALL StrVGet
ldy #$ff
.1 iny
lda (ZPCLBuf),y
bne .1
tya
2021-04-29 11:56:34 +00:00
sta CL.Ptr
sta CL.Len
2021-04-11 19:47:48 +00:00
jmp CL.PrintCLBuf
*--------------------------------------
MAN
SAVE usr/src/bin/forth.s.his
LOAD usr/src/bin/forth.s
ASM