From fa2e3d990dc496bc9149476b7246d344d48ed660 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Mon, 11 Nov 2024 22:59:55 -0800 Subject: [PATCH] About This Apple: Show duplicate SmartPort device names with counts Rather than showing "SmartPort: Devname, Devname, Devname, Devname, ..." until it is cut off, show "SmartPort: DevName (8)" or whatever the actual count is. This only counts adjacent devices with the same name, so if the units are heterogeneous then the list may still be cut off, but it's better than it was. --- RELEASE-NOTES.md | 1 + desk.acc/res/this.apple.res.da | 2 + desk.acc/res/this.apple.res.de | 2 + desk.acc/res/this.apple.res.en | 2 + desk.acc/res/this.apple.res.es | 2 + desk.acc/res/this.apple.res.fr | 2 + desk.acc/res/this.apple.res.it | 2 + desk.acc/res/this.apple.res.nl | 2 + desk.acc/res/this.apple.res.pt | 2 + desk.acc/res/this.apple.res.sv | 2 + desk.acc/this.apple.s | 67 ++++++++++++++++++++++++++++++---- 11 files changed, 78 insertions(+), 8 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index c1566b51..f919980a 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -41,6 +41,7 @@ Project Page: https://github.com/a2stuff/a2d * About This Apple II * Detect Microdigital TK-3000 //e * Detect Pravetz 8A/C + * Show duplicate SmartPort device names with counts. * Screen Dump: Improve use of SSC and IW2. * Print Catalog: Improve use of SSC and IW2. * Options: Add option to show invisible files. diff --git a/desk.acc/res/this.apple.res.da b/desk.acc/res/this.apple.res.da index e9ab58dc..e05c7a70 100644 --- a/desk.acc/res/this.apple.res.da +++ b/desk.acc/res/this.apple.res.da @@ -64,6 +64,8 @@ .define res_string_unknown "(ukendt)" .define res_string_empty "(tom)" .define res_string_none "(ingen)" +.define res_string_duplicate_suffix_pattern " (#)" +.define res_const_duplicate_suffix_pattern_offset1 3 .define res_string_cpu_prefix " CPU: " .define res_string_cpu_type_6502 "6502" .define res_string_cpu_type_65C02 "65C02" diff --git a/desk.acc/res/this.apple.res.de b/desk.acc/res/this.apple.res.de index 144c2d75..5442d7b2 100644 --- a/desk.acc/res/this.apple.res.de +++ b/desk.acc/res/this.apple.res.de @@ -64,6 +64,8 @@ .define res_string_unknown "(unbekannt)" .define res_string_empty "(leer)" .define res_string_none "(keine)" +.define res_string_duplicate_suffix_pattern " (#)" +.define res_const_duplicate_suffix_pattern_offset1 3 .define res_string_cpu_prefix " CPU: " .define res_string_cpu_type_6502 "6502" .define res_string_cpu_type_65C02 "65C02" diff --git a/desk.acc/res/this.apple.res.en b/desk.acc/res/this.apple.res.en index 5f84ad15..080b1b79 100644 --- a/desk.acc/res/this.apple.res.en +++ b/desk.acc/res/this.apple.res.en @@ -64,6 +64,8 @@ .define res_string_unknown "(unknown)" .define res_string_empty "(empty)" .define res_string_none "(none)" +.define res_string_duplicate_suffix_pattern " (#)" +.define res_const_duplicate_suffix_pattern_offset1 3 .define res_string_cpu_prefix " CPU: " .define res_string_cpu_type_6502 "6502" .define res_string_cpu_type_65C02 "65C02" diff --git a/desk.acc/res/this.apple.res.es b/desk.acc/res/this.apple.res.es index cd5633b3..9994d016 100644 --- a/desk.acc/res/this.apple.res.es +++ b/desk.acc/res/this.apple.res.es @@ -64,6 +64,8 @@ .define res_string_unknown "(desconocido)" .define res_string_empty "(vac\x12o)" .define res_string_none "(nada)" +.define res_string_duplicate_suffix_pattern " (#)" +.define res_const_duplicate_suffix_pattern_offset1 3 .define res_string_cpu_prefix " CPU: " .define res_string_cpu_type_6502 "6502" .define res_string_cpu_type_65C02 "65C02" diff --git a/desk.acc/res/this.apple.res.fr b/desk.acc/res/this.apple.res.fr index b24eaf07..785c30e0 100644 --- a/desk.acc/res/this.apple.res.fr +++ b/desk.acc/res/this.apple.res.fr @@ -64,6 +64,8 @@ .define res_string_unknown "(inconnu)" .define res_string_empty "(vide)" .define res_string_none "(aucun)" +.define res_string_duplicate_suffix_pattern " (#)" +.define res_const_duplicate_suffix_pattern_offset1 3 .define res_string_cpu_prefix " CPU : " .define res_string_cpu_type_6502 "6502" .define res_string_cpu_type_65C02 "65C02" diff --git a/desk.acc/res/this.apple.res.it b/desk.acc/res/this.apple.res.it index 7ae15b2b..3946221b 100644 --- a/desk.acc/res/this.apple.res.it +++ b/desk.acc/res/this.apple.res.it @@ -64,6 +64,8 @@ .define res_string_unknown "(sconosciuto)" .define res_string_empty "(vuoto)" .define res_string_none "(nessuno)" +.define res_string_duplicate_suffix_pattern " (#)" +.define res_const_duplicate_suffix_pattern_offset1 3 .define res_string_cpu_prefix " CPU: " .define res_string_cpu_type_6502 "6502" .define res_string_cpu_type_65C02 "65C02" diff --git a/desk.acc/res/this.apple.res.nl b/desk.acc/res/this.apple.res.nl index 8f2289ef..f144b861 100644 --- a/desk.acc/res/this.apple.res.nl +++ b/desk.acc/res/this.apple.res.nl @@ -64,6 +64,8 @@ .define res_string_unknown "(onbekend)" .define res_string_empty "(leeg)" .define res_string_none "(geen)" +.define res_string_duplicate_suffix_pattern " (#)" +.define res_const_duplicate_suffix_pattern_offset1 3 .define res_string_cpu_prefix " CPU: " .define res_string_cpu_type_6502 "6502" .define res_string_cpu_type_65C02 "65C02" diff --git a/desk.acc/res/this.apple.res.pt b/desk.acc/res/this.apple.res.pt index 84f991c9..d6576711 100644 --- a/desk.acc/res/this.apple.res.pt +++ b/desk.acc/res/this.apple.res.pt @@ -64,6 +64,8 @@ .define res_string_unknown "(desconhecido)" .define res_string_empty "(v@cuo)" .define res_string_none "(nenhum)" +.define res_string_duplicate_suffix_pattern " (#)" +.define res_const_duplicate_suffix_pattern_offset1 3 .define res_string_cpu_prefix " CPU: " .define res_string_cpu_type_6502 "6502" .define res_string_cpu_type_65C02 "65C02" diff --git a/desk.acc/res/this.apple.res.sv b/desk.acc/res/this.apple.res.sv index d45ba520..d37fecc3 100644 --- a/desk.acc/res/this.apple.res.sv +++ b/desk.acc/res/this.apple.res.sv @@ -64,6 +64,8 @@ .define res_string_unknown "(ok{nt)" .define res_string_empty "(t|mma)" .define res_string_none "(ingen)" +.define res_string_duplicate_suffix_pattern " (#)" +.define res_const_duplicate_suffix_pattern_offset1 3 .define res_string_cpu_prefix " CPU: " .define res_string_cpu_type_6502 "6502" .define res_string_cpu_type_65C02 "65C02" diff --git a/desk.acc/this.apple.s b/desk.acc/this.apple.s index 32bb2ce8..968cbcf0 100644 --- a/desk.acc/this.apple.s +++ b/desk.acc/this.apple.s @@ -719,9 +719,13 @@ str_unknown: PASCAL_STRING res_string_unknown str_empty: PASCAL_STRING res_string_empty str_none: PASCAL_STRING res_string_none +str_duplicate_suffix: PASCAL_STRING res_string_duplicate_suffix_pattern +kDuplicateCountOffset = res_const_duplicate_suffix_pattern_offset1 + ;;; ============================================================ dib_buffer: .tag SPDIB +kMaxSPDeviceNameLength = SPDIB::Device_Type_Code - SPDIB::Device_Name ;;; ============================================================ ;;; Per Technical Note: Apple II Miscellaneous #7: Apple II Family Identification @@ -2151,6 +2155,9 @@ p65802: return16 #str_65802 ; Other boards support 65802 start: copy #$80, empty_flag + lda #0 + sta str_last + sta duplicate_count ;; Locate SmartPort entry point: $Cn00 + ($CnFF) + 3 ldy #$FF @@ -2219,21 +2226,33 @@ next: dey done: .endscope + str_current := dib_buffer+SPDIB::ID_String_Length + + ;; Empty? + lda dib_buffer+SPDIB::ID_String_Length + IF_ZERO + .assert .strlen(res_string_unknown) < kMaxSPDeviceNameLength, error, "string length" + COPY_STRING str_unknown, str_current + END_IF + + ;; Same as last? + jsr CompareWithLast + IF_EQ + inc duplicate_count + bne next ; always + END_IF + jsr MaybeDrawDuplicateSuffix + COPY_STRING str_current, str_last + ;; Need a comma? bit empty_flag IF_PLUS param_call DrawString, str_list_separator END_IF + copy #0, empty_flag ; saw a unit! ;; Draw the device name - copy #0, empty_flag ; saw a unit! - lda dib_buffer+SPDIB::ID_String_Length - IF_ZERO - ldax #str_unknown - ELSE - ldax #dib_buffer+SPDIB::ID_String_Length - END_IF - jsr DrawString + param_call DrawString, str_current ;; Next! next: lda status_params::unit_num @@ -2243,6 +2262,8 @@ next: lda status_params::unit_num jmp device_loop finish: + jsr MaybeDrawDuplicateSuffix + ;; If no units, populate with "(none)" bit empty_flag IF_MINUS @@ -2252,6 +2273,10 @@ finish: rts +str_last: + .res ::kMaxSPDeviceNameLength+1 +duplicate_count: + .byte 0 empty_flag: .byte 0 num_devices: @@ -2268,6 +2293,32 @@ num_devices: .endproc ; SmartPortCall sp_addr = SmartPortCall::sp_addr +.proc CompareWithLast + lda str_current + cmp str_last + bne ret + tax +: lda str_current,x + cmp str_last,x + bne ret + dex + bne :- +ret: rts +.endproc ; CompareWithLast + +.proc MaybeDrawDuplicateSuffix + ldx duplicate_count + IF_NOT_ZERO + inx + txa + ora #'0' + sta str_duplicate_suffix + kDuplicateCountOffset + param_call DrawString, str_duplicate_suffix + lda #0 + sta duplicate_count + END_IF + rts +.endproc ; MaybeDrawDuplicateSuffix .endproc ; ShowSmartPortDeviceNamesImpl ShowSmartPortDeviceNames := ShowSmartPortDeviceNamesImpl::start