Working EOL
This commit is contained in:
parent
706dbe56e1
commit
d3604ca3ab
@ -48,7 +48,7 @@ draw_char:
|
||||
; Char drawing is complete. Increment cursor position
|
||||
inc POS_COLUMN
|
||||
; Check if end of line
|
||||
cpi POS_COLUMN, 52
|
||||
cpi POS_COLUMN, LINE_COLUMNS
|
||||
breq draw_char_eol
|
||||
; Reset chunk position to first glyph line of next column
|
||||
mov YL, r2 ; first restore Y
|
||||
@ -63,7 +63,7 @@ draw_char:
|
||||
brne draw_char_end
|
||||
cpi YL, low(FRAMEBUFFER_END + 1)
|
||||
brne draw_char_end
|
||||
; End of screen reached! Scroll framebuffer by 1 line (=52*FONT_HEIGHT bytes)
|
||||
; End of screen reached! Scroll framebuffer by 1 line (=46*FONT_HEIGHT bytes)
|
||||
; TODO
|
||||
draw_char_end:
|
||||
ret
|
||||
|
@ -9,7 +9,7 @@
|
||||
; INTERNAL POINTER:
|
||||
; Internally, the last screen position is represented by 24 bits in two registers:
|
||||
; POS_COARSE: Register Y (16-bit, r31 and r30): Coarse position. Points to one of the chunks
|
||||
; (character columns). 52 chunks per row, 304 rows. Used for character position, as
|
||||
; (character columns). 46 chunks per row, 304 rows. Used for character position, as
|
||||
; 1 chunk = 1 byte = 1 character.
|
||||
; POS_FINE: Register r24: Fine position. Represents the bit inside the chunk selected by POS_COARSE.
|
||||
; Ignored in character mode (the character is always aligned to column). Used in graphic mode.
|
||||
|
@ -26,8 +26,8 @@
|
||||
|
||||
; *** reserved registers ***
|
||||
; Cursor Position
|
||||
; POS_COLUMN (0-103) represents the column on a pair of rows: 0 to 51 is the first row, 52 to 103 the second one
|
||||
; POS_ROWP (0-152) represent the pair of rows. POS_ROWP = 5 means the 10th and 11th rows
|
||||
; 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_FINE represents fine position (bit inside coarse-position-pointed chunk) in graphic mode.
|
||||
.def POS_COLUMN = r21
|
||||
.def POS_ROWP = r20
|
||||
@ -87,21 +87,7 @@ main:
|
||||
cpi r26, 0b11000000
|
||||
brne load_mem_loop ; if not 0, repeat h_picture_loop
|
||||
|
||||
; test draw character routine
|
||||
call cursor_pos_home
|
||||
ldi r19, 14
|
||||
dctest:
|
||||
ldi r18, 0x21
|
||||
draw_chars:
|
||||
mov HIGH_ACCUM, r18
|
||||
call draw_char
|
||||
inc r18
|
||||
cpi r18, 0x7E
|
||||
brne draw_chars
|
||||
dec r19
|
||||
brne dctest
|
||||
|
||||
|
||||
|
||||
|
||||
; *** timer setup (use 16-bit counter TC1) ***
|
||||
; The Power Reduction TC1 and TC3 bits in the Power Reduction Registers (PRR0.PRTIM1 and
|
||||
@ -121,6 +107,39 @@ main:
|
||||
; Wait for data (it never exits)
|
||||
; jmp comm_init
|
||||
|
||||
|
||||
|
||||
; test draw character routine
|
||||
call cursor_pos_home
|
||||
dctest:
|
||||
ldi r18, 0x21
|
||||
draw_chars:
|
||||
mov HIGH_ACCUM, r18
|
||||
call draw_char
|
||||
inc r18
|
||||
cpi r18, 0x7E
|
||||
brne dc_continue
|
||||
ldi r18, 0x21
|
||||
dc_continue:
|
||||
; wait
|
||||
ser r19
|
||||
dc_wait_loop_1:
|
||||
ser r20
|
||||
dc_wait_loop_2:
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
dec r20
|
||||
brne dc_wait_loop_2
|
||||
dec r19
|
||||
brne dc_wait_loop_1
|
||||
brne draw_chars
|
||||
jmp dctest
|
||||
|
||||
|
||||
|
||||
|
||||
forever:
|
||||
jmp forever
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
; *******************************************
|
||||
|
||||
; Implemented following timings in http://blog.retroleum.co.uk/electronics-articles/pal-tv-timing-and-voltages/
|
||||
; Every line, for 52 times, it loads a byte from memory into PORTA register and then shifts the byte to the left to show another bit (do it 7 times)
|
||||
; Every line, for 46 times, it loads a byte from memory into PORTA register and then shifts the byte to the left to show another bit (do it 7 times)
|
||||
; This also displays byte's MSB pixel "for free", as the video pin is PD7 (last bit of PORTA).
|
||||
|
||||
; This module generates a Composite PAL monochrome signal with a resolution
|
||||
@ -153,16 +153,13 @@ draw_picture:
|
||||
push XH
|
||||
push XL
|
||||
|
||||
; set X register to framebuffer start 0x0100
|
||||
; (set it a byte before, because it will be incremented at first)
|
||||
clr r27
|
||||
ldi r26, 0xFF
|
||||
; set X register to framebuffer start
|
||||
ldi r27, high(FRAMEBUFFER)
|
||||
ldi r26, low(FRAMEBUFFER)
|
||||
|
||||
; start 304 picture lines
|
||||
ldi LINE_COUNTER, 256 ; line counter
|
||||
h_picture_loop:
|
||||
; ***************** DRAW FIRST LINE *********************
|
||||
|
||||
; **** start line sync: 4uS, 96 cycles @ 24Mhz
|
||||
; video pin goes low before sync
|
||||
clr VG_HIGH_ACCUM ; 1 cycle
|
||||
|
Loading…
Reference in New Issue
Block a user