2017-08-23 19:41:37 +00:00
|
|
|
SHIPY EQU $E4
|
|
|
|
|
|
|
|
; FIXME, sort out available ZP page space
|
|
|
|
TURNING EQU $40
|
|
|
|
|
|
|
|
|
|
|
|
SHIPX EQU 15
|
2017-08-17 03:18:59 +00:00
|
|
|
|
|
|
|
flying_start:
|
|
|
|
|
2017-08-23 19:41:37 +00:00
|
|
|
; Clear screen/pages
|
|
|
|
|
2017-08-17 03:18:59 +00:00
|
|
|
jsr set_gr_page0
|
|
|
|
|
2017-08-23 19:41:37 +00:00
|
|
|
; Init Variables
|
|
|
|
lda #20
|
|
|
|
sta SHIPY
|
|
|
|
lda #0
|
|
|
|
sta TURNING
|
|
|
|
|
2017-08-17 03:18:59 +00:00
|
|
|
flying_loop:
|
|
|
|
|
|
|
|
|
|
|
|
jsr wait_until_keypressed
|
|
|
|
|
|
|
|
lda LASTKEY
|
|
|
|
|
|
|
|
cmp #('Q')
|
|
|
|
bne skipskip
|
|
|
|
rts
|
|
|
|
skipskip:
|
|
|
|
|
|
|
|
cmp #('I')
|
|
|
|
bne check_down
|
2017-08-23 19:41:37 +00:00
|
|
|
lda SHIPY
|
|
|
|
cmp #16
|
|
|
|
bcc check_down ; bgt
|
|
|
|
dec SHIPY
|
|
|
|
dec SHIPY
|
2017-08-17 03:18:59 +00:00
|
|
|
|
|
|
|
check_down:
|
|
|
|
cmp #('M')
|
|
|
|
bne check_left
|
2017-08-23 19:41:37 +00:00
|
|
|
lda SHIPY
|
|
|
|
cmp #28
|
|
|
|
bcs check_left ; ble
|
|
|
|
inc SHIPY
|
|
|
|
inc SHIPY
|
2017-08-17 03:18:59 +00:00
|
|
|
|
|
|
|
check_left:
|
|
|
|
cmp #('J')
|
|
|
|
bne check_right
|
2017-08-23 19:41:37 +00:00
|
|
|
inc TURNING
|
2017-08-17 03:18:59 +00:00
|
|
|
|
|
|
|
check_right:
|
|
|
|
cmp #('K')
|
|
|
|
bne check_done
|
2017-08-23 19:41:37 +00:00
|
|
|
dec TURNING
|
2017-08-17 03:18:59 +00:00
|
|
|
|
|
|
|
check_done:
|
2017-08-23 19:41:37 +00:00
|
|
|
|
|
|
|
;====================
|
|
|
|
; Draw the background
|
|
|
|
;====================
|
|
|
|
|
|
|
|
jsr draw_background_mode7
|
|
|
|
|
|
|
|
;==============
|
|
|
|
; Draw the ship
|
|
|
|
;==============
|
|
|
|
|
|
|
|
clv
|
|
|
|
lda TURNING
|
|
|
|
bmi draw_ship_right
|
|
|
|
bne draw_ship_left
|
|
|
|
|
|
|
|
draw_ship_forward:
|
|
|
|
lda #>ship_forward
|
|
|
|
sta INH
|
|
|
|
lda #<ship_forward
|
|
|
|
sta INL
|
|
|
|
bvc draw_ship
|
|
|
|
|
|
|
|
draw_ship_right:
|
|
|
|
lda #>ship_right
|
|
|
|
sta INH
|
|
|
|
lda #<ship_right
|
|
|
|
sta INL
|
|
|
|
bvc draw_ship
|
|
|
|
|
|
|
|
draw_ship_left:
|
|
|
|
lda #>ship_left
|
|
|
|
sta INH
|
|
|
|
lda #<ship_left
|
|
|
|
sta INL
|
|
|
|
|
|
|
|
draw_ship:
|
|
|
|
lda #SHIPX
|
|
|
|
sta XPOS
|
|
|
|
lda SHIPY
|
|
|
|
sta YPOS
|
|
|
|
jsr put_sprite
|
|
|
|
|
|
|
|
;==================
|
|
|
|
; flip pages
|
|
|
|
;==================
|
|
|
|
|
|
|
|
jsr page_flip
|
|
|
|
|
|
|
|
;==================
|
|
|
|
; loop forever
|
|
|
|
;==================
|
|
|
|
|
2017-08-17 03:18:59 +00:00
|
|
|
jmp flying_loop
|
|
|
|
|
|
|
|
|
2017-08-23 19:41:37 +00:00
|
|
|
;===========================
|
|
|
|
; Draw the Mode7 Background
|
|
|
|
;===========================
|
|
|
|
|
|
|
|
draw_background_mode7:
|
|
|
|
|
|
|
|
; Draw Sky
|
|
|
|
|
|
|
|
lda #COLOR_BOTH_MEDIUMBLUE
|
|
|
|
sta COLOR
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
sky_loop:
|
|
|
|
ldy #40
|
|
|
|
sty V2
|
|
|
|
ldy #0
|
|
|
|
pha
|
|
|
|
|
|
|
|
jsr hlin_double
|
|
|
|
|
|
|
|
pla
|
|
|
|
clc
|
|
|
|
adc #2
|
|
|
|
cmp #6
|
|
|
|
bne sky_loop
|
|
|
|
|
|
|
|
; Draw Horizon
|
|
|
|
|
|
|
|
lda #COLOR_BOTH_GREY
|
|
|
|
sta COLOR
|
|
|
|
|
|
|
|
lda #6
|
|
|
|
ldy #40
|
|
|
|
sty V2
|
|
|
|
jsr hlin_double
|
|
|
|
|
|
|
|
; Temporarily Draw Ocean Everywhere
|
|
|
|
|
|
|
|
lda #COLOR_BOTH_DARKBLUE
|
|
|
|
sta COLOR
|
|
|
|
|
|
|
|
lda #6
|
|
|
|
sea_loop:
|
|
|
|
ldy #40
|
|
|
|
sty V2
|
|
|
|
ldy #0
|
|
|
|
pha
|
|
|
|
|
|
|
|
jsr hlin_double
|
|
|
|
|
|
|
|
pla
|
|
|
|
clc
|
|
|
|
adc #2
|
|
|
|
cmp #40
|
|
|
|
bne sea_loop
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
flying_map:
|
|
|
|
.byte 2,15,15,15, 15,15,15, 2
|
|
|
|
.byte 13,12,12, 8, 4, 4, 0,13
|
|
|
|
.byte 13,12,12,12, 8, 4, 4,13
|
|
|
|
.byte 13,12,12, 8, 4, 4, 4,13
|
|
|
|
.byte 13,12, 9, 9, 8, 4, 4,13
|
|
|
|
.byte 13,12, 9, 8, 4, 4, 4,13
|
|
|
|
.byte 13,12, 9, 9, 1, 4, 4,13
|
|
|
|
.byte 2,13,13,13, 13,13,13, 2
|
2017-08-17 03:18:59 +00:00
|
|
|
|