Minor fix

This commit is contained in:
Daniele Verducci su MatissePenguin 2021-02-16 08:57:15 +01:00
parent e34cfef259
commit cc9805f044
2 changed files with 13 additions and 6 deletions

View File

@ -84,9 +84,9 @@ cursor_pos_home:
; Updates framebuffer pointer (Y) to point to current text cursor position (POS_COLUMN, POS_ROWP)
; Usage:
; ldi POS_COLUMN, 55
; ldi POS_COLUMN, 10
; ldi POS_ROWP, 13
; call set_framebuffer_pointer_to_text_cursor ; (sets cursor to 4th character of second row in 13th row-pair = column 4, row 27 on screen)
; call set_framebuffer_pointer_to_text_cursor
; @modifies Y, R0, R1
set_framebuffer_pointer_to_text_cursor:
; Load framebuffer start position to Y
@ -109,12 +109,15 @@ draw_carriage_return:
sub YL, POS_COLUMN
sbci YH, 0
; Set cursor to start of current line
subi POS_COLUMN, LINE_COLUMNS
clr POS_COLUMN
; Go to next line
ldi HIGH_ACCUM, high(LINE_COLUMNS*FONT_HEIGHT)
add YH, HIGH_ACCUM
ldi HIGH_ACCUM, low(LINE_COLUMNS*FONT_HEIGHT)
adc YL, HIGH_ACCUM
; Update row pointer
ldi HIGH_ACCUM, FONT_HEIGHT
add POS_ROWP, HIGH_ACCUM
ret
; Scrolls the screen by one line (=LINE_COLUMNS*FONT_HEIGHT bytes)

View File

@ -26,8 +26,8 @@
; *** reserved registers ***
; Cursor Position
; POS_COLUMN (0-103) represents the column on a pair of rows: 0 to 46 is the first row, 47 to 92 the second one
; POS_ROWP (0-128) represent the pair of rows. POS_ROWP = 5 means the 10th and 11th rows
; POS_COLUMN (0-46) represents the character/chunk column
; POS_ROWP (0-255) represent the chunk row. The caracter row is POS_ROWP/FONT_HEIGHT
; POS_FINE represents fine position (bit inside coarse-position-pointed chunk) in graphic mode.
.def POS_COLUMN = r21
.def POS_ROWP = r20
@ -110,6 +110,10 @@ main:
; test draw character routine
call draw_carriage_return
call draw_carriage_return
call draw_carriage_return
call cursor_pos_home
ldi r18, 0x41
dctest:
@ -120,7 +124,7 @@ main:
cpi r18, 0x5B
brne dc_continue
ldi r18, 0x41
;call draw_carriage_return
call draw_carriage_return
dc_continue:
; wait
ser r19