hgr: vgi: more work

This commit is contained in:
Vince Weaver 2021-06-19 23:54:34 -04:00
parent 6e1efd5f41
commit 5495d6068c
4 changed files with 76 additions and 52 deletions

View File

@ -113,7 +113,7 @@ simple_rectangle_loop:
; get ROW into (GBASL)
ldx #0 ; X1 into X
ldx VGI_RX1 ; X1 into X
lda VGI_RY1 ; Y1 into A
ldy #0 ; always 0
jsr HPOSN ; (Y,X),(A) (values stores in HGRX,XH,Y)
@ -127,24 +127,26 @@ simple_rectangle_loop:
; get position of first block (x/7) and put into Y
; HPOSN does this for us
; draw leftmost
ldy VGI_RX1
lda div7_table,Y
tay
; ldy VGI_RX1
; lda div7_table,Y
; tay
; set up the color
; HPOSN also does this
and #$1
beq no_shift
lda HGR_BITS
jsr COLOR_SHIFT
; and #$1
; beq no_shift
no_shift:
; lda HGR_BITS
; jsr COLOR_SHIFT
;no_shift:
; check if narrow corner case where begin and end same block
; if RX%7 + XRUN > 8
; if RX%7 + XRUN < 8
ldx VGI_RX1
lda mod7_table,X
@ -156,18 +158,14 @@ no_shift:
corner:
; want to use MASK of left_mask, MOD7 and 7-XRUN
lda #7
sec
sbc XRUN
sta OTHER_MASK
lda mod7_table,X
tax
lda (GBASL),Y
eor HGR_BITS
and left_masks,X
and OTHER_MASK
ldx XRUN
and right_masks,X
eor (GBASL),Y
sta (GBASL),Y

View File

@ -3,7 +3,10 @@
;
1 1 6 0 90 140 191 ; ocean left
1 1 6 140 90 279 191 ; ocean right
1 4 1 157 121 208 191 ; tower shadow
;1 4 1 157 121 208 191 ; tower shadow
; 001000 100010
6 0x8 0x22 157 121 208 165 ; tower shadow
6 0x8 0x22 160 165 204 191 ; tower shadow
;
1 4 0 141 116 209 129 ; gear base shade
1 4 0 147 125 164 134 ; gear base shade left
@ -33,13 +36,35 @@
; marker switch
1 5 5 148 110 156 120 ; marker switch
1 2 2 149 106 155 109 ; top switch
; grass
1 5 1 0 163 63 191 ; grass
1 5 1 63 167 177 191 ; grass
1 5 1 177 185 230 191 ; grass
1 5 0 23 0 39 178 ; tree
1 1 5 1 13 99 44 ; leaves
1 5 0 0 0 20 188 ; tree
1 0 5 66 0 81 187 ; tree
1 1 5 66 1 99 19 ; leaves
; puzzle
1 0 4 60 152 120 178 ; black box
1 0 4 70 147 109 152 ; black box (more)
1 0 4 81 145 99 147 ; black box (more)
4 7 104 173 ; edge (white)
5 104 161 ; lineto top
4 5 60 152 ; top edge (orange)
5 104 161 ; right
5 118 151 ; more right
5 84 143 ; left
5 60 152 ; back to origin
1 0 0 78 142 86 147 ; left shaft
1 5 5 72 137 86 140 ; left knob
1 5 5 75 146 85 151 ; left base
1 0 0 90 145 97 152 ; right shaft
1 5 5 88 141 101 145 ; right knob
1 5 5 91 150 96 154 ; right base
1 2 5 100 152 105 157 ; button
; grass / trees
1 5 1 0 163 63 191 ; grass left
1 5 1 63 167 143 191 ; grass middle
1 5 1 133 177 184 191 ; grass again
1 5 1 177 185 230 191 ; grass right
6 0xA8 0xAA 28 0 39 178 ; middle tree
6 0x8 0x22 1 13 99 44 ; leaves
6 0xA8 0xAA 0 0 12 188 ; left tree
6 0xA8 0xAA 70 0 81 187 ; right tree
1 0 0 39 183 67 186 ; shadow
1 0 0 12 179 39 183 ; shadow
6 0x8 0x22 66 1 99 19 ; leaves
6 0x8 0x22 15 49 49 79 ; leaves
15

