VIC-IV cursor is now complete
This commit is contained in:
1 parent
7527c7a220
commit
642958cddc
10 files changed
+108
-95
No files matched your search
@@ -36,6 +36,9 @@
|
|||||||
|
|
||||||
.label m65_scrtab_txtwidth = KERNAL_0.m65_scrtab_txtwidth
|
.label m65_scrtab_txtwidth = KERNAL_0.m65_scrtab_txtwidth
|
||||||
.label m65_scrtab_txtheight = KERNAL_0.m65_scrtab_txtheight
|
.label m65_scrtab_txtheight = KERNAL_0.m65_scrtab_txtheight
|
||||||
|
.label cursor_undraw_cont = KERNAL_0.cursor_undraw_cont
|
||||||
|
.label cursor_timer_reset = KERNAL_0.cursor_timer_reset
|
||||||
|
.label cursor_show_if_enabled = KERNAL_0.cursor_show_if_enabled
|
||||||
|
|
||||||
#if CONFIG_IEC
|
#if CONFIG_IEC
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ cursor_draw:
|
|||||||
lda #1
|
lda #1
|
||||||
sta BLNON
|
sta BLNON
|
||||||
|
|
||||||
bne cursor_blink_timer_reset // branches always
|
bne cursor_timer_reset // branches always
|
||||||
|
|
||||||
|
|
||||||
// XXX code below is probably not 100% safe
|
// XXX code below is probably not 100% safe
|
||||||
@@ -66,9 +66,9 @@ cursor_hide_if_visible:
|
|||||||
lda #$FF
|
lda #$FF
|
||||||
sta BLNCT
|
sta BLNCT
|
||||||
|
|
||||||
// If cursor is not visible, nothing to do
|
// If cursor is not visible, not much to do
|
||||||
lda BLNON
|
lda BLNON
|
||||||
beq cursor_blink_timer_reset
|
beq cursor_timer_reset
|
||||||
|
|
||||||
// FALLTROUGH
|
// FALLTROUGH
|
||||||
|
|
||||||
@@ -80,12 +80,17 @@ cursor_undraw:
|
|||||||
lda GDCOL
|
lda GDCOL
|
||||||
sta (USER),y
|
sta (USER),y
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
cursor_undraw_cont: // entry point used by MEGA65 screen editor
|
||||||
|
|
||||||
|
// Mark cursor as not drawn
|
||||||
lda #0
|
lda #0
|
||||||
sta BLNON
|
sta BLNON
|
||||||
|
|
||||||
// FALLTROUGH
|
// FALLTROUGH
|
||||||
|
|
||||||
cursor_blink_timer_reset:
|
cursor_timer_reset:
|
||||||
|
|
||||||
// Rest blink counter (Mapping the 64, p39-40)
|
// Rest blink counter (Mapping the 64, p39-40)
|
||||||
lda #20
|
lda #20
|
||||||
|
|||||||
@@ -14,28 +14,21 @@
|
|||||||
cursor_show_if_enabled:
|
cursor_show_if_enabled:
|
||||||
|
|
||||||
lda BLNSW
|
lda BLNSW
|
||||||
bne cursor_show_end
|
bne !+
|
||||||
lda BLNON
|
lda BLNON
|
||||||
bne cursor_show_end
|
bne !+
|
||||||
|
|
||||||
// FALLTROUGH
|
// FALLTROUGH
|
||||||
|
|
||||||
cursor_show:
|
cursor_show:
|
||||||
|
|
||||||
// Set cursor as though it had just finished the off phase,
|
// Set the cursor so that it is going to be repainted by the next IRQ
|
||||||
// so that the call to cursor_blink paints it
|
|
||||||
lda #$00
|
|
||||||
sta BLNCT
|
|
||||||
sta BLNON
|
|
||||||
jsr cursor_blink
|
|
||||||
|
|
||||||
// Then set the timeout to 1 frame, so that the cursor
|
|
||||||
// blinks under key repeat conditions, like on the original KERNAL
|
|
||||||
lda #$01
|
lda #$01
|
||||||
sta BLNCT
|
sta BLNCT
|
||||||
|
|
||||||
// FALLTROUGH
|
lda #$00
|
||||||
|
sta BLNON
|
||||||
cursor_show_end:
|
|
||||||
|
|
||||||
|
!:
|
||||||
rts
|
rts
|
||||||
@@ -34,32 +34,13 @@ m65_chrout_screen_literal: // entry point for m65_chrout_screen_quote
|
|||||||
|
|
||||||
tax // store screen code, we need .A for calculations
|
tax // store screen code, we need .A for calculations
|
||||||
|
|
||||||
// Preserve .Z on stack, use it toi store screen columnt
|
// Preserve .Z on stack
|
||||||
|
|
||||||
phz
|
phz
|
||||||
ldz M65__TXTCOL
|
|
||||||
|
|
||||||
// Start from setting M65_LPNT_SCR to point colour memory (starts from $FF80000)
|
// Prepare .Z and M65_LPNT_SCR for colour memory manipulation
|
||||||
|
|
||||||
lda #$0F
|
jsr m65_helper_scrlpnt_color
|
||||||
sta M65_LPNT_SCR+3
|
|
||||||
lda #$F8
|
|
||||||
sta M65_LPNT_SCR+2
|
|
||||||
|
|
||||||
lda M65_COLVIEW+1
|
|
||||||
sta M65_LPNT_SCR+1
|
|
||||||
lda M65_COLVIEW+0
|
|
||||||
sta M65_LPNT_SCR+0
|
|
||||||
|
|
||||||
// Add screen row to the address
|
|
||||||
|
|
||||||
clc
|
|
||||||
lda M65_TXTROW_OFF+0
|
|
||||||
adc M65_LPNT_SCR+0
|
|
||||||
sta M65_LPNT_SCR+0
|
|
||||||
lda M65_TXTROW_OFF+1
|
|
||||||
adc M65_LPNT_SCR+1
|
|
||||||
sta M65_LPNT_SCR+1
|
|
||||||
|
|
||||||
// Store the new color in screen memory
|
// Store the new color in screen memory
|
||||||
|
|
||||||
@@ -68,19 +49,7 @@ m65_chrout_screen_literal: // entry point for m65_chrout_screen_quote
|
|||||||
|
|
||||||
// Now change M65_LPNT_SCR to point to screen memory
|
// Now change M65_LPNT_SCR to point to screen memory
|
||||||
|
|
||||||
// XXX deduplicate this part
|
jsr m65_helper_scrlpnt_to_screen
|
||||||
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
|
|
||||||
sta M65_LPNT_SCR+0
|
|
||||||
lda M65_SCRBASE+1
|
|
||||||
adc M65_LPNT_SCR+1
|
|
||||||
sta M65_LPNT_SCR+1
|
|
||||||
|
|
||||||
// Store the new character in screen memory, restore .Z
|
// Store the new character in screen memory, restore .Z
|
||||||
|
|
||||||
@@ -91,6 +60,9 @@ m65_chrout_screen_literal: // entry point for m65_chrout_screen_quote
|
|||||||
ora #$80 // reverse the character XXX consider doing this within chrout_to_screen_code
|
ora #$80 // reverse the character XXX consider doing this within chrout_to_screen_code
|
||||||
!:
|
!:
|
||||||
sta_lp (M65_LPNT_SCR),z
|
sta_lp (M65_LPNT_SCR),z
|
||||||
|
|
||||||
|
// Restore .Z
|
||||||
|
|
||||||
plz
|
plz
|
||||||
|
|
||||||
// Increment screen column by 1
|
// Increment screen column by 1
|
||||||
@@ -134,7 +106,7 @@ m65_chrout_fix_txtrow_off:
|
|||||||
|
|
||||||
m65_chrout_screen_done:
|
m65_chrout_screen_done:
|
||||||
|
|
||||||
jsr m65_cursor_show_if_enabled
|
jsr cursor_show_if_enabled
|
||||||
|
|
||||||
// XXX change this to return success
|
// XXX make sure it return success
|
||||||
rts
|
rts
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
// #LAYOUT# * * #IGNORE
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
|
||||||
|
// XXX deduplicate pointer manipulation
|
||||||
|
|
||||||
M65_CLRSCR:
|
M65_CLRSCR:
|
||||||
|
|
||||||
// Clear additional attributes from the color code
|
// Clear additional attributes from the color code
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
// #LAYOUT# * * #IGNORE
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
|
||||||
|
// XXX deduplicate pointer manipulation
|
||||||
|
|
||||||
M65_CLRWIN:
|
M65_CLRWIN:
|
||||||
|
|
||||||
// Clear additional attributes from the color code
|
// Clear additional attributes from the color code
|
||||||
|
|||||||
@@ -13,10 +13,6 @@
|
|||||||
|
|
||||||
m65_cursor_disable: // XXX utilize this!
|
m65_cursor_disable: // XXX utilize this!
|
||||||
|
|
||||||
// Make sure IRQ won't interfere by increasing the counter XXX reuse in legacy mode
|
|
||||||
lda #$FF
|
|
||||||
sta BLNCT
|
|
||||||
|
|
||||||
// Disable cursor blinking
|
// Disable cursor blinking
|
||||||
lda #$80
|
lda #$80
|
||||||
sta BLNSW
|
sta BLNSW
|
||||||
@@ -29,40 +25,29 @@ m65_cursor_hide_if_visible:
|
|||||||
lda #$FF
|
lda #$FF
|
||||||
sta BLNCT
|
sta BLNCT
|
||||||
|
|
||||||
// If cursor is not visible, nothing to do
|
// If cursor is not visible, not much to do
|
||||||
lda BLNON
|
lda BLNON
|
||||||
beq m65_cursor_blink_timer_reset
|
beq_16 cursor_timer_reset
|
||||||
|
|
||||||
// FALLTROUGH
|
// FALLTROUGH
|
||||||
|
|
||||||
m65_cursor_undraw:
|
m65_cursor_undraw:
|
||||||
|
|
||||||
// XXX provide implementation
|
// Preserve .Z
|
||||||
|
phz
|
||||||
|
|
||||||
|
// Cursor undraw - color
|
||||||
|
|
||||||
// Mark cursor as not drawn
|
jsr m65_helper_scrlpnt_color
|
||||||
lda #0
|
lda GDCOL
|
||||||
sta BLNON
|
sta_lp (M65_LPNT_SCR),z
|
||||||
|
|
||||||
rts
|
// Cursor undraw - character
|
||||||
|
|
||||||
m65_cursor_show_if_enabled:
|
jsr m65_helper_scrlpnt_to_screen
|
||||||
|
lda GDBLN
|
||||||
|
sta_lp (M65_LPNT_SCR),z
|
||||||
|
|
||||||
// XXX provide implementation
|
// Restore .Z and continue as with normal editor
|
||||||
|
plz
|
||||||
lda #$00
|
jmp cursor_undraw_cont
|
||||||
sta BLNSW
|
|
||||||
|
|
||||||
// FALLTROUGH
|
|
||||||
|
|
||||||
m65_cursor_blink_timer_reset: // XXX reuse code from main KERNAL
|
|
||||||
|
|
||||||
// Rest blink counter (Mapping the 64, p39-40)
|
|
||||||
lda #20
|
|
||||||
sta BLNCT
|
|
||||||
|
|
||||||
// FALLTROUGH
|
|
||||||
|
|
||||||
m65_cursor_blink_end:
|
|
||||||
|
|
||||||
rts
|
|
||||||
@@ -62,13 +62,11 @@ m65_cursor_blink_draw:
|
|||||||
lda_lp (M65_LPNT_IRQ),z
|
lda_lp (M65_LPNT_IRQ),z
|
||||||
sta GDCOL
|
sta GDCOL
|
||||||
lda COLOR
|
lda COLOR
|
||||||
and #$0F
|
and #$0F // take current colour, but not extended attributes
|
||||||
sta_lp (M65_LPNT_IRQ),z
|
sta_lp (M65_LPNT_IRQ),z
|
||||||
|
|
||||||
// Rework pointer to point to screnn memory
|
|
||||||
jsr m65_cursor_blink_rework_ptr
|
|
||||||
|
|
||||||
// Cursor draw - character
|
// Cursor draw - character
|
||||||
|
jsr m65_cursor_blink_irqpnt_to_screen
|
||||||
lda_lp (M65_LPNT_IRQ),z
|
lda_lp (M65_LPNT_IRQ),z
|
||||||
sta GDBLN
|
sta GDBLN
|
||||||
eor #$80
|
eor #$80
|
||||||
@@ -89,18 +87,17 @@ m65_cursor_blink_end:
|
|||||||
|
|
||||||
m65_cursor_blink_undraw:
|
m65_cursor_blink_undraw:
|
||||||
|
|
||||||
lda #0
|
|
||||||
sta BLNON
|
|
||||||
|
|
||||||
// Cursor undraw - color
|
// Cursor undraw - color
|
||||||
lda GDCOL
|
lda GDCOL
|
||||||
sta_lp (M65_LPNT_IRQ),z
|
sta_lp (M65_LPNT_IRQ),z
|
||||||
|
|
||||||
// Rework pointer to point to screnn memory
|
|
||||||
jsr m65_cursor_blink_rework_ptr
|
|
||||||
|
|
||||||
// Cursor undraw - character
|
// Cursor undraw - character
|
||||||
|
jsr m65_cursor_blink_irqpnt_to_screen
|
||||||
lda GDBLN
|
lda GDBLN
|
||||||
sta_lp (M65_LPNT_IRQ),z
|
sta_lp (M65_LPNT_IRQ),z
|
||||||
|
|
||||||
|
// Mark cursor as not drawn
|
||||||
|
lda #0
|
||||||
|
sta BLNON
|
||||||
|
|
||||||
jmp_8 m65_cursor_blink_timer_reset
|
jmp_8 m65_cursor_blink_timer_reset
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
// #LAYOUT# * * #IGNORE
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
|
||||||
m65_cursor_blink_rework_ptr:
|
m65_cursor_blink_irqpnt_to_screen:
|
||||||
|
|
||||||
// Adapt pointer to point to screen memory
|
// Adapt pointer to point to screen memory
|
||||||
|
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
// #LAYOUT# M65 KERNAL_1 #TAKE
|
||||||
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
m65_helper_scrlpnt_color:
|
||||||
|
|
||||||
|
// Set .Z to the current column
|
||||||
|
|
||||||
|
ldz M65__TXTCOL
|
||||||
|
|
||||||
|
// Setting M65_LPNT_SCR to point to colour memory (starts from $FF80000)
|
||||||
|
|
||||||
|
lda #$0F
|
||||||
|
sta M65_LPNT_SCR+3
|
||||||
|
lda #$F8
|
||||||
|
sta M65_LPNT_SCR+2
|
||||||
|
|
||||||
|
lda M65_COLVIEW+1
|
||||||
|
sta M65_LPNT_SCR+1
|
||||||
|
lda M65_COLVIEW+0
|
||||||
|
sta M65_LPNT_SCR+0
|
||||||
|
|
||||||
|
// Add screen row to the address
|
||||||
|
|
||||||
|
clc
|
||||||
|
lda M65_TXTROW_OFF+0
|
||||||
|
adc M65_LPNT_SCR+0
|
||||||
|
sta M65_LPNT_SCR+0
|
||||||
|
lda M65_TXTROW_OFF+1
|
||||||
|
adc M65_LPNT_SCR+1
|
||||||
|
sta M65_LPNT_SCR+1
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
m65_helper_scrlpnt_to_screen:
|
||||||
|
|
||||||
|
// Change M65_LPNT_SCR to point to screen memory (when it points to scren 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
|
||||||
|
sta M65_LPNT_SCR+0
|
||||||
|
lda M65_SCRBASE+1
|
||||||
|
adc M65_LPNT_SCR+1
|
||||||
|
sta M65_LPNT_SCR+1
|
||||||
|
|
||||||
|
rts
|
||||||
Reference in new issue
Block a user