Character masks, and sort directory DA identifications

This commit is contained in:
Joshua Bell 2018-06-01 18:52:26 -07:00
parent 501635259a
commit ad71d77c3d
15 changed files with 77 additions and 72 deletions

View File

@ -1218,7 +1218,7 @@ trydiv: cmp #'/' ; Divide?
ldxy #btn_9::port
jmp do_digit_click
: cmp #$7F ; Delete?
: cmp #CHAR_DELETE ; Delete?
bne end
ldy calc_l
beq end

View File

@ -1041,12 +1041,12 @@ loop: lda L0945
: jsr ensure_page_buffered
more: ldy drawtext_params::textlen
lda (ptr),y
and #$7F ; clear high bit
and #CHAR_MASK
sta (ptr),y
inc L0945
cmp #CHAR_RETURN
beq finish_text_run
cmp #' ' ; space character
cmp #' '
bne :+
sty L0F9B
pha

View File

@ -12,9 +12,8 @@
.org $800
CHAR_MASK := $7F
CASE_MASK := $DF
dir_data_buffer := $0E00
dir_data_buffer_len := $0E00
;;; ============================================================
@ -139,8 +138,8 @@ on_line_buffer:
.byte 0
io_buf := $1C00
buffer := $0E00
buffer_len := $0E00
buffer := dir_data_buffer
buffer_len := dir_data_buffer_len
DEFINE_OPEN_PARAMS open_params, path_buf, io_buf
DEFINE_READ_PARAMS read_params, buffer, buffer_len
@ -366,14 +365,14 @@ L0AE5: return #$FF
;;; ============================================================
.proc L0AE8
lda #$00
lda #0
sta L0B15
jsr L0B40
jsr L0B16
L0AF3: copy16 $06, $08
jsr L0B16
bcs L0B0F
jsr L0B5E
jsr compare_file_entries
bcc L0AF3
jsr swap_entries
lda #$FF
@ -420,9 +419,9 @@ rtcs: sec
;;; ============================================================
L0B40: lda #$01
L0B40: lda #1
sta L0AAF
copy16 #$0E04, $06
copy16 #dir_data_buffer + 4, $06
rts
;;; ============================================================
@ -445,30 +444,33 @@ loop: lda (ptr1),y
.endproc
;;; ============================================================
;;; Compare file entries ($06, $08); order returned in carry.
.proc L0B5E
;;; Uses compare_selection_orders, compare_file_entry_names,
;;; and compare_entry_types_and_names as appropriate.
.proc compare_file_entries
ptr1 := $06
ptr2 := $08
ldy #0
lda (ptr1),y
and #STORAGE_TYPE_MASK ; Active file entry?
bne L0B69
bne :+
jmp rtcc
L0B69: lda (ptr2),y
: lda (ptr2),y
and #STORAGE_TYPE_MASK ; Active file entry?
bne L0B72
bne :+
jmp rtcs
L0B72: lda selected_file_count
beq L0B7F
: lda selected_file_count
beq :+
lda path_index
beq L0B7F
beq :+
jmp compare_selection_orders
L0B7F:
ldax ptr2
: ldax ptr2
jsr check_system_file
bcc rtcc
@ -559,7 +561,7 @@ type: .byte 0
ldx selected_file_count
loop: dex
bmi L0C4A
bmi done1
;; Look up next icon, compare length.
lda selected_file_list,x
@ -600,11 +602,11 @@ next: iny ; skip leading space
cpy #0
bne next
L0C4A: stx match ; match, or $FF if none
done1: stx match ; match, or $FF if none
ldx selected_file_count
loop2: dex
bmi L0CA2
bmi done2
;; Look up next icon, compare length.
lda selected_file_list,x
@ -645,7 +647,7 @@ next2: iny
cpy #0
bne next2
L0CA2: stx match2 ; match, or $FF if none
done2: stx match2 ; match, or $FF if none
lda match
and match2

View File

@ -3404,7 +3404,7 @@ LBB87: MGTK_RELAY2_CALL MGTK::GetEvent, event_params
LBB9A: cmp #MGTK::event_kind_key_down
bne LBB87
lda event_key
and #$7F
and #CHAR_MASK
bit alert_action
bpl LBBEE
cmp #CHAR_ESCAPE

View File

