ootw: update graphics

This commit is contained in:
Vince Weaver 2021-04-09 23:33:27 -04:00
parent 49f661a5c0
commit 7e0fe35e53
46 changed files with 1326 additions and 3 deletions

View File

@ -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
####

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -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

View File

@ -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;
}

View File

@ -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 <vince@deater.net>
; 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

205
graphics/gr/sier/xor_zoom.s Normal file
View File

@ -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 <vince@deater.net>
; 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

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -0,0 +1,3 @@
5 HOME
20 PRINT CHR$(4)"CATALOG"

View File

@ -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

View File

@ -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?

View File

@ -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

View File

@ -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?

View File

@ -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?

View File

@ -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?