more work on MEGA65 specific CHRIN
This commit is contained in:
1 parent
d78514c5d4
commit
0d07074b20
14 files changed
+105
-20
No files matched your search
@@ -97,6 +97,16 @@
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// Some additional 65C02 instructions
|
||||
//
|
||||
|
||||
#if HAS_OPCODES_65C02
|
||||
|
||||
.pseudocommand inc_a { .byte $1A }
|
||||
.pseudocommand dec_a { .byte $3A }
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// Some additional 65CE02 instructions
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
.label BLNCT = $CD // cursor blink countdown
|
||||
.label GDBLN = $CE // cursor saved character
|
||||
.label BLNON = $CF // cursor visibility flag
|
||||
.label CRSW = $D0 // whether to input from screen or keyboard
|
||||
.label CRSW = $D0 // whether to input from screen or keyboard (if from screen, stores input offset)
|
||||
.label PNT = $D1 // $D1-$D2 pointer to the current screen line
|
||||
.label PNTR = $D3 // current screen X position (logical column), 0-79
|
||||
.label QTSW = $D4 // quote mode flag
|
||||
|
||||
@@ -24,8 +24,9 @@
|
||||
// Page 0 - other reused values
|
||||
//
|
||||
|
||||
.label M65__TXTROW = TBLX // screen row
|
||||
.label M65__TXTCOL = PNTR // screen column
|
||||
.label M65__TXTROW = TBLX // screen row
|
||||
.label M65__TXTCOL = PNTR // screen column
|
||||
.label M65__SCRINPUT = LSXP // pointer to the screen input, within the screen segment
|
||||
|
||||
//
|
||||
// Pages 4-7 - reused screen memory
|
||||
@@ -44,7 +45,7 @@
|
||||
.label M65_COLVIEW = $588 // $588-$589 first byte of color memory viewport
|
||||
.label M65_COLVIEWMAX = $58A // $58A-$58B largest allowed value of M65_COLVIEW
|
||||
.label M65_SCRMODE = $58C // 0 = 40x25, 1 = 80x25, 2 = 80x50
|
||||
.label M64_SCRWINMODE = $58D // $00 = normal mode, $FF = window enabled
|
||||
.label M65_SCRWINMODE = $58D // $00 = normal mode, $FF = window enabled
|
||||
.label M65_TXTWIN_X0 = $58E // text window - top-left X coordinate, starting from 0
|
||||
.label M65_TXTWIN_Y0 = $58F // text window - top-left Y coordinate, starting from 0
|
||||
.label M65_TXTWIN_X1 = $590 // text window - bottom-right X coordinate + 1
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
|
||||
.label m65_scrtab_txtwidth = KERNAL_0.m65_scrtab_txtwidth
|
||||
.label m65_scrtab_txtheight = KERNAL_0.m65_scrtab_txtheight
|
||||
.label m65_screen_set_indx = KERNAL_0.m65_screen_set_indx
|
||||
.label cursor_enable = KERNAL_0.cursor_enable
|
||||
.label cursor_undraw_cont = KERNAL_0.cursor_undraw_cont
|
||||
.label cursor_timer_reset = KERNAL_0.cursor_timer_reset
|
||||
|
||||
@@ -113,7 +113,7 @@ chrin_keyboard_enter:
|
||||
|
||||
chrin_enter_calc_length:
|
||||
|
||||
// Calculate length
|
||||
// Get the logical line length
|
||||
jsr screen_get_logical_line_end_ptr
|
||||
iny
|
||||
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
|
||||
m65_chrin_keyboard: // XXX connnect this function to Kernal
|
||||
|
||||
// Preserve .X and .Y registers
|
||||
// Preserve .X, .Y and .Z registers
|
||||
|
||||
phx
|
||||
phy
|
||||
phz
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
@@ -25,7 +26,7 @@ m65_chrin_keyboard_repeat:
|
||||
|
||||
// XXX implement
|
||||
|
||||
// We have input waiting at (XXX)+CRSW
|
||||
// We have input waiting at [M65__SCRINPUT]+CRSW
|
||||
// When CRSW = INDX, then we return a carriage return and clear the flag
|
||||
|
||||
cmp INDX
|
||||
@@ -43,10 +44,16 @@ m65_chrin_keyboard_empty_line:
|
||||
|
||||
// For an empty line, just return the carriage return
|
||||
|
||||
lda #$0D
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
m65_chrin_keyboard_end:
|
||||
|
||||
plz
|
||||
ply
|
||||
plx
|
||||
clc
|
||||
lda #$0D
|
||||
rts
|
||||
|
||||
m65_chrin_keyboard_not_end_of_input:
|
||||
@@ -62,7 +69,7 @@ m65_chrin_keyboard_return_byte:
|
||||
|
||||
// XXX implement
|
||||
|
||||
rts
|
||||
jmp_8 m65_chrin_keyboard_end
|
||||
|
||||
m65_chrin_keyboard_read:
|
||||
|
||||
@@ -80,6 +87,8 @@ m65_chrin_keyboard_read:
|
||||
|
||||
m65_chrin_keyboard_enter:
|
||||
|
||||
// Disable cursor, retrieve code from keyboard buffer
|
||||
|
||||
jsr m65_cursor_disable
|
||||
jsr pop_keyboard_buffer
|
||||
jsr m65_cursor_hide_if_visible
|
||||
@@ -87,14 +96,43 @@ m65_chrin_keyboard_enter:
|
||||
// It was enter. Note that we have a line of input to return, and return the first byte
|
||||
// after computing and storing its length (Computes Mapping the 64, p96)
|
||||
|
||||
// Set pointer to the input, start for the viewport offset + screen memory base
|
||||
clc
|
||||
lda M65_COLVIEW+0
|
||||
adc M65_SCRBASE+0
|
||||
sta M65__SCRINPUT+0
|
||||
lda M65_COLVIEW+1
|
||||
adc M65_SCRBASE+1
|
||||
sta M65__SCRINPUT+1
|
||||
// Add current row offset
|
||||
clc
|
||||
lda M65__SCRINPUT+0
|
||||
adc M65_TXTROW_OFF+0
|
||||
sta M65__SCRINPUT+0
|
||||
lda M65__SCRINPUT+1
|
||||
adc M65_TXTROW_OFF+1
|
||||
sta M65__SCRINPUT+1
|
||||
|
||||
// XXX for windowed mode add current column too
|
||||
|
||||
// Retrieve first byte which is not space
|
||||
|
||||
ldy INDX
|
||||
iny
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
m65_chrin_enter_loop:
|
||||
|
||||
dey
|
||||
bmi m65_chrin_keyboard_empty_line
|
||||
|
||||
// XXX implement
|
||||
|
||||
rts
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
m65_chrkin_keyboard_not_enter:
|
||||
|
||||
lda KEYD
|
||||
|
||||
@@ -75,7 +75,7 @@ m65_chrout_fix_column_row:
|
||||
|
||||
ldy M65_SCRMODE
|
||||
|
||||
bit M64_SCRWINMODE
|
||||
bit M65_SCRWINMODE
|
||||
bmi m65_chrout_fix_column_row_win
|
||||
|
||||
// Non-windowed mode
|
||||
|
||||
@@ -46,7 +46,7 @@ m65_chrout_screen_RETURN:
|
||||
|
||||
// Move cursor to the beginning of the next line
|
||||
|
||||
bit M64_SCRWINMODE
|
||||
bit M65_SCRWINMODE
|
||||
bpl !+
|
||||
lda M65_TXTWIN_X0
|
||||
skip_2_bytes_trash_nvz
|
||||
|
||||
@@ -12,7 +12,7 @@ M65_CLRSCR:
|
||||
// Disable the window mode
|
||||
|
||||
lda #$00
|
||||
sta M64_SCRWINMODE
|
||||
sta M65_SCRWINMODE
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
@@ -107,6 +107,8 @@ m65_clrscr_loop_done:
|
||||
|
||||
// Set screen variables
|
||||
|
||||
jsr m65_screen_set_indx
|
||||
|
||||
// XXX provide proper implementation
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
@@ -12,7 +12,7 @@ M65_CLRWIN:
|
||||
|
||||
// Check if windowed mode; if not, go to M65_CLRSCR
|
||||
|
||||
lda M64_SCRWINMODE
|
||||
lda M65_SCRWINMODE
|
||||
bpl_16 m65_clrscr_takeover
|
||||
|
||||
// To clear the window, two zeropage long pointers will be used:
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
m65_screen_set_indx: // leaves value in .A
|
||||
|
||||
lda M65_SCRWINMODE
|
||||
bmi !+
|
||||
|
||||
// Non-windowed mode
|
||||
|
||||
phx
|
||||
ldx M65_SCRMODE
|
||||
lda m65_scrtab_txtwidth,x
|
||||
dec_a
|
||||
sta INDX
|
||||
plx
|
||||
rts
|
||||
!:
|
||||
// Windowed mode
|
||||
|
||||
sec
|
||||
lda M65_TXTWIN_X1
|
||||
sbc M65_TXTWIN_X0
|
||||
dec_a
|
||||
sta INDX
|
||||
rts
|
||||
@@ -6,7 +6,7 @@ m65_helper_scrlpnt_color:
|
||||
|
||||
// Set .Z to the current column
|
||||
|
||||
ldz M65__TXTCOL
|
||||
ldz M65__TXTCOL // XXX probably not the best place for this
|
||||
|
||||
// Setting M65_LPNT_SCR to point to colour memory (starts from $FF80000)
|
||||
|
||||
|
||||
@@ -59,10 +59,10 @@ m65_scrmodeset_internal: // entry point for M65_MODE65
|
||||
stx VIC_CHARSTEP+1
|
||||
|
||||
// Set the following locations:
|
||||
// - M64_SCRWINMODE - for scroll-console mode
|
||||
// - M65_SCRWINMODE - for scroll-console mode
|
||||
// - M65_SCRSEG, VIC_SCRNPTR+2/+3 - for screen in $0001xxxx area
|
||||
|
||||
stx M64_SCRWINMODE // .X = 0
|
||||
stx M65_SCRWINMODE // .X = 0
|
||||
stx M65_SCRSEG+1
|
||||
stx VIC_SCRNPTR+3
|
||||
inx
|
||||
|
||||
@@ -33,7 +33,9 @@ M65_SETWIN_N:
|
||||
pha
|
||||
|
||||
lda #$00
|
||||
sta M64_SCRWINMODE
|
||||
sta M65_SCRWINMODE
|
||||
|
||||
jsr m65_screen_set_indx
|
||||
|
||||
pla
|
||||
rts
|
||||
@@ -44,7 +46,11 @@ M65_SETWIN_Y:
|
||||
pha
|
||||
|
||||
lda #$FF
|
||||
sta M64_SCRWINMODE
|
||||
sta M65_SCRWINMODE
|
||||
|
||||
jsr m65_screen_set_indx
|
||||
|
||||
// XXX consider calling HOME instead
|
||||
|
||||
lda M65_TXTWIN_X0
|
||||
sta M65__TXTCOL
|
||||
|
||||
Reference in new issue
Block a user