From 7c680e4b56bcec02f9f74466aecdcefbaa998b1c Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Thu, 7 Oct 2021 15:13:07 -0400 Subject: [PATCH] hgr: wires: finally get it more or less working --- graphics/hgr/wires/Makefile | 23 ++++- graphics/hgr/wires/cycle.s | 143 +++++++++++++++++++++++++++ graphics/hgr/wires/grid.s | 80 +++++++++++++++ graphics/hgr/wires/staggered.s | 82 +++++++++++++++ graphics/hgr/wires/wires.s | 176 +++++++++++++++------------------ graphics/hgr/wires/worm.s | 137 +++++++++++++++++++++++++ 6 files changed, 542 insertions(+), 99 deletions(-) create mode 100644 graphics/hgr/wires/cycle.s create mode 100644 graphics/hgr/wires/grid.s create mode 100644 graphics/hgr/wires/staggered.s create mode 100644 graphics/hgr/wires/worm.s diff --git a/graphics/hgr/wires/Makefile b/graphics/hgr/wires/Makefile index 27c99be1..f35073f2 100644 --- a/graphics/hgr/wires/Makefile +++ b/graphics/hgr/wires/Makefile @@ -7,10 +7,12 @@ EMPTY_DISK = ../../../empty_disk all: wires.dsk -wires.dsk: HELLO WIRES BLUEORANGE BLUEORANGEZ +wires.dsk: HELLO WIRES CYCLE STAGGERED BLUEORANGE BLUEORANGEZ cp $(EMPTY_DISK)/empty.dsk wires.dsk $(DOS33) -y wires.dsk SAVE A HELLO $(DOS33) -y wires.dsk BSAVE -a 0x0C00 WIRES + $(DOS33) -y wires.dsk BSAVE -a 0x0C00 CYCLE + $(DOS33) -y wires.dsk BSAVE -a 0x0C00 STAGGERED $(DOS33) -y wires.dsk BSAVE -a 0x0373 BLUEORANGE $(DOS33) -y wires.dsk BSAVE -a 0x0C00 BLUEORANGEZ @@ -29,6 +31,23 @@ wires.o: wires.s #### +STAGGERED: staggered.o + ld65 -o STAGGERED staggered.o -C $(LINKER_SCRIPTS)/apple2_c00.inc + +staggered.o: staggered.s + ca65 -o staggered.o staggered.s -l staggered.lst + + +#### + +CYCLE: cycle.o + ld65 -o CYCLE cycle.o -C $(LINKER_SCRIPTS)/apple2_c00.inc + +cycle.o: cycle.s + ca65 -o cycle.o cycle.s -l cycle.lst + +#### + BLUEORANGE: blueorange.o ld65 -o BLUEORANGE blueorange.o -C $(LINKER_SCRIPTS)/apple2_373.inc @@ -44,4 +63,4 @@ BLUEORANGEZ: blueorange.o ###### clean: - rm -f *~ *.o *.lst WIRES + rm -f *~ *.o *.lst WIRES CYCLE diff --git a/graphics/hgr/wires/cycle.s b/graphics/hgr/wires/cycle.s new file mode 100644 index 00000000..67f4e092 --- /dev/null +++ b/graphics/hgr/wires/cycle.s @@ -0,0 +1,143 @@ +; wires -- Apple II Hires + + +; D0+ used by HGR routines + +HGR_COLOR = $E4 +HGR_PAGE = $E6 + +D = $F9 +XX = $FA +YY = $FB +R = $FC +CX = $FD +CY = $FE +FRAME = $FF + +; soft-switches + +; ROM routines + +HGR2 = $F3D8 ; set hires page2 and clear $4000-$5fff +HGR = $F3E2 ; set hires page1 and clear $2000-$3fff +HPLOT0 = $F457 ; plot at (Y,X), (A) +HCOLOR1 = $F6F0 ; set HGR_COLOR to value in X +COLORTBL = $F6F6 +PLOT = $F800 ; PLOT AT Y,A (A colors output, Y preserved) +NEXTCOL = $F85F ; COLOR=COLOR+3 +SETCOL = $F864 ; COLOR=A +SETGR = $FB40 ; set graphics and clear LO-RES screen +BELL2 = $FBE4 +WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us + +wires: + + jsr HGR2 + +ol: + ldx #0 +line_loop: + lda #$D5 +ll_smc1: + sta $4000,X + inx + lda #$AA +ll_smc2: + sta $4000,X + inx + +; cpx #40 + bne line_loop + + inc ll_smc1+2 + inc ll_smc2+2 + + lda ll_smc2+2 + cmp #$60 + bne ol + + +reset_loop: + ldy #0 +outer_loop: + ldx #0 +move_line_loop: + +ml_smc1: + lda $4000,X + eor pulse_even,Y +ml_smc2: + sta $4000,X + inx + +ml_smc3: + lda $4000,X + eor pulse_odd,Y +ml_smc4: + sta $4000,X + inx + +; cpx #40 + bne move_line_loop + +; lda #100 +; jsr WAIT + + inc ml_smc1+2 + inc ml_smc2+2 + inc ml_smc3+2 + inc ml_smc4+2 + + lda ml_smc2+2 + cmp #$60 + bne move_line_loop + + lda #$40 + sta ml_smc1+2 + sta ml_smc2+2 + sta ml_smc3+2 + sta ml_smc4+2 + + + iny + cpy #21 + bne outer_loop + beq reset_loop + + +game_over: + jmp game_over + + +; all +pulse_even: + .byte $03,$0C,$30,$40,$00,$00,$00 + .byte $01,$04,$10,$00,$00,$00,$00 + .byte $02,$08,$20,$00,$00,$00,$00 +pulse_odd: + .byte $00,$00,$00,$01,$06,$18,$60 + .byte $00,$00,$00,$00,$02,$08,$20 + .byte $00,$00,$00,$01,$04,$10,$40 + + +; blue/orange +;pulse_even: +; .byte $03,$0C,$30,$40,$00,$00,$00 +;pulse_odd: +; .byte $00,$00,$00,$01,$06,$18,$60 + + +; blue/black +;pulse_even: +; .byte $01,$04,$10,$00,$00,$00,$00 +;pulse_odd: +; .byte $00,$00,$00,$00,$02,$08,$20 + +; blue/white +;pulse_even: +; .byte $02,$08,$20,$00,$00,$00,$00 +;pulse_odd: +; .byte $00,$00,$00,$01,$04,$10,$40 + + + diff --git a/graphics/hgr/wires/grid.s b/graphics/hgr/wires/grid.s new file mode 100644 index 00000000..5327e4bb --- /dev/null +++ b/graphics/hgr/wires/grid.s @@ -0,0 +1,80 @@ +; wires -- Apple II Hires + + +; D0+ used by HGR routines + +HGR_COLOR = $E4 +HGR_PAGE = $E6 + +GBASL = $26 +GBASH = $27 + +D = $F9 +XX = $FA +YY = $FB +R = $FC +CX = $FD +CY = $FE +FRAME = $FF + +; soft-switches + +; ROM routines + +HGR2 = $F3D8 ; set hires page2 and clear $4000-$5fff +HGR = $F3E2 ; set hires page1 and clear $2000-$3fff +HPLOT0 = $F457 ; plot at (Y,X), (A) +HCOLOR1 = $F6F0 ; set HGR_COLOR to value in X +COLORTBL = $F6F6 +PLOT = $F800 ; PLOT AT Y,A (A colors output, Y preserved) +NEXTCOL = $F85F ; COLOR=COLOR+3 +SETCOL = $F864 ; COLOR=A +SETGR = $FB40 ; set graphics and clear LO-RES screen +BELL2 = $FBE4 +WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us + +wires: + + jsr HGR2 + + lda #$00 + sta GBASL + lda #$40 + sta GBASH + + + lda #$81 +vert_loop: + +smc: + sta $4000 + eor #$1 + + inc smc+1 + bne noflo + inc smc+2 +noflo: + ldy smc+2 + cpy #$60 + bne vert_loop + + + + ldy #0 +horiz_loop: + lda #$D5 + sta (GBASL),Y + iny + lda #$AA + sta (GBASL),Y + iny + bne horiz_loop + + inc GBASH + lda GBASH + cmp #$44 + bne horiz_loop + + +end: + jmp end diff --git a/graphics/hgr/wires/staggered.s b/graphics/hgr/wires/staggered.s new file mode 100644 index 00000000..743e0376 --- /dev/null +++ b/graphics/hgr/wires/staggered.s @@ -0,0 +1,82 @@ +; wires -- Apple II Hires + + +; D0+ used by HGR routines + +HGR_COLOR = $E4 +HGR_PAGE = $E6 + +GBASL = $26 +GBASH = $27 + +COUNT = $FE +FRAME = $FF + +; soft-switches + +; ROM routines + +HGR2 = $F3D8 ; set hires page2 and clear $4000-$5fff +HGR = $F3E2 ; set hires page1 and clear $2000-$3fff +HPLOT0 = $F457 ; plot at (Y,X), (A) +HCOLOR1 = $F6F0 ; set HGR_COLOR to value in X +COLORTBL = $F6F6 +PLOT = $F800 ; PLOT AT Y,A (A colors output, Y preserved) +NEXTCOL = $F85F ; COLOR=COLOR+3 +SETCOL = $F864 ; COLOR=A +SETGR = $FB40 ; set graphics and clear LO-RES screen +BELL2 = $FBE4 +WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us + +wires: + + jsr HGR2 + + ; pulse loop horizontal + + lda #$00 + tay + tax + sta GBASL + +outer_loop: + lda #$40 + sta GBASH +inner_loop: + + lda even_lookup,X + sta (GBASL),Y + iny + + lda odd_lookup,X + sta (GBASL),Y + + iny + bne inner_loop + + inc GBASH + + inx + txa + and #$7 + tax + + + lda #$60 + cmp GBASH + bne inner_loop + +; lda #100 + jsr WAIT + + inx + + jmp outer_loop + + + +even_lookup: +.byte $D7,$DD,$F5,$D5, $D5,$D5,$D5,$D5 +odd_lookup: +.byte $AA,$AA,$AA,$AB, $AB,$AE,$BA,$EA + diff --git a/graphics/hgr/wires/wires.s b/graphics/hgr/wires/wires.s index 67f4e092..cddb60b0 100644 --- a/graphics/hgr/wires/wires.s +++ b/graphics/hgr/wires/wires.s @@ -6,12 +6,10 @@ HGR_COLOR = $E4 HGR_PAGE = $E6 -D = $F9 -XX = $FA -YY = $FB -R = $FC -CX = $FD -CY = $FE +GBASL = $26 +GBASH = $27 + +COUNT = $FE FRAME = $FF ; soft-switches @@ -34,110 +32,94 @@ wires: jsr HGR2 -ol: - ldx #0 -line_loop: - lda #$D5 -ll_smc1: - sta $4000,X - inx - lda #$AA -ll_smc2: - sta $4000,X - inx - -; cpx #40 - bne line_loop - - inc ll_smc1+2 - inc ll_smc2+2 - - lda ll_smc2+2 - cmp #$60 - bne ol -reset_loop: - ldy #0 + + ldx #$0 + outer_loop: - ldx #0 -move_line_loop: -ml_smc1: - lda $4000,X - eor pulse_even,Y -ml_smc2: - sta $4000,X - inx -ml_smc3: - lda $4000,X - eor pulse_odd,Y -ml_smc4: - sta $4000,X - inx + ; pulse loop horizontal -; cpx #40 - bne move_line_loop + lda #$00 + tay -; lda #100 -; jsr WAIT - - inc ml_smc1+2 - inc ml_smc2+2 - inc ml_smc3+2 - inc ml_smc4+2 - - lda ml_smc2+2 - cmp #$60 - bne move_line_loop + sta GBASL lda #$40 - sta ml_smc1+2 - sta ml_smc2+2 - sta ml_smc3+2 - sta ml_smc4+2 + sta GBASH +horiz_loop: + lda even_lookup,X + sta (GBASL),Y + iny + + lda odd_lookup,X + sta (GBASL),Y iny - cpy #21 - bne outer_loop - beq reset_loop + bne noflo2 + inc GBASH +noflo2: - -game_over: - jmp game_over - - -; all -pulse_even: - .byte $03,$0C,$30,$40,$00,$00,$00 - .byte $01,$04,$10,$00,$00,$00,$00 - .byte $02,$08,$20,$00,$00,$00,$00 -pulse_odd: - .byte $00,$00,$00,$01,$06,$18,$60 - .byte $00,$00,$00,$00,$02,$08,$20 - .byte $00,$00,$00,$01,$04,$10,$40 - - -; blue/orange -;pulse_even: -; .byte $03,$0C,$30,$40,$00,$00,$00 -;pulse_odd: -; .byte $00,$00,$00,$01,$06,$18,$60 - - -; blue/black -;pulse_even: -; .byte $01,$04,$10,$00,$00,$00,$00 -;pulse_odd: -; .byte $00,$00,$00,$00,$02,$08,$20 - -; blue/white -;pulse_even: -; .byte $02,$08,$20,$00,$00,$00,$00 -;pulse_odd: -; .byte $00,$00,$00,$01,$04,$10,$40 + lda #$44 + cmp GBASH + bne horiz_loop + lda #$44 + sta smc+2 + + +vert_loop: + txa + clc + adc #2 + asl + asl + adc #$40 + sbc smc+2 + cmp #8 + lda #$81 + bcs noeor + ora #$02 +noeor: + +smc: + sta $4400 + + inc smc+1 + inc smc+1 + bne noflo + inc smc+2 +noflo: + ldy smc+2 + cpy #$60 + bne vert_loop + + + inx + cpx #7 + bne noreset + + ldx #0 +noreset: + + ; wait + + lda #100 + jsr WAIT + + jmp outer_loop + + + +even_lookup: +;.byte $D7 +.byte $D7,$DD,$F5, $D5,$D5,$D5,$D5 +odd_lookup: +;.byte $AA +.byte $AA,$AA,$AA, $AB,$AE,$BA,$EA + diff --git a/graphics/hgr/wires/worm.s b/graphics/hgr/wires/worm.s new file mode 100644 index 00000000..d2629c98 --- /dev/null +++ b/graphics/hgr/wires/worm.s @@ -0,0 +1,137 @@ +; wires -- Apple II Hires + + +; D0+ used by HGR routines + +HGR_COLOR = $E4 +HGR_PAGE = $E6 + +GBASL = $26 +GBASH = $27 + +COUNT = $FE +FRAME = $FF + +; soft-switches + +; ROM routines + +HGR2 = $F3D8 ; set hires page2 and clear $4000-$5fff +HGR = $F3E2 ; set hires page1 and clear $2000-$3fff +HPLOT0 = $F457 ; plot at (Y,X), (A) +HCOLOR1 = $F6F0 ; set HGR_COLOR to value in X +COLORTBL = $F6F6 +PLOT = $F800 ; PLOT AT Y,A (A colors output, Y preserved) +NEXTCOL = $F85F ; COLOR=COLOR+3 +SETCOL = $F864 ; COLOR=A +SETGR = $FB40 ; set graphics and clear LO-RES screen +BELL2 = $FBE4 +WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us + +wires: + + jsr HGR2 + + lda #$00 + sta GBASL + lda #$40 + sta GBASH + + + lda #$81 +vert_loop: + +smc: + sta $4000 + eor #$1 + + inc smc+1 + bne noflo + inc smc+2 +noflo: + ldy smc+2 + cpy #$60 + bne vert_loop + + + ; pulse loop horizontal + + ldy #0 + ldx #0 + + lda #$00 + sta GBASL +outer_loop: + lda #$40 + sta GBASH +inner_loop: + + lda even_lookup,X + sta (GBASL),Y + iny + + lda odd_lookup,X + sta (GBASL),Y + + iny + bne noflo2 + inc GBASH +noflo2: + + lda #$44 + cmp GBASH + bne inner_loop + + + + + + ; pulse loop vertical + lda #0 + sta GBASL + + lda addr_lookup,X + sta GBASH + + ldy #0 + sty COUNT +vouter: + + +vinner: + lda (GBASL),Y + eor #$1 + sta (GBASL),Y + + iny + iny + + bne vinner + +blargh: + inc GBASH + inc COUNT + lda COUNT + cmp #4 + bne vouter + + + + inx + txa + and #$7 + tax + + lda #100 + jsr WAIT + + jmp outer_loop + + + +even_lookup: +.byte $D7,$DD,$F5,$D5, $D5,$D5,$D5,$D5 +odd_lookup: +.byte $AA,$AA,$AA,$AB, $AB,$AE,$BA,$EA +addr_lookup: +.byte $44,$48,$4C,$50, $54,$58,$5C,$20