diff --git a/STATUS.md b/STATUS.md
index ed8966a0..ff3fb37e 100644
--- a/STATUS.md
+++ b/STATUS.md
@@ -58,7 +58,7 @@ The following ROM features are currently missing:
| :----------------: | :------: | :------------------------------------------------: |
| C64 | DONE | |
| C128 | DONE | |
-| Mega65 | NOT DONE | code should be complete, but is not tested yet |
+| Mega65 | PARTIAL | code mostly complete, but not tested yet |
@@ -70,7 +70,7 @@ The following ROM features are currently missing:
| :----------------: | :------: | :------------------------------------------------: |
| VIC-II | DONE | |
| 80 columns, VDC | NOT DONE | |
-| 80 columns, Mega65 | NOT DONE | |
+| 80 columns, Mega65 | PARTIAL | work-in-progreess, not useable yet |
@@ -121,6 +121,17 @@ The following ROM features are currently missing:
+## MEGA65 storage
+
+
+
+| Driver | Status | Remarks |
+| :----------------: | :------: | :-------------------------------------------------------------------------: |
+| internal floppy | NOT DONE | try to reuse https://github.com/commanderx16/x16-rom/tree/master/dos |
+| SD card access | NOT DONE | tryy to reuse https://github.com/commanderx16/x16-rom/tree/master/dos/fat32 |
+
+
+
## RS-232
* modems (telephone, WiFi)
diff --git a/src/kernal/board_m65/mega65_imports.s b/src/kernal/board_m65/mega65_imports.s
index 7bda6d9f..6eca7f6b 100644
--- a/src/kernal/board_m65/mega65_imports.s
+++ b/src/kernal/board_m65/mega65_imports.s
@@ -23,6 +23,7 @@
.label clrchn_reset = KERNAL_0.clrchn_reset
.label udtim_keyboard = KERNAL_0.udtim_keyboard
.label chrout_to_screen_code = KERNAL_0.chrout_to_screen_code
+.label colour_codes = KERNAL_0.colour_codes
.label setup_irq_timer = KERNAL_0.setup_irq_timer
.label wait_x_bars = KERNAL_0.wait_x_bars
diff --git a/src/kernal/screen_m65/mega65_chrout_screen.s b/src/kernal/screen_m65/mega65_chrout_screen.s
index 5bae0d37..4e9abced 100644
--- a/src/kernal/screen_m65/mega65_chrout_screen.s
+++ b/src/kernal/screen_m65/mega65_chrout_screen.s
@@ -93,4 +93,8 @@ m65_chrout_screen_literal: // entry point for m65_chrout_screen_quote
// XXX continue the implementation - fix the cursor position
+m65_chrout_screen_done:
+
+ // XXX reenable cursor
+
rts
diff --git a/src/kernal/screen_m65/mega65_chrout_screen_control.s b/src/kernal/screen_m65/mega65_chrout_screen_control.s
index 53602392..76fb00c8 100644
--- a/src/kernal/screen_m65/mega65_chrout_screen_control.s
+++ b/src/kernal/screen_m65/mega65_chrout_screen_control.s
@@ -4,6 +4,126 @@
m65_chrout_screen_control:
- // XXX provide implementation
+ txa
- rts
+m65_chrout_try_jumptable:
+
+ ldx #(__m65_chrout_screen_jumptable_codes_end - m65_chrout_screen_jumptable_codes - 1)
+
+m65_chrout_try_jumptable_loop:
+
+ cpx #(__m65_chrout_screen_jumptable_quote_guard - m65_chrout_screen_jumptable_codes - 1)
+ bne m65_chrout_try_jumptable_loop_noquote
+
+ // Is this insert/quote mode?
+
+ tay
+ lda QTSW
+ ora INSRT
+ beq !+
+ tya
+ jmp m65_chrout_screen_quote
+!:
+ tya
+
+ // FALLTROUGH
+
+m65_chrout_try_jumptable_loop_noquote:
+
+ cmp m65_chrout_screen_jumptable_codes, x
+ bne !+
+
+ // Found, perform a jump to subroutine
+
+ txa
+ asl
+ tax
+ jmp (m65_chrout_screen_jumptable, x)
+
+!:
+ dex
+ bpl m65_chrout_try_jumptable_loop
+
+m65_chrout_try_COLOR:
+
+ ldx #$0F
+
+m65_chrout_try_color_loop:
+
+ cmp colour_codes,x
+ bne !+
+
+ lda COLOR
+ and #$F0
+ sta COLOR
+
+ txa
+ ora COLOR
+ sta COLOR
+
+ jmp m65_chrout_screen_done
+!:
+ dex
+ bpl m65_chrout_try_color_loop
+
+ // Unknown code, or key not requiring any handling
+
+ jmp m65_chrout_screen_done
+
+
+
+
+// XXX: implement screen routines below:
+
+m65_chrout_screen_quote:
+ nop
+m65_chrout_screen_CLR:
+ nop
+m65_chrout_screen_HOME:
+ nop
+m65_chrout_screen_SHIFT_OFF:
+ nop
+m65_chrout_screen_SHIFT_ON:
+ nop
+m65_chrout_screen_TXT:
+ nop
+m65_chrout_screen_GFX:
+ nop
+m65_chrout_screen_RVS_OFF:
+ nop
+m65_chrout_screen_RVS_ON:
+ nop
+m65_chrout_screen_CRSR_RIGHT:
+ nop
+m65_chrout_screen_CRSR_LEFT:
+ nop
+m65_chrout_screen_CRSR_DOWN:
+ nop
+m65_chrout_screen_CRSR_UP:
+ nop
+m65_chrout_screen_INS:
+ nop
+m65_chrout_screen_TAB:
+ nop
+m65_chrout_screen_LINE_FEED:
+ nop
+m65_chrout_screen_UNDERLINE_ON:
+ nop
+m65_chrout_screen_UNDERLINE_OFF:
+ nop
+m65_chrout_screen_FLASHING_ON:
+ nop
+m65_chrout_screen_FLASHING_OFF:
+ nop
+m65_chrout_screen_TAB_SET_CLR:
+ nop
+m65_chrout_screen_ESC:
+ nop
+m65_chrout_screen_BELL:
+ nop
+m65_chrout_screen_STOP:
+ nop
+m65_chrout_screen_DEL:
+ nop
+m65_chrout_screen_RETURN:
+ jmp m65_chrout_screen_done
diff --git a/src/kernal/screen_m65/mega65_screen_tables.s b/src/kernal/screen_m65/mega65_screen_tables.s
index aa3bc9a3..55a10b18 100644
--- a/src/kernal/screen_m65/mega65_screen_tables.s
+++ b/src/kernal/screen_m65/mega65_screen_tables.s
@@ -89,3 +89,38 @@ __m65_chrout_screen_jumptable_quote_guard:
.byte KEY_RETURN
__m65_chrout_screen_jumptable_codes_end:
+
+
+.const m65_chrout_list = List().add(
+
+ m65_chrout_screen_CLR,
+ m65_chrout_screen_HOME,
+ m65_chrout_screen_SHIFT_OFF,
+ m65_chrout_screen_SHIFT_ON,
+ m65_chrout_screen_TXT,
+ m65_chrout_screen_GFX,
+ m65_chrout_screen_RVS_OFF,
+ m65_chrout_screen_RVS_ON,
+ m65_chrout_screen_CRSR_RIGHT,
+ m65_chrout_screen_CRSR_LEFT,
+ m65_chrout_screen_CRSR_DOWN,
+ m65_chrout_screen_CRSR_UP,
+ m65_chrout_screen_INS,
+ m65_chrout_screen_TAB,
+ m65_chrout_screen_LINE_FEED,
+ m65_chrout_screen_UNDERLINE_ON,
+ m65_chrout_screen_UNDERLINE_OFF,
+ m65_chrout_screen_FLASHING_ON,
+ m65_chrout_screen_FLASHING_OFF,
+ m65_chrout_screen_TAB_SET_CLR,
+ m65_chrout_screen_ESC,
+ m65_chrout_screen_BELL,
+ m65_chrout_screen_STOP,
+ m65_chrout_screen_DEL,
+ m65_chrout_screen_RETURN
+)
+
+m65_chrout_screen_jumptable:
+
+ // Note: 65C02 has the page boundary vector bug fixed!
+ put_jumptable(m65_chrout_list)