Use lookup table for hex digits

This commit is contained in:
Joshua Bell 2019-04-12 10:27:55 -06:00
parent f4114b3900
commit 91d91d14c8
2 changed files with 16 additions and 21 deletions

View File

@ -8484,7 +8484,7 @@ tmp: .byte 0
sta file_type
copy16 #type_table, ptr
ldy #num_file_types-1
: lda ($06),y
: lda (ptr),y
cmp file_type
beq found
dey
@ -8499,7 +8499,7 @@ found: tya
copy16 #type_names_table, ptr
ldx #0
: lda ($06),y
: lda (ptr),y
sta str_file_type+1,x
iny
inx
@ -8514,29 +8514,20 @@ not_found:
copy #4, str_file_type
copy #' ', str_file_type+1
copy #'$', str_file_type+2
lda file_type
lsr a
lsr a
lsr a
lsr a
cmp #$0A
bcs L8764
clc
adc #'0' ; 0-9
bne L8767
L8764: clc
adc #'A' - $A ; A-F
L8767: sta str_file_type+3
tax
copy hex_digits,x, str_file_type+3
lda file_type
and #$0F
cmp #$0A
bcs L8778
clc
adc #'0' ; 0-9
bne L877B
L8778: clc
adc #'A' - $A ; A-F
L877B: sta path_buf4
tax
copy hex_digits,x, str_file_type+4
rts
file_type:

View File

@ -929,7 +929,8 @@ window_path_addr_table:
;;; ============================================================
str_file_type: .res 4, 0
str_file_type:
PASCAL_STRING " $00"
;;; ============================================================
@ -1393,9 +1394,12 @@ LEC53: .byte 0
LEC54: .word 0
.res 4, 0
date: .word 0
date: .word 0
.res 7, 0 ; ???
.res 7, 0 ; Used! But where ???
hex_digits:
.byte "0123456789ABCDEF"
;;; --------------------------------------------------