@ -1071,7 +1071,7 @@ L484B: lda ($06),y
bcc L4859
cmp #'z'+1
bcs L4859
and #$DF ; make upper-case
and #CASE_MASK
sta ($06),y
L4859: dey
bne L484B
@ -1430,15 +1430,15 @@ L4AEA: jsr L4B5F
sta L4BB1
tay
L4B81: lda ($06),y
and #$7F
and #CHAR_MASK
cmp #'/'
beq L4B8C
dey
bne L4B81
L4B8C: dey
L4B8D: lda ($06),y
and #$7F
cmp #$2F
and #CHAR_MASK
cmp #'/'
beq L4B98
dey
bne L4B8D
@ -2675,7 +2675,7 @@ L5584: jsr get_event
jmp L55D1
L5595: lda event_params+1
and #$7F
and #CHAR_MASK
cmp #CHAR_RETURN
beq L55D1
cmp #CHAR_ESCAPE
@ -2866,7 +2866,7 @@ L5732: jsr get_event
jmp L578B
L5743: lda event_key
and #$7F
and #CHAR_MASK
cmp #CHAR_RETURN
beq L578B
cmp #CHAR_ESCAPE
@ -8141,7 +8141,7 @@ done: rts
;; Ignore punctuation
: lda (ptr),y
and #$7F
and #CHAR_MASK
cmp #'/'
beq skip
cmp #' '
@ -8154,7 +8154,7 @@ skip: dey
;; Look at previous character - is it a letter?
check: iny
lda (ptr),y
and #$7F
and #CHAR_MASK
cmp #'A'
bcc :+
cmp #'Z' + 1
@ -11703,7 +11703,7 @@ LA6F7: jsr LB9B8
cmp #MGTK::event_modifier_solid_apple
bne LA71A
lda event_key
and #$7F
and #CHAR_MASK
cmp #CHAR_LEFT
bne LA710
jmp LA815
@ -11715,7 +11715,7 @@ LA710: cmp #CHAR_RIGHT
LA717: return #$FF
LA71A: lda event_key
and #$7F
and #CHAR_MASK
cmp #CHAR_LEFT
bne LA72E
bit LD8ED
@ -11917,7 +11917,7 @@ jump_relay:
cmp #MGTK::event_kind_key_down
bne :-
lda event_key
and #$7F
and #CHAR_MASK
cmp #CHAR_ESCAPE
beq close
cmp #CHAR_RETURN
@ -13317,7 +13317,7 @@ loop: dey
done: rts
: lda (ptr),y
and #$7F
and #CHAR_MASK
cmp #'/'
beq :+
cmp #'.'
@ -13328,7 +13328,7 @@ done: rts
check_alpha:
iny
lda (ptr),y
and #$7F
and #CHAR_MASK
cmp #'A'
bcc :+
cmp #'Z'+1

View File

@ -187,7 +187,7 @@ prompt_for_system_disk:
wait: sta KBDSTRB
: lda KBD
bpl :-
and #$7F
and #CHAR_MASK
cmp #$0D ; Return
bne wait
jmp start

View File

@ -5203,7 +5203,7 @@ irq_entry:
lda KBD
bpl end ; no key
and #$7F
and #CHAR_MASK
sta input::key
bit KBDSTRB ; clear strobe
@ -5940,7 +5940,7 @@ loop: jsr get_menu_item
find_by_shortcut:
lda find_shortcut
and #$7F
and #CHAR_MASK
cmp curmenuitem::shortcut1
beq :+
cmp curmenuitem::shortcut2
@ -9411,7 +9411,7 @@ no_modifiers:
lda KBD
bpl :+
stx KBDSTRB
and #$7F
and #CHAR_MASK
sec
: rts
.endproc

View File

@ -1108,7 +1108,7 @@ LD9D1: .byte 0, $A, $C, $10
LD9D5: lda event_modifiers
bne LD9E6
lda event_key
and #$7F
and #CHAR_MASK
cmp #CHAR_ESCAPE
beq LD9E6
jmp LDBFC
@ -1287,7 +1287,7 @@ LDBF3: .addr 0
.endproc
LDBFC: lda event_key
and #$7F
and #CHAR_MASK
cmp #'D'
beq LDC09
cmp #'d'
@ -1738,7 +1738,7 @@ LE10A: dey
LE10F: rts
LE110: lda ($0A),y
and #$7F
and #CHAR_MASK
cmp #'/'
beq LE11C
cmp #'.'
@ -1748,7 +1748,7 @@ LE11C: dey
LE120: iny
lda ($0A),y
and #$7F
and #CHAR_MASK
cmp #'A'
bcc LE132
cmp #'Z'+1
@ -2850,7 +2850,7 @@ LED42: jmp LED79
LED58: cmp #MGTK::event_kind_key_down
bne LED35
lda event_key
and #$7F
and #CHAR_MASK
bit LE941
bmi LED69
jmp LEDE2

View File

