plasma: more attempts
This commit is contained in:
parent
22eceb515b
commit
ecaa560381
|
@ -7,7 +7,8 @@ EMPTYDISK = ../../../empty_disk/empty.dsk
|
|||
|
||||
all: plasma_hgr.dsk
|
||||
|
||||
plasma_hgr.dsk: HELLO OVAL PURPLE_WAVES ZEBRA JAWS TWIST OVAL_BOT
|
||||
plasma_hgr.dsk: HELLO OVAL PURPLE_WAVES ZEBRA JAWS TWIST OVAL_FLIP MOVING \
|
||||
MIRROR
|
||||
cp $(EMPTYDISK) plasma_hgr.dsk
|
||||
$(DOS33) -y plasma_hgr.dsk SAVE A HELLO
|
||||
$(DOS33) -y plasma_hgr.dsk BSAVE -a 0xc00 OVAL
|
||||
|
@ -15,7 +16,9 @@ plasma_hgr.dsk: HELLO OVAL PURPLE_WAVES ZEBRA JAWS TWIST OVAL_BOT
|
|||
$(DOS33) -y plasma_hgr.dsk BSAVE -a 0xc00 ZEBRA
|
||||
$(DOS33) -y plasma_hgr.dsk BSAVE -a 0xc00 JAWS
|
||||
$(DOS33) -y plasma_hgr.dsk BSAVE -a 0xc00 TWIST
|
||||
$(DOS33) -y plasma_hgr.dsk BSAVE -a 0x3F5 OVAL_BOT
|
||||
$(DOS33) -y plasma_hgr.dsk BSAVE -a 0x3F5 OVAL_FLIP
|
||||
$(DOS33) -y plasma_hgr.dsk BSAVE -a 0x3F5 MOVING
|
||||
$(DOS33) -y plasma_hgr.dsk BSAVE -a 0x3F5 MIRROR
|
||||
|
||||
###
|
||||
|
||||
|
@ -32,11 +35,28 @@ oval.o: oval.s
|
|||
|
||||
###
|
||||
|
||||
OVAL_BOT: oval_bot.o
|
||||
ld65 -o OVAL_BOT oval_bot.o -C $(LINKERSCRIPTS)/apple2_3f5.inc
|
||||
OVAL_FLIP: oval_flip.o
|
||||
ld65 -o OVAL_FLIP oval_flip.o -C $(LINKERSCRIPTS)/apple2_3f5.inc
|
||||
|
||||
oval_flip.o: oval_flip.s
|
||||
ca65 -o oval_flip.o oval_flip.s -l oval_flip.lst
|
||||
|
||||
###
|
||||
|
||||
MOVING: moving.o
|
||||
ld65 -o MOVING moving.o -C $(LINKERSCRIPTS)/apple2_3f5.inc
|
||||
|
||||
moving.o: moving.s
|
||||
ca65 -o moving.o moving.s -l moving.lst
|
||||
|
||||
###
|
||||
|
||||
MIRROR: mirror.o
|
||||
ld65 -o MIRROR mirror.o -C $(LINKERSCRIPTS)/apple2_3f5.inc
|
||||
|
||||
mirror.o: mirror.s
|
||||
ca65 -o mirror.o mirror.s -l mirror.lst
|
||||
|
||||
oval_bot.o: oval_bot.s
|
||||
ca65 -o oval_bot.o oval_bot.s -l oval_bot.lst
|
||||
|
||||
|
||||
###
|
||||
|
@ -76,5 +96,5 @@ purple_waves.o: purple_waves.s
|
|||
###
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o *.lst OVAL PURPLE_WAVES ZEBRA JAWS TWIST OVAL_BOT
|
||||
rm -f *~ *.o *.lst OVAL PURPLE_WAVES ZEBRA JAWS TWIST OVAL_FLIP
|
||||
|
||||
|
|
|
@ -0,0 +1,191 @@
|
|||
; Moving
|
||||
; moving, orange and green
|
||||
|
||||
|
||||
; zero page
|
||||
GBASL = $26
|
||||
GBASH = $27
|
||||
YY = $69
|
||||
ROW_SUM = $70
|
||||
|
||||
HGR_X = $E0
|
||||
HGR_XH = $E1
|
||||
HGR_Y = $E2
|
||||
HGR_COLOR = $E4
|
||||
HGR_PAGE = $E6
|
||||
|
||||
FRAME = $FC
|
||||
SUM = $FD
|
||||
SAVEX = $FE
|
||||
SAVEY = $FF
|
||||
|
||||
; soft-switches
|
||||
FULLGR = $C052
|
||||
PAGE1 = $C054
|
||||
|
||||
; ROM routines
|
||||
|
||||
HGR2 = $F3D8
|
||||
HPOSN = $F411 ; (Y,X),(A) (values stores in HGRX,XH,Y)
|
||||
|
||||
;================================
|
||||
; Clear screen and setup graphics
|
||||
;================================
|
||||
oval:
|
||||
|
||||
jsr HGR2 ; set hi-res 140x192, page2, fullscreen
|
||||
; A and Y both 0 at end
|
||||
;==================
|
||||
; create sinetable
|
||||
|
||||
;ldy #0 ; Y is 0
|
||||
sinetable_loop:
|
||||
tya ; 2
|
||||
and #$3f ; wrap sine at 63 entries ; 2
|
||||
|
||||
cmp #$20
|
||||
php ; save pos/negative for later
|
||||
|
||||
and #$1f
|
||||
|
||||
cmp #$10
|
||||
bcc sin_left ; blt
|
||||
|
||||
sin_right:
|
||||
; sec carry should be set here
|
||||
eor #$FF
|
||||
adc #$20 ; 32-X
|
||||
sin_left:
|
||||
tax
|
||||
lda sinetable_base,X ; 4+
|
||||
|
||||
plp
|
||||
bcc sin_done
|
||||
|
||||
sin_negate:
|
||||
; carry set here
|
||||
eor #$ff
|
||||
adc #0
|
||||
|
||||
sin_done:
|
||||
sta sinetable,Y
|
||||
|
||||
iny
|
||||
bne sinetable_loop
|
||||
|
||||
|
||||
; NOTE: making gbash/gbasl table wasn't worth it
|
||||
|
||||
;============================
|
||||
; main loop
|
||||
;============================
|
||||
|
||||
draw_oval:
|
||||
inc FRAME
|
||||
|
||||
lda #191 ; YY
|
||||
|
||||
create_yloop:
|
||||
; HGR_Y (YY) is in A here
|
||||
|
||||
; ldx #39 ; X is don't care?
|
||||
ldy #0
|
||||
|
||||
jsr HPOSN ; (Y,X),(A) (values stores in HGRX,XH,Y)
|
||||
|
||||
; restore values
|
||||
|
||||
lda HGR_Y ; YY
|
||||
|
||||
calcsine_div4:
|
||||
lsr
|
||||
lsr ; 2
|
||||
sec
|
||||
sbc FRAME
|
||||
tax
|
||||
lda sinetable,X
|
||||
sta row_sum_smc+1
|
||||
|
||||
ldx HGR_Y ; YY
|
||||
|
||||
ldy #39 ; XX
|
||||
create_xloop:
|
||||
|
||||
;=====================
|
||||
; critical inner loop
|
||||
; every cycle here is 40x192 cycles
|
||||
;=====================
|
||||
|
||||
; clc
|
||||
tya
|
||||
adc FRAME
|
||||
tax
|
||||
lda sinetable,X
|
||||
|
||||
adc sinetable,Y ; 4+
|
||||
row_sum_smc:
|
||||
adc #$dd ; row base value ; 2
|
||||
|
||||
lsr ; double colors ; 2
|
||||
; also puts bit in carry
|
||||
; which helps proper color gen
|
||||
|
||||
tax ; 2
|
||||
lda colorlookup,X ; lookup in table ; 5
|
||||
|
||||
ror_nop_smc:
|
||||
ror ; $6A/$EA ; 2
|
||||
sta (GBASL),Y ; 6
|
||||
|
||||
lda ror_nop_smc ; toggle ror/nop ; 4
|
||||
eor #$80 ; 2
|
||||
sta ror_nop_smc ; 4
|
||||
|
||||
dey ; 2
|
||||
bpl create_xloop ; 2/3
|
||||
|
||||
dec HGR_Y
|
||||
lda HGR_Y
|
||||
cmp #$ff ; blah want to draw line 0
|
||||
bne create_yloop
|
||||
|
||||
flip_pages:
|
||||
|
||||
; Y should be $FF here
|
||||
|
||||
lda HGR_PAGE ; will be $20/$40
|
||||
cmp #$20
|
||||
bne done_page
|
||||
dey
|
||||
done_page:
|
||||
ldx PAGE1-$FE,Y ; set display page to PAGE1 or PAGE2
|
||||
|
||||
eor #$60 ; flip draw page between $2000/$4000
|
||||
sta HGR_PAGE
|
||||
|
||||
bne draw_oval ; bra
|
||||
|
||||
|
||||
colorlookup:
|
||||
.byte $22,$aa,$ba,$ff,$ba,$aa,$22 ; use 00 from sinetable
|
||||
;.byte $00
|
||||
|
||||
;.byte $11,$55,$5d,$7f,$5d,$55,$11 ; use 00 from sinetable
|
||||
;.byte $00
|
||||
|
||||
|
||||
;sinetable_base = $F5BA
|
||||
|
||||
sinetable_base:
|
||||
; this is actually (32*sin(x))
|
||||
.byte $00,$03,$06,$09,$0C,$0F,$11,$14
|
||||
.byte $16,$18,$1A,$1C,$1D,$1E,$1F,$1F
|
||||
.byte $20
|
||||
|
||||
; for bot
|
||||
; 3F5 - 7d = 378
|
||||
; jmp oval
|
||||
|
||||
sinetable=$6000
|
||||
|
||||
|
|
@ -0,0 +1,191 @@
|
|||
; Moving
|
||||
; moving, orange and green
|
||||
|
||||
|
||||
; zero page
|
||||
GBASL = $26
|
||||
GBASH = $27
|
||||
YY = $69
|
||||
ROW_SUM = $70
|
||||
|
||||
HGR_X = $E0
|
||||
HGR_XH = $E1
|
||||
HGR_Y = $E2
|
||||
HGR_COLOR = $E4
|
||||
HGR_PAGE = $E6
|
||||
|
||||
FRAME = $FC
|
||||
SUM = $FD
|
||||
SAVEX = $FE
|
||||
SAVEY = $FF
|
||||
|
||||
; soft-switches
|
||||
FULLGR = $C052
|
||||
PAGE1 = $C054
|
||||
|
||||
; ROM routines
|
||||
|
||||
HGR2 = $F3D8
|
||||
HPOSN = $F411 ; (Y,X),(A) (values stores in HGRX,XH,Y)
|
||||
|
||||
;================================
|
||||
; Clear screen and setup graphics
|
||||
;================================
|
||||
oval:
|
||||
|
||||
jsr HGR2 ; set hi-res 140x192, page2, fullscreen
|
||||
; A and Y both 0 at end
|
||||
;==================
|
||||
; create sinetable
|
||||
|
||||
;ldy #0 ; Y is 0
|
||||
sinetable_loop:
|
||||
tya ; 2
|
||||
and #$3f ; wrap sine at 63 entries ; 2
|
||||
|
||||
cmp #$20
|
||||
php ; save pos/negative for later
|
||||
|
||||
and #$1f
|
||||
|
||||
cmp #$10
|
||||
bcc sin_left ; blt
|
||||
|
||||
sin_right:
|
||||
; sec carry should be set here
|
||||
eor #$FF
|
||||
adc #$20 ; 32-X
|
||||
sin_left:
|
||||
tax
|
||||
lda sinetable_base,X ; 4+
|
||||
|
||||
plp
|
||||
bcc sin_done
|
||||
|
||||
sin_negate:
|
||||
; carry set here
|
||||
eor #$ff
|
||||
; adc #0 ; FIXME: this makes things off by 1
|
||||
|
||||
sin_done:
|
||||
sta sinetable,Y
|
||||
|
||||
iny
|
||||
bne sinetable_loop
|
||||
|
||||
|
||||
; NOTE: making gbash/gbasl table wasn't worth it
|
||||
|
||||
;============================
|
||||
; main loop
|
||||
;============================
|
||||
|
||||
draw_oval:
|
||||
inc FRAME
|
||||
|
||||
lda #191 ; YY
|
||||
|
||||
create_yloop:
|
||||
; HGR_Y (YY) is in A here
|
||||
|
||||
; ldx #39 ; X is don't care?
|
||||
; ldy #0 ; Y is also don't care?
|
||||
|
||||
jsr HPOSN ; (Y,X),(A) (values stores in HGRX,XH,Y)
|
||||
|
||||
; restore values
|
||||
|
||||
lda HGR_Y ; YY
|
||||
|
||||
calcsine_div4:
|
||||
lsr
|
||||
lsr ; 2
|
||||
sec
|
||||
sbc FRAME
|
||||
tax
|
||||
lda sinetable,X
|
||||
sta row_sum_smc+1
|
||||
|
||||
ldx HGR_Y ; YY
|
||||
|
||||
ldy #39 ; XX
|
||||
create_xloop:
|
||||
|
||||
;=====================
|
||||
; critical inner loop
|
||||
; every cycle here is 40x192 cycles
|
||||
;=====================
|
||||
|
||||
clc
|
||||
tya
|
||||
adc FRAME
|
||||
tax
|
||||
lda sinetable,X
|
||||
|
||||
adc sinetable,Y ; 4+
|
||||
row_sum_smc:
|
||||
adc #$dd ; row base value ; 2
|
||||
|
||||
lsr ; double colors ; 2
|
||||
; also puts bit in carry
|
||||
; which helps proper color gen
|
||||
and #$7 ; 2
|
||||
tax ; 2
|
||||
lda colorlookup,X ; lookup in table ; 5
|
||||
|
||||
ror_nop_smc:
|
||||
ror ; $6A/$EA ; 2
|
||||
sta (GBASL),Y ; 6
|
||||
|
||||
lda ror_nop_smc ; toggle ror/nop ; 4
|
||||
eor #$80 ; 2
|
||||
sta ror_nop_smc ; 4
|
||||
|
||||
dey ; 2
|
||||
bpl create_xloop ; 2/3
|
||||
|
||||
dec HGR_Y
|
||||
lda HGR_Y
|
||||
cmp #$ff ; blah want to draw line 0
|
||||
bne create_yloop
|
||||
|
||||
flip_pages:
|
||||
|
||||
; Y should be $FF here
|
||||
|
||||
lda HGR_PAGE ; will be $20/$40
|
||||
cmp #$20
|
||||
bne done_page
|
||||
dey
|
||||
done_page:
|
||||
ldx PAGE1-$FE,Y ; set display page to PAGE1 or PAGE2
|
||||
|
||||
eor #$60 ; flip draw page between $2000/$4000
|
||||
sta HGR_PAGE
|
||||
|
||||
bne draw_oval ; bra
|
||||
|
||||
|
||||
colorlookup:
|
||||
.byte $22,$aa,$ba,$ff,$ba,$aa,$22 ; use 00 from sinetable
|
||||
;.byte $00
|
||||
|
||||
;.byte $11,$55,$5d,$7f,$5d,$55,$11 ; use 00 from sinetable
|
||||
;.byte $00
|
||||
|
||||
|
||||
;sinetable_base = $F5BA
|
||||
|
||||
sinetable_base:
|
||||
; this is actually (32*sin(x))
|
||||
.byte $00,$03,$06,$09,$0C,$0F,$11,$14
|
||||
.byte $16,$18,$1A,$1C,$1D,$1E,$1F,$1F
|
||||
.byte $20
|
||||
|
||||
; for bot
|
||||
; 3F5 - 7d = 378
|
||||
; jmp oval
|
||||
|
||||
sinetable=$6000
|
||||
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
; Ovals
|
||||
|
||||
; zero page
|
||||
GBASL = $26
|
||||
GBASH = $27
|
||||
YY = $69
|
||||
ROW_SUM = $70
|
||||
|
||||
HGR_X = $E0
|
||||
HGR_XH = $E1
|
||||
HGR_Y = $E2
|
||||
HGR_COLOR = $E4
|
||||
HGR_PAGE = $E6
|
||||
|
||||
FRAME = $FC
|
||||
SUM = $FD
|
||||
SAVEX = $FE
|
||||
SAVEY = $FF
|
||||
|
||||
; soft-switches
|
||||
FULLGR = $C052
|
||||
PAGE1 = $C054
|
||||
|
||||
; ROM routines
|
||||
|
||||
HGR2 = $F3D8
|
||||
HPOSN = $F411 ; (Y,X),(A) (values stores in HGRX,XH,Y)
|
||||
|
||||
;================================
|
||||
; Clear screen and setup graphics
|
||||
;================================
|
||||
oval:
|
||||
|
||||
jsr HGR2 ; set hi-res 140x192, page2, fullscreen
|
||||
|
||||
draw_oval:
|
||||
inc FRAME
|
||||
|
||||
ldx #191 ; YY
|
||||
stx HGR_Y
|
||||
|
||||
create_yloop:
|
||||
lda HGR_Y
|
||||
ldx #39
|
||||
ldy #0
|
||||
|
||||
jsr HPOSN ; (Y,X),(A) (values stores in HGRX,XH,Y)
|
||||
|
||||
; restore values
|
||||
|
||||
ldy #39 ; XX
|
||||
|
||||
lda FRAME
|
||||
sta ROW_SUM
|
||||
|
||||
lda HGR_Y ; YY
|
||||
jsr calcsine_div2
|
||||
|
||||
ldx HGR_Y ; YY
|
||||
|
||||
sta ROW_SUM
|
||||
|
||||
create_xloop:
|
||||
|
||||
tya ; XX ; 2
|
||||
jsr calcsine ; 6
|
||||
|
||||
lsr ; double colors ; 2
|
||||
and #$7 ; mask ; 2
|
||||
tax ; 2
|
||||
lda colorlookup,X ; lookup in table ; 5
|
||||
sta SAVEY ; save for later ; 3
|
||||
|
||||
tya ; 2
|
||||
ror ; 2
|
||||
bcc noshift ; 2/3
|
||||
ror SAVEY ; 5
|
||||
noshift:
|
||||
lda SAVEY ; 3
|
||||
; and #$7f
|
||||
sta (GBASL),Y ; 6
|
||||
|
||||
dey ; 2
|
||||
bpl create_xloop ; 2/3
|
||||
|
||||
dec HGR_Y
|
||||
bne create_yloop
|
||||
|
||||
; X and Y both $FF
|
||||
|
||||
beq draw_oval
|
||||
|
||||
|
||||
;==============================
|
||||
; calcsine
|
||||
;==============================
|
||||
; looks up sine of value in A
|
||||
; accumulates it with ROW_SUM
|
||||
; returns result in A
|
||||
; Y preserved
|
||||
|
||||
calcsine_div2:
|
||||
lsr ; 2
|
||||
calcsine:
|
||||
and #$3f ; wrap sine at 63 entries ; 2
|
||||
|
||||
tax ; 2
|
||||
cmp #$20 ; see if negative ; 2
|
||||
bcc sinadd ; 2/3
|
||||
|
||||
sinsub:
|
||||
; carry already set
|
||||
lda ROW_SUM ; 3
|
||||
sbc sinetable-32,X ; 4+
|
||||
jmp sindone ; 3
|
||||
|
||||
sinadd:
|
||||
; carry already clear
|
||||
lda ROW_SUM ; 3
|
||||
adc sinetable,X ; 4+
|
||||
|
||||
sindone:
|
||||
rts ; 6
|
||||
|
||||
|
||||
colorlookup:
|
||||
|
||||
.byte $11,$55,$5d,$7f,$5d,$55,$11 ; use 00 from sinetable
|
||||
;.byte $00
|
||||
|
||||
sinetable:
|
||||
; this is actually (32*sin(x))
|
||||
|
||||
.byte $00,$03,$06,$09,$0C,$0F,$11,$14
|
||||
.byte $16,$18,$1A,$1C,$1D,$1E,$1F,$1F
|
||||
.byte $20,$1F,$1F,$1E,$1D,$1C,$1A,$18
|
||||
.byte $16,$14,$11,$0F,$0C,$09,$06,$03
|
|
@ -0,0 +1,256 @@
|
|||
; Moving
|
||||
; moving, orange and green
|
||||
|
||||
|
||||
; zero page
|
||||
GBASL = $26
|
||||
GBASH = $27
|
||||
YY = $69
|
||||
ROW_SUM = $70
|
||||
|
||||
HGR_X = $E0
|
||||
HGR_XH = $E1
|
||||
HGR_Y = $E2
|
||||
HGR_COLOR = $E4
|
||||
HGR_PAGE = $E6
|
||||
|
||||
FRAME = $FC
|
||||
SUM = $FD
|
||||
SAVEX = $FE
|
||||
SAVEY = $FF
|
||||
|
||||
; soft-switches
|
||||
FULLGR = $C052
|
||||
PAGE1 = $C054
|
||||
|
||||
; ROM routines
|
||||
|
||||
HGR2 = $F3D8
|
||||
HPOSN = $F411 ; (Y,X),(A) (values stores in HGRX,XH,Y)
|
||||
|
||||
;================================
|
||||
; Clear screen and setup graphics
|
||||
;================================
|
||||
oval:
|
||||
|
||||
jsr HGR2 ; set hi-res 140x192, page2, fullscreen
|
||||
|
||||
|
||||
.if 1
|
||||
|
||||
;==========================================
|
||||
; create sinetable using ROM cosine table
|
||||
|
||||
ldy #0
|
||||
sinetable_loop:
|
||||
tya ; 2
|
||||
and #$3f ; wrap sine at 63 entries ; 2
|
||||
|
||||
cmp #$20
|
||||
php ; save pos/negative for later
|
||||
|
||||
and #$1f
|
||||
|
||||
beq sin_noadjust
|
||||
|
||||
cmp #$10
|
||||
bcc sin_left ; blt
|
||||
bne sin_right
|
||||
|
||||
lda #$20 ; force sin(16) to $20 instead of $1F
|
||||
bne sin_noadjust
|
||||
|
||||
sin_right:
|
||||
; sec carry should be set here
|
||||
sbc #$10 ; X-16 (x=16..31)
|
||||
bne sin_both ; bra
|
||||
sin_left:
|
||||
; clc ; carry should be clear
|
||||
eor #$FF ; 16-X (but plus one twos complement)
|
||||
adc #$11
|
||||
sin_both:
|
||||
tax
|
||||
lda sinetable_base,X ; 4+
|
||||
|
||||
lsr ; rom value is *256
|
||||
lsr ; we want *32
|
||||
lsr
|
||||
sin_noadjust:
|
||||
|
||||
plp
|
||||
bcc sin_done
|
||||
|
||||
sin_negate:
|
||||
; carry set here
|
||||
eor #$ff
|
||||
; adc #0 ; off by one, does it matter?
|
||||
|
||||
sin_done:
|
||||
sta sinetable,Y
|
||||
|
||||
iny
|
||||
bne sinetable_loop
|
||||
|
||||
.else
|
||||
|
||||
;==================
|
||||
; create sinetable
|
||||
|
||||
ldy #0
|
||||
sinetable_loop:
|
||||
tya ; 2
|
||||
and #$3f ; wrap sine at 63 entries ; 2
|
||||
|
||||
cmp #$20
|
||||
php ; save pos/negative for later
|
||||
|
||||
and #$1f
|
||||
|
||||
cmp #$10
|
||||
bcc sin_left ; blt
|
||||
|
||||
sin_right:
|
||||
; sec carry should be set here
|
||||
eor #$FF
|
||||
adc #$20 ; 32-X
|
||||
sin_left:
|
||||
tax
|
||||
lda sinetable_base,X ; 4+
|
||||
|
||||
plp
|
||||
bcc sin_done
|
||||
|
||||
sin_negate:
|
||||
; carry set here
|
||||
eor #$ff
|
||||
adc #0
|
||||
|
||||
sin_done:
|
||||
sta sinetable,Y
|
||||
|
||||
iny
|
||||
bne sinetable_loop
|
||||
.endif
|
||||
|
||||
; NOTE: making gbash/gbasl table wasn't worth it
|
||||
|
||||
;============================
|
||||
; main loop
|
||||
;============================
|
||||
|
||||
draw_oval:
|
||||
inc FRAME
|
||||
|
||||
lda #191 ; YY
|
||||
|
||||
create_yloop:
|
||||
; HGR_Y (YY) is in A here
|
||||
|
||||
; ldx #39 ; X is don't care?
|
||||
ldy #0
|
||||
|
||||
jsr HPOSN ; (Y,X),(A) (values stores in HGRX,XH,Y)
|
||||
|
||||
; restore values
|
||||
|
||||
lda HGR_Y ; YY
|
||||
|
||||
calcsine_div4:
|
||||
lsr
|
||||
lsr ; 2
|
||||
sec
|
||||
sbc FRAME
|
||||
tax
|
||||
lda sinetable,X
|
||||
sta row_sum_smc+1
|
||||
|
||||
ldx HGR_Y ; YY
|
||||
|
||||
ldy #39 ; XX
|
||||
create_xloop:
|
||||
|
||||
;=====================
|
||||
; critical inner loop
|
||||
; every cycle here is 40x192 cycles
|
||||
;=====================
|
||||
|
||||
clc
|
||||
tya
|
||||
adc FRAME
|
||||
tax
|
||||
lda sinetable,X
|
||||
|
||||
adc sinetable,Y ; 4+
|
||||
row_sum_smc:
|
||||
adc #$dd ; row base value ; 2
|
||||
|
||||
lsr ; double colors ; 2
|
||||
; also puts bit in carry
|
||||
; which helps make blue
|
||||
and #$7 ; mask ; 2
|
||||
tax ; 2
|
||||
lda colorlookup,X ; lookup in table ; 5
|
||||
|
||||
ror_nop_smc:
|
||||
ror ; $6A/$EA ; 2
|
||||
; and #$7f ; make all purple
|
||||
sta (GBASL),Y ; 6
|
||||
|
||||
lda ror_nop_smc ; toggle ror/nop ; 4
|
||||
eor #$80 ; 2
|
||||
sta ror_nop_smc ; 4
|
||||
|
||||
dey ; 2
|
||||
bpl create_xloop ; 2/3
|
||||
|
||||
dec HGR_Y
|
||||
lda HGR_Y
|
||||
cmp #$ff
|
||||
bne create_yloop
|
||||
|
||||
; we skip drawing line 0 as it makes it easier
|
||||
|
||||
flip_pages:
|
||||
|
||||
; Y should be $FF here
|
||||
|
||||
; iny
|
||||
lda HGR_PAGE
|
||||
cmp #$20
|
||||
bne done_page
|
||||
dey
|
||||
done_page:
|
||||
ldx PAGE1-$FE,Y ; set display page to PAGE1 or PAGE2
|
||||
|
||||
eor #$60 ; flip draw page between $400/$800
|
||||
sta HGR_PAGE
|
||||
|
||||
bne draw_oval ; bra
|
||||
|
||||
|
||||
colorlookup:
|
||||
.byte $22,$aa,$ba,$ff,$ba,$aa,$22 ; use 00 from sinetable
|
||||
.byte $00
|
||||
|
||||
;.byte $11,$55,$5d,$7f,$5d,$55,$11 ; use 00 from sinetable
|
||||
;.byte $00
|
||||
|
||||
|
||||
sinetable_base = $F5BA
|
||||
|
||||
;sinetable_base:
|
||||
; this is actually (32*sin(x))
|
||||
;.byte $00,$03,$06,$09,$0C,$0F,$11,$14
|
||||
;.byte $16,$18,$1A,$1C,$1D,$1E,$1F,$1F
|
||||
;.byte $20
|
||||
;,$1F,$1F,$1E,$1D,$1C,$1A,$18
|
||||
;.byte $16,$14,$11,$0F,$0C,$09,$06,$03
|
||||
|
||||
|
||||
; for bot
|
||||
; 3F5 - 7d = 378
|
||||
; jmp oval
|
||||
|
||||
sinetable=$6000
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ SDL_INCLUDE= `sdl-config --cflags`
|
|||
GR_SIM = ../gr-sim.a
|
||||
|
||||
all: fireworks fw_purple lines image_load hgr_view seven \
|
||||
random16 scroll scroll-asm plasma_new
|
||||
random16 scroll scroll-asm plasma_new plasma_test plasma_test64
|
||||
|
||||
###
|
||||
|
||||
|
@ -51,6 +51,23 @@ plasma_new.o: plasma_new.c
|
|||
|
||||
###
|
||||
|
||||
plasma_test64: plasma_test64.o $(GR_SIM)
|
||||
$(CC) -o plasma_test64 plasma_test64.o $(GR_SIM) $(LFLAGS) $(SDL_LIBS)
|
||||
|
||||
plasma_test64.o: plasma_test64.c
|
||||
$(CC) $(CFLAGS) -c plasma_test64.c
|
||||
|
||||
###
|
||||
|
||||
plasma_test: plasma_test.o $(GR_SIM)
|
||||
$(CC) -o plasma_test plasma_test.o $(GR_SIM) $(LFLAGS) $(SDL_LIBS)
|
||||
|
||||
plasma_test.o: plasma_test.c
|
||||
$(CC) $(CFLAGS) -c plasma_test.c
|
||||
|
||||
|
||||
###
|
||||
|
||||
fw_purple: fw_purple.o $(GR_SIM)
|
||||
$(CC) -o fw_purple fw_purple.o $(GR_SIM) $(LFLAGS) $(SDL_LIBS)
|
||||
|
||||
|
@ -92,4 +109,5 @@ scroll-asm.o: scroll-asm.c
|
|||
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o fireworks lines image_load hgr_view fw_purple seven random16 scroll scroll-asm
|
||||
rm -f *~ *.o fireworks lines image_load hgr_view fw_purple seven \
|
||||
random16 scroll scroll-asm plasma_text plasma_text64
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
/* for demoscene, you need a plasma effect... */
|
||||
/* https://rosettacode.org/wiki/Plasma_effect */
|
||||
/* https://www.bidouille.org/prog/plasma */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "tfv_zp.h"
|
||||
#include "gr-sim.h"
|
||||
|
||||
#define PI 3.14159265358979323846264338327950
|
||||
|
||||
|
||||
int sine_lookup[64];
|
||||
|
||||
#if 0
|
||||
static unsigned char color_lookup[]={0x0, 0x0, 0x1, 0x1,
|
||||
0x2, 0x2, 0x3, 0x3,
|
||||
0x4, 0x4, 0x5, 0x5,
|
||||
0x6, 0x6, 0x7, 0x7};
|
||||
#else
|
||||
static unsigned char color_lookup[]={0x0, 0x0, 0x0, 0x1,
|
||||
0x1, 0x1, 0x2, 0x2,
|
||||
0x2, 0x3, 0x3, 0x3,
|
||||
0x2, 0x2, 0x1, 0x1};
|
||||
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
int ch,xx,yy,col;
|
||||
|
||||
grsim_init();
|
||||
|
||||
home();
|
||||
|
||||
hgr();
|
||||
|
||||
soft_switch(MIXCLR);
|
||||
|
||||
clear_screens();
|
||||
|
||||
ram[DRAW_PAGE]=0x0;
|
||||
|
||||
for(xx=0;xx<64;xx++) {
|
||||
|
||||
sine_lookup[xx]=32.0*sin( (xx*2*PI)/64);
|
||||
|
||||
}
|
||||
|
||||
int offset=0;
|
||||
|
||||
while(1) {
|
||||
|
||||
for(yy=0;yy<192;yy++) {
|
||||
for(xx=0;xx<40;xx++) {
|
||||
|
||||
col = (int)
|
||||
( 128.0 + sine_lookup[ (int)(xx+offset)&0x3f ]
|
||||
+ sine_lookup[ (int)(xx)&0x3f ]
|
||||
+ sine_lookup[ (int)((yy/4)-offset)&0x3f ]
|
||||
// + sine_lookup[ (int)((xx + yy)/4)&0x3f ]
|
||||
) ;
|
||||
|
||||
|
||||
col+=offset;
|
||||
|
||||
hcolor_equals(color_lookup[col&0xf]);
|
||||
|
||||
hplot(xx*7,yy);
|
||||
hplot_to((xx*7)+6,yy);
|
||||
}
|
||||
}
|
||||
offset++;
|
||||
grsim_update();
|
||||
|
||||
ch=grsim_input();
|
||||
if (ch=='q') exit(0);
|
||||
|
||||
if (ch==' ') {
|
||||
while(1) {
|
||||
ch=grsim_input();
|
||||
if (ch) break;
|
||||
}
|
||||
}
|
||||
usleep(200000);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
/* for demoscene, you need a plasma effect... */
|
||||
/* https://rosettacode.org/wiki/Plasma_effect */
|
||||
/* https://www.bidouille.org/prog/plasma */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "tfv_zp.h"
|
||||
#include "gr-sim.h"
|
||||
|
||||
#define PI 3.14159265358979323846264338327950
|
||||
|
||||
|
||||
int sine_lookup[64];
|
||||
|
||||
#if 0
|
||||
static unsigned char color_lookup[]={0x0, 0x0, 0x1, 0x1,
|
||||
0x2, 0x2, 0x3, 0x3,
|
||||
0x4, 0x4, 0x5, 0x5,
|
||||
0x6, 0x6, 0x7, 0x7};
|
||||
#else
|
||||
static unsigned char color_lookup[]={0x0, 0x0, 0x0, 0x1,
|
||||
0x1, 0x1, 0x2, 0x2,
|
||||
0x2, 0x3, 0x3, 0x3,
|
||||
0x2, 0x2, 0x1, 0x1};
|
||||
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
int ch,xx,yy,col;
|
||||
|
||||
grsim_init();
|
||||
|
||||
home();
|
||||
|
||||
hgr();
|
||||
|
||||
soft_switch(MIXCLR);
|
||||
|
||||
clear_screens();
|
||||
|
||||
ram[DRAW_PAGE]=0x0;
|
||||
|
||||
for(xx=0;xx<64;xx++) {
|
||||
|
||||
sine_lookup[xx]=64.0*sin( (xx*2*PI)/64);
|
||||
|
||||
}
|
||||
|
||||
int offset=0;
|
||||
|
||||
while(1) {
|
||||
|
||||
for(yy=0;yy<192;yy++) {
|
||||
for(xx=0;xx<40;xx++) {
|
||||
|
||||
col = (int)
|
||||
( 128.0 + sine_lookup[ (int)(xx+offset)&0x3f ]
|
||||
+ sine_lookup[ (int)(xx)&0x3f ]
|
||||
+ sine_lookup[ (int)((yy/4)-offset)&0x3f ]
|
||||
// + sine_lookup[ (int)((xx + yy)/4)&0x3f ]
|
||||
) ;
|
||||
|
||||
|
||||
col+=offset;
|
||||
|
||||
hcolor_equals(color_lookup[col&0xf]);
|
||||
|
||||
hplot(xx*7,yy);
|
||||
hplot_to((xx*7)+6,yy);
|
||||
}
|
||||
}
|
||||
offset++;
|
||||
grsim_update();
|
||||
|
||||
ch=grsim_input();
|
||||
if (ch=='q') exit(0);
|
||||
|
||||
if (ch==' ') {
|
||||
while(1) {
|
||||
ch=grsim_input();
|
||||
if (ch) break;
|
||||
}
|
||||
}
|
||||
usleep(200000);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue