mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-02-08 12:30:47 +00:00
demos: d2
This commit is contained in:
parent
29951578fd
commit
c75dffc7ed
@ -29,6 +29,7 @@ D2: d2.o
|
||||
ld65 -o D2 d2.o -C $(LINKER_SCRIPTS)/apple2_6000.inc
|
||||
|
||||
d2.o: d2.s \
|
||||
moving.s wires.s \
|
||||
zp.inc hardware.inc \
|
||||
peasant_music.s \
|
||||
interrupt_handler.s mockingboard_setup.s
|
||||
@ -45,5 +46,5 @@ text_to_tiny.o: text_to_tiny.c
|
||||
####
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o *.lst YANKEE PEASANT HELLO text_to_tiny peasant_music.s
|
||||
rm -f *~ *.o *.lst D2 HELLO text_to_tiny peasant_music.s
|
||||
|
||||
|
@ -1,14 +1,4 @@
|
||||
; Tiny Mockingboard Player
|
||||
|
||||
; 514B -- Initial implementation
|
||||
; 423B -- inline everything
|
||||
; 400B -- put register init at end of song
|
||||
; 381B -- generate the frequency table
|
||||
|
||||
; proposed format
|
||||
; CCOONNNN -- c=channel, o=octave, n=note
|
||||
; 11LLLLLL -- L=length
|
||||
; 11LLLLLL -- wait time
|
||||
; Demo2
|
||||
|
||||
; by deater (Vince Weaver) <vince@deater.net>
|
||||
|
||||
@ -17,15 +7,10 @@
|
||||
.include "hardware.inc"
|
||||
|
||||
|
||||
;==========================================
|
||||
|
||||
tiny_music:
|
||||
d2:
|
||||
|
||||
;===================
|
||||
;
|
||||
|
||||
;===================
|
||||
; Player Setup
|
||||
; music Player Setup
|
||||
|
||||
|
||||
lda #<peasant_song
|
||||
@ -39,11 +24,69 @@ tiny_music:
|
||||
start_interrupts:
|
||||
cli
|
||||
|
||||
forever:
|
||||
jmp moving
|
||||
;================================
|
||||
; Clear screen and setup graphics
|
||||
;================================
|
||||
|
||||
jsr HGR2 ; set hi-res 140x192, page2, fullscreen
|
||||
; A and Y both 0 at end
|
||||
|
||||
sty FRAME ; start at 1 for wires purposes
|
||||
|
||||
;==================
|
||||
; 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
|
||||
|
||||
|
||||
forever:
|
||||
jsr oval
|
||||
|
||||
jsr moving
|
||||
|
||||
jsr wires
|
||||
|
||||
jmp forever
|
||||
|
||||
.include "moving.s"
|
||||
.include "wires.s"
|
||||
.include "oval.s"
|
||||
|
||||
; music
|
||||
.include "peasant_music.s"
|
||||
@ -51,3 +94,11 @@ forever:
|
||||
; must be last
|
||||
.include "mockingboard_setup.s"
|
||||
|
||||
; Moving
|
||||
; moving, orange and green
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -6,54 +6,11 @@
|
||||
;================================
|
||||
moving:
|
||||
|
||||
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:
|
||||
draw_moving:
|
||||
inc FRAME
|
||||
|
||||
lda #191 ; YY
|
||||
@ -137,8 +94,11 @@ done_page:
|
||||
eor #$60 ; flip draw page between $2000/$4000
|
||||
sta HGR_PAGE
|
||||
|
||||
bne draw_oval ; bra
|
||||
lda FRAME
|
||||
cmp #$1f
|
||||
bne draw_moving ; bra
|
||||
|
||||
rts
|
||||
|
||||
colorlookup:
|
||||
.byte $22,$aa,$ba,$ff,$ba,$aa,$22 ; use 00 from sinetable
|
||||
@ -158,7 +118,7 @@ sinetable_base:
|
||||
|
||||
; for bot
|
||||
; 3F5 - 7d = 378
|
||||
; jmp oval
|
||||
; jmp moving
|
||||
|
||||
sinetable=$8000
|
||||
|
||||
|
182
demos/d2/oval.s
Normal file
182
demos/d2/oval.s
Normal file
@ -0,0 +1,182 @@
|
||||
; 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
|
||||
|
||||
;====================
|
||||
; 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
|
||||
|
||||
;sin_right:
|
||||
; sec carry should be set?
|
||||
; 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
|
||||
|
||||
oval_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_div2:
|
||||
lsr ; 2
|
||||
tax
|
||||
clc
|
||||
lda sinetable,X
|
||||
adc FRAME
|
||||
sta oval_row_sum_smc+1
|
||||
|
||||
ldx HGR_Y ; YY
|
||||
|
||||
ldy #39 ; XX
|
||||
oval_xloop:
|
||||
|
||||
;=====================
|
||||
; critical inner loop
|
||||
; every cycle here is 40x192 cycles
|
||||
;=====================
|
||||
|
||||
lda sinetable,Y ; 4+
|
||||
clc ; 2
|
||||
oval_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 colorlookup2,X ; lookup in table ; 5
|
||||
|
||||
oval_ror_nop_smc:
|
||||
ror ; $6A/$EA ; 2
|
||||
; and #$7f ; make all purple
|
||||
sta (GBASL),Y ; 6
|
||||
|
||||
lda oval_ror_nop_smc ; toggle ror/nop ; 4
|
||||
eor #$80 ; 2
|
||||
sta oval_ror_nop_smc ; 4
|
||||
|
||||
dey ; 2
|
||||
bpl oval_xloop ; 2/3
|
||||
|
||||
dec HGR_Y
|
||||
lda HGR_Y
|
||||
cmp #$ff
|
||||
bne oval_yloop
|
||||
|
||||
; we skip drawing line 0 as it makes it easier
|
||||
|
||||
oval_flip_pages:
|
||||
|
||||
; Y should be $FF here
|
||||
|
||||
; iny
|
||||
lda HGR_PAGE
|
||||
cmp #$20
|
||||
bne oval_done_page
|
||||
dey
|
||||
oval_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
|
||||
|
||||
|
||||
colorlookup2:
|
||||
.byte $11,$55,$5d,$7f,$5d,$55,$11,$00
|
||||
|
||||
;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
|
||||
|
||||
|
94
demos/d2/wires.s
Normal file
94
demos/d2/wires.s
Normal file
@ -0,0 +1,94 @@
|
||||
; wires -- Apple II Hires
|
||||
|
||||
; go for 100 frames?
|
||||
|
||||
wires:
|
||||
|
||||
; jsr HGR2
|
||||
|
||||
reset_x:
|
||||
ldx #$0
|
||||
stx FRAME
|
||||
|
||||
outer_loop:
|
||||
|
||||
|
||||
; pulse loop horizontal
|
||||
|
||||
lda #$00
|
||||
tay
|
||||
|
||||
sta GBASL
|
||||
|
||||
lda #$40
|
||||
sta GBASH
|
||||
horiz_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 horiz_loop
|
||||
|
||||
|
||||
; A should already be $44 here
|
||||
; Y should be 0
|
||||
|
||||
vert_loop:
|
||||
txa
|
||||
clc
|
||||
adc #2
|
||||
asl
|
||||
asl
|
||||
adc #$40
|
||||
sbc GBASH
|
||||
cmp #8
|
||||
lda #$81
|
||||
bcs noeor
|
||||
ora #$02
|
||||
noeor:
|
||||
|
||||
sta (GBASL),Y
|
||||
|
||||
inc GBASL
|
||||
inc GBASL
|
||||
bne noflo
|
||||
inc GBASH
|
||||
noflo:
|
||||
lda #$60
|
||||
cmp GBASH
|
||||
bne vert_loop
|
||||
|
||||
inx ; wrap at 7
|
||||
cpx #7
|
||||
beq reset_x
|
||||
|
||||
inc FRAME
|
||||
bne outer_loop
|
||||
|
||||
rts
|
||||
|
||||
even_lookup:
|
||||
.byte $D7,$DD,$F5, $D5,$D5,$D5,$D5
|
||||
odd_lookup:
|
||||
.byte $AA,$AA,$AA, $AB,$AE,$BA,$EA
|
||||
|
||||
|
||||
; want this to be at 3f5
|
||||
; Length is 94 so start at
|
||||
; $3F5 - 91 = $39A
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -20,5 +20,6 @@ HGR_Y = $E2
|
||||
HGR_COLOR = $E4
|
||||
HGR_PAGE = $E6
|
||||
|
||||
COUNT = $FB
|
||||
FRAME = $FC
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user