started work on VIC-IV cursor

This commit is contained in:
FeralChild64 committed 2020-08-23 20:28:06 +02:00
1 parent ad22140617
commit 511a30715f
10 files changed
+175 -24

No files matched your search

+9
View File
@@ -338,6 +338,15 @@
// Flat memory access support
.pseudocommand lda_lp arg {
.var value = arg.getValue()
.var type = arg.getType()
.if(type != AT_IZEROPAGEZ) .error "'lda_lp' only accepts AT_IZEROPAGEZ"
.if(value > $FF ) .error "'lda_lp' requires zeropage address"
nop
.byte $B2, value
}
.pseudocommand sta_lp arg {
.var value = arg.getValue()
.var type = arg.getType()
+2
View File
@@ -34,6 +34,8 @@
.label wait_x_bars = KERNAL_0.wait_x_bars
.label viciv_unhide = KERNAL_0.viciv_unhide
.label m65_scrtab_rowoffset_lo = KERNAL_0.m65_scrtab_rowoffset_lo
.label m65_scrtab_rowoffset_hi = KERNAL_0.m65_scrtab_rowoffset_hi
.label m65_scrtab_txtwidth = KERNAL_0.m65_scrtab_txtwidth
.label m65_scrtab_txtheight = KERNAL_0.m65_scrtab_txtheight
@@ -18,7 +18,7 @@ default_irq_handler:
#if ROM_LAYOUT_M65
jsr M65_ISMODE65
bne !+
bcs !+
jsr m65_cursor_blink
+9 -3
View File
@@ -17,6 +17,7 @@
cursor_blink:
// Is the cursor enabled?
lda BLNSW
bne cursor_blink_end
@@ -50,26 +51,31 @@ cursor_draw:
bne cursor_blink_timer_reset // branches always
cursor_disable:
lda #$80
sta BLNSW
// FALLTHROUGH
cursor_hide_if_visible:
lda BLNON
beq cursor_blink_end
// FALLTROUGH
cursor_undraw:
// Prevent interrupts from updating cursor
lda #0
sta BLNON
jsr screen_get_clipped_PNTR
lda GDBLN
sta (PNT),y
lda GDCOL
sta (USER),y
lda #0
sta BLNON
// FALLTROUGH
cursor_blink_timer_reset:
+5 -2
View File
@@ -8,7 +8,9 @@
m65_chrout_screen:
// XXX hide cursor if visible
jsr m65_cursor_hide_if_visible
// Retrieve the character to output
lda SCHAR
tax
@@ -127,6 +129,7 @@ m65_chrout_fix_column_row_win:
m65_chrout_screen_done:
// XXX reenable cursor
jsr m65_cursor_show_if_enabled
// XXX change this to return success
rts
+30 -2
View File
@@ -1,9 +1,37 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
//
// Variables used:
// - BLNSW (cursor blink switch)
// - BLNCT (cursor blink countdown)
// - GDBLN (cursor saved character)
// - BLNON (if cursor is visible)
// - GDCOL (colour under cursor)
//
m65_cursor_blink:
m65_cursor_hide_if_visible:
lda BLNON
beq m65_cursor_end
// FALLTROUGH
m65_cursor_undraw:
// XXX provide implementation
rts
m65_cursor_show_if_enabled:
// XXX provide implementation
nop
// FALLTROUGH
m65_cursor_end:
rts
@@ -0,0 +1,93 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Variables used:
// - BLNSW (cursor blink switch)
// - BLNCT (cursor blink countdown)
// - GDBLN (cursor saved character)
// - BLNON (if cursor is visible)
// - GDCOL (colour under cursor)
//
m65_cursor_blink:
// Preserve .Z
phz
// Is the cursor enabled?
lda BLNSW
bne m65_cursor_blink_end
// Do we need to redraw things?
dec BLNCT
bpl m65_cursor_blink_end
// Prepare .Z and long pointer to screen position
ldz M65__TXTCOL
lda M65_SCRVIEW+0
sta M65_LPNT_IRQ+0
lda M65_SCRVIEW+1
sta M65_LPNT_IRQ+1
lda M65_SCRSEG+0
sta M65_LPNT_IRQ+2
lda M65_SCRSEG+1
sta M65_LPNT_IRQ+3
// Add row offset to the long pointer
ldy M65__TXTROW
clc
lda m65_scrtab_rowoffset_lo,y
adc M65_LPNT_IRQ+0
sta M65_LPNT_IRQ+0
lda m65_scrtab_rowoffset_hi,y
adc M65_LPNT_IRQ+1
sta M65_LPNT_IRQ+1
// Check if cursor was visible or not, and toggle
lda BLNON
bne m65_cursor_blink_undraw
// FALLTROUGH
m65_cursor_blink_draw:
lda #1
sta BLNON
// Cursor draw - character
lda_lp (M65_LPNT_IRQ),z
sta GDBLN
eor #$80
sta_lp (M65_LPNT_IRQ),z
// Cursor draw - color
// XXX provide implementation
m65_cursor_blink_timer_reset:
// Rest blink counter (Mapping the 64, p39-40)
lda #20
sta BLNCT
// FALLTROUGH
m65_cursor_blink_end:
plz
rts
m65_cursor_blink_undraw:
lda #0
sta BLNON
// Cursor undraw - character
lda GDBLN
sta_lp (M65_LPNT_IRQ),z
// Cursor undraw - color
// XXX provide implementation
jmp_8 m65_cursor_blink_timer_reset
@@ -0,0 +1,13 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
// XXX consider moving this back to extended memory, and just store the offset in RAM
m65_scrtab_rowoffset_hi: // row offsets - high bytes
.byte >(80 * 0), >(80 * 1), >(80 * 2), >(80 * 3), >(80 * 4), >(80 * 5), >(80 * 6), >(80 * 7), >(80 * 8), >(80 * 9)
.byte >(80 * 10), >(80 * 11), >(80 * 12), >(80 * 13), >(80 * 14), >(80 * 15), >(80 * 16), >(80 * 17), >(80 * 18), >(80 * 19)
.byte >(80 * 20), >(80 * 21), >(80 * 22), >(80 * 23), >(80 * 24), >(80 * 25), >(80 * 26), >(80 * 27), >(80 * 28), >(80 * 29)
.byte >(80 * 30), >(80 * 31), >(80 * 32), >(80 * 33), >(80 * 34), >(80 * 35), >(80 * 36), >(80 * 37), >(80 * 38), >(80 * 39)
.byte >(80 * 40), >(80 * 41), >(80 * 42), >(80 * 43), >(80 * 44), >(80 * 45), >(80 * 46), >(80 * 47), >(80 * 48), >(80 * 49)
@@ -0,0 +1,13 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
// XXX consider moving this back to extended memory, and just store the offset in RAM
m65_scrtab_rowoffset_lo: // row offsets - low bytes
.byte <(80 * 0), <(80 * 1), <(80 * 2), <(80 * 3), <(80 * 4), <(80 * 5), <(80 * 6), <(80 * 7), <(80 * 8), <(80 * 9)
.byte <(80 * 10), <(80 * 11), <(80 * 12), <(80 * 13), <(80 * 14), <(80 * 15), <(80 * 16), <(80 * 17), <(80 * 18), <(80 * 19)
.byte <(80 * 20), <(80 * 21), <(80 * 22), <(80 * 23), <(80 * 24), <(80 * 25), <(80 * 26), <(80 * 27), <(80 * 28), <(80 * 29)
.byte <(80 * 30), <(80 * 31), <(80 * 32), <(80 * 33), <(80 * 34), <(80 * 35), <(80 * 36), <(80 * 37), <(80 * 38), <(80 * 39)
.byte <(80 * 40), <(80 * 41), <(80 * 42), <(80 * 43), <(80 * 44), <(80 * 45), <(80 * 46), <(80 * 47), <(80 * 48), <(80 * 49)
@@ -26,22 +26,6 @@ m65_scrtab_scrolx: // values for VIC_SCROLX
.byte $CA
.byte $CA
m65_scrtab_rowoffset_lo: // row offsets - low bytes
.byte <(80 * 0), <(80 * 1), <(80 * 2), <(80 * 3), <(80 * 4), <(80 * 5), <(80 * 6), <(80 * 7), <(80 * 8), <(80 * 9)
.byte <(80 * 10), <(80 * 11), <(80 * 12), <(80 * 13), <(80 * 14), <(80 * 15), <(80 * 16), <(80 * 17), <(80 * 18), <(80 * 19)
.byte <(80 * 20), <(80 * 21), <(80 * 22), <(80 * 23), <(80 * 24), <(80 * 25), <(80 * 26), <(80 * 27), <(80 * 28), <(80 * 29)
.byte <(80 * 30), <(80 * 31), <(80 * 32), <(80 * 33), <(80 * 34), <(80 * 35), <(80 * 36), <(80 * 37), <(80 * 38), <(80 * 39)
.byte <(80 * 40), <(80 * 41), <(80 * 42), <(80 * 43), <(80 * 44), <(80 * 45), <(80 * 46), <(80 * 47), <(80 * 48), <(80 * 49)
m65_scrtab_rowoffset_hi: // row offsets - high bytes
.byte >(80 * 0), >(80 * 1), >(80 * 2), >(80 * 3), >(80 * 4), >(80 * 5), >(80 * 6), >(80 * 7), >(80 * 8), >(80 * 9)
.byte >(80 * 10), >(80 * 11), >(80 * 12), >(80 * 13), >(80 * 14), >(80 * 15), >(80 * 16), >(80 * 17), >(80 * 18), >(80 * 19)
.byte >(80 * 20), >(80 * 21), >(80 * 22), >(80 * 23), >(80 * 24), >(80 * 25), >(80 * 26), >(80 * 27), >(80 * 28), >(80 * 29)
.byte >(80 * 30), >(80 * 31), >(80 * 32), >(80 * 33), >(80 * 34), >(80 * 35), >(80 * 36), >(80 * 37), >(80 * 38), >(80 * 39)
.byte >(80 * 40), >(80 * 41), >(80 * 42), >(80 * 43), >(80 * 44), >(80 * 45), >(80 * 46), >(80 * 47), >(80 * 48), >(80 * 49)
// Jumptable for screen control codes support. To improve performance, should be sorted
// starting from the least probable routine.