From 4a724440cfd9e0f8f63bea9d154417ac749d4d08 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Thu, 1 Jul 2021 17:21:19 -0400 Subject: [PATCH] gr: thinking: stuck on those last bytes --- graphics/gr/thinking/hardware.inc | 4 +- graphics/gr/thinking/thinking.s | 100 ++++++++++--- graphics/gr/thinking/thinking_attempt2.s | 147 +++++++++++++++++++ graphics/gr/thinking/thinking_attempt3.s | 157 ++++++++++++++++++++ graphics/gr/thinking/thinking_attempt4.s | 172 ++++++++++++++++++++++ graphics/gr/thinking/thinking_flip.s | 176 +++++++++++++++++++++++ graphics/gr/thinking/zp.inc | 1 - 7 files changed, 736 insertions(+), 21 deletions(-) create mode 100644 graphics/gr/thinking/thinking_attempt2.s create mode 100644 graphics/gr/thinking/thinking_attempt3.s create mode 100644 graphics/gr/thinking/thinking_attempt4.s create mode 100644 graphics/gr/thinking/thinking_flip.s diff --git a/graphics/gr/thinking/hardware.inc b/graphics/gr/thinking/hardware.inc index 8e0d0a83..9f111ac2 100644 --- a/graphics/gr/thinking/hardware.inc +++ b/graphics/gr/thinking/hardware.inc @@ -16,8 +16,8 @@ SET_GR = $C050 SET_TEXT = $C051 FULLGR = $C052 TEXTGR = $C053 -PAGE0 = $C054 -PAGE1 = $C055 +PAGE1 = $C054 +PAGE2 = $C055 LORES = $C056 ; Enable LORES graphics HIRES = $C057 ; Enable HIRES graphics AN3 = $C05E ; Annunciator 3 diff --git a/graphics/gr/thinking/thinking.s b/graphics/gr/thinking/thinking.s index 3a99f970..55a62cc2 100644 --- a/graphics/gr/thinking/thinking.s +++ b/graphics/gr/thinking/thinking.s @@ -5,11 +5,18 @@ .include "zp.inc" .include "hardware.inc" +; 161 -- original with page flip removed +; 159 -- remove extraneous store to YY +; 158 -- cond jump for jmp + COL = $F0 XSTART = $F1 XSTOP = $F2 YSTART = $F3 YSTOP = $F4 +OFFSET = $F5 +CURRENT = $F6 +YY = $F7 thinking: @@ -31,17 +38,17 @@ big_loop: box_loop: - ldx YSTART - yloop: txa jsr GBASCALC ; take Y-coord/2 in A, put address in GBASL/H ( a trashed, C clear) +.if 0 lda GBASH draw_page_smc: adc #0 sta GBASH +.endif lda COL and #$7 @@ -74,6 +81,49 @@ xloop: ; done drawing rainbow box ;========================== + ;========================== + ; write THINKING + ;========================== + +thinking_loop: + lda #7 ; YY + ldx #0 + +thinking_yloop: + sta YY ; YY in A here + +; lda YY + jsr GBASCALC ; take Y-coord/2 in A, put address in GBASL/H ( a trashed, C clear) + + ldy #0 +inc_pointer: + inx + lda thinking_data-1,X + sta CURRENT +thinking_xloop: + ror CURRENT + bcc no_draw + + lda #$00 + sta (GBASL),Y +no_draw: + iny + tya + and #$7 + beq inc_pointer + + cpy #39 + bne thinking_xloop + + inc YY + lda YY + cmp #14 + bne thinking_yloop + + ;========================== + ; flip pages + ;========================== +.if 0 flip_pages: ldy #1 @@ -85,39 +135,53 @@ done_page: eor #$4 ; flip draw page between $400/$800 sta draw_page_smc+1 ; DRAW_PAGE +.endif - lda #255 - jsr WAIT - ;=================== ; increment color ; after loop we are +10 ; so -1 actually means increment 1 (because we mod 8 it) dec COL - jmp big_loop + ;=================== + ; WAIT + + lda #255 + jsr WAIT ; A = 0 at end + + beq big_loop -;0 1 2 3 3 -;0123456789012345678901234567890123456789 -; ***** * * * * * * * * * * *** -; * * * * ** * * * * ** * * * -; * * * * ** * * * * ** * * -; * **** * * * * ** * * * * * -; * * * * * ** * * * * ** * ** -; * * * * * ** * * * * ** * * -; * * * * * * * * * * * **** +;0 1 2 3 3 +;01234567|89012345|67890123|45678901|23456789 +; ***** *| * * * | * * |* * * |* *** +; * *| * * **| * * *| * ** |* * * +; * *| * * **| * * * | * ** |* * +; * *|*** * * |* * ** | * * * |* * +; * *| * * * | ** * * | * * *|* * ** +; * *| * * * | ** * *| * * *|* * * +; * *| * * * | * * |* * * |* **** ; ; 7*5 bytes = 35 bytes -thinking_loop: +thinking_data: +.byte $BE,$54,$14,$15,$39 +.byte $88,$D4,$94,$34,$45 +.byte $88,$D4,$54,$34,$05 +.byte $88,$57,$35,$54,$05 +.byte $88,$54,$56,$94,$65 +.byte $88,$54,$96,$94,$45 +.byte $88,$54,$14,$15,$79 -end: - jmp end color_lookup: ; magenta, pink, orange, yellow, lgreen, aqua, mblue, lblue .byte $33,$BB,$99,$DD,$CC,$EE,$66,$77 + + + ; for apple II bot entry at $3F5 + + jmp thinking diff --git a/graphics/gr/thinking/thinking_attempt2.s b/graphics/gr/thinking/thinking_attempt2.s new file mode 100644 index 00000000..4a01ecdc --- /dev/null +++ b/graphics/gr/thinking/thinking_attempt2.s @@ -0,0 +1,147 @@ +; Print-shop Style THINKING + +; by Vince `deater` Weaver + +.include "zp.inc" +.include "hardware.inc" + +; 183 bytes +; 161 bytes (no pageflip) +; 114 only print thinking + +COL = $F0 +XSTART = $F1 +XSTOP = $F2 +YSTART = $F3 +YSTOP = $F4 +OFFSET = $F5 +CURRENT = $F6 +YY = $F7 +YS = $F8 + +thinking: + + jsr SETGR ; set lo-res 40x40 mode + ; A=$D0 afterward + +big_loop: + + ;============================== + ; write THINKING + rainbow box + ;============================== + +thinking_loop: + ldx #0 + stx YY + + + ;=================== + ; new yline +thinking_yloop: + lda YY + jsr GBASCALC ; take Y-coord/2 in A, put address in GBASL/H ( a trashed, C clear) + + ;=================== + ; start with x=0 + + ldy #0 +inc_pointer: + inx + lda thinking_data-1-35,X + sta CURRENT +thinking_xloop: + + ; to draw or not + ; first see if >7 && < 14 + lda YY + cmp #7 + bcc draw_bg + cmp #14 + bcs draw_bg + + ror CURRENT + bcs no_draw + + ; set color of background +draw_bg: + sty YS + lda COL + lda color_lookup,Y + ldy YS + sta (GBASL),Y +no_draw: + + iny + cpy #40 + beq done_line + + tya + and #$7 + beq inc_pointer + bne thinking_xloop + +done_line: + + inc COL + + inc YY + lda YY + cmp #19 + bne thinking_yloop + + ;========================== + ; flip pages + ;========================== + +flip_pages: + + + ;========================== + ; Wait + ;========================== + + + + lda #255 + jsr WAIT + + ;=================== + ; increment color + ; after loop we are +10 + ; so -1 actually means increment 1 (because we mod 8 it) + dec COL + + jmp big_loop + + +;0 1 2 3 3 +;01234567|89012345|67890123|45678901|23456789 +; ***** *| * * * | * * |* * * |* *** +; * *| * * **| * * *| * ** |* * * +; * *| * * **| * * * | * ** |* * +; * *|*** * * |* * ** | * * * |* * +; * *| * * * | ** * * | * * *|* * ** +; * *| * * * | ** * *| * * *|* * * +; * *| * * * | * * |* * * |* **** +; +; 7*5 bytes = 35 bytes + +thinking_data: +.byte $BE,$54,$14,$15,$39 +.byte $88,$D4,$94,$34,$45 +.byte $88,$D4,$54,$34,$05 +.byte $88,$57,$35,$54,$05 +.byte $88,$54,$56,$94,$65 +.byte $88,$54,$96,$94,$45 +.byte $88,$54,$14,$15,$79 + + + +color_lookup: + ; magenta, pink, orange, yellow, lgreen, aqua, mblue, lblue +.byte $33,$BB,$99,$DD,$CC,$EE,$66,$77 + + + ; for apple II bot entry at $3F5 + + jmp thinking diff --git a/graphics/gr/thinking/thinking_attempt3.s b/graphics/gr/thinking/thinking_attempt3.s new file mode 100644 index 00000000..44ac8eaa --- /dev/null +++ b/graphics/gr/thinking/thinking_attempt3.s @@ -0,0 +1,157 @@ +; Print-shop Style THINKING + +; by Vince `deater` Weaver + +.include "zp.inc" +.include "hardware.inc" + +COL = $F0 +XSTART = $F1 +XSTOP = $F2 +YSTART = $F3 +YSTOP = $F4 +OFFSET = $F5 +CURRENT = $F6 +YY = $F7 +XS = $F8 + +thinking: + + jsr SETGR ; set lo-res 40x40 mode + ; A=$D0 afterward + +big_loop: + + ; COL value doesn't matter? + + lda #0 + sta YSTART + sta XSTART + + lda #20 + sta YSTOP + asl + sta XSTOP + +box_loop: + + ldx YSTART +yloop: + txa + jsr GBASCALC ; take Y-coord/2 in A, put address in GBASL/H ( a trashed, C clear) + + + lda COL + and #$7 + tay + lda color_lookup,Y + sta COLOR + + ;====================== + ;====================== + ; inner loop begin + ; Y=xx + ; X=yy + + + ldy XSTART +xloop: + stx XS + tya + lsr + lsr + lsr + tax + lda thinking_data,X + sta CURRENT + + tya + and #$7 + tax +bloop: + ror CURRENT + dex + bne bloop + ldx XS + + bcs dont_draw + + lda COLOR + sta (GBASL),Y + +dont_draw: + iny + cpy XSTOP + bne xloop + + ; inner loop end + ;====================== + ;====================== + + + inx + cpx YSTOP + bne yloop + + inc COL + + inc XSTART + dec XSTOP + + inc YSTART + dec YSTOP + lda YSTOP + cmp #10 + bne box_loop + + ;========================== + ; done drawing rainbow box + ;========================== + + ;========================== + ; wait a bit + ;========================== + + lda #255 + jsr WAIT + + ;=================== + ; increment color + ; after loop we are +10 + ; so -1 actually means increment 1 (because we mod 8 it) + dec COL + + jmp big_loop + + +;0 1 2 3 3 +;01234567|89012345|67890123|45678901|23456789 +; ***** *| * * * | * * |* * * |* *** +; * *| * * **| * * *| * ** |* * * +; * *| * * **| * * * | * ** |* * +; * *|*** * * |* * ** | * * * |* * +; * *| * * * | ** * * | * * *|* * ** +; * *| * * * | ** * *| * * *|* * * +; * *| * * * | * * |* * * |* **** +; +; 7*5 bytes = 35 bytes + +thinking_data: +.byte $BE,$54,$14,$15,$39 +.byte $88,$D4,$94,$34,$45 +.byte $88,$D4,$54,$34,$05 +.byte $88,$57,$35,$54,$05 +.byte $88,$54,$56,$94,$65 +.byte $88,$54,$96,$94,$45 +.byte $88,$54,$14,$15,$79 + + + +color_lookup: + ; magenta, pink, orange, yellow, lgreen, aqua, mblue, lblue +.byte $33,$BB,$99,$DD,$CC,$EE,$66,$77 + + + ; for apple II bot entry at $3F5 + + jmp thinking diff --git a/graphics/gr/thinking/thinking_attempt4.s b/graphics/gr/thinking/thinking_attempt4.s new file mode 100644 index 00000000..1c8abc52 --- /dev/null +++ b/graphics/gr/thinking/thinking_attempt4.s @@ -0,0 +1,172 @@ +; Print-shop Style THINKING + +; by Vince `deater` Weaver + +.include "zp.inc" +.include "hardware.inc" + +COL = $F0 +XSTART = $F1 +XSTOP = $F2 +YSTART = $F3 +YSTOP = $F4 +OFFSET = $F5 +CURRENT = $F6 +YY = $F7 +XR = $F8 +XL = $F9 +YT = $FA +YB = $FB + +thinking: + + jsr SETGR ; set lo-res 40x40 mode + ; A=$D0 afterward + + lda #1 + sta COL + + lda #0 + sta XL + sta YT + + lda #39 + sta XR + sta YB + +big_loop: + lda COL + jsr SETCOL + + ; FOR Y=0 TO 20 STEP 2 + ; X=Y/2 + ; HLIN X,39-X AT Y + ; HLIN X,39-X AT 39-Y + ; VLIN Y,39-Y AT X + ; VLIN Y,39-Y AT 39-X + + + ; HLIN X,39-X AT Y + ; HLIN X,39-X AT 39-Y + ldy XL + lda XR + sta $2C + lda YT + jsr HLINE ; HLINE Y,$2C at A + + ldy XL + lda YB + jsr HLINE ; HLINE Y,$2C at A + + + + + ; VLIN Y,39-Y AT X + ; VLIN Y,39-Y AT 39-X + + ldy XR + lda YB + sta $2D + lda YT + + jsr VLINE ; VLINE A,$2D at Y + + + ldy XL + lda YB + sta $2D + lda YT + + jsr VLINE ; VLINE A,$2D at Y + + + ;========================== + ; done drawing rainbow box + ;========================== + + ;========================== + ; write THINKING + ;========================== + +thinking_loop: + lda #7 + sta YY + ldx #0 + +thinking_yloop: + lda YY + jsr GBASCALC ; take Y-coord/2 in A, put address in GBASL/H ( a trashed, C clear) + + ldy #0 +inc_pointer: + inx + lda thinking_data-1,X + sta CURRENT +thinking_xloop: + ror CURRENT + bcc no_draw + + lda #$00 + sta (GBASL),Y +no_draw: + iny + tya + and #$7 + beq inc_pointer + + cpy #39 + bne thinking_xloop + + inc YY + lda YY + cmp #14 + bne thinking_yloop + + + + lda #255 + jsr WAIT + + ;=================== + ; increment color + ; after loop we are +10 + ; so -1 actually means increment 1 (because we mod 8 it) + dec COL + +done: + jmp done + + jmp big_loop + + +;0 1 2 3 3 +;01234567|89012345|67890123|45678901|23456789 +; ***** *| * * * | * * |* * * |* *** +; * *| * * **| * * *| * ** |* * * +; * *| * * **| * * * | * ** |* * +; * *|*** * * |* * ** | * * * |* * +; * *| * * * | ** * * | * * *|* * ** +; * *| * * * | ** * *| * * *|* * * +; * *| * * * | * * |* * * |* **** +; +; 7*5 bytes = 35 bytes + +thinking_data: +.byte $BE,$54,$14,$15,$39 +.byte $88,$D4,$94,$34,$45 +.byte $88,$D4,$54,$34,$05 +.byte $88,$57,$35,$54,$05 +.byte $88,$54,$56,$94,$65 +.byte $88,$54,$96,$94,$45 +.byte $88,$54,$14,$15,$79 + + + +color_lookup: + ; magenta, pink, orange, yellow, lgreen, aqua, mblue, lblue +.byte $33,$BB,$99,$DD,$CC,$EE,$66,$77 + + + ; for apple II bot entry at $3F5 + + jmp thinking diff --git a/graphics/gr/thinking/thinking_flip.s b/graphics/gr/thinking/thinking_flip.s new file mode 100644 index 00000000..adba59bc --- /dev/null +++ b/graphics/gr/thinking/thinking_flip.s @@ -0,0 +1,176 @@ +; Print-shop Style THINKING + +; by Vince `deater` Weaver + +.include "zp.inc" +.include "hardware.inc" + +COL = $F0 +XSTART = $F1 +XSTOP = $F2 +YSTART = $F3 +YSTOP = $F4 +OFFSET = $F5 +CURRENT = $F6 +YY = $F7 + +thinking: + + jsr SETGR ; set lo-res 40x40 mode + ; A=$D0 afterward + +big_loop: + + ; COL value doesn't matter? + + lda #0 + sta YSTART + sta XSTART + + lda #20 + sta YSTOP + asl + sta XSTOP + +box_loop: + + ldx YSTART +yloop: + txa + jsr GBASCALC ; take Y-coord/2 in A, put address in GBASL/H ( a trashed, C clear) + + lda GBASH +draw_page_smc: + adc #0 + sta GBASH + + lda COL + and #$7 + tay + lda color_lookup,Y + + ldy XSTART +xloop: + sta (GBASL),Y + iny + cpy XSTOP + bne xloop + + inx + cpx YSTOP + bne yloop + + inc COL + + inc XSTART + dec XSTOP + + inc YSTART + dec YSTOP + lda YSTOP + cmp #10 + bne box_loop + + ;========================== + ; done drawing rainbow box + ;========================== + + ;========================== + ; write THINKING + ;========================== + +thinking_loop: + lda #7 + sta YY + ldx #0 + +thinking_yloop: + lda YY + jsr GBASCALC ; take Y-coord/2 in A, put address in GBASL/H ( a trashed, C clear) + + ldy #0 +inc_pointer: + inx + lda thinking_data-1,X + sta CURRENT +thinking_xloop: + ror CURRENT + bcc no_draw + + lda #$00 + sta (GBASL),Y +no_draw: + iny + tya + and #$7 + beq inc_pointer + + cpy #39 + bne thinking_xloop + + inc YY + lda YY + cmp #14 + bne thinking_yloop + + ;========================== + ; flip pages + ;========================== + +flip_pages: + + ldy #1 + lda draw_page_smc+1 ; DRAW_PAGE + bne done_page + dey +done_page: + ldx PAGE1,Y ; set display page to PAGE1 or PAGE2 + + eor #$4 ; flip draw page between $400/$800 + sta draw_page_smc+1 ; DRAW_PAGE + + + + lda #255 + jsr WAIT + + ;=================== + ; increment color + ; after loop we are +10 + ; so -1 actually means increment 1 (because we mod 8 it) + dec COL + + jmp big_loop + + +;0 1 2 3 3 +;01234567|89012345|67890123|45678901|23456789 +; ***** *| * * * | * * |* * * |* *** +; * *| * * **| * * *| * ** |* * * +; * *| * * **| * * * | * ** |* * +; * *|*** * * |* * ** | * * * |* * +; * *| * * * | ** * * | * * *|* * ** +; * *| * * * | ** * *| * * *|* * * +; * *| * * * | * * |* * * |* **** +; +; 7*5 bytes = 35 bytes + +thinking_data: +.byte $BE,$54,$14,$15,$39 +.byte $88,$D4,$94,$34,$45 +.byte $88,$D4,$54,$34,$05 +.byte $88,$57,$35,$54,$05 +.byte $88,$54,$56,$94,$65 +.byte $88,$54,$96,$94,$45 +.byte $88,$54,$14,$15,$79 + + + +color_lookup: + ; magenta, pink, orange, yellow, lgreen, aqua, mblue, lblue +.byte $33,$BB,$99,$DD,$CC,$EE,$66,$77 + + + ; for apple II bot entry at $3F5 + + jmp thinking diff --git a/graphics/gr/thinking/zp.inc b/graphics/gr/thinking/zp.inc index 32082246..53fab8ee 100644 --- a/graphics/gr/thinking/zp.inc +++ b/graphics/gr/thinking/zp.inc @@ -101,7 +101,6 @@ COLOR1 = $E0 COLOR2 = $E1 MATCH = $E2 XX = $E3 -YY = $E4 SHIPY = $E4 YADD = $E5 LOOP = $E6