From 645f486c91b0fefb4b011bae9e5af6502f9e3fbf Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Thu, 9 Sep 2021 16:23:06 -0400 Subject: [PATCH] hgr: blueorange --- graphics/hgr/wires/Makefile | 40 +++++++++ graphics/hgr/wires/blueorange.s | 147 ++++++++++++++++++++++++++++++++ graphics/hgr/wires/hello.bas | 2 + graphics/hgr/wires/wires.s | 143 +++++++++++++++++++++++++++++++ linker_scripts/apple2_373.inc | 12 +++ 5 files changed, 344 insertions(+) create mode 100644 graphics/hgr/wires/Makefile create mode 100644 graphics/hgr/wires/blueorange.s create mode 100644 graphics/hgr/wires/hello.bas create mode 100644 graphics/hgr/wires/wires.s create mode 100644 linker_scripts/apple2_373.inc diff --git a/graphics/hgr/wires/Makefile b/graphics/hgr/wires/Makefile new file mode 100644 index 00000000..558b6051 --- /dev/null +++ b/graphics/hgr/wires/Makefile @@ -0,0 +1,40 @@ +include ../../../Makefile.inc + +DOS33 = ../../../utils/dos33fs-utils/dos33 +TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft +LINKER_SCRIPTS = ../../../linker_scripts +EMPTY_DISK = ../../../empty_disk + +all: wires.dsk + +wires.dsk: HELLO WIRES BLUEORANGE + 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 0x0373 BLUEORANGE + +### + +HELLO: hello.bas + $(TOKENIZE) < hello.bas > HELLO + +#### + +WIRES: wires.o + ld65 -o WIRES wires.o -C $(LINKER_SCRIPTS)/apple2_c00.inc + +wires.o: wires.s + ca65 -o wires.o wires.s -l wires.lst + +#### + +BLUEORANGE: blueorange.o + ld65 -o BLUEORANGE blueorange.o -C $(LINKER_SCRIPTS)/apple2_373.inc + +blueorange.o: blueorange.s + ca65 -o blueorange.o blueorange.s -l blueorange.lst + +###### + +clean: + rm -f *~ *.o *.lst WIRES diff --git a/graphics/hgr/wires/blueorange.s b/graphics/hgr/wires/blueorange.s new file mode 100644 index 00000000..cef32814 --- /dev/null +++ b/graphics/hgr/wires/blueorange.s @@ -0,0 +1,147 @@ +; 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 +BKGND0 = $F3F4 +WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us + +wires: + + jsr HGR2 + + lda #$D5 + jsr BKGND0 + +.if 0 +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 + +.endif + +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 #28 + bne outer_loop + beq reset_loop + + + + + +; 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 + .byte $83,$8C,$B0,$C0,$80,$80,$80 +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 + .byte $80,$80,$80,$81,$86,$98,$E0 + +; 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 + + + ; want this to be at 3f5 + ; Length is 133 so start at + ; $3F5 - 130 = $373 + + +game_over: + jmp wires diff --git a/graphics/hgr/wires/hello.bas b/graphics/hgr/wires/hello.bas new file mode 100644 index 00000000..133a44bb --- /dev/null +++ b/graphics/hgr/wires/hello.bas @@ -0,0 +1,2 @@ +5 HOME +10 PRINT CHR$(4);"CATALOG" diff --git a/graphics/hgr/wires/wires.s b/graphics/hgr/wires/wires.s new file mode 100644 index 00000000..67f4e092 --- /dev/null +++ b/graphics/hgr/wires/wires.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/linker_scripts/apple2_373.inc b/linker_scripts/apple2_373.inc new file mode 100644 index 00000000..ee1e2bab --- /dev/null +++ b/linker_scripts/apple2_373.inc @@ -0,0 +1,12 @@ +MEMORY { + ZP: start = $00, size = $1A, type = rw; + RAM: start = $373, size = $8E00, file = %O; +} + +SEGMENTS { +CODE: load = RAM, type = ro; +RODATA: load = RAM, type = ro; +DATA: load = RAM, type = rw; +BSS: load = RAM, type = bss, define = yes; +ZEROPAGE: load = ZP, type = zp; +}