A2osX/BIN/SH.S.HIS.txt

137 lines
2.6 KiB
Plaintext
Raw Normal View History

NEW
2019-06-02 08:58:46 +00:00
AUTO 3,1
2015-10-19 20:35:00 +00:00
.LIST OFF
*--------------------------------------
2019-04-01 06:07:56 +00:00
HIS.Init >LDYAI HISTORY.MAX Get a buffer for History
2018-07-13 14:38:24 +00:00
>SYSCALL GetMem0
2015-10-19 20:35:00 +00:00
bcs .9
txa
>STA.G HIS.hBuf
2015-10-19 20:35:00 +00:00
lda #0
>STA.G HIS.Count
>STA.G HIS.Index
2015-10-19 20:35:00 +00:00
.9 rts
*--------------------------------------
2019-04-01 06:07:56 +00:00
HIS.Quit >LDA.G HIS.hBuf
beq .9
>SYSCALL FreeMem
.9 rts
*--------------------------------------
HIS.Add >LDA.G HIS.hBuf
2015-10-19 20:35:00 +00:00
beq .9
2018-07-13 14:38:24 +00:00
>SYSCALL GetMemPtr
2015-10-19 20:35:00 +00:00
>STYA ZPPTR1
.10 lda #$ff
jsr HIS.GetA Y=ending 0
phy
tya
sec add len+1
2019-08-05 13:30:58 +00:00
>ADC.G CL.Len CmdBuffer length
pla
2015-10-19 20:35:00 +00:00
bcc .2 enough room
2019-08-05 13:30:58 +00:00
jsr GetPtr1LenY get len of oldest string
tya
2019-10-03 06:25:27 +00:00
* sec
2015-10-19 20:35:00 +00:00
adc ZPPTR1
sta ZPPTR2
lda ZPPTR1+1
adc #0
sta ZPPTR2+1
ldy #$FF
.1 iny
lda (ZPPTR2),y move back until String ending 0 found
2015-10-19 20:35:00 +00:00
sta (ZPPTR1),y
bne .1
iny
lda (ZPPTR2),y move back until Array ending 0 found
sta (ZPPTR1),y
bne .1
>DEC.G HIS.Count
bra .10 retry....
2019-07-31 15:10:59 +00:00
.2 jsr AddAPtr1 A = ending O offset
ldy #$ff
.4 iny
lda (ZPCLBuf),y
2015-10-19 20:35:00 +00:00
sta (ZPPTR1),y
bne .4
iny
sta (ZPPTR1),y set new array ending 0
2019-10-03 06:25:27 +00:00
* lda #0
>STA.G HIS.Index Reset Index
>INC.G HIS.Count
2015-10-19 20:35:00 +00:00
.9 rts
*--------------------------------------
HIS.GetPrev >LDA.G HIS.hBuf
2015-10-19 20:35:00 +00:00
beq HISTORY.RTS
2018-07-13 14:38:24 +00:00
>SYSCALL GetMemPtr
2015-10-19 20:35:00 +00:00
>STYA ZPPTR1
>LDA.G HIS.Count
beq HISTORY.RTS empty history,nothing to do
>LDA.G HIS.Index
bne .1
>LDA.G HIS.Count
.1 dec
>STA.G HIS.Index
bra HIS.SetA
2015-10-19 20:35:00 +00:00
History.RTS rts
*--------------------------------------
HIS.GetNext >LDA.G HIS.hBuf
2015-10-19 20:35:00 +00:00
beq HISTORY.RTS
2018-07-13 14:38:24 +00:00
>SYSCALL GetMemPtr
2015-10-19 20:35:00 +00:00
>STYA ZPPTR1
>LDA.G HIS.Count
beq HISTORY.RTS empty history,nothing to do
>LDA.G HIS.Index
inc
>CMP.G HIS.Count
bne .1
lda #0
>STA.G HIS.Index
jmp CL.CLR
.1 >STA.G HIS.Index
*--------------------------------------
HIS.SetA jsr HIS.GetA
tya
2019-07-31 15:10:59 +00:00
jsr AddAPtr1
jsr CL.CLR
ldy #$ff
.2 iny
lda (ZPPTR1),y
sta (ZPCLBuf),y
bne .2
tya
2018-11-10 14:30:09 +00:00
>STA.G CL.Ptr
>STA.G CL.Len
2019-01-26 21:46:39 +00:00
jmp CL.PrintCLBuf
2015-10-19 20:35:00 +00:00
*--------------------------------------
HIS.GetA ldy #0
tax
beq .80
lda (ZPPTR1),y
beq .9
.1 iny
lda (ZPPTR1),y
bne .1
dex
beq .8
iny
lda (ZPPTR1),y
bne .1
.9 sec Found ending 0....
rts
.8 iny
.80 clc
rts
*--------------------------------------
2015-10-19 20:35:00 +00:00
MAN
2019-02-08 16:13:43 +00:00
SAVE USR/SRC/BIN/SH.S.HIS
LOAD USR/SRC/BIN/SH.S
2015-10-19 20:35:00 +00:00
ASM