@ -1182,7 +1182,7 @@ L1307: sta L124A
sty $06+1
ldy #$01
lda ($06),y
and #$7F
and #CHAR_MASK
cmp #'/'
bne L132C
dey
@ -1196,7 +1196,7 @@ L132C: ldy #0
lda ($06),y
tay
: lda ($06),y
and #$7F
and #CHAR_MASK
sta L14E5,y
dey
bpl :-
@ -1422,11 +1422,11 @@ L1900: stx $06+1
lda ($06),y
tay
L1909: lda ($06),y
cmp #$61
cmp #'a'
bcc L1917
cmp #$7B
cmp #'z'+1
bcs L1917
and #$DF
and #CASE_MASK
sta ($06),y
L1917: dey
bpl L1909

View File

@ -788,7 +788,7 @@ L9822: lda event_modifiers
bne :+
return #$FF
: lda event_key
and #$7F
and #CHAR_MASK
cmp #CHAR_LEFT
bne :+
@ -1509,15 +1509,15 @@ L9E74: sta L9EBF
sta L9EC0
tay
L9E90: lda ($06),y
and #$7F
cmp #$2F
and #CHAR_MASK
cmp #'/'
beq L9E9B
dey
bne L9E90
L9E9B: dey
L9E9C: lda ($06),y
and #$7F
cmp #$2F
and #CHAR_MASK
cmp #'/'
beq L9EA7
dey
bne L9E9C

View File

@ -583,7 +583,7 @@ L567F: lda #$00
jmp L56E1
L568C: lda path_buf,x
and #$7F
and #CHAR_MASK
cmp #'/'
beq L569B
dex
@ -876,7 +876,7 @@ L59B8: rts
;; With modifiers
lda event_key
and #$7F
and #CHAR_MASK
cmp #CHAR_LEFT
bne :+
@ -910,7 +910,7 @@ L59E4: cmp #'0'
;;; Key - without modifiers
L59F7: lda event_key
and #$7F
and #CHAR_MASK
cmp #CHAR_LEFT
bne :+
@ -1679,7 +1679,7 @@ loop: dey
bpl :+
done: rts
: lda ($0A),y
and #$7F ; convert to ASCII
and #CHAR_MASK ; convert to ASCII
cmp #'/'
beq next
cmp #'.'
@ -1689,7 +1689,7 @@ next: dey
check: iny
lda ($0A),y
and #$7F
and #CHAR_MASK
cmp #'A'
bcc L615D
cmp #'Z'+1
@ -2014,7 +2014,7 @@ L64B3: ldy #$00
lda ($06),y
tay
L64B8: lda ($06),y
and #$7F
and #CHAR_MASK
cmp #'.'
beq L64D8
cmp #'/'

View File

@ -133,7 +133,7 @@ L7137: lda $5028,x
ldx path_buf0
beq L7178
L7156: lda path_buf0,x
and #$7F
and #CHAR_MASK
cmp #'/'
beq L7162
dex

View File

@ -414,7 +414,7 @@ L74F4: lda winfo_entrydlg
rts
L7500: lda event_key
and #$7F
and #CHAR_MASK
cmp #'1'
bne L750C
jmp L73FE

View File

@ -573,7 +573,7 @@ loop: iny
loop: lda IN,y
cmp #$80|CHAR_RETURN
beq done
and #$7F
and #CHAR_MASK
sta buffer+1,y
iny
jmp loop
@ -1296,7 +1296,7 @@ L346F: .byte 0
loop: lda IN,y
cmp #$80|CHAR_RETURN
beq done
and #$7F
and #CHAR_MASK
sta path2+1,y
iny
jmp loop
@ -1887,7 +1887,7 @@ read: sta read_params::ref_num
ldy L324A
: lda L324A,y
and #$7F
and #CHAR_MASK
cmp #'/'
beq L38D2
dey
@ -1896,7 +1896,7 @@ read: sta read_params::ref_num
L38D2: dey
sty L324A
L38D6: lda L324A,y
and #$7F
and #CHAR_MASK
cmp #'/'
beq :+
dey
@ -2016,7 +2016,7 @@ str_not_completed:
sta KBDSTRB
loop: lda KBD
bpl loop
and #$7F
and #CHAR_MASK
sta KBDSTRB
cmp #'M'
beq monitor
@ -2069,7 +2069,7 @@ done: rts
lda KBD
bpl wait_enter_escape
sta KBDSTRB
and #$7F
and #CHAR_MASK
cmp #CHAR_ESCAPE
beq done
cmp #CHAR_RETURN

View File

@ -249,6 +249,9 @@ MOUSE_MODE := $0738
;;; Character Constants (Screen/Key Codes)
;;; ============================================================
CHAR_MASK := $7F
CASE_MASK := $DF
CHAR_CTRL_C := $03
CHAR_LEFT := $08
CHAR_TAB := $09