dos33fsprogs/ootw/ootw.s

228 lines
2.8 KiB
ArmAsm
Raw Normal View History

2019-01-13 06:10:44 +00:00
; Ootw
.include "zp.inc"
.include "hardware.inc"
title_screen:
;===========================
; Enable graphics
bit LORES
bit SET_GR
bit FULLGR
;===========================
; Clear both bottoms
lda #$4
sta DRAW_PAGE
jsr clear_bottom
lda #$0
sta DRAW_PAGE
jsr clear_bottom
lda #0
sta DRAW_PAGE
lda #1
sta DISP_PAGE
;=============================
2019-01-14 04:37:49 +00:00
; Load background to $c00
2019-01-13 06:10:44 +00:00
lda #$0c
sta BASH
lda #$00
2019-01-14 04:37:49 +00:00
sta BASL ; load image off-screen $c00
2019-01-13 06:10:44 +00:00
lda #>(planet_rle)
sta GBASH
lda #<(planet_rle)
sta GBASL
jsr load_rle_gr
;=================================
2019-01-14 04:37:49 +00:00
; copy to both pages $400/$800
2019-01-13 06:10:44 +00:00
jsr gr_copy_to_current
jsr page_flip
jsr gr_copy_to_current
;=================================
2019-01-14 04:37:49 +00:00
; setup vars
lda #22
2019-01-14 17:44:26 +00:00
sta PHYSICIST_Y
2019-01-14 04:37:49 +00:00
lda #20
2019-01-14 17:44:26 +00:00
sta PHYSICIST_X
2019-01-14 04:37:49 +00:00
2019-01-14 05:34:45 +00:00
lda #1
sta DIRECTION
2019-01-14 17:44:26 +00:00
lda #0
sta GAIT
2019-01-14 04:37:49 +00:00
game_loop:
; check keyboard
jsr handle_keypress
; copy background to current page
2019-01-14 04:58:48 +00:00
jsr gr_copy_to_current
2019-01-14 17:44:26 +00:00
; draw physicist
2019-01-14 04:37:49 +00:00
2019-01-14 17:44:26 +00:00
jsr draw_physicist
2019-01-14 04:37:49 +00:00
2019-01-13 06:10:44 +00:00
2019-01-14 04:37:49 +00:00
; draw bad guys
2019-01-13 06:10:44 +00:00
2019-01-14 04:37:49 +00:00
; draw foreground
2019-01-14 05:18:37 +00:00
lda #>foreground_plant
sta INH
lda #<foreground_plant
sta INL
lda #4
sta XPOS
lda #30
sta YPOS
jsr put_sprite
2019-01-14 04:37:49 +00:00
; page flip
2019-01-13 06:10:44 +00:00
jsr page_flip
2019-01-14 04:37:49 +00:00
; pause?
; loop forever
jmp game_loop
;======================================
; handle keypress
;======================================
handle_keypress:
lda KEYPRESS ; 4
bpl no_keypress ; 3
; -1
2019-01-13 06:10:44 +00:00
2019-01-14 04:58:48 +00:00
and #$7f ; clear high bit
check_left:
cmp #'A'
beq left
cmp #$8 ; left arrow
bne check_right
left:
2019-01-14 05:34:45 +00:00
lda DIRECTION
bne face_left
2019-01-14 17:44:26 +00:00
dec PHYSICIST_X
inc GAIT
inc GAIT
2019-01-14 04:58:48 +00:00
jmp done_keypress
2019-01-14 05:34:45 +00:00
face_left:
lda #0
sta DIRECTION
2019-01-14 17:44:26 +00:00
sta GAIT
2019-01-14 05:34:45 +00:00
jmp done_keypress
2019-01-14 04:58:48 +00:00
check_right:
cmp #'D'
beq right
cmp #$15
bne unknown
right:
2019-01-14 05:34:45 +00:00
lda DIRECTION
beq face_right
2019-01-14 17:44:26 +00:00
inc PHYSICIST_X
inc GAIT
inc GAIT
2019-01-14 04:58:48 +00:00
jmp done_keypress
2019-01-14 05:34:45 +00:00
face_right:
2019-01-14 17:44:26 +00:00
lda #0
sta GAIT
2019-01-14 05:34:45 +00:00
lda #1
sta DIRECTION
jmp done_keypress
2019-01-14 04:58:48 +00:00
unknown:
done_keypress:
2019-01-14 04:37:49 +00:00
bit KEYRESET ; clear the keyboard strobe ; 4
no_keypress:
rts ; 6
2019-01-14 17:44:26 +00:00
;======================================
; draw physicist
;======================================
draw_physicist:
lda GAIT
and #$f
sta GAIT
tax
lda DIRECTION
beq facing_left
facing_right:
lda adv_walk_right_progression,X
sta INL
lda adv_walk_right_progression+1,X
sta INH
jmp draw_him
facing_left:
lda adv_walk_left_progression,X
sta INL
lda adv_walk_left_progression+1,X
sta INH
draw_him:
lda PHYSICIST_X
sta XPOS
lda PHYSICIST_Y
sta YPOS
jsr put_sprite ; make this a "jmp"?
rts
2019-01-13 06:10:44 +00:00
.include "gr_pageflip.s"
.include "gr_unrle.s"
.include "gr_fast_clear.s"
.include "gr_copy.s"
2019-01-14 04:37:49 +00:00
.include "gr_putsprite.s"
.include "gr_offsets.s"
2019-01-13 06:10:44 +00:00
.include "ootw_backgrounds.inc"
2019-01-14 04:37:49 +00:00
.include "ootw_sprites.inc"