Finish labels

This commit is contained in:
Joshua Bell 2017-12-09 16:17:29 -08:00
parent ece57e671c
commit 6a0a6c5ad9

32
b.s
View File

@ -132,6 +132,8 @@ ASCII_ESCAPE := $1B
entries_per_block := $6F entries_per_block := $6F
file_count := $70 ; 2 bytes file_count := $70 ; 2 bytes
entry_num := $72
max_entries := 128 ; max # of entries; more are ignored max_entries := 128 ; max # of entries; more are ignored
types_table := $74 ; high bit clear = dir, set = sys types_table := $74 ; high bit clear = dir, set = sys
@ -232,7 +234,7 @@ check_device:
sta read_params_request sta read_params_request
lda #1 lda #1
sta $72 ; ??? sta entry_num ; ???
stz mark_position+1 stz mark_position+1
stz mark_position+2 stz mark_position+2
@ -244,32 +246,38 @@ finish_read2:
bra finish_read bra finish_read
next_file_entry: next_file_entry:
bit file_count+1 bit file_count+1 ; wrap around?
bmi finish_read2 bmi finish_read2
;; TODO: The math here is mysterious; understand and document
floop: lda mark_position+1 floop: lda mark_position+1
and #$FE and #$FE
sta mark_position+1 sta mark_position+1
ldy $72 ldy entry_num
lda #0 lda #0
cpy entries_per_block cpy entries_per_block
bcc L10CE bcc :+
tay tay
sty $72 sty entry_num
inc mark_position+1 inc mark_position+1
L10CC: inc mark_position+1 carry: inc mark_position+1
L10CE: dey : dey
clc clc
bmi L10D8 bmi :+
adc entry_length adc entry_length
bcc L10CE bcc :-
bcs L10CC bcs carry
L10D8: adc #4
: adc #4
sta mark_position sta mark_position
MLI_CALL SET_MARK, mark_params MLI_CALL SET_MARK, mark_params
bcs finish_read2 bcs finish_read2
jsr do_read jsr do_read
bcs finish_read2 bcs finish_read2
inc $72
inc entry_num
lda read_buffer + FileEntry::storage_type lda read_buffer + FileEntry::storage_type
and #$F0 ; mask off storage_type and #$F0 ; mask off storage_type
beq floop ; inactive file entry beq floop ; inactive file entry