View File

@ -14,17 +14,17 @@ int main(int argc, char **argv) {
if (buffer[0]==';') continue;
sscanf(buffer,"%d",&type);
sscanf(buffer,"%i",&type);
switch(type) {
case 0: /* clear screen */
sscanf(buffer,"%d %d",&type,&color1);
sscanf(buffer,"%i %i",&type,&color1);
printf(".byte $%02X,",(type<<4)|2);
printf("$%02X\n",color1);
break;
case 1: /* compact rectangle */
sscanf(buffer,"%d %d %d %d %d %d %d",
sscanf(buffer,"%i %i %i %i %i %i %i",
&type,
&color1,&color2,
&x1,&y1,&x2,&y2);
@ -37,7 +37,7 @@ int main(int argc, char **argv) {
break;
case 2: /* circle */
sscanf(buffer,"%d %d %d %d %d",
sscanf(buffer,"%i %i %i %i %i",
&type,
&color1,
&x1,&y1,&r);
@ -49,7 +49,7 @@ int main(int argc, char **argv) {
break;
case 3: /* filled circle */
sscanf(buffer,"%d %d %d %d %d",
sscanf(buffer,"%i %i %i %i %i",
&type,
&color1,
&x1,&y1,&r);
@ -61,7 +61,7 @@ int main(int argc, char **argv) {
break;
case 4: /* point */
sscanf(buffer,"%d %d %d %d",
sscanf(buffer,"%i %i %i %i",
&type,
&color1,
&x1,&y1);
@ -72,7 +72,7 @@ int main(int argc, char **argv) {
break;
case 5: /* line to */
sscanf(buffer,"%d %d %d",
sscanf(buffer,"%i %i %i",
&type,
&x1,&y1);
printf(".byte $%02X,",(type<<4)|3);
@ -81,7 +81,7 @@ int main(int argc, char **argv) {
break;
case 6: /* dithered rectangle */
sscanf(buffer,"%d %d %d %d %d %d %d",
sscanf(buffer,"%i %i %i %i %i %i %i",
&type,
&color1,&color2,
&x1,&y1,&x2,&y2);
@ -99,7 +99,7 @@ int main(int argc, char **argv) {
break;
default:
fprintf(stderr,"Unknown type %d\n",type);
fprintf(stderr,"Unknown type %i\n",type);
break;
}

View File

@ -188,11 +188,13 @@ done_colors:
; get ROW into (GBASL)
ldx #0 ; X1 into X
ldx VGI_RX1 ; X1 into X
lda VGI_RY1 ; Y1 into A
ldy #0 ; always 0
jsr HPOSN ; (Y,X),(A) (values stores in HGRX,XH,Y)
; Y is already the RX1/7
; copy the XRUN
lda VGI_RXRUN
@ -204,22 +206,22 @@ done_colors:
; get position of first block (x/7) and put into Y
; draw leftmost
ldy VGI_RX1
lda div7_table,Y
tay
; ldy VGI_RX1
; lda div7_table,Y
; tay
; set up the color
and #$1
beq no_shift
; and #$1
; beq no_shift
lda HGR_BITS
jsr COLOR_SHIFT
; lda HGR_BITS
; jsr COLOR_SHIFT
no_shift:
;no_shift:
; check if narrow corner case where begin and end same block
; if RX%7 + XRUN > 8
; if RX%7 + XRUN < 8
ldx VGI_RX1
lda mod7_table,X
@ -231,18 +233,14 @@ no_shift:
corner:
; want to use MASK of left_mask, MOD7 and 7-XRUN
lda #7
sec
sbc XRUN
sta OTHER_MASK
lda mod7_table,X
tax
lda (GBASL),Y
eor HGR_BITS
and left_masks,X
and OTHER_MASK
ldx XRUN
and right_masks,X
eor (GBASL),Y
sta (GBASL),Y
@ -345,6 +343,9 @@ vgi_dithered_rectangle:
lda #1
sta USE_DITHERED
lda #0
sta COUNT
jmp simple_rectangle_loop
.if 0
dithered_rectangle_loop: