2015-10-19 20:35:00 +00:00
|
|
|
|
PR#3
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2017-07-06 15:30:40 +00:00
|
|
|
|
LOMEM $A00
|
2015-10-19 20:35:00 +00:00
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
2017-09-25 15:50:33 +00:00
|
|
|
|
HIS.Init >LDYAI History.MAX Get a buffer for History
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMem0.YA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
txa
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>STA.G HIS.hBuf
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
|
|
|
|
lda #0
|
2017-09-25 15:50:33 +00:00
|
|
|
|
>STA.G HIS.Count
|
|
|
|
|
>STA.G HIS.Index
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2017-09-08 14:49:23 +00:00
|
|
|
|
HIS.Add >LDA.G HIS.hBuf
|
2015-10-19 20:35:00 +00:00
|
|
|
|
beq .9
|
2017-08-22 06:37:03 +00:00
|
|
|
|
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMemPtr.A
|
2015-10-19 20:35:00 +00:00
|
|
|
|
>STYA ZPPTR1
|
|
|
|
|
|
2017-09-25 15:50:33 +00:00
|
|
|
|
.10 lda #$ff
|
|
|
|
|
jsr HIS.GetA Y=ending 0
|
2017-09-26 06:27:34 +00:00
|
|
|
|
phy
|
2017-09-25 15:50:33 +00:00
|
|
|
|
tya
|
|
|
|
|
|
|
|
|
|
sec add len+1
|
2017-09-26 06:27:34 +00:00
|
|
|
|
>ADC.G CmdBuflen CmdBuffer length
|
|
|
|
|
pla
|
2015-10-19 20:35:00 +00:00
|
|
|
|
bcc .2 enough room
|
|
|
|
|
|
2017-09-26 06:27:34 +00:00
|
|
|
|
ldy #$ff we must remove oldest
|
2017-09-25 15:50:33 +00:00
|
|
|
|
|
|
|
|
|
.12 iny
|
|
|
|
|
lda (ZPPTR1),y get len of oldest string
|
|
|
|
|
bne .12
|
|
|
|
|
|
|
|
|
|
tya
|
|
|
|
|
* 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
|
2017-09-25 15:50:33 +00:00
|
|
|
|
lda (ZPPTR2),y move back until String ending 0 found
|
2015-10-19 20:35:00 +00:00
|
|
|
|
sta (ZPPTR1),y
|
|
|
|
|
bne .1
|
|
|
|
|
|
2017-09-25 15:50:33 +00:00
|
|
|
|
iny
|
|
|
|
|
lda (ZPPTR2),y move back until Array ending 0 found
|
|
|
|
|
sta (ZPPTR1),y
|
|
|
|
|
bne .1
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-09-26 06:27:34 +00:00
|
|
|
|
>DEC.G HIS.Count
|
|
|
|
|
|
2017-09-25 15:50:33 +00:00
|
|
|
|
bra .10 retry....
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-09-26 06:27:34 +00:00
|
|
|
|
.2 clc A = ending O offset
|
2015-10-19 20:35:00 +00:00
|
|
|
|
adc ZPPTR1
|
2017-09-26 06:27:34 +00:00
|
|
|
|
sta ZPPTR1
|
|
|
|
|
bcc .3
|
|
|
|
|
inc ZPPTR1+1
|
|
|
|
|
|
2017-09-25 15:50:33 +00:00
|
|
|
|
.3 ldy #$ff
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-09-25 15:50:33 +00:00
|
|
|
|
.4 iny
|
|
|
|
|
lda (ZPCMDBuf),y
|
2015-10-19 20:35:00 +00:00
|
|
|
|
sta (ZPPTR1),y
|
2017-09-25 15:50:33 +00:00
|
|
|
|
bne .4
|
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
iny
|
2017-09-25 15:50:33 +00:00
|
|
|
|
sta (ZPPTR1),y set new array ending 0
|
|
|
|
|
* lda #0
|
|
|
|
|
>STA.G HIS.Index Reset Index
|
2017-09-08 14:49:23 +00:00
|
|
|
|
|
2017-09-25 15:50:33 +00:00
|
|
|
|
>INC.G HIS.Count
|
|
|
|
|
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2017-09-08 14:49:23 +00:00
|
|
|
|
HIS.GetPrev >LDA.G HIS.hBuf
|
2015-10-19 20:35:00 +00:00
|
|
|
|
beq HISTORY.RTS
|
|
|
|
|
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMemPtr.A
|
2015-10-19 20:35:00 +00:00
|
|
|
|
>STYA ZPPTR1
|
|
|
|
|
|
2017-09-25 15:50:33 +00:00
|
|
|
|
>LDA.G HIS.Count
|
|
|
|
|
beq HISTORY.RTS empty history,nothing to do
|
|
|
|
|
|
|
|
|
|
>LDA.G HIS.Index
|
|
|
|
|
bne .1
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-09-25 15:50:33 +00:00
|
|
|
|
>LDA.G HIS.Count
|
2016-04-28 14:55:22 +00:00
|
|
|
|
|
2017-09-25 15:50:33 +00:00
|
|
|
|
.1 dec
|
|
|
|
|
>STA.G HIS.Index
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-09-26 15:55:25 +00:00
|
|
|
|
bra HIS.SetA
|
2017-09-25 15:50:33 +00:00
|
|
|
|
|
2015-10-19 20:35:00 +00:00
|
|
|
|
History.RTS rts
|
|
|
|
|
*--------------------------------------
|
2017-09-08 14:49:23 +00:00
|
|
|
|
HIS.GetNext >LDA.G HIS.hBuf
|
2015-10-19 20:35:00 +00:00
|
|
|
|
beq HISTORY.RTS
|
|
|
|
|
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMemPtr.A
|
2015-10-19 20:35:00 +00:00
|
|
|
|
>STYA ZPPTR1
|
|
|
|
|
|
2017-09-25 15:50:33 +00:00
|
|
|
|
>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
|
2017-09-26 15:55:25 +00:00
|
|
|
|
>STA.G HIS.Index
|
2017-11-08 16:09:52 +00:00
|
|
|
|
jmp CL.CLR
|
2017-09-25 15:50:33 +00:00
|
|
|
|
|
2017-09-26 15:55:25 +00:00
|
|
|
|
.1 >STA.G HIS.Index
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
HIS.SetA jsr HIS.GetA
|
|
|
|
|
|
|
|
|
|
tya
|
|
|
|
|
clc
|
|
|
|
|
adc ZPPTR1
|
|
|
|
|
sta ZPPTR1
|
|
|
|
|
bcc .1
|
|
|
|
|
inc ZPPTR1+1
|
|
|
|
|
|
2017-11-08 16:09:52 +00:00
|
|
|
|
.1 jsr CL.CLR
|
2017-09-25 15:50:33 +00:00
|
|
|
|
|
2017-09-26 15:55:25 +00:00
|
|
|
|
ldy #$ff
|
|
|
|
|
|
|
|
|
|
.2 iny
|
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
sta (ZPCMDBuf),y
|
|
|
|
|
bne .2
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-09-27 15:40:31 +00:00
|
|
|
|
tya
|
|
|
|
|
>STA.G CmdBufPtr
|
|
|
|
|
>STA.G CmdBuflen
|
|
|
|
|
|
2017-11-08 16:09:52 +00:00
|
|
|
|
jmp CL.PRINT
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
2017-09-26 15:55:25 +00:00
|
|
|
|
HIS.GetA ldy #0
|
|
|
|
|
|
|
|
|
|
tax
|
|
|
|
|
beq .80
|
2017-09-25 15:50:33 +00:00
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
2017-09-26 15:55:25 +00:00
|
|
|
|
.8 iny
|
|
|
|
|
|
|
|
|
|
.80 clc
|
2017-09-25 15:50:33 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-09-08 14:49:23 +00:00
|
|
|
|
HIS.Quit >LDA.G HIS.hBuf
|
2015-10-19 20:35:00 +00:00
|
|
|
|
beq .9
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL FreeMem.A
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2017-03-29 15:48:15 +00:00
|
|
|
|
SAVE /A2OSX.SRC/SBIN/SHELL.S.HIS
|
|
|
|
|
LOAD /A2OSX.SRC/SBIN/SHELL.S
|
2015-10-19 20:35:00 +00:00
|
|
|
|
ASM
|