From 7da8d58ee00bd2987b235643ec4b71d599999e1d Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Sun, 24 Sep 2017 17:57:57 -0700 Subject: [PATCH] Document offset params for DRAW_BITMAP --- desk.acc/a2d.inc | 8 +- desk.acc/calculator.s | 340 +++++++++++++++++++++++------------------- 2 files changed, 194 insertions(+), 154 deletions(-) diff --git a/desk.acc/a2d.inc b/desk.acc/a2d.inc index 89dde4a..88fa2b5 100644 --- a/desk.acc/a2d.inc +++ b/desk.acc/a2d.inc @@ -150,9 +150,11 @@ A2D_DRAW_BITMAP := $14 ; Draw pattern ;; (input length 16 bytes) ;; .word left ;; .word top - ;; .addr pattern pattern is 7 bits per byte, 0 = black, 1 = white - ;; .byte stride pattern width in bytes - ;; .byte 0,0,0,0,0 ??? + ;; .addr bitmap bitmap is 7 bits per byte, 0 = black, 1 = white + ;; .byte stride bitmap width in bytes + ;; .byte 0 ??? + ;; .word hoffset offset within bitmap definition + ;; .word voffset ;; .word width pixels ;; .word height pixels diff --git a/desk.acc/calculator.s b/desk.acc/calculator.s index 21c1f32..83e7457 100644 --- a/desk.acc/calculator.s +++ b/desk.acc/calculator.s @@ -241,236 +241,272 @@ flag: .byte A2D_CZP_OVERWRITE border_br := 2 ; (bottom/right) .proc btn_c - .word col1_left - border_lt - .word row1_top - border_lt - .addr button_bitmap - .byte bitmap_stride - .byte $00,$00,$00,$00,$00 ; ??? - .word button_width + border_lt + border_br - .word button_height + border_lt + border_br +left: .word col1_left - border_lt +top: .word row1_top - border_lt +bitmap: .addr button_bitmap +stride: .byte bitmap_stride + .byte 0 ; ??? +hoffset:.word 0 +voffset:.word 0 +width: .word button_width + border_lt + border_br +height: .word button_height + border_lt + border_br label: .byte 'c' pos: .word col1_left + 6, row1_bot box: .word col1_left,row1_top,col1_right,row1_bot .endproc .proc btn_e - .word col2_left - border_lt - .word row1_top - border_lt - .addr button_bitmap - .byte bitmap_stride - .byte $00,$00,$00,$00,$00 - .word button_width + border_lt + border_br - .word button_height + border_lt + border_br +left: .word col2_left - border_lt +top: .word row1_top - border_lt +bitmap: .addr button_bitmap +stride: .byte bitmap_stride + .byte 0 ; ??? +hoffset:.word 0 +voffset:.word 0 +width: .word button_width + border_lt + border_br +height: .word button_height + border_lt + border_br label: .byte 'e' - .word col2_left + 6, row1_bot +pos: .word col2_left + 6, row1_bot box: .word col2_left,row1_top,col2_right,row1_bot .endproc .proc btn_eq - .word col3_left - border_lt - .word row1_top - border_lt - .addr button_bitmap - .byte bitmap_stride - .byte $00,$00,$00,$00,$00 - .word button_width + border_lt + border_br - .word button_height + border_lt + border_br +left: .word col3_left - border_lt +top: .word row1_top - border_lt +bitmap: .addr button_bitmap +stride: .byte bitmap_stride + .byte 0 ; ??? +hoffset:.word 0 +voffset:.word 0 +width: .word button_width + border_lt + border_br +height: .word button_height + border_lt + border_br label: .byte '=' - .word col3_left + 6, row1_bot +pos: .word col3_left + 6, row1_bot box: .word col3_left,row1_top,col3_right,row1_bot .endproc .proc btn_mul - .word col4_left - border_lt - .word row1_top - border_lt - .addr button_bitmap - .byte bitmap_stride - .byte $00,$00,$00,$00,$00 - .word button_width + border_lt + border_br - .word button_height + border_lt + border_br +left: .word col4_left - border_lt +top: .word row1_top - border_lt +bitmap: .addr button_bitmap +stride: .byte bitmap_stride + .byte 0 ; ??? +hoffset:.word 0 +voffset:.word 0 +width: .word button_width + border_lt + border_br +height: .word button_height + border_lt + border_br label: .byte '*' - .word col4_left + 6, row1_bot +pos: .word col4_left + 6, row1_bot box: .word col4_left,row1_top,col4_right,row1_bot .endproc .proc btn_7 - .word col1_left - border_lt - .word row2_top - border_lt - .addr button_bitmap - .byte bitmap_stride - .byte $00,$00,$00,$00,$00 - .word button_width + border_lt + border_br - .word button_height + border_lt + border_br +left: .word col1_left - border_lt +top: .word row2_top - border_lt +bitmap: .addr button_bitmap +stride: .byte bitmap_stride + .byte 0 ; ??? +hoffset:.word 0 +voffset:.word 0 +width: .word button_width + border_lt + border_br +height: .word button_height + border_lt + border_br label: .byte '7' - .word col1_left + 6, row2_bot +pos: .word col1_left + 6, row2_bot box: .word col1_left,row2_top,col1_right,row2_bot .endproc .proc btn_8 - .word col2_left - border_lt - .word row2_top - border_lt - .addr button_bitmap - .byte bitmap_stride - .byte $00,$00,$00,$00,$00 - .word button_width + border_lt + border_br - .word button_height + border_lt + border_br +left: .word col2_left - border_lt +top: .word row2_top - border_lt +bitmap: .addr button_bitmap +stride: .byte bitmap_stride + .byte 0 ; ??? +hoffset:.word 0 +voffset:.word 0 +width: .word button_width + border_lt + border_br +height: .word button_height + border_lt + border_br label: .byte '8' - .word col2_left + 6, row2_bot +pos: .word col2_left + 6, row2_bot box: .word col2_left,row2_top,col2_right,row2_bot .endproc .proc btn_9 - .word col3_left - border_lt - .word row2_top - border_lt - .addr button_bitmap - .byte bitmap_stride - .byte $00,$00,$00,$00,$00 - .word button_width + border_lt + border_br - .word button_height + border_lt + border_br +left: .word col3_left - border_lt +top: .word row2_top - border_lt +bitmap: .addr button_bitmap +stride: .byte bitmap_stride + .byte 0 ; ??? +hoffset:.word 0 +voffset:.word 0 +width: .word button_width + border_lt + border_br +height: .word button_height + border_lt + border_br label: .byte '9' - .word col3_left + 6, row2_bot +pos: .word col3_left + 6, row2_bot box: .word col3_left,row2_top,col3_right,row2_bot .endproc .proc btn_div - .word col4_left - border_lt - .word row2_top - border_lt - .addr button_bitmap - .byte bitmap_stride - .byte $00,$00,$00,$00,$00 - .word button_width + border_lt + border_br - .word button_height + border_lt + border_br +left: .word col4_left - border_lt +top: .word row2_top - border_lt +bitmap: .addr button_bitmap +stride: .byte bitmap_stride + .byte 0 ; ??? +hoffset:.word 0 +voffset:.word 0 +width: .word button_width + border_lt + border_br +height: .word button_height + border_lt + border_br label: .byte '/' - .word col4_left + 6, row2_bot +pos: .word col4_left + 6, row2_bot box: .word col4_left,row2_top,col4_right,row2_bot .endproc .proc btn_4 - .word col1_left - border_lt - .word row3_top - border_lt - .addr button_bitmap - .byte bitmap_stride - .byte $00,$00,$00,$00,$00 - .word button_width + border_lt + border_br - .word button_height + border_lt + border_br +left: .word col1_left - border_lt +top: .word row3_top - border_lt +bitmap: .addr button_bitmap +stride: .byte bitmap_stride + .byte 0 ; ??? +hoffset:.word 0 +voffset:.word 0 +width: .word button_width + border_lt + border_br +height: .word button_height + border_lt + border_br label: .byte '4' - .word col1_left + 6, row3_bot +pos: .word col1_left + 6, row3_bot box: .word col1_left,row3_top,col1_right,row3_bot .endproc .proc btn_5 - .word col2_left - border_lt - .word row3_top - border_lt - .addr button_bitmap - .byte bitmap_stride - .byte $00,$00,$00,$00,$00 - .word button_width + border_lt + border_br - .word button_height + border_lt + border_br +left: .word col2_left - border_lt +top: .word row3_top - border_lt +bitmap: .addr button_bitmap +stride: .byte bitmap_stride + .byte 0 ; ??? +hoffset:.word 0 +voffset:.word 0 +width: .word button_width + border_lt + border_br +height: .word button_height + border_lt + border_br label: .byte '5' - .word col2_left + 6, row3_bot +pos: .word col2_left + 6, row3_bot box: .word col2_left,row3_top,col2_right,row3_bot .endproc .proc btn_6 - .word col3_left - border_lt - .word row3_top - border_lt - .addr button_bitmap - .byte bitmap_stride - .byte $00,$00,$00,$00,$00 - .word button_width + border_lt + border_br - .word button_height + border_lt + border_br +left: .word col3_left - border_lt +top: .word row3_top - border_lt +bitmap: .addr button_bitmap +stride: .byte bitmap_stride + .byte 0 ; ??? +hoffset:.word 0 +voffset:.word 0 +width: .word button_width + border_lt + border_br +height: .word button_height + border_lt + border_br label: .byte '6' - .word col3_left + 6, row3_bot +pos: .word col3_left + 6, row3_bot box: .word col3_left,row3_top,col3_right,row3_bot .endproc .proc btn_sub - .word col4_left - border_lt - .word row3_top - border_lt - .addr button_bitmap - .byte bitmap_stride - .byte $00,$00,$00,$00,$00 - .word button_width + border_lt + border_br - .word button_height + border_lt + border_br +left: .word col4_left - border_lt +top: .word row3_top - border_lt +bitmap: .addr button_bitmap +stride: .byte bitmap_stride + .byte 0 ; ??? +hoffset:.word 0 +voffset:.word 0 +width: .word button_width + border_lt + border_br +height: .word button_height + border_lt + border_br label: .byte '-' - .word col4_left + 6, row3_bot +pos: .word col4_left + 6, row3_bot box: .word col4_left,row3_top,col4_right,row3_bot .endproc .proc btn_1 - .word col1_left - border_lt - .word row4_top - border_lt - .addr button_bitmap - .byte bitmap_stride - .byte $00,$00,$00,$00,$00 - .word button_width + border_lt + border_br - .word button_height + border_lt + border_br +left: .word col1_left - border_lt +top: .word row4_top - border_lt +bitmap: .addr button_bitmap +stride: .byte bitmap_stride + .byte 0 ; ??? +hoffset:.word 0 +voffset:.word 0 +width: .word button_width + border_lt + border_br +height: .word button_height + border_lt + border_br label: .byte '1' - .word col1_left + 6, row4_bot +pos: .word col1_left + 6, row4_bot box: .word col1_left,row4_top,col1_right,row4_bot .endproc .proc btn_2 - .word col2_left - border_lt - .word row4_top - border_lt - .addr button_bitmap - .byte bitmap_stride - .byte $00,$00,$00,$00,$00 - .word button_width + border_lt + border_br - .word button_height + border_lt + border_br +left: .word col2_left - border_lt +top: .word row4_top - border_lt +bitmap: .addr button_bitmap +stride: .byte bitmap_stride + .byte 0 ; ??? +hoffset:.word 0 +voffset:.word 0 +width: .word button_width + border_lt + border_br +height: .word button_height + border_lt + border_br label: .byte '2' - .word col2_left + 6, row4_bot +pos: .word col2_left + 6, row4_bot box: .word col2_left,row4_top,col2_right,row4_bot .endproc .proc btn_3 - .word col3_left - border_lt - .word row4_top - border_lt - .addr button_bitmap - .byte bitmap_stride - .byte $00,$00,$00,$00,$00 - .word button_width + border_lt + border_br - .word button_height + border_lt + border_br +left: .word col3_left - border_lt +top: .word row4_top - border_lt +bitmap: .addr button_bitmap +stride: .byte bitmap_stride + .byte 0 ; ??? +hoffset:.word 0 +voffset:.word 0 +width: .word button_width + border_lt + border_br +height: .word button_height + border_lt + border_br label: .byte '3' - .word col3_left + 6, row4_bot +pos: .word col3_left + 6, row4_bot box: .word col3_left,row4_top,col3_right,row4_bot .endproc .proc btn_0 - .word col1_left - border_lt - .word row5_top - border_lt - .addr wide_button_bitmap - .byte 8 ; bitmap_stride (bytes) - .byte $00,$00,$00,$00,$00 - .word 49 ; 0 is extra wide - .word button_height + border_lt + border_br - .byte '0' - .word col1_left + 6, row5_bot +left: .word col1_left - border_lt +top: .word row5_top - border_lt +bitmap: .addr wide_button_bitmap +stride: .byte 8 ; bitmap_stride (bytes) + .byte 0 ; ??? +hoffset:.word 0 +voffset:.word 0 +width: .word 49 ; 0 is extra wide +height: .word button_height + border_lt + border_br +label: .byte '0' +pos: .word col1_left + 6, row5_bot box: .word col1_left,row5_top,col2_right,row5_bot .endproc .proc btn_dec - .word col3_left - border_lt - .word row5_top - border_lt - .addr button_bitmap - .byte bitmap_stride - .byte $00,$00,$00,$00,$00 - .word button_width + border_lt + border_br - .word button_height + border_lt + border_br - .byte '.' - .word col3_left + 6 + 2, row5_bot ; + 2 to center the label +left: .word col3_left - border_lt +top: .word row5_top - border_lt +bitmap: .addr button_bitmap +stride: .byte bitmap_stride + .byte 0 ; ??? +hoffset:.word 0 +voffset:.word 0 +width: .word button_width + border_lt + border_br +height: .word button_height + border_lt + border_br +label: .byte '.' +pos: .word col3_left + 6 + 2, row5_bot ; + 2 to center the label box: .word col3_left,row5_top,col3_right,row5_bot .endproc .proc btn_add - .word col4_left - border_lt - .word row4_top - border_lt - .addr tall_button_bitmap - .byte bitmap_stride - .byte $00,$00,$00,$00,$00 - .word button_width + border_lt + border_br - .word 27 ; + is extra tall - .byte '+' - .word col4_left + 6, row5_bot +left: .word col4_left - border_lt +top: .word row4_top - border_lt +bitmap: .addr tall_button_bitmap +stride: .byte bitmap_stride + .byte 0 ; ??? +hoffset:.word 0 +voffset:.word 0 +width: .word button_width + border_lt + border_br +height: .word 27 ; + is extra tall +label: .byte '+' +pos: .word col4_left + 6, row5_bot box: .word col4_left,row4_top,col4_right,row5_bot .endproc .byte 0 ; sentinel @@ -480,7 +516,7 @@ box: .word col4_left,row4_top,col4_right,row5_bot ;; bitmaps are low 7 bits, 0=black 1=white bitmap_stride := 3 ; bytes -button_bitmap: ; bitmap for normal buttons +button_bitmap: ; bitmap for normal buttons .byte px(%0000000),px(%0000000),px(%0000001) .byte px(%0111111),px(%1111111),px(%1111100) .byte px(%0111111),px(%1111111),px(%1111100) @@ -496,7 +532,7 @@ button_bitmap: ; bitmap for normal buttons .byte px(%1000000),px(%0000000),px(%0000000) wide_bitmap_stride := 8 -wide_button_bitmap: ; bitmap for '0' button +wide_button_bitmap: ; bitmap for '0' button .byte px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%1111111) .byte px(%0111111),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1111110),px(%0111111) .byte px(%0111111),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1111110),px(%0111111) @@ -511,7 +547,7 @@ wide_button_bitmap: ; bitmap for '0' button .byte px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0111111) .byte px(%1000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0111111) -tall_button_bitmap: ; bitmap for '+' button +tall_button_bitmap: ; bitmap for '+' button .byte px(%0000000),px(%0000000),px(%0000001) .byte px(%0111111),px(%1111111),px(%1111100) .byte px(%0111111),px(%1111111),px(%1111100) @@ -665,7 +701,9 @@ left: .word 115 ; overwritten top: .word $FFF7 ; overwritten bitmap:.addr pixels stride: .byte 1 - .byte 0,0,0,0,0 ; ??? + .byte 0 ; ??? +hoffset:.word 0 +voffset:.word 0 width: .word 6 height: .word 5 ;; (not part of struct, but not referenced outside) @@ -681,7 +719,7 @@ pixels: .byte px(%1000001) .proc state_params left: .word 0 top: .word 0 -addr: .word 0 +saddr: .word 0 stride: .word 0 hoffset:.word 0 voffset:.word 0