Back working on communication

This commit is contained in:
Daniele Verducci su MatissePenguin 2021-01-27 08:58:04 +01:00
parent 467197fd23
commit 5bea35365d
3 changed files with 19 additions and 14 deletions

View File

@ -75,10 +75,11 @@ cursor_pos_home:
clr POS_ROWP clr POS_ROWP
clr POS_FINE clr POS_FINE
; Load framebuffer start position to Y ; Load framebuffer start position to Y
ldi YH, high(FRAMEBUFFER) ; ldi YH, high(FRAMEBUFFER)
ldi YL, low(FRAMEBUFFER) ; ldi YL, low(FRAMEBUFFER)
; ldi YH, high(0x1000) ; TODO: First 3 lines are not visible! Outside of screen!
; ldi YL, low(0x1000) ldi YH, high(0x780)
ldi YL, low(0x780)
ret ret
; Updates framebuffer pointer (Y) to point to current text cursor position (POS_COLUMN, POS_ROWP) ; Updates framebuffer pointer (Y) to point to current text cursor position (POS_COLUMN, POS_ROWP)

View File

@ -18,16 +18,20 @@
comm_init: comm_init:
call cursor_pos_home ; Set cursor to 0,0 call cursor_pos_home ; Set cursor to 0,0
comm_wait_byte: comm_wait_byte:
in A, DATA_PORT_IN ; read PORTB in HIGH_ACCUM, DATA_PORT_IN ; read PORTB
; Check continuously CLK until a LOW is found ; Check continuously CLK until a LOW is found
sbic PORTD, CLK_PIN sbic PORTD, CLK_PIN
jmp comm_wait_byte jmp comm_wait_byte
; CLK triggered: Copy PORTB to the next framebuffer byte ; CLK triggered: Draw char
st Y+, A call draw_char
; if reached the last framebuffer byte, exit cycle jmp comm_wait_byte
cpi r31, 0b00111110
brne comm_wait_byte ; if not 0, repeat h_picture_loop ; ; CLK triggered: Copy PORTB to the next framebuffer byte
cpi r30, 0b11000000 ; st Y+, A
brne comm_wait_byte ; if not 0, repeat h_picture_loop ; ; if reached the last framebuffer byte, exit cycle
jmp comm_init ; filled all memory: reset framebuffer position ; cpi r31, 0b00111110
; brne comm_wait_byte ; if not 0, repeat h_picture_loop
; cpi r30, 0b11000000
; brne comm_wait_byte ; if not 0, repeat h_picture_loop
; jmp comm_init ; filled all memory: reset framebuffer position

View File

@ -158,7 +158,7 @@ main:
; Timer setup completed. ; Timer setup completed.
; Wait for data (it never exits) ; Wait for data (it never exits)
;jmp comm_init jmp comm_init
forever: forever:
jmp forever jmp forever