home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 128 6
/
q06.d81
/
quicktext.pal
< prev
next >
Wrap
Text File
|
2022-08-28
|
3KB
|
135 lines
.org $1300
;
r0 = $fa ; 16-bit pseudo-reg #0
r1 = r0+2 ; 16-bit pseudo-reg #1
eol = $ae ;
topbase = $35 ; BASIC 7.0's string pointers
beneath = $37 ;
cr = 13 ; carriage-return
;
;
.obj "textfile2array.o"
;
;
sta base ; save pointer to string
stx base+1 ;
;
ldy #0 ; NULL-terminate
tya ; the text file
sta (eol),y ;
;
sta r0 ; Pointer to BASE of
lda #$15 ; BLOADed data
sta r0+1 ;
;
.byte $24 ; Skip over RTS instruction
;
steely = *
;
rts ;
;
;------------------------
;
main = *
;
ldy #0 ; Init index register
;
traffic = *
;
lda (r0),y ; Fetch a character
beq steely ; exit if EOF
;
iny ;
cmp #cr ; Is it a carriage return?
beq kix ; branch if so
;
sta buffer-1,y ; Else store char
bne traffic ; local buffer
;
kix = *
;
cpy #1 ;
bne loco ;
;
lda #$20 ; If the only char on that line
sta buffer ; was a c/r, then substitute a SPACE
clc ;
.byte $2c ; skip next TWO instr's
;
loco = *
;
sec ;
dey ;
;
sty length ; Save length of current line
tya ; Update SOURCE pointer
adc r0 ;
sta r0 ;
bcc cars ;
inc r0+1 ;
;
cars = *
; Adjust 'TOPBASE'
;
sec ; TOPBASE =
lda beneath ; BENEATH-LENGTH
sbc length ;
sta topbase ;
lda beneath+1 ;
sbc #0 ;
sta topbase+1 ;
;
ldy #0 ;
;
legs = *
;
lda buffer,y ; Copy the buffer to
sta (topbase),y ; the destination
iny ;
cpy length ;
bne legs ;
; Copy POINTER to
lda base ; End of String
sta (topbase),y ;
sta r1 ;
iny ;
lda base+1 ;
sta (topbase),y ;
sta r1+1 ;
;
ldy #0 ; MoveW LENGTH,(BASE)
lda length ;
sta (r1),y ;
iny ;
lda topbase ; MoveW [old TOPBASE],(BASE)
sta (r1),y ;
iny ;
lda topbase+1 ;
sta (r1),y ;
;
sec ; BENEATH = TOPBASE - 2
lda topbase ;
sbc #2 ;
sta beneath ;
lda topbase+1 ;
sbc #0 ;
sta beneath+1 ;
;
sec ; BASE = BASE + 3
tya ;
adc base ;
sta base ;
bcc dan ;
inc base+1 ;
;
dan = *
;
jmp main ;
;
;
;
length .buf 1 ;
base .buf 2 ;
temp .buf 2 ;
buffer .buf 1 ;