diff --git a/basic/appleiibot/Makefile b/basic/appleiibot/Makefile index fcf61827..8a514cd4 100644 --- a/basic/appleiibot/Makefile +++ b/basic/appleiibot/Makefile @@ -14,7 +14,8 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS HELLO \ RLEASM.BAS HORIZON.BAS FLYER.BAS STAR.BAS HYPER.BAS FASTAR.BAS \ FASTAR2.BAS BIN.BAS FALLING.BAS SNOW.BAS XMAS.BAS AN3.BAS PLASMA.BAS \ C64.BAS SIERPINSKI.BAS FAKES.BAS SIER.BAS DROPS.BAS RR.BAS RR_HGR.BAS \ - COMBO.BAS WIRES.BAS PATTERN.BAS BALL.BAS LINES.BAS MOD9.BAS + COMBO.BAS WIRES.BAS PATTERN.BAS BALL.BAS LINES.BAS MOD9.BAS \ + XOR_ZOOM.BAS # cp $(EMPTY_DISK)/empty.dsk appleiibot.dsk cp empty.dsk appleiibot.dsk $(DOS33) -y appleiibot.dsk BSAVE -a 0x0300 LOAD @@ -72,6 +73,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS HELLO \ $(DOS33) -y appleiibot.dsk SAVE A BALL.BAS $(DOS33) -y appleiibot.dsk SAVE A LINES.BAS $(DOS33) -y appleiibot.dsk SAVE A MOD9.BAS + $(DOS33) -y appleiibot.dsk SAVE A XOR_ZOOM.BAS #### @@ -163,6 +165,11 @@ NYAN.BAS: nyan.bas MOD9.BAS: mod9.bas $(TOKENIZE) < mod9.bas > MOD9.BAS +#### + +XOR_ZOOM.BAS: xor_zoom.bas + $(TOKENIZE) < xor_zoom.bas > XOR_ZOOM.BAS + #### diff --git a/games/ootw/ending/graphics/ending/rooftop01.png b/games/ootw/ending/graphics/ending/rooftop01.png new file mode 100644 index 00000000..2f027593 Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop01.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop02.png b/games/ootw/ending/graphics/ending/rooftop02.png new file mode 100644 index 00000000..6e72b0b8 Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop02.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop03.png b/games/ootw/ending/graphics/ending/rooftop03.png new file mode 100644 index 00000000..d77d5f26 Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop03.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop04.png b/games/ootw/ending/graphics/ending/rooftop04.png new file mode 100644 index 00000000..fc61dd51 Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop04.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop05.png b/games/ootw/ending/graphics/ending/rooftop05.png new file mode 100644 index 00000000..ee7ec42a Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop05.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop06.png b/games/ootw/ending/graphics/ending/rooftop06.png new file mode 100644 index 00000000..61d3cbdb Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop06.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop07.png b/games/ootw/ending/graphics/ending/rooftop07.png new file mode 100644 index 00000000..fccfde55 Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop07.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop08.png b/games/ootw/ending/graphics/ending/rooftop08.png new file mode 100644 index 00000000..81cdd6da Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop08.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop09.png b/games/ootw/ending/graphics/ending/rooftop09.png new file mode 100644 index 00000000..5578f418 Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop09.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop10.png b/games/ootw/ending/graphics/ending/rooftop10.png new file mode 100644 index 00000000..8b2e0dfd Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop10.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop11.png b/games/ootw/ending/graphics/ending/rooftop11.png new file mode 100644 index 00000000..bc5b1334 Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop11.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop12.png b/games/ootw/ending/graphics/ending/rooftop12.png new file mode 100644 index 00000000..3be7eb81 Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop12.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop13.png b/games/ootw/ending/graphics/ending/rooftop13.png new file mode 100644 index 00000000..e916e402 Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop13.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop14.png b/games/ootw/ending/graphics/ending/rooftop14.png new file mode 100644 index 00000000..6acf4e36 Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop14.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop15.png b/games/ootw/ending/graphics/ending/rooftop15.png new file mode 100644 index 00000000..0c9463b9 Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop15.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop16.png b/games/ootw/ending/graphics/ending/rooftop16.png new file mode 100644 index 00000000..70f80fdc Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop16.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop17.png b/games/ootw/ending/graphics/ending/rooftop17.png new file mode 100644 index 00000000..a2c7950a Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop17.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop18.png b/games/ootw/ending/graphics/ending/rooftop18.png new file mode 100644 index 00000000..5d2ad75e Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop18.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop19.png b/games/ootw/ending/graphics/ending/rooftop19.png new file mode 100644 index 00000000..40d51b8a Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop19.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop20.png b/games/ootw/ending/graphics/ending/rooftop20.png new file mode 100644 index 00000000..9e6b180c Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop20.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop21.png b/games/ootw/ending/graphics/ending/rooftop21.png new file mode 100644 index 00000000..0b030ff9 Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop21.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop22.png b/games/ootw/ending/graphics/ending/rooftop22.png new file mode 100644 index 00000000..310c2a7e Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop22.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop23.png b/games/ootw/ending/graphics/ending/rooftop23.png new file mode 100644 index 00000000..76cdabe8 Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop23.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop24.png b/games/ootw/ending/graphics/ending/rooftop24.png new file mode 100644 index 00000000..980f2bb1 Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop24.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop25.png b/games/ootw/ending/graphics/ending/rooftop25.png new file mode 100644 index 00000000..8b394b41 Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop25.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop26.png b/games/ootw/ending/graphics/ending/rooftop26.png new file mode 100644 index 00000000..ffbb496e Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop26.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop27.png b/games/ootw/ending/graphics/ending/rooftop27.png new file mode 100644 index 00000000..2c4c145c Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop27.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop28.png b/games/ootw/ending/graphics/ending/rooftop28.png new file mode 100644 index 00000000..8385ecdc Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop28.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop29.png b/games/ootw/ending/graphics/ending/rooftop29.png new file mode 100644 index 00000000..9fcc3957 Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop29.png differ diff --git a/games/ootw/ending/graphics/ending/rooftop_bg.png b/games/ootw/ending/graphics/ending/rooftop_bg.png new file mode 100644 index 00000000..5a9f8ea0 Binary files /dev/null and b/games/ootw/ending/graphics/ending/rooftop_bg.png differ diff --git a/graphics/gr/sier/Makefile b/graphics/gr/sier/Makefile index 39cd1dc2..ab53b3ae 100644 --- a/graphics/gr/sier/Makefile +++ b/graphics/gr/sier/Makefile @@ -7,7 +7,7 @@ EMPTY_DISK = ../../../empty_disk/empty.dsk all: sier.dsk -sier.dsk: HELLO SIER SIER_BOT SIER_TINY SIER_64 MOD9 +sier.dsk: HELLO SIER SIER_BOT SIER_TINY SIER_64 MOD9 XOR_ZOOM MOD9_ZOOM cp $(EMPTY_DISK) sier.dsk $(DOS33) -y sier.dsk SAVE A HELLO $(DOS33) -y sier.dsk BSAVE -a 0x60 SIER @@ -15,6 +15,8 @@ sier.dsk: HELLO SIER SIER_BOT SIER_TINY SIER_64 MOD9 $(DOS33) -y sier.dsk BSAVE -a 0x300 SIER_TINY $(DOS33) -y sier.dsk BSAVE -a 0x300 SIER_64 $(DOS33) -y sier.dsk BSAVE -a 0x375 MOD9 + $(DOS33) -y sier.dsk BSAVE -a 0x37C XOR_ZOOM + $(DOS33) -y sier.dsk BSAVE -a 0x300 MOD9_ZOOM ### @@ -39,6 +41,23 @@ sier.o: sier.s ### +XOR_ZOOM: xor_zoom.o + ld65 -o XOR_ZOOM xor_zoom.o -C ./apple2_37c.inc + +xor_zoom.o: xor_zoom.s + ca65 -o xor_zoom.o xor_zoom.s -l xor_zoom.lst + +### + +MOD9_ZOOM: mod9_zoom.o + ld65 -o MOD9_ZOOM mod9_zoom.o -C $(LINKERSCRIPTS)/apple2_300.inc + +mod9_zoom.o: mod9_zoom.s + ca65 -o mod9_zoom.o mod9_zoom.s -l mod9_zoom.lst + + +### + SIER_BOT: sier_bot.o ld65 -o SIER_BOT sier_bot.o -C ./apple2_36c.inc @@ -67,4 +86,4 @@ sier_64.o: sier_64.s ### clean: - rm -f *~ *.o *.lst HELLO SIER SIER_TINY SIER_64 MOD9 + rm -f *~ *.o *.lst HELLO SIER SIER_TINY SIER_64 MOD9 XOR_ZOOM MOD9_ZOOM SIER_BOT diff --git a/graphics/gr/sier/apple2_37c.inc b/graphics/gr/sier/apple2_37c.inc new file mode 100644 index 00000000..a6a01bdf --- /dev/null +++ b/graphics/gr/sier/apple2_37c.inc @@ -0,0 +1,12 @@ +MEMORY { + ZP: start = $00, size = $1A, type = rw; + RAM: start = $37c, size = $8E00, file = %O; +} + +SEGMENTS { +CODE: load = RAM, type = ro, align = $1; +RODATA: load = RAM, type = ro; +DATA: load = RAM, type = rw; +BSS: load = RAM, type = bss, define = yes; +ZEROPAGE: load = ZP, type = zp; +} diff --git a/graphics/gr/sier/mod9_zoom.s b/graphics/gr/sier/mod9_zoom.s new file mode 100644 index 00000000..ef7d6545 --- /dev/null +++ b/graphics/gr/sier/mod9_zoom.s @@ -0,0 +1,242 @@ +; zooming xor mod 9 + +; based on the zooming and (sierpinski) sier.s from lovebyte2021 +; which was based on Hellmood's Memories demo + +; by Vince `deater` Weaver + + +; zero page + +GBASH = $27 +MASK = $2E +COLOR = $30 + +;XX = $F7 +XX_TH = $F8 +XX_TL = $F9 +;YY = $FA +YY_TH = $FB +YY_TL = $FC +TEMP = $FD +OLD = $FE +SAVED = $FF + +; Soft switches +FULLGR = $C052 +PAGE1 = $C054 +PAGE2 = $C055 +LORES = $C056 ; Enable LORES graphics + +; ROM routines +HGR = $F3E2 +HGR2 = $F3D8 +PLOT1 = $F80E ;; PLOT at (GBASL),Y (need MASK to be $0f or $f0) +GBASCALC= $F847 ;; take Y-coord/2 in A, put address in GBASL/H ( a trashed, C clear) +SETCOL = $F864 ;; COLOR=A +SETGR = $FB40 + + +;.zeropage +;.globalzp T_L,T_H + + ;================================ + ; Clear screen and setup graphics + ;================================ +mod9_zoom: + jsr HGR2 ; set FULLGR, sets A=0 + ; be sure to avoid code at E6 if we do this + bit LORES ; drop down to lo-res + +; lda #0 ; start with multiplier 0 +; sta T_L +; sta T_H + +sier_outer: + + ldx #0 ; YY starts at 0 + + stx YY_TL + stx YY_TH + +sier_yloop: + + ; calc YY_T (8.8 fixed point add) + ; save space by skipping clc as it's only a slight variation w/o +; clc + lda YY_TL + adc T_L + sta YY_TL + lda YY_TH + adc T_H + sta YY_TH + + txa ; YY ; plot call needs Y/2 + lsr + + php + +; bcc even_mask +; ldy #$f0 +; .byte $2C ; bit hack +;even_mask: +; ldy #$0f +; sty MASK + + 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 ; adjust for PAGE1/PAGE2 ($400/$800) + + plp + jsr $f806 ; trick to calculate MASK by jumping + ; into middle of PLOT routine + + ; reset XX to 0 + + ldy #0 ; XX + sty XX_TL + sty XX_TH + +sier_xloop: + + ; want (YY-(XX*T)) & (XX+(YY*T) + + + ; SAVED = XX+(Y*T) +; clc + tya ; XX + adc YY_TH + sta SAVED + + + ; calc XX*T +; clc + lda XX_TL + adc T_L + sta XX_TL + lda XX_TH + adc T_H + sta XX_TH + + + ; calc (YY-X_T) + txa ; lda YY + sec + sbc XX_TH + + ; want (YY-(XX*T)) & (XX+(YY*T) + + + ;================= + ; magic is here + + eor SAVED + + ;=============================== + ; modulo 9 + ;=============================== + ; value in A +mod_9: + ; Divide by 9 + ; 17 bytes, 30 cycles + ; by Omegamatrix https://forums.nesdev.com/viewtopic.php?t=11336 + sta OLD + + sta TEMP + lsr + lsr + lsr + adc TEMP + ror + adc TEMP + ror + adc TEMP + ror + lsr + lsr + lsr + + ; A is ORIG/9, mod = OLD-(A*9) + sta TEMP + + asl + asl + asl + clc + adc TEMP + + eor #$ff + sec + adc OLD + + ;================= + ; blah + + + and #$8 + +; and #$f0 + +; beq green +;black: +; lda #00 ; black +; .byte $2C ; bit trick +;green: +; lda #$CC ; green +; sta COLOR + + jsr SETCOL + + ; XX value already in Y + + jsr PLOT1 ; PLOT AT (GBASL),Y + + iny ; XX + cpy #40 + bne sier_xloop + + inx ; YY + cpx #48 + bne sier_yloop + + ; inc T +; clc + lda T_L +blah_smc: + adc #1 + sta T_L + bcc no_carry + inc T_H +no_carry: + + ; speed up the zoom as it goes +; inc blah_smc+1 + + + ; x is 48 +flip_pages: + lda draw_page_smc+1 ; DRAW_PAGE + beq done_page + inx +done_page: + ; X=48 ($30) PAGE1=$C054-$30=$C024 + ldy $C024,X ; set display page to PAGE1 or PAGE2 + + eor #$4 ; flip draw page between $400/$800 + sta draw_page_smc+1 ; DRAW_PAGE + + jmp sier_outer ; what can we branch on? + +T_L: .byte $00 +T_H: .byte $00 + + ; this is at beginning+$79, want it to be at $3F5 so $37C? + ; 1 + ; $3F5 + ; - 79 + ;====== + ; 37C + jmp mod9_zoom diff --git a/graphics/gr/sier/xor_zoom.s b/graphics/gr/sier/xor_zoom.s new file mode 100644 index 00000000..7e8882e3 --- /dev/null +++ b/graphics/gr/sier/xor_zoom.s @@ -0,0 +1,205 @@ +; zooming xor + +; based on the zooming and (sierpinski) sier.s from lovebyte2021 +; which was based on Hellmood's Memories demo + +; by Vince `deater` Weaver + + +; zero page + +GBASH = $27 +MASK = $2E +COLOR = $30 + +;XX = $F7 +XX_TH = $F8 +XX_TL = $F9 +;YY = $FA +YY_TH = $FB +YY_TL = $FC +;T_L = $FD +;T_H = $FE +SAVED = $FF + +; Soft switches +FULLGR = $C052 +PAGE1 = $C054 +PAGE2 = $C055 +LORES = $C056 ; Enable LORES graphics + +; ROM routines +HGR = $F3E2 +HGR2 = $F3D8 +PLOT1 = $F80E ;; PLOT at (GBASL),Y (need MASK to be $0f or $f0) +GBASCALC= $F847 ;; take Y-coord/2 in A, put address in GBASL/H ( a trashed, C clear) +SETCOL = $F864 ;; COLOR=A +SETGR = $FB40 + + +;.zeropage +;.globalzp T_L,T_H + + ;================================ + ; Clear screen and setup graphics + ;================================ +xor_zoom: + jsr HGR2 ; set FULLGR, sets A=0 + ; be sure to avoid code at E6 if we do this + bit LORES ; drop down to lo-res + +; lda #0 ; start with multiplier 0 +; sta T_L +; sta T_H + +sier_outer: + + ldx #0 ; YY starts at 0 + + stx YY_TL + stx YY_TH + +sier_yloop: + + ; calc YY_T (8.8 fixed point add) + ; save space by skipping clc as it's only a slight variation w/o +; clc + lda YY_TL + adc T_L + sta YY_TL + lda YY_TH + adc T_H + sta YY_TH + + txa ; YY ; plot call needs Y/2 + lsr + + php + +; bcc even_mask +; ldy #$f0 +; .byte $2C ; bit hack +;even_mask: +; ldy #$0f +; sty MASK + + 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 ; adjust for PAGE1/PAGE2 ($400/$800) + + plp + jsr $f806 ; trick to calculate MASK by jumping + ; into middle of PLOT routine + + ; reset XX to 0 + + ldy #0 ; XX + sty XX_TL + sty XX_TH + +sier_xloop: + + ; want (YY-(XX*T)) & (XX+(YY*T) + + + ; SAVED = XX+(Y*T) +; clc + tya ; XX + adc YY_TH + sta SAVED + + + ; calc XX*T +; clc + lda XX_TL + adc T_L + sta XX_TL + lda XX_TH + adc T_H + sta XX_TH + + + ; calc (YY-X_T) + txa ; lda YY + sec + sbc XX_TH + + ; want (YY-(XX*T)) & (XX+(YY*T) + + + ;================= + ; magic is here + + eor SAVED + + + ;================= + ; blah + + + +; and #$f0 + +; beq green +;black: +; lda #00 ; black +; .byte $2C ; bit trick +;green: +; lda #$CC ; green +; sta COLOR + + jsr SETCOL + + ; XX value already in Y + + jsr PLOT1 ; PLOT AT (GBASL),Y + + iny ; XX + cpy #40 + bne sier_xloop + + inx ; YY + cpx #48 + bne sier_yloop + + ; inc T +; clc + lda T_L +blah_smc: + adc #2 + sta T_L + bcc no_carry + inc T_H +no_carry: + + ; speed up the zoom as it goes +; inc blah_smc+1 + + + ; x is 48 +flip_pages: + lda draw_page_smc+1 ; DRAW_PAGE + beq done_page + inx +done_page: + ; X=48 ($30) PAGE1=$C054-$30=$C024 + ldy $C024,X ; set display page to PAGE1 or PAGE2 + + eor #$4 ; flip draw page between $400/$800 + sta draw_page_smc+1 ; DRAW_PAGE + + jmp sier_outer ; what can we branch on? + +T_L: .byte $80 +T_H: .byte $00 + + ; this is at beginning+$79, want it to be at $3F5 so $37C? + ; 1 + ; $3F5 + ; - 79 + ;====== + ; 37C + jmp xor_zoom diff --git a/graphics/gr/sier/zor_tiny.s b/graphics/gr/sier/zor_tiny.s new file mode 100644 index 00000000..263be673 --- /dev/null +++ b/graphics/gr/sier/zor_tiny.s @@ -0,0 +1,53 @@ +; fake sierpinski + +; just plot X AND Y + + +; 51 initial +; 46, put YY in X +; 39, optimized to death? + +.include "zp.inc" +.include "hardware.inc" + + ;================================ + ; Clear screen and setup graphics + ;================================ +sier: + + jsr SETGR ; set lo-res 40x40 mode + bit FULLGR ; make it 40x48 + + lda #39 + sta XX + +sier_xloop: + + ldx #47 + +sier_yloop: + + txa + and XX + + bne black + lda #$11 ; red + + .byte $2C ; bit trick +black: + lda #$00 + sta COLOR + + ldy XX + txa + jsr PLOT ; PLOT AT Y,A + + + dex + bpl sier_yloop + + dec XX + bpl sier_xloop + +done: + bmi done diff --git a/graphics/hgr/tiny_triangles/Makefile b/graphics/hgr/tiny_triangles/Makefile new file mode 100644 index 00000000..91193d8c --- /dev/null +++ b/graphics/hgr/tiny_triangles/Makefile @@ -0,0 +1,80 @@ +include ../../../Makefile.inc + +DOS33 = ../../../utils/dos33fs-utils/dos33 +TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft +LINKER_SCRIPTS = ../../../linker_scripts +EMPTY_DISK = ../../../empty_disk/empty.dsk + +all: triangles.dsk + +triangles.dsk: HELLO TINY_TRIANGLES XOR MOD9 MOD9_64 WRITING MOVE_RIGHT + cp $(EMPTY_DISK) triangles.dsk + $(DOS33) -y triangles.dsk SAVE A HELLO + $(DOS33) -y triangles.dsk BSAVE -a 0x070 TINY_TRIANGLES + $(DOS33) -y triangles.dsk BSAVE -a 0x300 XOR + $(DOS33) -y triangles.dsk BSAVE -a 0x300 MOD9 + $(DOS33) -y triangles.dsk BSAVE -a 0x300 MOD9_64 + $(DOS33) -y triangles.dsk BSAVE -a 0x300 WRITING + $(DOS33) -y triangles.dsk BSAVE -a 0x300 MOVE_RIGHT + +### + +HELLO: hello.bas + $(TOKENIZE) < hello.bas > HELLO + +### + +TINY_TRIANGLES: tiny_triangles.o + ld65 -o TINY_TRIANGLES tiny_triangles.o -C $(LINKER_SCRIPTS)/apple2_70_zp.inc + +tiny_triangles.o: tiny_triangles.s + ca65 -o tiny_triangles.o tiny_triangles.s -l tiny_triangles.lst + +### + +XOR: xor.o + ld65 -o XOR xor.o -C $(LINKER_SCRIPTS)/apple2_300.inc + +xor.o: xor.s + ca65 -o xor.o xor.s -l xor.lst + +### + +MOD9: mod9.o + ld65 -o MOD9 mod9.o -C $(LINKER_SCRIPTS)/apple2_300.inc + +mod9.o: mod9.s + ca65 -o mod9.o mod9.s -l mod9.lst + +### + +MOD9_64: mod9_64.o + ld65 -o MOD9_64 mod9_64.o -C $(LINKER_SCRIPTS)/apple2_300.inc + +mod9_64.o: mod9_64.s + ca65 -o mod9_64.o mod9_64.s -l mod9_64.lst + + +### + +WRITING: writing.o + ld65 -o WRITING writing.o -C $(LINKER_SCRIPTS)/apple2_300.inc + +writing.o: writing.s + ca65 -o writing.o writing.s -l writing.lst + +### + +MOVE_RIGHT: move_right.o + ld65 -o MOVE_RIGHT move_right.o -C $(LINKER_SCRIPTS)/apple2_300.inc + +move_right.o: move_right.s + ca65 -o move_right.o move_right.s -l move_right.lst + + + +### + +clean: + rm -f *~ *.o *.lst HELLO TINY_TRIANGLES XOR MOD9 MOD9_64 WRITING \ + MOVE_RIGHT diff --git a/graphics/hgr/tiny_triangles/apple2_70_zp.inc b/graphics/hgr/tiny_triangles/apple2_70_zp.inc new file mode 100644 index 00000000..9737f2d1 --- /dev/null +++ b/graphics/hgr/tiny_triangles/apple2_70_zp.inc @@ -0,0 +1,12 @@ +MEMORY { + ZP: start = $70, size = $90, type = rw; + RAM: start = $70, 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 = ro; +} diff --git a/graphics/hgr/tiny_triangles/feathers.s b/graphics/hgr/tiny_triangles/feathers.s new file mode 100644 index 00000000..032498d2 --- /dev/null +++ b/graphics/hgr/tiny_triangles/feathers.s @@ -0,0 +1,139 @@ +GBASL = $26 +GBASH = $27 +HGRPAGE = $E6 +HGR_BITS = $1C +HGR_X = $E0 +HGR_Y = $E2 +HGR_COLOR = $E4 +HGR_HORIZ = $E5 + +SAVEX = $FD +TEMP = $FE +OLD = $FF + +PAGE0 = $C054 +PAGE1 = $C055 + +COLORTBL = $F6F6 + +HGR = $F3E2 +HGR2 = $F3D8 +HCLR = $F3F2 +HPOSN = $F411 +HPLOT0 = $F457 ;; plot at (Y,X), (A) +HPLOT1 = $F45A + +MOVE_RIGHT = $F48A + +HCOLOR1 = $F6F0 +WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us + + +mod9_lookup = $1000 + + +mod9_start: + jsr HGR2 ; clear page1 + ; A is 0 after + +tiny_yloop: + + ldy #0 + ldx #0 ; XX = 0 +yy_smc: + lda #0 ; Y co-ord + + jsr HPOSN ; plot at (Y,X), (A) + + ldx #0 + +tiny_xloop: + + jsr HPLOT1 + + txa ; XX -> A + +;===============here + + eor yy_smc+1 + tay + lda mod9_lookup,Y + + + +blurgh: + and #$1 + + stx SAVEX + + tax +; jsr HCOLOR1 + lda COLORTBL,X + sta HGR_COLOR + sta HGR_BITS + + +; beq store_color + +; lda #$7f +;store_color: +; sta HGR_COLOR + + + jsr MOVE_RIGHT ; trashes A + + ldx SAVEX + + inx + bne tiny_xloop + + inc yy_smc+1 + ldy yy_smc+1 + cpy #192 + bne tiny_yloop + + inc blurgh+1 + ldy #0 + sty yy_smc+1 + beq tiny_yloop + + + + + + ;=============================== + ; modulo 9 + ;=============================== + ; value in A +mod_9: + ; Divide by 9 + ; 17 bytes, 30 cycles + ; by Omegamatrix https://forums.nesdev.com/viewtopic.php?t=11336 + sta OLD + + sta TEMP + lsr + lsr + lsr + adc TEMP + ror + adc TEMP + ror + adc TEMP + ror + lsr + lsr + lsr + + ; A is ORIG/9, mod = OLD-(A*9) + sta TEMP + + asl + asl + asl + clc + adc TEMP + + eor #$ff + sec + adc OLD diff --git a/graphics/hgr/tiny_triangles/hello.bas b/graphics/hgr/tiny_triangles/hello.bas new file mode 100644 index 00000000..41cf3582 --- /dev/null +++ b/graphics/hgr/tiny_triangles/hello.bas @@ -0,0 +1,3 @@ +5 HOME +20 PRINT CHR$(4)"CATALOG" + diff --git a/graphics/hgr/tiny_triangles/mod9.s b/graphics/hgr/tiny_triangles/mod9.s new file mode 100644 index 00000000..c27ceeea --- /dev/null +++ b/graphics/hgr/tiny_triangles/mod9.s @@ -0,0 +1,131 @@ +GBASL = $26 +GBASH = $27 +HGRPAGE = $E6 +HGR_BITS = $1C +HGR_X = $E0 +HGR_Y = $E2 +HGR_COLOR = $E4 +HGR_HORIZ = $E5 + +SAVEX = $FD +TEMP = $FE +OLD = $FF + +PAGE0 = $C054 +PAGE1 = $C055 + +COLORTBL = $F6F6 + +HGR = $F3E2 +HGR2 = $F3D8 +HCLR = $F3F2 +HPOSN = $F411 +HPLOT0 = $F457 ;; plot at (Y,X), (A) +HPLOT1 = $F45A +COLOR_SHIFT = $F47E + +MOVE_RIGHT = $F48A + +HCOLOR1 = $F6F0 +WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us + + +mod9_lookup = $1000 + + +mod9_start: + jsr make_mod9_lookup + + jsr HGR2 ; clear page1 + ; A is 0 after + +tiny_yloop: + + ldy #0 + ldx #0 ; XX = 0 +yy_smc: + lda #0 ; Y co-ord + + jsr HPOSN ; plot at (Y,X), (A) + + ldx #0 + +tiny_xloop: + + stx SAVEX + +; jsr HPLOT1 + +;===============here + + txa + eor yy_smc+1 + tax + lda mod9_lookup,X + + + +blurgh: + and #$1 + + + tax + + tya + lsr ; check even or odd + php + +; jsr HCOLOR1 + lda COLORTBL,X +; sta HGR_COLOR + sta HGR_BITS + + plp + bcc no_shift + + jsr COLOR_SHIFT ; if odd then color shift + +no_shift: + +; beq store_color + +; lda #$7f +;store_color: +; sta HGR_COLOR + + + jsr HPLOT1 + jsr MOVE_RIGHT ; trashes A + + ldx SAVEX + + inx + bne tiny_xloop + + inc yy_smc+1 + ldy yy_smc+1 + cpy #192 + bne tiny_yloop + + inc blurgh+1 + ldy #0 + sty yy_smc+1 + beq tiny_yloop + + + +make_mod9_lookup: + ldy #0 +m9_xreset: + ldx #0 +m9_loop: + txa + sta mod9_lookup,Y + iny + beq m9_done + inx + cpx #9 + beq m9_xreset + bne m9_loop +m9_done: + rts diff --git a/graphics/hgr/tiny_triangles/mod9_64.s b/graphics/hgr/tiny_triangles/mod9_64.s new file mode 100644 index 00000000..508805a7 --- /dev/null +++ b/graphics/hgr/tiny_triangles/mod9_64.s @@ -0,0 +1,109 @@ +GBASL = $26 +GBASH = $27 +HGRPAGE = $E6 +HGR_BITS = $1C +HGR_X = $E0 +HGR_Y = $E2 +HGR_COLOR = $E4 + +TEMP = $FE +OLD = $FF + +PAGE0 = $C054 +PAGE1 = $C055 + +HGR = $F3E2 +HGR2 = $F3D8 +HCLR = $F3F2 +HPLOT0 = $F457 ;; plot at (Y,X), (A) +WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us + +;.zeropage +;.globalzp xx_smc,yy_smc + +tiny: + jsr HGR2 ; clear page1 + ; A is 0 after +tiny_yloop: + +; lda #0 +; sta XX ; XX doesn't really matter where starts +; sta YY ; start at top of screen + +tiny_xloop: + txa +; lda xx_smc+1 + +;===============here + + +; and yy_smc+1 + + eor yy_smc+1 + + ;=============================== + ; modulo 9 + ;=============================== + ; value in A +mod_9: + ; Divide by 9 + ; 17 bytes, 30 cycles + ; by Omegamatrix https://forums.nesdev.com/viewtopic.php?t=11336 + sta OLD + + sta TEMP + lsr + lsr + lsr + adc TEMP + ror + adc TEMP + ror + adc TEMP + ror + lsr + lsr + lsr + + ; A is ORIG/9, mod = OLD-(A*9) + sta TEMP + + asl + asl + asl + clc + adc TEMP + + eor #$ff + sec + adc OLD + + + + beq store_color + + lda #$7f +store_color: + sta HGR_COLOR + + ldy #0 +;xx_smc: +; ldx #0 +yy_smc: + lda #0 + + jsr HPLOT0 ; plot at (Y,X), (A) + ; at begin, stores A to HGR_Y + ; X to HGR_X and Y to HGR_X+1 + ; destroys X,Y,A + ; Y is XX/7 + + ldx HGR_X + inx +; inc xx_smc+1 + bne tiny_xloop + + inc yy_smc+1 + bne tiny_xloop + + ; should we over-write brk handler to restart? diff --git a/graphics/hgr/tiny_triangles/move_right.s b/graphics/hgr/tiny_triangles/move_right.s new file mode 100644 index 00000000..24c8e4cd --- /dev/null +++ b/graphics/hgr/tiny_triangles/move_right.s @@ -0,0 +1,71 @@ +GBASL = $26 +GBASH = $27 + +HGR_BITS = $1C +HGR_HMASK = $30 +HGR_X = $E0 +HGR_Y = $E2 +HGR_COLOR = $E4 +HGR_HORIZ = $E5 +HGRPAGE = $E6 + +SAVEX = $FD +TEMP = $FE +OLD = $FF + +PAGE0 = $C054 +PAGE1 = $C055 + +HGR = $F3E2 +HGR2 = $F3D8 +HCLR = $F3F2 +HPOSN = $F411 +HPLOT0 = $F457 ;; plot at (Y,X), (A) +HPLOT1 = $F45A + +MOVE_RIGHT = $F48A + +HCOLOR1 = $F6F0 +WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us + +tiny: + jsr HGR2 ; clear page1 + ; A is 0 after + + ldx #3 + jsr HCOLOR1 + +tiny_yloop: + + ldy #0 + ldx #0 ; XX = 0 +yy_smc: + lda #0 ; Y co-ord + + jsr HPOSN ; plot at (Y,X), (A) + +tiny_xloop: + + +; lda (GBASL),Y +; eor HGR_BITS +; and HGR_HMASK +; eor (GBASL),Y +; sta (GBASL),Y + +; lda HGR_BITS +; eor (GBASL),Y +; and HGR_HMASK +; eor (GBASL),Y +; sta (GBASL),Y + + jsr HPLOT1 + + jsr MOVE_RIGHT ; trashes A + + cpy #39 + bne tiny_xloop + + inc yy_smc+1 + jmp tiny_yloop + diff --git a/graphics/hgr/tiny_triangles/tiny_triangles.s b/graphics/hgr/tiny_triangles/tiny_triangles.s new file mode 100644 index 00000000..86f8878c --- /dev/null +++ b/graphics/hgr/tiny_triangles/tiny_triangles.s @@ -0,0 +1,61 @@ +GBASL = $26 +GBASH = $27 +HGRPAGE = $E6 +HGR_BITS = $1C +HGR_X = $E0 +HGR_Y = $E2 +HGR_COLOR = $E4 + + +PAGE0 = $C054 +PAGE1 = $C055 + +HGR = $F3E2 +HGR2 = $F3D8 +HCLR = $F3F2 +HPLOT0 = $F457 ;; plot at (Y,X), (A) +WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us + +.zeropage +.globalzp xx_smc,yy_smc + +tiny: + jsr HGR2 ; clear page1 + ; A is 0 after +tiny_yloop: + +; lda #0 +; sta XX ; XX doesn't really matter where starts +; sta YY ; start at top of screen + +tiny_xloop: + txa +; lda xx_smc+1 + and yy_smc+1 + beq store_color + + lda #$7f +store_color: + sta HGR_COLOR + + ldy #0 +;xx_smc: +; ldx #0 +yy_smc: + lda #0 + + jsr HPLOT0 ; plot at (Y,X), (A) + ; at begin, stores A to HGR_Y + ; X to HGR_X and Y to HGR_X+1 + ; destroys X,Y,A + ; Y is XX/7 + + ldx HGR_X + inx +; inc xx_smc+1 + bne tiny_xloop + + inc yy_smc+1 + bne tiny_xloop + + ; should we over-write brk handler to restart? diff --git a/graphics/hgr/tiny_triangles/writing.s b/graphics/hgr/tiny_triangles/writing.s new file mode 100644 index 00000000..b17d147e --- /dev/null +++ b/graphics/hgr/tiny_triangles/writing.s @@ -0,0 +1,109 @@ +GBASL = $26 +GBASH = $27 +HGRPAGE = $E6 +HGR_BITS = $1C +HGR_X = $E0 +HGR_Y = $E2 +HGR_COLOR = $E4 + +TEMP = $FE +OLD = $FF + +PAGE0 = $C054 +PAGE1 = $C055 + +HGR = $F3E2 +HGR2 = $F3D8 +HCLR = $F3F2 +HPLOT0 = $F457 ;; plot at (Y,X), (A) +WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us + +;.zeropage +;.globalzp xx_smc,yy_smc + +tiny: + jsr HGR2 ; clear page1 + ; A is 0 after +tiny_yloop: + +; lda #0 +; sta XX ; XX doesn't really matter where starts +; sta YY ; start at top of screen + +tiny_xloop: + txa +; lda xx_smc+1 + +;===============here + + +; and yy_smc+1 + + eor yy_smc+1 + + ;=============================== + ; modulo 9 + ;=============================== + ; value in A +mod_9: + ; Divide by 9 + ; 17 bytes, 30 cycles + ; by Omegamatrix https://forums.nesdev.com/viewtopic.php?t=11336 + sta OLD + + sta TEMP + lsr + lsr + lsr + adc TEMP + ror + adc TEMP + ror + adc TEMP + ror + lsr + lsr + lsr + + ; A is ORIG/9, mod = OLD-(A*9) + sta TEMP + + asl + asl + asl + clc + adc TEMP + + eor #$ff + sec + adc OLD + + +; +; beq store_color + +; lda #$7f +store_color: + sta HGR_COLOR + + ldy #0 +;xx_smc: +; ldx #0 +yy_smc: + lda #0 + + jsr HPLOT0 ; plot at (Y,X), (A) + ; at begin, stores A to HGR_Y + ; X to HGR_X and Y to HGR_X+1 + ; destroys X,Y,A + ; Y is XX/7 + + ldx HGR_X + inx +; inc xx_smc+1 + bne tiny_xloop + + inc yy_smc+1 + bne tiny_xloop + + ; should we over-write brk handler to restart? diff --git a/graphics/hgr/tiny_triangles/xor.s b/graphics/hgr/tiny_triangles/xor.s new file mode 100644 index 00000000..1428a26b --- /dev/null +++ b/graphics/hgr/tiny_triangles/xor.s @@ -0,0 +1,70 @@ +GBASL = $26 +GBASH = $27 +HGRPAGE = $E6 +HGR_BITS = $1C +HGR_X = $E0 +HGR_Y = $E2 +HGR_COLOR = $E4 + + +PAGE0 = $C054 +PAGE1 = $C055 + +HGR = $F3E2 +HGR2 = $F3D8 +HCLR = $F3F2 +HPLOT0 = $F457 ;; plot at (Y,X), (A) +WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us + +;.zeropage +;.globalzp xx_smc,yy_smc + +tiny: + jsr HGR2 ; clear page1 + ; A is 0 after +tiny_yloop: + +; lda #0 +; sta XX ; XX doesn't really matter where starts +; sta YY ; start at top of screen + +tiny_xloop: + txa +; lda xx_smc+1 + +;===============here + + +; and yy_smc+1 + + eor yy_smc+1 + + +; +; beq store_color + +; lda #$7f +store_color: + sta HGR_COLOR + + ldy #0 +;xx_smc: +; ldx #0 +yy_smc: + lda #0 + + jsr HPLOT0 ; plot at (Y,X), (A) + ; at begin, stores A to HGR_Y + ; X to HGR_X and Y to HGR_X+1 + ; destroys X,Y,A + ; Y is XX/7 + + ldx HGR_X + inx +; inc xx_smc+1 + bne tiny_xloop + + inc yy_smc+1 + bne tiny_xloop + + ; should we over-write brk handler to restart?