fixed spurious line wrap (and scroll) when writing to the very last char in bottom right hand corner. this was causing the title screen in 'nano' to get scrolled off the top of the screen

git-svn-id: http://svn.code.sf.net/p/netboot65/code@228 93682198-c243-4bdb-bd91-e943c89aac3b
This commit is contained in:
jonnosan 2009-12-20 06:33:12 +00:00
parent cf84a7d4f5
commit a16f32597d

View File

@ -1103,7 +1103,6 @@ print_to_screen:
; chr in A
; X and Y unaffected
; -------------------------------------
;plot_char = $e716
plot_char:
sta temp_ptr_x ; save char
@ -1159,13 +1158,34 @@ plot_char:
; --- put char to screen ---
@put_char:
ldy $d3 ; get crsr col
cpy #$28 ;col = 40
bcc @no_line_wrap
;the only way we end up trying to write to column 40 should
;be if we skipped the normal line wrap after writing to col 39
;because we are at the end of the scroll region
;that means we should do a scroll up and then write this char at col 0
pha
jsr scroll_up_scrollregion
pla
ldy #$00 ; begin of line
sty $d3
@no_line_wrap:
sta ($d1),y ; char to screen
lda $0286 ; get colour
sta ($f3),y ; set colour
; --- move on crsr ---
ldx $d6 ; get crsr row
cpx scroll_region_end ; end of scroll reg?
beq @dont_scroll_yet ; we don't want to trigger a scroll of the whole screen unless
; we are actually writing a char. we shouldn't scroll just when
; writing to the bottom right hand screen (else e.g. the title bar
; in 'nano' gets pushed off the top of the screen.
;
cpy #$27 ; col = 39?
beq move_to_next_line ; yes -> new line
@dont_scroll_yet:
iny ; move on
sty $d3