iigs-game-engine/demos/shell/Actions.s

221 lines
5.9 KiB
ArmAsm
Raw Normal View History

2021-07-12 05:16:18 +00:00
MoveLeft
clc
adc StartX ; Increment the virtual X-position
jsl SetBG0XPos
2021-07-16 22:05:29 +00:00
lda StartX
lsr
jsl SetBG1XPos
2021-07-16 22:05:29 +00:00
jsl Render
2021-07-12 05:16:18 +00:00
rts
MoveRight
pha
lda StartX
2021-07-12 05:16:18 +00:00
sec
sbc 1,s
bpl *+5
lda #0
jsl SetBG0XPos
lda StartX
lsr
jsl SetBG1XPos
jsl Render
2021-07-12 05:16:18 +00:00
pla
rts
MoveUp
2021-07-12 05:16:18 +00:00
clc
adc StartY ; Increment the virtual Y-position
pha
lda #240 ; virtual play field height
sec
sbc ScreenHeight
tax
cmp 1,s
bcc *+4
lda 1,s
jsl SetBG0YPos
pla
; lda StartY
; lsr
; jsl SetBG1YPos
jsl Render
2021-07-12 05:16:18 +00:00
rts
MoveDown
2021-07-12 05:16:18 +00:00
pha
lda StartY
2021-07-12 05:16:18 +00:00
sec
sbc 1,s
bpl *+5
lda #0
jsl SetBG0YPos
; lda StartY
; lsr
; jsl SetBG1YPos
jsl Render
2021-07-12 05:16:18 +00:00
pla
rts
; Very simple, scroll as fast as possible
oldOneSecondCounter ds 2
frameCount ds 2
2021-07-12 05:16:18 +00:00
Demo
ldal OneSecondCounter
sta oldOneSecondCounter
stz frameCount
; Every 3 ticks (20 fps) cycle some colors
; lda #DoColorCycle
; ldx #^DoColorCycle
; ldy #3
; jsl AddTimer
2021-07-12 05:16:18 +00:00
:loop
jsl DoTimers
; lda #1
; jsr MoveLeft
jsr UpdateBG1Rotation
2021-07-29 10:35:09 +00:00
; jsr DoColorCycle
jsl Render
inc frameCount
ldal KBD_STROBE_REG
bit #$0080
beq :nokey
and #$007F
cmp #'s'
bne :nokey
2021-07-12 05:16:18 +00:00
rts
:nokey
ldal OneSecondCounter
cmp oldOneSecondCounter
beq :loop
sta oldOneSecondCounter
lda ScreenWidth
cmp #150
bcs :loop
lda #FPSStr
ldx #0 ; top-left corner
ldy #$7777
jsr DrawString
lda frameCount
ldx #4*4
jsr DrawWord
stz frameCount
bra :loop
FPSStr str 'FPS'
2021-07-29 10:35:09 +00:00
; Move some colors around color (6 - 11) address 12 - 22
DoColorCycle
ldal $E19E0C
2021-07-29 10:35:09 +00:00
pha
ldal $E19E0E
2021-07-29 10:35:09 +00:00
pha
ldal $E19E10
2021-07-29 10:35:09 +00:00
pha
ldal $E19E12
2021-07-29 10:35:09 +00:00
pha
ldal $E19E14
2021-07-29 10:35:09 +00:00
pha
ldal $E19E16
stal $E19E0C
2021-07-29 10:35:09 +00:00
pla
stal $E19E16
2021-07-29 10:35:09 +00:00
pla
stal $E19E14
2021-07-29 10:35:09 +00:00
pla
stal $E19E12
2021-07-29 10:35:09 +00:00
pla
stal $E19E10
2021-07-29 10:35:09 +00:00
pla
stal $E19E0E
rts
; Triggered timer to sway the background
UpdateBG1Offset
lda BG1OffsetIndex
inc
inc
cmp #32 ; 16 entries x 2 for indexing
bcc *+5
sbc #32
sta BG1OffsetIndex
rts
2021-07-24 14:00:52 +00:00
AngleUp
lda angle
2021-07-24 14:00:52 +00:00
inc
cmp #64
bcc *+5
sbc #64
sta angle
jsr _ApplyAngle
jsl Render
2021-07-24 14:00:52 +00:00
rts
AngleDown
lda angle
2021-07-24 14:00:52 +00:00
dec
bpl *+6
2021-07-24 14:00:52 +00:00
clc
adc #64
sta angle
jsr _ApplyAngle
jsl Render
2021-07-24 14:00:52 +00:00
rts
angle dw 0
2021-07-24 14:00:52 +00:00
UpdateBG1Rotation
jsr _ApplyAngle
2021-07-24 14:00:52 +00:00
; Increment the angle
lda angle
2021-07-24 14:00:52 +00:00
inc
cmp #64
bcc *+5
lda #0
sta angle
2021-07-24 14:00:52 +00:00
rts
2021-07-30 13:01:16 +00:00
x_angles EXT
y_angles EXT
2021-07-24 14:00:52 +00:00
_ApplyAngle
lda angle ; debug with angle = 0
2021-07-24 14:00:52 +00:00
asl
tax
ldal x_angles,x ; load the address of addressed for this angle
2021-07-24 14:00:52 +00:00
tay
phx
jsl ApplyBG1XPosAngle
2021-07-24 14:00:52 +00:00
plx
ldal y_angles,x ; load the address of addresses for this angle
2021-07-24 14:00:52 +00:00
tay
jsl ApplyBG1YPosAngle
2021-07-24 14:00:52 +00:00
rts