diff --git a/README.md b/README.md new file mode 100644 index 0000000..684a620 --- /dev/null +++ b/README.md @@ -0,0 +1,61 @@ +# Bird's Better Bye - Diassembly (and improvements) + +The ProDOS operating system for the Apple II personal computer line +supported a quit routine (invoked from BASIC with the `BYE` command) +allowing the user to type the name of a system file to invoke once +the previous system file had exited. + +[Alan Bird](https://alanlbird.wordpress.com/products/) wrote a +replacement called **Bird's Better Bye** that would patch itself into +ProDOS, fitting into a tight 768 bytes. It provides a menu system, +allowing selection of system files (with the arrow keys), directories +(with the return key to enter and escape key to exit), and devices +(with the tab key), with a minimal and stylish 80-column display using +MouseText folder glyphs. + +Later official versions of ProDOS replaced the previous quit routine +with _Bird's Better Bye_. + +## ProDOS 2.4 / Bitsy Bye + +The new (unofficial) releases of +[ProDOS 2.4](http://www.callapple.org/uncategorized/announcing-prodos-2-4-for-all-apple-ii-computers/) +by John Brooks include a replacement quit routine called Bitsy Bye. +This new quit routine is far more powerful, allowing access to BASIC +and binary files (and more), drive selection, type-down, more entries, +and so on. It runs on older hardware than _Bird's Better Bye_ so +uses only 40 columns, and does not require a 65C02 processor. + +Impressed though I am with the power of Bitsy Bye, I am not a fan of +its aesthetics - the display is "cluttered" to my eye. + +## BYE.SYSTEM + +Aeons ago, Dave Cotter created BYE.SYSTEM which would patch _Bird's +Better Bye_ back into ProDOS if it had been replaced. It can be found +at: + +http://www.lazilong.com/apple_ii/bye.sys/bye.html + +Since I really liked the look of _Bird's Better Bye_ I used this as +the boot system for my virtual hard drive (occuring after some [clock +drivers](https://github.com/inexorabletash/cricket)). + +## Buh-Bye + +But... I really wanted a way to quickly scroll through my games list. +So I set out to improve _Bird's Better Bye_ by disassembling it (and +the `BYE.SYSTEM` installer), thus ending up with "Bell's Better Bird's +Better Bye" or "Buh-Bye" for short. + +The changes are so far pretty minimal since my 6502 skills are not, +in fact, mad, and there are only 768 bytes to play with. + +I replaced the directory enumeration logic with tighter code as +outlined in the ProDOS Technical Reference Manual, and along with +other optimizations I made enough room to add seeking if an +alphabetical key is typed (hit 'C' and the list will scroll to the +next file starting with 'C'). + +There are a few spare bytes to play with and more can be squeezed +out, so perhaps further improvements can be made. diff --git a/buhbye.system.s b/buhbye.system.s index 7190ef1..116838e 100644 --- a/buhbye.system.s +++ b/buhbye.system.s @@ -237,11 +237,11 @@ while_loop: ldy #FileEntry::file_type lda (entry_pointer),y cmp #FileType::Directory - beq good_entry + beq store_entry cmp #FileType::System bne done_active_entry -good_entry: +store_entry: ;; Store type ldx num_entries sta types_table,x @@ -339,8 +339,9 @@ close_dir: : stz current_entry stz page_start lda num_entries - beq keyboard_loop ; no entries (empty directory) + beq selection_loop_keyboard_loop ; no entries (empty directory) + ;; Draw entries cmp #bottom_row ; more entries than fit? bcc :+ lda #(bottom_row - top_row + 1) @@ -356,7 +357,7 @@ loop: jsr draw_current_line dec row_count bne loop stz current_entry - beq draw_current_line_inv + beq selection_loop .endproc ;;; ------------------------------------------------------------ @@ -382,19 +383,19 @@ handy_rts: .proc on_down jsr down_common - bra draw_current_line_inv + bra selection_loop .endproc ;;; ------------------------------------------------------------ .proc on_up - ldx current_entry - beq draw_current_line_inv ; first one? just redraw - dec current_entry ; go to previous + ldx current_entry ; first one? + beq selection_loop + dec current_entry ; go to previous lda CV cmp #top_row ; at the top? - bne draw_current_line_inv ; if not, just draw + bne selection_loop dec page_start ; yes, adjust page and lda #ASCII_SYN ; scroll screen up jsr COUT @@ -403,14 +404,11 @@ handy_rts: ;;; ------------------------------------------------------------ -draw_current_line_inv: +.proc selection_loop jsr SETINV jsr draw_current_line - ;; fall through -;;; ------------------------------------------------------------ - -.proc keyboard_loop +keyboard_loop: lda KBD bpl keyboard_loop sta KBDSTRB @@ -436,6 +434,7 @@ draw_current_line_inv: beq on_up ;; fall through .endproc + selection_loop_keyboard_loop := selection_loop::keyboard_loop ;;; ------------------------------------------------------------ @@ -446,7 +445,7 @@ loop: jsr down_common and #$5F ; make ASCII and uppercase ldy #1 cmp (curr_ptr),y ; key = first char ? - beq draw_current_line_inv + beq selection_loop bra loop .endproc @@ -466,7 +465,7 @@ loop: jsr down_common bcc :+ pla ; yes - abort subroutine pla - bra draw_current_line_inv + bra selection_loop : sta current_entry ; go to next