diff --git a/CONFIG.md b/CONFIG.md index aace455b..edb75812 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -169,23 +169,13 @@ Allows to assign command to any function key, `RUN` key and `HELP` key (if selec Needs 25 bytes more space in KERNAL segment for the code. In addition, each configured key takes 3 bytes + length of the command. -## Eye candy +## Screen editor -### `CONFIG_COLORS_BRAND` +### `CONFIG_EDIT_STOPQUOTE` -Tries to adjust the color scheme to the selected brand. Some brands might not support this. +If enabled, STOP key terminates insert/quote mode (like on BlackBox cartridge). -### `CONFIG_BANNER_SIMPLE`, `CONFIG_BANNER_FANCY`, `CONFIG_BANNER_BRAND` - -Select startup banner - either a simple one, or with some colorful elements. `CONFIG_BANNER_BRAND` heavily depends on the selected brand, not all the brands support it. - -Richer banners need more BASIC segment, varies between brands. - -### `CONFIG_BANNER_PAL_NTSC` - -If enabled, prints video system on startup banner. Eye candy only. - -Feature needs some bytes in BASIC (depending on banner type) and about 25 bytes in KERNAL segment. +Feature needs 10 bytes in KERNAL segment. If unsure - enable. ## Software features @@ -207,6 +197,24 @@ On the most widespread CPUs the D flag is not cleared upon entering interrupts. Feature needs 2 bytes in KERNAL segmment (for CPUs needing the patch), but at the same time allows optimizations allowing to gain some more bytes. If unsure - enable. +## Eye candy + +### `CONFIG_COLORS_BRAND` + +Tries to adjust the color scheme to the selected brand. Some brands might not support this. + +### `CONFIG_BANNER_SIMPLE`, `CONFIG_BANNER_FANCY`, `CONFIG_BANNER_BRAND` + +Select startup banner - either a simple one, or with some colorful elements. `CONFIG_BANNER_BRAND` heavily depends on the selected brand, not all the brands support it. + +Richer banners need more BASIC segment, varies between brands. + +### `CONFIG_BANNER_PAL_NTSC` + +If enabled, prints video system on startup banner. Eye candy only. + +Feature needs some bytes in BASIC (depending on banner type) and about 25 bytes in KERNAL segment. + ## Debug options Options in this section are for debug purposes only. If unsure - disable. diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index 9fdebcbd..f6e34b61 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -41,6 +41,7 @@ // I/O devices #define CONFIG_IEC // please keep enabled for now +// #define CONFIG_IEC_JIFFYDOS // please keep disabled for now // #define CONFIG_TAPE_NORMAL // please keep disabled for now // #define CONFIG_TAPE_TURBO // please keep disabled for now // #define CONFIG_RS232_UP2400 // please keep disabled for now @@ -95,13 +96,9 @@ .const CONFIG_KEYCMD_F14 = @"" -// Eye candy +// Screen editor -#define CONFIG_COLORS_BRAND -// #define CONFIG_BANNER_SIMPLE -#define CONFIG_BANNER_FANCY -// #define CONFIG_BANNER_BRAND -#define CONFIG_SHOW_PAL_NTSC +#define CONFIG_EDIT_STOPQUOTE // Software features @@ -111,6 +108,15 @@ #define CONFIG_BCD_SAFE_INTERRUPTS +// Eye candy + +#define CONFIG_COLORS_BRAND +// #define CONFIG_BANNER_SIMPLE +#define CONFIG_BANNER_FANCY +// #define CONFIG_BANNER_BRAND +#define CONFIG_SHOW_PAL_NTSC + + // Debug options // #define CONFIG_DBG_STUBS_BRK diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index 1f003c0b..6e9b9c84 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -43,6 +43,7 @@ // I/O devices #define CONFIG_IEC // please keep enabled for now +// #define CONFIG_IEC_JIFFYDOS // please keep disabled for now // #define CONFIG_TAPE_NORMAL // please keep disabled for now // #define CONFIG_TAPE_TURBO // please keep disabled for now // #define CONFIG_RS232_UP2400 // please keep disabled for now @@ -97,13 +98,9 @@ .const CONFIG_KEYCMD_F14 = @"" -// Eye candy +// Screen editor -#define CONFIG_COLORS_BRAND -// #define CONFIG_BANNER_SIMPLE -// #define CONFIG_BANNER_FANCY -#define CONFIG_BANNER_BRAND -// #define CONFIG_SHOW_PAL_NTSC +#define CONFIG_EDIT_STOPQUOTE // Software features @@ -113,6 +110,15 @@ #define CONFIG_BCD_SAFE_INTERRUPTS +// Eye candy + +#define CONFIG_COLORS_BRAND +// #define CONFIG_BANNER_SIMPLE +// #define CONFIG_BANNER_FANCY +#define CONFIG_BANNER_BRAND +// #define CONFIG_SHOW_PAL_NTSC + + // Debug options // #define CONFIG_DBG_STUBS_BRK diff --git a/c64/,,config_testing.s b/c64/,,config_testing.s index b8364118..01b3142b 100644 --- a/c64/,,config_testing.s +++ b/c64/,,config_testing.s @@ -42,6 +42,7 @@ // I/O devices #define CONFIG_IEC // please keep enabled for now +// #define CONFIG_IEC_JIFFYDOS // please keep disabled for now // #define CONFIG_TAPE_NORMAL // please keep disabled for now // #define CONFIG_TAPE_TURBO // please keep disabled for now // #define CONFIG_RS232_UP2400 // please keep disabled for now @@ -96,13 +97,9 @@ .const CONFIG_KEYCMD_F14 = @"" -// Eye candy +// Screen editor -// #define CONFIG_COLORS_BRAND -// #define CONFIG_BANNER_SIMPLE -#define CONFIG_BANNER_FANCY -// #define CONFIG_BANNER_BRAND -// #define CONFIG_SHOW_PAL_NTSC +#define CONFIG_EDIT_STOPQUOTE // Software features @@ -112,6 +109,15 @@ #define CONFIG_BCD_SAFE_INTERRUPTS +// Eye candy + +// #define CONFIG_COLORS_BRAND +// #define CONFIG_BANNER_SIMPLE +#define CONFIG_BANNER_FANCY +// #define CONFIG_BANNER_BRAND +// #define CONFIG_SHOW_PAL_NTSC + + // Debug options // #define CONFIG_DBG_STUBS_BRK diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index a1209988..3c829b77 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -41,6 +41,7 @@ // I/O devices #define CONFIG_IEC // please keep enabled for now +// #define CONFIG_IEC_JIFFYDOS // please keep disabled for now // #define CONFIG_TAPE_NORMAL // please keep disabled for now // #define CONFIG_TAPE_TURBO // please keep disabled for now // #define CONFIG_RS232_UP2400 // please keep disabled for now @@ -95,13 +96,9 @@ .const CONFIG_KEYCMD_F14 = @"" -// Eye candy +// Screen editor -#define CONFIG_COLORS_BRAND -// #define CONFIG_BANNER_SIMPLE -#define CONFIG_BANNER_FANCY -// #define CONFIG_BANNER_BRAND -#define CONFIG_SHOW_PAL_NTSC +#define CONFIG_EDIT_STOPQUOTE // Software features @@ -111,6 +108,15 @@ #define CONFIG_BCD_SAFE_INTERRUPTS +// Eye candy + +#define CONFIG_COLORS_BRAND +// #define CONFIG_BANNER_SIMPLE +#define CONFIG_BANNER_FANCY +// #define CONFIG_BANNER_BRAND +#define CONFIG_SHOW_PAL_NTSC + + // Debug options // #define CONFIG_DBG_STUBS_BRK diff --git a/c64/aliases/,aliases_config.s b/c64/aliases/,aliases_config.s index 3a231e52..23f5d173 100644 --- a/c64/aliases/,aliases_config.s +++ b/c64/aliases/,aliases_config.s @@ -109,6 +109,10 @@ // Check that I/O configuration is correct { +#if CONFIG_IEC_JIFFYDOS && !CONFIG_IEC + .error "CONFIG_IEC_JIFFYDOS requires CONFIG_IEC" +#endif + .var selected_rs232 = 0; #if CONFIG_RS232_UP2400 diff --git a/c64/aliases/,aliases_ram_lowmem.s b/c64/aliases/,aliases_ram_lowmem.s index 905446dc..10852ad2 100644 --- a/c64/aliases/,aliases_ram_lowmem.s +++ b/c64/aliases/,aliases_ram_lowmem.s @@ -154,8 +154,8 @@ .label LDTBL = $D9 // $D9-$F2 screen line link table, [!] our usage is different XXX give more details .label USER = $F3 // $F3-$F4 pointer to current color RAM location .label KEYTAB = $F5 // $F5-$F6 pointer to keyboard lookup table - .label RIBUF = $F7 // $F7-$F8 -- NOT IMPLEMENTED -- - .label ROBUF = $F9 // $F9-$FA -- NOT IMPLEMENTED -- + .label RIBUF = $F7 // $F7-$F8 -- NOT IMPLEMENTED -- XXX WIP + .label ROBUF = $F9 // $F9-$FA -- NOT IMPLEMENTED -- XXX WIP // $FB $FB-$FE -- UNUSED -- free for user software .label BASZPT = $FF // -- NOT IMPLEMENTED -- @@ -202,10 +202,10 @@ .label BITNUM = $298 // -- NOT IMPLEMENTED -- .label BAUDOF = $299 // $299-$29A -- NOT IMPLEMENTED -- #endif - .label RIDBE = $29B // -- NOT IMPLEMENTED -- - .label RIDBS = $29C // -- NOT IMPLEMENTED -- - .label RODBS = $29D // -- NOT IMPLEMENTED -- - .label RODBE = $29E // -- NOT IMPLEMENTED -- + .label RIDBE = $29B // -- NOT IMPLEMENTED -- XXX WIP + .label RIDBS = $29C // -- NOT IMPLEMENTED -- XXX WIP + .label RODBS = $29D // -- NOT IMPLEMENTED -- XXX WIP + .label RODBE = $29E // -- NOT IMPLEMENTED -- XXX WIP .label IRQTMP = $29F // $29F-$2A0 -- NOT IMPLEMENTED -- .label ENABL = $2A1 // -- NOT IMPLEMENTED -- .label TODSNS = $2A2 // -- NOT IMPLEMENTED -- diff --git a/c64/kernal/screen/chrout_screen_clr.s b/c64/kernal/screen/chrout_screen_clr.s new file mode 100644 index 00000000..ab9469dd --- /dev/null +++ b/c64/kernal/screen/chrout_screen_clr.s @@ -0,0 +1,9 @@ + +// +// CLR key handling within CHROUT +// + +chrout_screen_CLR: + + jsr clear_screen + jmp chrout_screen_done diff --git a/c64/kernal/screen/chrout_screen_control.s b/c64/kernal/screen/chrout_screen_control.s index ff4f5706..61fa2f4e 100644 --- a/c64/kernal/screen/chrout_screen_control.s +++ b/c64/kernal/screen/chrout_screen_control.s @@ -15,7 +15,7 @@ chrout_screen_control: chrout_try_RETURN: - cmp #$0D + cmp #KEY_RETURN bne !+ // RETURN clears quote and insert modes, it also clears reverse flag @@ -27,156 +27,60 @@ chrout_try_RETURN: !: chrout_try_DEL: - cmp #$14 + cmp #KEY_DEL bne !+ - jmp chrout_screen_del + jmp chrout_screen_DEL !: +#if CONFIG_EDIT_STOPQUOTE +chrout_try_STOP: + + cmp #KEY_STOP + bne !+ + + lda #$00 + sta QTSW + sta INSRT + // Let it run, we are saving 3 bytes on JMP this way + // and the performance hit is not going to be visible nevertheless +!: +#endif chrout_try_quote: lda QTSW ora INSRT beq !+ + txa jmp chrout_screen_quote !: txa -chrout_try_CRSR_UP: +chrout_try_jumptable: - cmp #$91 + ldx #(__chrout_screen_jumptable_codes_end - chrout_screen_jumptable_codes - 1) +chrout_try_jumptable_loop: + cmp chrout_screen_jumptable_codes, x bne !+ - - lda PNTR - sec - sbc #40 - sta PNTR - jmp chrout_screen_calc_lptr_done + // Found, perform a jump to subroutine + lda chrout_screen_jumptable_hi, x + pha + lda chrout_screen_jumptable_lo, x + pha + rts !: -chrout_try_CRSR_DOWN: + dex + bpl chrout_try_jumptable_loop - cmp #$11 - bne !+ - - lda PNTR - clc - adc #40 - sta PNTR - // We need to advance the pointer manually, as normalising - // now will break things. The pointer update is required - // so that we can tell if we really are on the bottom phys - // screen line or not - jsr screen_scroll_up_if_on_last_line - jmp chrout_screen_calc_lptr_done -!: -chrout_try_CRSR_LEFT: - - cmp #$9D - bne !+ - - lda TBLX - ora PNTR - beq crsr_l1 // recalculating pointer is not really necessary, but this is a very rare case nevertheless - dec PNTR -crsr_l1: - jmp chrout_screen_calc_lptr_done -!: -chrout_try_CRSR_RIGHT: - - cmp #$1D - bne !+ - - inc PNTR - jmp chrout_screen_calc_lptr_done -!: -chrout_try_RVS_ON: - - cmp #$12 - bne !+ - - lda #$80 - bne rvs_l1 -!: -chrout_try_RVS_OFF: - - cmp #$92 - bne !+ - - lda #$00 -rvs_l1: - sta RVS - jmp chrout_screen_done -!: -chrout_try_MODE_GFX: - - cmp #$8E - bne !+ - - lda VIC_YMCSB - and #$02 // to upper case -mode_l1: - sta VIC_YMCSB - jmp chrout_screen_done -!: -chrout_try_MODE_TXT: - - cmp #$0E - bne !+ - - lda VIC_YMCSB - ora #$02 // to lower case - bne mode_l1 // branch always -!: chrout_try_COLOR: ldx #$0F -colour_check_loop: +chrout_try_color_loop: cmp colour_codes,x bne !+ stx COLOR jmp chrout_screen_done !: dex - bpl colour_check_loop - -chrout_try_SHIFT_ENABLE: - - cmp #$09 - bne !+ - - lda #$00 // enable SHIFT+VENDOR combination - sta MODE + bpl chrout_try_color_loop + // Unknown code, or key not requiring any handling jmp chrout_screen_done -!: -chrout_try_SHIFT_DISABLE: - - cmp #$08 - bne !+ - - lda #$80 // disable SHIFT+VENDOR combination - sta MODE - - jmp chrout_screen_done -!: -chrout_try_HOME: - - cmp #$13 - bne !+ - - jsr cursor_home - jmp chrout_screen_done -!: -chrout_try_CLR: - - cmp #$93 - bne !+ - - jsr clear_screen -clr_l1: - jmp chrout_screen_done -!: -chrout_try_INS: - - cmp #$94 - bne clr_l1 // unknown code or key does not need handling - - jmp chrout_screen_ins diff --git a/c64/kernal/screen/chrout_screen_crsr.s b/c64/kernal/screen/chrout_screen_crsr.s new file mode 100644 index 00000000..7f6cbffb --- /dev/null +++ b/c64/kernal/screen/chrout_screen_crsr.s @@ -0,0 +1,40 @@ + +// +// Cursor keys handling within CHROUT +// + + +chrout_screen_CRSR_UP: + + lda PNTR + sec + sbc #40 + sta PNTR + jmp chrout_screen_calc_lptr_done + +chrout_screen_CRSR_DOWN: + + lda PNTR + clc + adc #40 + sta PNTR + // We need to advance the pointer manually, as normalising + // now will break things. The pointer update is required + // so that we can tell if we really are on the bottom phys + // screen line or not + jsr screen_scroll_up_if_on_last_line + jmp chrout_screen_calc_lptr_done + +chrout_screen_CRSR_LEFT: + + lda TBLX + ora PNTR + beq !+ // recalculating pointer is not really necessary, but this is a very rare case nevertheless + dec PNTR +!: + jmp chrout_screen_calc_lptr_done + +chrout_screen_CRSR_RIGHT: + + inc PNTR + jmp chrout_screen_calc_lptr_done diff --git a/c64/kernal/screen/chrout_screen_del.s b/c64/kernal/screen/chrout_screen_del.s index 135f4777..88a403b2 100644 --- a/c64/kernal/screen/chrout_screen_del.s +++ b/c64/kernal/screen/chrout_screen_del.s @@ -3,7 +3,7 @@ // CHROUT routine - screen support, DEL key handling // -chrout_screen_del: +chrout_screen_DEL: // In insert mode it embeds control character ldx INSRT diff --git a/c64/kernal/screen/chrout_screen_gfxtxt.s b/c64/kernal/screen/chrout_screen_gfxtxt.s new file mode 100644 index 00000000..e523e03b --- /dev/null +++ b/c64/kernal/screen/chrout_screen_gfxtxt.s @@ -0,0 +1,19 @@ + +// +// GFX/TXT mode switch handling within CHROUT +// + + +chrout_screen_GFX: + + lda VIC_YMCSB + and #$02 // to upper case +!: + sta VIC_YMCSB + jmp chrout_screen_done + +chrout_screen_TXT: + + lda VIC_YMCSB + ora #$02 // to lower case + bne !- // branch always diff --git a/c64/kernal/screen/chrout_screen_home.s b/c64/kernal/screen/chrout_screen_home.s new file mode 100644 index 00000000..77976bd0 --- /dev/null +++ b/c64/kernal/screen/chrout_screen_home.s @@ -0,0 +1,10 @@ + +// +// HOME key handling within CHROUT +// + + +chrout_screen_HOME: + + jsr cursor_home + jmp chrout_screen_done diff --git a/c64/kernal/screen/chrout_screen_ins.s b/c64/kernal/screen/chrout_screen_ins.s index 8e0e7f63..3082012a 100644 --- a/c64/kernal/screen/chrout_screen_ins.s +++ b/c64/kernal/screen/chrout_screen_ins.s @@ -3,7 +3,7 @@ // CHROUT routine - screen support, INS key handling // -chrout_screen_ins: +chrout_screen_INS: // Insert (shift-DELETE) diff --git a/c64/kernal/screen/chrout_screen_jumptable_codes.s b/c64/kernal/screen/chrout_screen_jumptable_codes.s new file mode 100644 index 00000000..28bef1cf --- /dev/null +++ b/c64/kernal/screen/chrout_screen_jumptable_codes.s @@ -0,0 +1,55 @@ + +// +// Jumptable for screen control coldes support. To improve performance, should be sorted +// starting from the least probable routine +// + +chrout_screen_jumptable_codes: + + .byte KEY_INS + .byte KEY_CLR + .byte KEY_HOME + .byte KEY_SHIFT_OFF + .byte KEY_SHIFT_ON + .byte KEY_TXT + .byte KEY_GFX + .byte KEY_RVS_OFF + .byte KEY_RVS_ON + .byte KEY_CRSR_RIGHT + .byte KEY_CRSR_LEFT + .byte KEY_CRSR_DOWN + .byte KEY_CRSR_UP + +__chrout_screen_jumptable_codes_end: + +chrout_screen_jumptable_lo: + + .byte <(chrout_screen_INS - 1) + .byte <(chrout_screen_CLR - 1) + .byte <(chrout_screen_HOME - 1) + .byte <(chrout_screen_SHIFT_OFF - 1) + .byte <(chrout_screen_SHIFT_ON - 1) + .byte <(chrout_screen_TXT - 1) + .byte <(chrout_screen_GFX - 1) + .byte <(chrout_screen_RVS_OFF - 1) + .byte <(chrout_screen_RVS_ON - 1) + .byte <(chrout_screen_CRSR_RIGHT - 1) + .byte <(chrout_screen_CRSR_LEFT - 1) + .byte <(chrout_screen_CRSR_DOWN - 1) + .byte <(chrout_screen_CRSR_UP - 1) + +chrout_screen_jumptable_hi: + + .byte >(chrout_screen_INS - 1) + .byte >(chrout_screen_CLR - 1) + .byte >(chrout_screen_HOME - 1) + .byte >(chrout_screen_SHIFT_OFF - 1) + .byte >(chrout_screen_SHIFT_ON - 1) + .byte >(chrout_screen_TXT - 1) + .byte >(chrout_screen_GFX - 1) + .byte >(chrout_screen_RVS_OFF - 1) + .byte >(chrout_screen_RVS_ON - 1) + .byte >(chrout_screen_CRSR_RIGHT - 1) + .byte >(chrout_screen_CRSR_LEFT - 1) + .byte >(chrout_screen_CRSR_DOWN - 1) + .byte >(chrout_screen_CRSR_UP - 1) diff --git a/c64/kernal/screen/chrout_screen_rvs.s b/c64/kernal/screen/chrout_screen_rvs.s new file mode 100644 index 00000000..b1f68b76 --- /dev/null +++ b/c64/kernal/screen/chrout_screen_rvs.s @@ -0,0 +1,17 @@ + +// +// RVS ON/OFF handling within CHROUT +// + + +chrout_screen_RVS_ON: + + lda #$80 + bne !+ // branch always + +chrout_screen_RVS_OFF: + + lda #$00 +!: + sta RVS + jmp chrout_screen_done diff --git a/c64/kernal/screen/chrout_screen_shift_onoff.s b/c64/kernal/screen/chrout_screen_shift_onoff.s new file mode 100644 index 00000000..8f16587d --- /dev/null +++ b/c64/kernal/screen/chrout_screen_shift_onoff.s @@ -0,0 +1,16 @@ + +// +// SHIFT ON/OFF handling within CHROUT +// + +chrout_screen_SHIFT_ON: + + lda #$00 // enable SHIFT+VENDOR combination +!: + sta MODE + jmp chrout_screen_done + +chrout_screen_SHIFT_OFF: + + lda #$80 // disable SHIFT+VENDOR combination + bne !- // branch always