dos33fsprogs/demos/d2/d2.s

253 lines
3.6 KiB
ArmAsm
Raw Normal View History

2021-11-09 06:51:33 +00:00
; HGR Demo2
2021-11-05 04:23:34 +00:00
; Apple II graphics/music in 1k
; 1k demo for Demosplash 2021
2021-11-05 04:23:34 +00:00
; by deater (Vince Weaver) <vince@deater.net>
2021-11-12 00:58:20 +00:00
2021-11-05 04:23:34 +00:00
; Zero Page
.include "zp.inc"
.include "hardware.inc"
2021-11-06 04:09:39 +00:00
d2:
2021-11-05 04:23:34 +00:00
;===================
2021-11-06 04:09:39 +00:00
; music Player Setup
2021-11-05 04:23:34 +00:00
lda #<peasant_song
sta SONG_L
lda #>peasant_song
sta SONG_H
; assume mockingboard in slot#4
2021-11-12 00:58:20 +00:00
; TODO: inline?
2021-11-05 04:23:34 +00:00
jsr mockingboard_init
2021-11-12 00:58:20 +00:00
2021-11-05 04:23:34 +00:00
2021-11-06 04:09:39 +00:00
;================================
; Clear screen and setup graphics
;================================
jsr HGR2 ; set hi-res 140x192, page2, fullscreen
; A and Y both 0 at end
2021-11-12 00:58:20 +00:00
sty FRAME ; start at 0
2021-11-06 04:09:39 +00:00
;==================
; 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
2021-11-12 00:58:20 +00:00
adc #0
2021-11-06 04:09:39 +00:00
sin_done:
sta sinetable,Y
iny
bne sinetable_loop
; NOTE: making gbash/gbasl table wasn't worth it
2021-11-12 00:58:20 +00:00
;=====================
; setup credits
2021-11-07 19:06:57 +00:00
2021-11-12 02:08:35 +00:00
;===================
; print message
;===================
print_message:
2021-11-09 06:51:33 +00:00
2021-11-12 02:08:35 +00:00
.include "clear_bottom.s"
ldx #12
print_message_loop:
lda message1,X
sta $6d2,X
sta $Ad2,X
lda message2,X
sta $6ea,X
sta $Aea,X
dex
bpl print_message_loop
2021-11-12 00:58:20 +00:00
;==========================
; beginning of demo
;==========================
2021-11-12 02:08:35 +00:00
.include "dsr_shape.s"
2021-11-12 00:58:20 +00:00
; start music, no music for spin
start_interrupts:
cli
forever:
;=====================
; orange/green effect
2021-11-06 04:09:39 +00:00
2021-11-12 01:55:03 +00:00
.include "moving.s"
2021-11-05 04:23:34 +00:00
;=========================
; clear screen first time
2021-11-12 00:58:20 +00:00
skip_clear_smc:
lda #0
bne skip_clear
2021-11-09 06:51:33 +00:00
jsr fast_hclr
skip_clear:
2021-11-07 19:06:57 +00:00
jsr flip_page
2021-11-12 00:58:20 +00:00
;=====================
; wires effect
2021-11-12 01:55:03 +00:00
.include "wires.s"
; jsr wires
2021-11-06 04:09:39 +00:00
2021-11-12 00:58:20 +00:00
;=====================
; oval effect
2021-11-12 01:55:03 +00:00
; jsr oval
.include "oval.s"
2021-11-07 19:06:57 +00:00
2021-11-12 00:58:20 +00:00
;=====================
; repeat
2021-11-12 02:08:35 +00:00
; switch things up for the second round
2021-11-12 01:55:03 +00:00
lda #$7f
sta color_smc+1
sta skip_clear_smc+1
2021-11-12 01:55:03 +00:00
lda #159
sta moving_size_smc+1
sta oval_size_smc+1
2021-11-12 02:08:35 +00:00
lda #<colorlookup2
sta colorlookup_smc+1
; make split screen so credits are visible
2021-11-12 01:55:03 +00:00
2021-11-12 01:29:38 +00:00
bit TEXTGR
2021-11-06 04:09:39 +00:00
jmp forever
2021-11-05 04:23:34 +00:00
2021-11-07 19:06:57 +00:00
2021-11-12 00:58:20 +00:00
;===========================
; common flip page routine
2021-11-07 19:06:57 +00:00
flip_page:
lda KEYPRESS
bmi its_over
2021-11-07 19:06:57 +00:00
ldy #$0
lda HGR_PAGE ; will be $20/$40
cmp #$20
beq done_flip_page
iny
done_flip_page:
ldx PAGE1,Y ; set display page to PAGE1 or PAGE2
eor #$60 ; flip draw page between $2000/$4000
sta HGR_PAGE
rts
;================
; halt music
; stop playing
; turn off sound
its_over:
sei
lda #$3f
ldx #7
jsr ay3_write_reg
2021-11-12 00:58:20 +00:00
stuck_forever:
bne stuck_forever
2021-11-09 06:51:33 +00:00
; 01234567890123456789012345678901234567890"
2021-11-12 00:58:20 +00:00
;message1:
;.byte "THE APPLE II HAS NO PALETTE ROTATION"
;message2:
;.byte "WE ARE DOING THIS THE HARD WAY... "
.macro hiasc str
.repeat .strlen(str),I
.byte .strat(str,I) | $80
.endrep
.endmacro
2021-11-09 06:51:33 +00:00
message1:
2021-11-12 00:58:20 +00:00
hiasc "CODE: DEATER"
2021-11-09 06:51:33 +00:00
message2:
2021-11-12 00:58:20 +00:00
hiasc "MUSIC: MA2E "
2021-11-07 19:06:57 +00:00
2021-11-05 04:23:34 +00:00
2021-11-12 02:08:35 +00:00
shape_dsr:
.byte $2d,$36,$ff,$3f
.byte $24,$ad,$22,$24,$94,$21,$2c,$4d
.byte $91,$3f,$36,$00
2021-11-12 01:55:03 +00:00
even_lookup:
.byte $D7,$DD,$F5, $D5,$D5,$D5,$D5
odd_lookup:
.byte $AA,$AA,$AA, $AB,$AE,$BA,$EA
2021-11-12 02:08:35 +00:00
colorlookup2:
.byte $11,$55,$5d,$7f,$5d,$55,$11,$00
2021-11-12 01:55:03 +00:00
colorlookup:
.byte $22,$aa,$ba,$ff,$ba,$aa,$22 ; use 00 from sinetable
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
sinetable=$8000
.include "fast_hclr.s"
2021-11-05 04:23:34 +00:00
; music
2021-11-12 00:58:20 +00:00
.include "mA2E_2.s"
2021-11-05 04:23:34 +00:00
.include "interrupt_handler.s"
; must be last
.include "mockingboard_setup.s"