work on character inserting

This commit is contained in:
FeralChild64 committed 2020-01-07 18:52:11 +01:00
1 parent b03aa78f54
commit 47090a52fd
9 files changed
+63 -131

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@
Here are the features of the Open ROMs not found in the original ROMs from the 80s (many of them are [configurable](CONFIG.md) during compilation):
* improved keyboard scanning, resistant to ghosting and joystick interference (one variant even supports multi-keyy rollover), supports additional C128 keys
* improved keyboard scanning, resistant to ghosting and joystick interference (one variant even supports multi-key rollover), supports additional C128 keys
* joystick can be used to move text cursor
* pre-defined function keys
+1 -2
View File
@@ -90,8 +90,7 @@ chrin_enter:
sta LXSP+1
// Calculate length
jsr screen_get_current_line_logical_length
tay
jsr screen_get_logical_line_end_ptr
iny
!: dey
bmi empty_line
+8 -3
View File
@@ -3,10 +3,7 @@
// CHROUT routine - screen support, DEL key handling
//
chrout_screen_DEL:
jmp chrout_screen_done
/* YYY disabled for rework
chrout_screen_DEL:
// In insert mode it embeds control character
@@ -14,6 +11,14 @@ chrout_screen_DEL:
beq !+
jmp chrout_screen_quote
!:
jmp chrout_screen_done
/* YYY disabled for rework
chrout_screen_DEL:
ldx PNTR
bne chrout_screen_del_column_non_0
+18 -28
View File
@@ -3,39 +3,30 @@
// CHROUT routine - screen support, INS key handling
//
chrout_screen_INS:
jmp chrout_screen_done
/* YYY disabled for rework
// YYY does not work properly on growing logical line
// YYY implement LNMX
chrout_screen_INS:
// Insert (shift-DELETE)
// First check if last character of the line is space
// Abort if line already max length, ie 79th char is not a space
jsr screen_get_current_line_logical_length
cmp #79
bne !+
tay
lda (PNT),y
cmp #$20
beq !+
jsr screen_check_space_ends_line
beq chrout_screen_ins_possible
// Line is too long to extend
jmp chrout_screen_done
!:
// Work out if line needs to be expanded, and if so expand it
ldy #39
lda (PNT),y
cmp #$20
beq !+
// Not space, try to grow logical line and check once again
jsr screen_grow_logical_line
jsr screen_check_space_ends_line
bne_far chrout_screen_done
!:
// Shuffle chars towards end of line
jsr screen_get_current_line_logical_length
tay
// FALLTROUGH
chrout_screen_ins_possible:
// Move chars towards end of the line
jsr screen_get_logical_line_end_ptr
!:
// Note: While the following routine is obvious to any skilled
// in the art as the most obvious simple and efficient solution,
@@ -43,7 +34,7 @@ chrout_screen_INS:
// in a relatively long verbatim stretch of bytes when compared to
// the C64 KERNAL. Thus we have swapped the order, just to reduce
// the potential for any argument of copyright infringement, even
// though we really don't believe that the routine can be copyrighted
// though we really do not believe that the routine can be copyrighted
// due to the lack of creativity.
dey
lda (USER),y
@@ -63,7 +54,6 @@ chrout_screen_INS:
// Put space in the inserted gap
lda #$20
sta (PNT),y
sta (PNT), y
jmp chrout_screen_done
*/
@@ -0,0 +1,8 @@
screen_check_space_ends_line:
jsr screen_get_logical_line_end_ptr
lda (PNT), y
cmp #$20
rts
@@ -1,17 +0,0 @@
screen_get_current_line_logical_length:
rts
/* YYY disabled for rework
screen_get_current_line_logical_length:
ldy TBLX
lda LDTBL,y
bpl !+
lda #79
.byte $2c // BIT absolute mode, which we use to skip the next two instruction bytes
!:
lda #39
sta LNMX
rts
*/
@@ -0,0 +1,26 @@
screen_get_logical_line_end_ptr:
ldy TBLX
cpy #24
bcs screen_get_logical_line_end_39 // last line of the screen
lda LDTBL, y
bpl screen_get_logical_line_end_39 // current line continues previous one
iny
lda LDTBL, y
bmi screen_get_logical_line_end_39 // current line is not continued
// FALLTROUGH
screen_get_logical_line_end_79:
ldy #79
rts
screen_get_logical_line_end_39:
ldy #39
rts
+1 -1
View File
@@ -1,5 +1,5 @@
// YYY test all the cases!
// YYY test all the cases, does not work correctly yet!
screen_grow_logical_line_screen_up:
-79
View File
@@ -1,79 +0,0 @@
//
// Normalise X and Y values
// If X < 0, then make X = X + 40 (or 80, if previous line is linked)
//
/* YYY disabled for rework
screen_normalize_xy:
lda PNTR
bpl x_not_negative
dec TBLX
// Check that we didn't go backwards off the top of the screen
bpl !+
lda #0
sta TBLX
!: jsr screen_add_40_to_PNTR
// Check if line is linked, if so, add 40 again
ldy TBLX
lda LDTBL,y
bpl !+
jsr screen_add_40_to_PNTR
!:
x_not_negative:
// Work out if X is too big
ldy TBLX
lda LDTBL,y
bpl !+
lda #79
skip_2_bytes_trash_nvz
!: lda #39
cmp PNTR
bcs x_not_too_big
// X value is too big, so subtract 40 and increment Y
lda PNTR
sec
sbc #40
sta PNTR
inc TBLX
x_not_too_big:
// Make sure Y isn't negative
lda TBLX
bpl !+
lda #0
sta TBLX
!:
// Make sure Y isn't too large for absolute size of
// screen
cmp #24
bcc !+
lda #24
sta TBLX
!:
// Make sure Y isn't too much for the screen, taking
// into account the line link table
ldy #24 // max allowable line
ldx #0
link_count_loop:
lda LDTBL,x
bpl !+
dey
!: inx
cpx #25
bne link_count_loop
tya
cmp TBLX
bcs y_ok
sta TBLX
y_ok:
rts
*/