tested cursor homing, started work on PNT recalculation

This commit is contained in:
FeralChild64 committed 2020-01-01 20:47:18 +01:00
1 parent 0df88248a3
commit ca3b678578
8 files changed
+88 -74

No files matched your search

+2 -1
View File
@@ -236,7 +236,8 @@ Not all of them - only these we want to have implemented.
| `$E51B` | init screen keyboard, no VIC | DONE | |
| `$E544` | clear screen | DONE | |
| `$E50C` | set cursor position | PARTIAL | |
| `$E566` | home cursor | NOT DONE | |
| `$E566` | home cursor | DONE | |
| `$E56C` | set PNTR value | | |
| `$E5A0` | setup VIC II & I/O | DONE | |
| `$E6B6` | advance cursor | NOT DONE | |
| `$E701` | previous line | NOT DONE | |
-4
View File
@@ -1,4 +0,0 @@
// XXX provide documentation and implementation
STUB_IMPLEMENTATION()
+5 -2
View File
@@ -1,6 +1,9 @@
// Clear screen and initialise line link table
// (Compute's Mapping the 64 p215-216)
//
// Clear screen and initialise line link table, described in:
//
// - [CM64] Computes Mapping the Commodore 64 - pages 215-216
//
clear_screen:
+15
View File
@@ -0,0 +1,15 @@
//
// Home the cursor, described in:
//
// - [CM64] Computes Mapping the Commodore 64 - page 216
//
cursor_home:
lda #$00
sta PNTR // current column
sta TBLX // current row
// FALLTROUGH to the next routine
File renamed without changes.
+4
View File
@@ -0,0 +1,4 @@
This is a well-known address, probably used by lots of software. See for example here:
- https://www.lemon64.com/forum/viewtopic.php?t=69526&sid=836d087e9759db667ba3bb1732eea266
@@ -1,7 +1,16 @@
//
// Home the cursor (Compute's Mapping the 64 p216)
// Set pointer (PNT) to current screen line , described in:
//
// - [CM64] Computes Mapping the Commodore 64 - page 216
//
screen_calculate_PNT:
// YYY implement this!
rts
// Variables: (http://sta.c64.org/cbm64mem.html)
// - $C7 - RVS - reverse mode switch
@@ -25,16 +34,59 @@
// - $02A5 - TLNIDX - number of line currently being scrolled during scrolling the screen
cursor_home:
jmp cursor_home
/* YYY disabled for rework
cursor_home:
lda #$00
sta PNTR // x position
sta TBLX // y position
screen_calculate_line_pointer:
jsr screen_normalize_xy
// Reset pointer to start of screen
lda HIBASE
sta PNT+1
lda #0
sta PNT+0
jmp screen_calculate_line_pointer
// Add 40 for every line, or 80 if the lines are linked
ldx TBLX
!:
// Stop if we have counted enough lines
beq !+
// Add 40 or 80 based on whether the line is linked
// or not.
ldy #40
// -1 offset is because we count down from N to 1, not
// N-1 to 0.
lda LDTBL-1,x
bpl sclp_l1
ldy #80
sclp_l1:
// Add computed line length to pointer value
tya
clc
adc PNT+0
sta PNT+0
lda PNT+1
adc #0
sta PNT+1
// Loop back to next line
dex
jmp !-
!:
// FALLTHROUGH
update_colour_line_pointer:
// Now setup pointer to colour RAM
lda PNT+0
sta USER+0
lda PNT+1
sec
sbc HIBASE
clc
adc #>$d800
sta USER+1
rts
*/
@@ -1,57 +0,0 @@
/* YYY disabled for rework
screen_calculate_line_pointer:
jsr screen_normalize_xy
// Reset pointer to start of screen
lda HIBASE
sta PNT+1
lda #0
sta PNT+0
// Add 40 for every line, or 80 if the lines are linked
ldx TBLX
!:
// Stop if we have counted enough lines
beq !+
// Add 40 or 80 based on whether the line is linked
// or not.
ldy #40
// -1 offset is because we count down from N to 1, not
// N-1 to 0.
lda LDTBL-1,x
bpl sclp_l1
ldy #80
sclp_l1:
// Add computed line length to pointer value
tya
clc
adc PNT+0
sta PNT+0
lda PNT+1
adc #0
sta PNT+1
// Loop back to next line
dex
jmp !-
!:
// FALLTHROUGH
update_colour_line_pointer:
// Now setup pointer to colour RAM
lda PNT+0
sta USER+0
lda PNT+1
sec
sbc HIBASE
clc
adc #>$d800
sta USER+1
rts
*/