CHRIN for MEGA65 - code complete, but needs bugfixing

This commit is contained in:
FeralChild64 committed 2020-08-27 22:44:42 +02:00
1 parent 0d07074b20
commit dee452d352
6 files changed
+80 -24

No files matched your search

@@ -19,13 +19,14 @@
.label VK1__load_tape_auto = $4000 + 2 * 5
.label VK1__tape_head_align = $4000 + 2 * 6
.label VK1__m65_chrout_screen = $4000 + 2 * 7
.label VK1__M65_MODE64 = $4000 + 2 * 8
.label VK1__M65_MODE65 = $4000 + 2 * 9
.label VK1__M65_SCRMODEGET = $4000 + 2 * 10
.label VK1__M65_SCRMODESET = $4000 + 2 * 11
.label VK1__M65_CLRSCR = $4000 + 2 * 12
.label VK1__M65_CLRWIN = $4000 + 2 * 13
.label VK1__m65_screen_upd_txtrow_off = $4000 + 2 * 14
.label VK1__m65_chrin_keyboard = $4000 + 2 * 8
.label VK1__M65_MODE64 = $4000 + 2 * 9
.label VK1__M65_MODE65 = $4000 + 2 * 10
.label VK1__M65_SCRMODEGET = $4000 + 2 * 11
.label VK1__M65_SCRMODESET = $4000 + 2 * 12
.label VK1__M65_CLRSCR = $4000 + 2 * 13
.label VK1__M65_CLRWIN = $4000 + 2 * 14
.label VK1__m65_screen_upd_txtrow_off = $4000 + 2 * 15
#else
@@ -60,6 +61,7 @@
#endif
.word m65_chrout_screen
.word m65_chrin_keyboard
.word M65_MODE64
.word M65_MODE65
+2
View File
@@ -30,6 +30,8 @@
.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 screen_check_toggle_quote = KERNAL_0.screen_check_toggle_quote
.label screen_code_to_petscii = KERNAL_0.screen_code_to_petscii
.label setup_irq_timer = KERNAL_0.setup_irq_timer
.label wait_x_bars = KERNAL_0.wait_x_bars
@@ -13,6 +13,12 @@ m65_chrout_screen:
jsr map_NORMAL
jmp chrout_done_success
m65_chrin_keyboard:
jsr map_KERNAL_1
jsr_ind VK1__m65_chrin_keyboard
jmp map_NORMAL
m65_screen_upd_txtrow_off:
jsr map_KERNAL_1
+9 -1
View File
@@ -15,6 +15,14 @@ chrin_keyboard:
stx XSAV
phy_trash_a
#if ROM_LAYOUT_M65
/* XXX does not work yet
jsr M65_ISMODE65
bcc_16 m65_chrin_keyboard
*/
#endif
// FALLTROUGH
chrin_keyboard_repeat:
@@ -119,7 +127,7 @@ chrin_enter_calc_length:
chrin_enter_loop:
// Retrieve bytes
// Skip spaces at the end of line
dey
bmi chrin_keyboard_empty_line
lda (LSXP),y
+31 -11
View File
@@ -8,10 +8,8 @@
m65_chrin_keyboard: // XXX connnect this function to Kernal
// Preserve .X, .Y and .Z registers
// Preserve .Z register
phx
phy
phz
// FALLTROUGH
@@ -24,8 +22,6 @@ m65_chrin_keyboard_repeat:
lda CRSW
beq m65_chrin_keyboard_read
// XXX implement
// We have input waiting at [M65__SCRINPUT]+CRSW
// When CRSW = INDX, then we return a carriage return and clear the flag
@@ -50,9 +46,9 @@ m65_chrin_keyboard_empty_line:
m65_chrin_keyboard_end:
ldx XSAV
plz
ply
plx
clc
rts
@@ -67,7 +63,14 @@ m65_chrin_keyboard_not_end_of_input:
m65_chrin_keyboard_return_byte:
// XXX implement
jsr m65_helper_scrlpnt_chrin
tya
taz
lda_lp (M65_LPNT_SCR), z
jsr screen_check_toggle_quote
jsr screen_code_to_petscii
jmp_8 m65_chrin_keyboard_end
@@ -113,10 +116,9 @@ m65_chrin_keyboard_enter:
adc M65_TXTROW_OFF+1
sta M65__SCRINPUT+1
// XXX for windowed mode add current column too
// Retrieve first byte which is not space
jsr m65_helper_scrlpnt_chrin
ldy INDX
iny
@@ -124,13 +126,30 @@ m65_chrin_keyboard_enter:
m65_chrin_enter_loop:
// Skip spaces at the end of line
dey
bmi m65_chrin_keyboard_empty_line
// XXX implement
tya
taz
lda_lp (M65_LPNT_SCR), z
cmp #$20
beq m65_chrin_enter_loop
iny
sty INDX
rts
// XXX add windowed mode support here - correct INDX and M65__SCRINPUT
// Set mark informing that we are returning a line
ldy #$01
sty CRSW
// Clear quote mode mark
dey
sty QTSW
// Return first char of line
jmp_8 m65_chrin_keyboard_return_byte // branch always
m65_chrkin_keyboard_not_enter:
@@ -148,3 +167,4 @@ m65_chrkin_keyboard_not_enter:
jsr CHROUT
jsr pop_keyboard_buffer
jmp m65_chrin_keyboard_repeat
@@ -33,15 +33,11 @@ m65_helper_scrlpnt_color:
rts
m65_helper_scrlpnt_to_screen:
// Change M65_LPNT_SCR to point to screen memory (when it points to color memory)
lda M65_SCRSEG+1
sta M65_LPNT_SCR+3
lda M65_SCRSEG+0
sta M65_LPNT_SCR+2
clc
lda M65_SCRBASE+0
adc M65_LPNT_SCR+0
@@ -50,4 +46,26 @@ m65_helper_scrlpnt_to_screen:
adc M65_LPNT_SCR+1
sta M65_LPNT_SCR+1
// FALLTROUGH
m65_helper_scrlpnt_to_screen_hi:
lda M65_SCRSEG+1
sta M65_LPNT_SCR+3
lda M65_SCRSEG+0
sta M65_LPNT_SCR+2
rts
m65_helper_scrlpnt_chrin:
// Prepare the pointer for CHRIN
lda M65__SCRINPUT+0
sta M65_LPNT_SCR+0
lda M65__SCRINPUT+1
sta M65_LPNT_SCR+1
jmp_8 m65_helper_scrlpnt_to_screen_hi