This commit is contained in:
Daniele Verducci su MatissePenguin 2021-01-26 20:52:53 +01:00
parent 64da85548e
commit 9d6e6efd13
2 changed files with 16 additions and 9 deletions

View File

@ -53,7 +53,10 @@ draw_char:
; Sets the cursor to 0,0 and clears fine position ; Sets the cursor to 0,0 and clears fine position
cursor_pos_home: cursor_pos_home:
; Set Y to framebuffer start ; Set Y to framebuffer start
ldi YH, high(FRAMEBUFFER) ;ldi YH, high(FRAMEBUFFER)
ldi YL, low(FRAMEBUFFER) ;ldi YL, low(FRAMEBUFFER)
ldi YH, high(0x0068)
ldi YL, low(0x0068)
clr POS_FINE clr POS_FINE
ret ret

View File

@ -27,13 +27,17 @@
.include "m1284def.inc" ; Atmega 1280 device definition .include "m1284def.inc" ; Atmega 1280 device definition
; reserved registers ; *** reserved registers ***
; Cursor Position
.def POS_COLUMN = r21 ; absolute coarse position on line (0 to 51)
.def POS_ROW = r20 ; absolute coarse position on line (0 to 51)
.def POS_FINE = r24 ; fine position (bit inside coarse-position-pointed byte)
; Internal registers
.def A = r0 ; accumulator .def A = r0 ; accumulator
.def STATUS = r25 ; signal status (see STATUS TABLE) .def STATUS = r25 ; signal status (see STATUS TABLE)
;POS_COARSE = Y ; coarse position (aligned to character column) ;POS_COARSE = Y ; coarse position (aligned to character column)
;DRAWING_BYTE = X ; coarse position (aligned to character column) ;DRAWING_BYTE = X ; current position in framebuffer
.def POS_FINE = r24 ; fine position (bit inside coarse-position-pointed byte) .def LINE_COUNTER = r23
.def LINE_COUNTER = r23 ; fine position (bit inside coarse-position-pointed byte)
.def VG_HIGH_ACCUM = r22 ; an accumulator in high registers to be used only by video_generator in interrupt .def VG_HIGH_ACCUM = r22 ; an accumulator in high registers to be used only by video_generator in interrupt
.def HIGH_ACCUM = r16 ; an accumulator in high registers to be used outside of interrupts .def HIGH_ACCUM = r16 ; an accumulator in high registers to be used outside of interrupts
@ -47,7 +51,7 @@
.equ BUSY_PIN = PD2 .equ BUSY_PIN = PD2
; memory ; memory
.equ FRAMEBUFFER = 0x100 .equ FRAMEBUFFER = 0x0100
; start vector ; start vector
.org 0x0000 .org 0x0000
@ -83,7 +87,7 @@ main:
brne load_mem_loop ; if not 0, repeat h_picture_loop brne load_mem_loop ; if not 0, repeat h_picture_loop
; test draw character routine ; test draw character routine
;call cursor_pos_home call cursor_pos_home
ldi r18, 0x30 ldi r18, 0x30
draw_chars: draw_chars:
mov HIGH_ACCUM, r18 mov HIGH_ACCUM, r18