initial LNMX calculation routine

This commit is contained in:
FeralChild64 committed 2020-01-08 18:36:46 +01:00
1 parent 98e7e633e8
commit b498d4010b
5 files changed
+73 -35

No files matched your search

+1 -1
View File
@@ -155,7 +155,7 @@
.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
.label LNMX = $D5 // logical line length, [!] our usage probably differs in details
.label LNMX = $D5 // logical line length, 39 or 79
.label TBLX = $D6 // current screen Y position (row), 0-24
.label SCHAR = $D7 // ASCII value of the last printed character
.label INSRT = $D8 // insert mode flag/counter
+3 -2
View File
@@ -120,11 +120,12 @@ chrout_screen_literal:
chrout_screen_calc_lptr_done:
jsr screen_calculate_PNT_USER
jsr screen_fix_PNTR
jsr screen_calculate_PNTR
jsr screen_calculate_LNMX
// FALLTROUGH
chrout_screen_done:
chrout_screen_done: // YYY review all the jumps here
// YYY should we update character under cursor here? or in cursor_show_if_enabled?
+36
View File
@@ -0,0 +1,36 @@
//
// Sets LNMX to 39 or 79
//
// YYY value is improper shortly after linee growth!
screen_calculate_LNMX: // YYY review all the code, mayybe some optimizations are possible using this value
ldy TBLX
lda LDTBL, y
bpl screen_calculate_lnmx_79 // this line is a continuation
cpy #24
beq screen_calculate_lnmx_39 // this is the last line, which is not a continuation
iny
lda LDTBL, y
bpl screen_calculate_lnmx_79 // line is continued
// FALLTROUGH
screen_calculate_lnmx_39:
lda #39
skip_2_bytes_trash_nvz
// FALLTROUGH
screen_calculate_lnmx_79:
lda #79
sta LNMX
rts
@@ -4,18 +4,18 @@
//
screen_fix_PNTR:
screen_calculate_PNTR:
ldy TBLX
lda LDTBL, y
php
jsr screen_get_clipped_PNTR
plp
bmi screen_fix_PNTR_0_39
bmi screen_calculate_PNTR_0_39
// FALLTROUGH
screen_fix_PNTR_40_79:
screen_calculate_PNTR_40_79:
tya
clc
@@ -24,7 +24,7 @@ screen_fix_PNTR_40_79:
// FALLTROUGH
screen_fix_PNTR_0_39:
screen_calculate_PNTR_0_39:
sty PNTR
rts