From 9590bc4b9e757160dd07294a30fa9301da730661 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Thu, 1 Sep 2022 20:38:07 -0700 Subject: [PATCH] BuhBye: Cycle through volumes after the boot volume more intuitively Previously, the boot volume was shown first, but then tab would cycle from the highest priority volume to the lowest. This would be awkward if the boot volume was not the highest priority volume. For example, with these devices (listed lowest to highest priority, like DEVLST), /HD1 is the boot volume but the RAM disks are highest priority: (low) /FLOPPY2 /FLOPPY1 /HD4 /HD3 /HD2 /HD1 /RAMWORKS /RAM (high) Prior to this fix, it would cycle: /HD1 /RAM /RAMWORKS /HD1 /HD2 /HD3 /HD4 /FLOPPY1 /FLOPPY2 /RAM ... After this fix, it will cycle: /HD1 /HD2 /HD3 /HD4 /FLOPPY1 /FLOPPY2 /RAM /RAMWORKS /HD1 ... To fit, a little bit of code golfing was necessary. --- selectors/buhbye.system.s | 41 ++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/selectors/buhbye.system.s b/selectors/buhbye.system.s index b4abbcc..564b9c0 100644 --- a/selectors/buhbye.system.s +++ b/selectors/buhbye.system.s @@ -100,7 +100,7 @@ loop: lda (src_ptr) ; *src_ptr = *dst_ptr read_buffer := $2000 ; Also, start location for launched SYS files ;; Device/Prefix enumeration - next_device_num := $65 ; next device number to try + cur_device_num := $65 ; device number to try prefix_depth := $6B ; 0 = root ;; Directory enumeration @@ -146,22 +146,23 @@ loop: lda (src_ptr) ; *src_ptr = *dst_ptr sta BITMAP ;; Find device - lda DEVCNT ; max device num - sta next_device_num - lda DEVNUM - bne check_device + ldx DEVCNT +: lda DEVLST,x + and #%11110000 + cmp DEVNUM + beq check_device + dex + bra :- next_device: - ldx next_device_num - lda DEVLST,x - cpx #1 - bcs :+ + ldx cur_device_num + dex + bpl :+ ldx DEVCNT - inx -: dex - stx next_device_num +: lda DEVLST,x check_device: + stx cur_device_num sta on_line_params_unit MLI_CALL ON_LINE, on_line_params bcs next_device @@ -256,9 +257,9 @@ store_entry: sta (curr_ptr),y dey bpl :- - iny ; Y = 0; storage_type/name_length in A + ; storage_type/name_length in A and #%00001111 ; mask off name_length (remove storage_type) - sta (curr_ptr),y ; store length + sta (curr_ptr) ; store length inc num_entries @@ -300,9 +301,9 @@ next_in_block: lda entry_pointer adc entry_length sta entry_pointer - lda entry_pointer+1 - adc #0 - sta entry_pointer+1 + bcc :+ + inc entry_pointer+1 +: inc block_entries @@ -568,9 +569,9 @@ loop: lda help_string,y clc adc curr_ptr+1 sta curr_ptr+1 - ldy #0 - lda (curr_ptr),y + lda (curr_ptr) sta curr_len + ldy #0 ; needed by caller ;; fall through .endproc @@ -691,7 +692,7 @@ cout: jmp COUT ;;; ------------------------------------------------------------ .endproc - .assert .sizeof(selector) <= max_size, error, "Must fit in $300 bytes" + .assert .sizeof(selector) <= max_size, error, .sprintf("Must fit in $300 bytes, is: $%x", .sizeof(selector)) install_size = .sizeof(selector) poporg