; adventure.asm ---------------------------------------------------------
;
; A simple adventure-like game for the 6502asm.com site
;
; RRRRR EEEEEE AA DDDDD MM MMM EEEEEE
; RR RR EE AA AA DD DD MMM MMMM EE
; RRRRR EEEEEE AAAAAA DD DD MM MM MM MM EEEEEE
; RR RR EE AA AA DD DD MM MM MM EE
; RR RR EEEEEE AA AA DDDDD MM MM MM EEEEEE
;
; Thank you for trying my game! You are Good Guy, and you are on a
; quest to defeat Bad Guy, the only other guy in this area of The
; World.
;
; You start in the forest. Somewhere within the forest are a pair of
; flippers, which will allow you to swim in the river. Somewhere along
; the banks of the river there is a key to the White Castle. Within the
; White Castle are a protective crown and a deadly weapon (it looks like
; a red star thingy). These two items are needed to defeat Evil Guy.
;
; Evil Guy lives in the Black Castle, which you can get to through the
; desert. Conveniantly enough, the key to the Black Castle is somewhere
; in the desert.
;
; Find Evil Guy in the Black Castle while wearing the crown and weapon
; and you win! If you lack either the crown or weapon, the screen will
; flash only red, and you will loose!
;
; Copyright (c) 2010 Norman B. Lancaster
;
; Released under the GNU General Public License version 3 or later.
; See http://gnu.org/licenses/gpl.html
;
;
*=128
player_map_x:
*=129
player_map_y:
*=130
player_screen_x:
*=131
player_screen_y:
*=132
player_sprite:
*=133
screen_item_x:
*=134
screen_item_y:
*=135
screen_item_idx:
*=136
item_flags:
*=138
*=254
random:
*=255
keypress:
*=512
frame_buffer:
*=1536
jmp start
screen_item_x: dcb $00
screen_item_y: dcb $00
screen_item_idx: dcb $00
; Screen RAM, 64 Bytes
screen_ram:
dcb $0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f
dcb $0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f
dcb $0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f
dcb $0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f
dcb $0f,$03,$0f,$05,$0f,$0f,$0f,$0f
dcb $0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f
dcb $0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f
dcb $0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f
; Item RAM, 64 Bytes
; Map X, Screen X, Map Y, Screen Y, Item Number, Fill x3
item_ram:
dcb $00,$05,$00,$05,$00,$00,$00,$00 ; Flippers
dcb $01,$05,$00,$05,$01,$00,$00,$00 ; White Key
dcb $0d,$05,$0d,$05,$02,$00,$00,$00 ; Black Key
dcb $0d,$05,$0e,$05,$03,$00,$00,$00 ; Crown
dcb $0d,$04,$0c,$05,$04,$00,$00,$00 ; Death Star
dcb $08,$03,$0d,$03,$05,$00,$00,$00 ; Evil Guy (DO NOT MAKE TAKEABLE!)
dcb $ff,$ff,$ff,$ff,$06,$00,$00,$00 ; Not Used
dcb $ff,$ff,$ff,$ff,$07,$00,$00,$00 ; Not Used
start:
; Init item patch table pointers
ldx #0
lda #screen_data
sta item_patch_table_hi,x
inx
lda #sprite_data
sta item_patch_table_hi,x
inx
lda #tile_flags
sta item_patch_table_hi,x
inx
lda #item_flags
sta item_patch_table_hi,x
; Init player position, etc
lda #$00
sta player_map_x
lda #$00
sta player_map_y
lda #0
sta player_sprite
lda #4
sta player_screen_x
sta player_screen_y
sta keypress
jsr spawn_items
; Initial map rendering
jsr update_map_screen
jsr blit_player
; Main game loop
main_loop:
; Debug, load location info into registers
lda player_map_x
asl
asl
asl
asl
ora player_screen_x
tax
lda player_map_y
asl
asl
asl
asl
ora player_screen_y
tay
; Wait for input
input_loop:
lda keypress
beq input_loop
ldx #0
stx keypress
; Act on input (key code in A)
cmp #97 ; Move left
bne test_input_1
jmp input_do_move_left
test_input_1:
cmp #104 ; Move left
bne test_input_2
jmp input_do_move_left
test_input_2:
cmp #100 ; Move right
bne test_input_3
jmp input_do_move_right
test_input_3:
cmp #108 ; Move right
bne test_input_4
jmp input_do_move_right
test_input_4:
cmp #119 ; Move up
bne test_input_5
jmp input_do_move_up
test_input_5:
cmp #107 ; Move up
bne test_input_6
jmp input_do_move_up
test_input_6:
cmp #115 ; Move down
bne test_input_7
jmp input_do_move_down
test_input_7:
cmp #106 ; Move down
bne test_input_8
jmp input_do_move_down
test_input_8:
jmp input_loop
; Input handlers
input_do_move_left:
lda #2
ldx player_screen_x
ldy player_screen_y
dex
jsr move_player
jmp main_loop
input_do_move_right:
lda #1
ldx player_screen_x
ldy player_screen_y
inx
jsr move_player
jmp main_loop
input_do_move_up:
lda #3
ldx player_screen_x
ldy player_screen_y
dey
jsr move_player
jmp main_loop
input_do_move_down:
lda #0
ldx player_screen_x
ldy player_screen_y
iny
jsr move_player
jmp main_loop
end:
jmp end
;
;
; palette_rotate_effect
;
; Rotate all colors in the framebuffer
;
; Uses
; $2 - $3 Framebuffer pointer
; $4 Itterations counter
; $5 Step
; $6 Itterations
;
; Inputs
; A Palette rotation step
; X Number of itterations
palette_rotate_effect_max_fb_page: dcb $00
palette_rotate_effect:
sta $5
stx $6
; Loop through itterations
lda #0
sta $4
palette_rotate_effect_itter_loop:
lda #frame_buffer
sta $3
; Loop through pixels
ldx #0
palette_rotate_effect_pixel_page_loop:
ldy #0
palette_rotate_effect_pixel_loop:
lda ($2),y
clc
adc $5
sta ($2),y
iny
bne palette_rotate_effect_pixel_loop
; Page step
inc $3
inx
cpx #4
bne palette_rotate_effect_pixel_page_loop
; Itteration step
inc $4
lda $4
cmp $6
bne palette_rotate_effect_itter_loop
rts
;
;
; spawn_items
;
; Spawns items everywhere
;
;
spawn_items:
lda #0
jsr spawn_item
lda #1
jsr spawn_item
lda #2
jsr spawn_item
lda #3
jsr spawn_item
lda #4
jsr spawn_item
rts
;
;
; spawn_item
;
; Spawns a single item
;
; Uses
; $2 - $3 The item\'s address in the item RAM area
;
; Inputs
; A The item number to spawn
spawn_item_number_backup: dcb $00
spawn_item_x_backup: dcb $00
spawn_item_y_backup: dcb $00
spawn_item:
sta spawn_item_number_backup
jsr get_random_spawn_location
stx spawn_item_x_backup
sty spawn_item_y_backup
; Calculate the item\'s RAM address
lda spawn_item_number_backup
asl
asl
asl
clc
adc #item_ram
sta $3
; X location
ldy #0
lda spawn_item_x_backup
lsr
lsr
lsr
lsr
sta ($2),y
iny
lda spawn_item_x_backup
and #$0f
sta ($2),y
; Y location
iny
lda spawn_item_y_backup
lsr
lsr
lsr
lsr
sta ($2),y
iny
lda spawn_item_y_backup
and #$0f
sta ($2),y
rts
;
;
; get_random_spawn_location
;
; Gets a random spawn location for a given item
;
; Uses
; $2 - $3 The base address in the spawn location table
;
; Inputs
; A The item number to spawn
;
; Outputs
; X The X location byte
; Y The Y location bytes
get_random_spawn_location:
; Calculate the base address in the spawn location table
asl
asl
asl
asl
asl
clc
adc #spawn_points
sta $3
; Get a random number between 0 and 15
lda random
and #$0f
; Convert to the offset
asl
; X location byte
tay
lda ($2),y
tax
; Y location bytes
iny
lda ($2),y
tay
rts
;
;
; End of Game
;
;
end_of_game_count: dcb $00
end_of_game:
; Does the player have the crown and death star?
ldx #0
lda item_flags,x
beq end_of_game_loose
inx
lda item_flags,x
beq end_of_game_loose
; Win routine
lda #1
ldx #32
jsr palette_rotate_effect
jmp end
; Loose routine
end_of_game_loose:
lda #0
sta end_of_game_count
end_of_game_loose_loop:
lda #7
ldx #1
jsr palette_rotate_effect
lda #9
ldx #1
jsr palette_rotate_effect
inc end_of_game_count
lda end_of_game_count
cmp #8
bne end_of_game_loose_loop
lda #7
ldx #1
jsr palette_rotate_effect
jmp end
;
;
; move_player
;
; Handles moving the player to a new location
;
; Inputs
; A The new direction code of the player
; 0 = Down, 1 = Right, 2 = Left, 3 = Up
; X The new screen X location of the player
; Y The new screen Y location of the player
move_player_direction: dcb $00
move_player_x: dcb $00
move_player_y: dcb $00
move_player:
sta move_player_direction
stx move_player_x
sty move_player_y
; Check for Out of Bounds move
lda move_player_x
bpl move_player_bounds_1 ; Went off left side of screen
dec player_map_x
lda #7
sta move_player_x
jsr update_map_screen
move_player_bounds_1:
cmp #8
bmi move_player_bounds_2 ; Went off right side of screen
inc player_map_x
lda #0
sta move_player_x
jsr update_map_screen
move_player_bounds_2:
lda move_player_y
bpl move_player_bounds_3 ; Went off top side of screen
dec player_map_y
lda #7
sta move_player_y
jsr update_map_screen
move_player_bounds_3:
cmp #8
bmi move_player_bounds_4 ; Went off bottom side of screen
inc player_map_y
lda #0
sta move_player_y
jsr update_map_screen
move_player_bounds_4:
; Clear previous location
ldx player_screen_x
ldy player_screen_y
jsr clear_screen_position
; Test location for moveability
; Calculate screen RAM offset to get tile color
lda move_player_y
asl
asl
asl
ora move_player_x
tay
ldx screen_ram,y ; Now X is the tile color
lda tile_flags,x ; Load the tile flags into A
lsr
bcs move_player_do_move ; If the walkable flag is set, continue
jmp move_player_skip_move
move_player_do_move:
ldx move_player_x
ldy move_player_y
stx player_screen_x
sty player_screen_y
move_player_skip_move:
; Update the position and sprite
ldx player_screen_x
ldy player_screen_y
lda player_sprite
and #$fc
ora move_player_direction
sta player_sprite
jsr blit_sprite
; Check for Items and Act on Them
lda player_screen_x
cmp screen_item_x
bne move_player_skip_item
lda player_screen_y
cmp screen_item_y
bne move_player_skip_item
jsr take_screen_item
move_player_skip_item:
; At end of game check
lda player_map_x
cmp #$08
bne move_player_skip_eog
lda player_map_y
cmp #$0d
bne move_player_skip_eog
lda player_screen_x
cmp #$03
bne move_player_skip_eog
lda player_screen_y
cmp #$04
bne move_player_skip_eog
jsr end_of_game
move_player_skip_eog:
rts
;
;
; take_screen_item
;
; Called when the player has stepped onto the item on this screen.
;
; Uses
; $2 - $3 Base pointer into the item patch table
; $4 - $5 Patch pointer
; $6 Temp
take_screen_item_idx: dcb $00
take_screen_item_patch: dcb $00
take_screen_item:
; Remove the item from the screen
lda screen_item_idx
sta take_screen_item_idx
lda #$ff
sta screen_item_x
sta screen_item_y
sta screen_item_idx
; Remove the item from the map
lda take_screen_item_idx
asl
asl
asl
tax
lda #$ff
sta item_ram,x
inx
sta item_ram,x
inx
sta item_ram,x
inx
sta item_ram,x
inx
sta item_ram,x
; Calculate the base offset into the item patch table
lda take_screen_item_idx
asl
asl
asl
asl
asl
clc
adc #item_patch_data
sta $3
; Itterate through all patches
lda #0
ldy #0
sta take_screen_item_patch
take_screen_item_patch_loop:
; Validate the patch is valid
lda ($2),y
bpl take_screen_item_valid_patch
; Skip over this patch
iny
iny
iny
iny
jmp take_screen_item_next_patch
take_screen_item_valid_patch:
; Calculate the patch pointer
lda ($2),y
tax
lda item_patch_table_lo,x
sta $4
lda item_patch_table_hi,x
sta $5
iny
clc
lda ($2),y
adc $4
sta $4
iny
lda ($2),y
adc $5
sta $5
iny
; Do the patch
lda ($2),y
iny
sty $6
ldy #0
sta ($4),y
ldy $6
; Go to the next patch
take_screen_item_next_patch:
inc take_screen_item_patch
lda take_screen_item_patch
cmp #8
bne take_screen_item_patch_loop
lda #1
ldx #16
jsr palette_rotate_effect
jsr render_screen
lda player_sprite
ldx player_screen_x
ldy player_screen_y
jsr blit_sprite
rts
;
;
; clear_screen_position
;
; Redraws a single location on the current screen
;
; Uses
; $2 - $3 Frame buffer base address
; $4 X location
; $5 Y location
; $6 Tile color
;
; Inputs
; X X location
; Y Y location
clear_screen_position:
stx $4
sty $5
; Calculate the screen RAM offset and get the tile color
tya
asl
asl
asl
ora $4
tay
lda screen_ram,y
sta $6
; Calculate the framebuffer base offset
asl $4
asl $4
asl $5
asl $5
lda $5
asl
asl
asl
asl
asl
ora $4
sta $2
lda $5
lsr
lsr
lsr
clc
adc #>frame_buffer
sta $3
; Itterate rows
ldx #0
ldy #0
clear_screen_position_row_loop:
lda $6
sta ($2),y
iny
sta ($2),y
iny
sta ($2),y
iny
sta ($2),y
tya
clc
adc #29
tay
inx
cpx #4
bne clear_screen_position_row_loop
rts
;
;
; blit_player
;
; Blits the player\'s sprite to the screen
;
;
blit_player:
lda player_sprite
ldx player_screen_x
ldy player_screen_y
jsr blit_sprite
rts
;
;
; update_map_screen
;
; Loads and renders the player\'s current map screen
;
;
update_map_screen:
; Render the screen
ldx player_map_x
ldy player_map_y
jsr load_map_screen
jsr render_screen
rts
;
;
; blit_sprite
;
; Blits a sprite to the frame buffer
;
; Uses
;
; Inputs
; A Sprite number
; X X screen coordinate
; Y Y screen coordinate
blit_sprite:
; Set up framebuffer offset
sta $6
tya
asl
asl
tay ; Now we have the pixel row, so make the row base offset
asl
asl
asl
asl
asl
sta $2
tya
lsr
lsr
lsr
clc
adc #>frame_buffer
sta $3 ; Now we have the base row offset, add the collumn offset
txa
asl
asl
ora $2
sta $2
; Set up sprite data pointer
lda #sprite_data
sta $5
lda $6
asl
asl
asl
clc
adc $4
sta $4
lda $5
adc #0
sta $5
; Itterate bytes
ldy #0
ldx #0
blit_sprite_byte_loop:
; Blat out the pixels
lda ($4),y
lsr
lsr
lsr
lsr
beq blit_sprite_skip_pixel_1
sta ($2,x)
blit_sprite_skip_pixel_1:
inc $2
lda ($4),y
and #$0f
beq blit_sprite_skip_pixel_2
sta ($2,x)
blit_sprite_skip_pixel_2:
inc $2
; Step to next byte
iny
; If we are on an even byte, step the framebuffer pointer
tya
and #$01
bne blit_sprite_fbinc_skip
clc
lda $2
adc #28
sta $2
lda $3
adc #0
sta $3
blit_sprite_fbinc_skip:
cpy #8
bne blit_sprite_byte_loop
rts
;
;
; load_map_screen
;
; Loads a map screen from the world map into the screen RAM
;
; Uses
; $2 - $3 Item RAM pointer
; $4 Temp variable
; $5 Item Map X
; $6 Item Screen X
; $7 Item Map Y
; $8 Item Screen Y
; $9 Item Idx
;
; Calls load_screen
;
; Inputs
; X X world coordinate
; Y Y world coordinate
load_map_screen_x: dcb $00
load_map_screen_y: dcb $00
load_map_screen:
; Wrap coordinates
tya
and #$0f
tay
txa
and #$0f
tax
sty load_map_screen_y
stx load_map_screen_x
; Calculate the offset into the world map table
tya
asl
asl
asl
asl
stx $2
ora $2
tax
; Get the screen number and load
lda world_map,x
jsr load_screen
; Clear out the screen item variables
lda #$ff
sta screen_item_x
sta screen_item_y
sta screen_item_idx
; Itterate through all items to see if we have an item on this
; screen.
lda #item_ram
sta $3
ldx #0
load_screen_item_loop:
txa
asl
asl
asl
tay
lda ($2),y
sta $5
iny
lda ($2),y
sta $6
iny
lda ($2),y
sta $7
iny
lda ($2),y
sta $8
iny
lda ($2),y
sta $9
lda $5
cmp load_map_screen_x
bne load_screen_item_skip
lda $7
cmp load_map_screen_y
bne load_screen_item_skip
; Now we have an item that is on this map, put that item\'s
; info into the screen item variables.
lda $6
sta screen_item_x
lda $8
sta screen_item_y
lda $9
sta screen_item_idx
; And go to the next item
load_screen_item_skip:
inx
cpx #8
bne load_screen_item_loop
rts
;
;
; load_screen
;
; Decompresses a screen into the screen RAM
;
; Uses
; $2 - $3 Map data pointer
;
; Inputs
; A Screen number to load
load_screen:
; Calculate base screen data offset
tay
asl
asl
asl
asl
asl
sta $2
tya
lsr
lsr
lsr
sta $3
clc
lda $2
adc #screen_data
sta $3
; Itterate through all bytes
ldy #0
ldx #0
load_screen_byte_loop:
lda ($2),y
lsr
lsr
lsr
lsr
sta screen_ram,x
inx
lda ($2),y
and #$0f
sta screen_ram,x
inx
iny
cpy #32
bne load_screen_byte_loop
rts
;
;
; render_screen
;
; Renders the entire screen from RAM to the display as well as any
; item that may be present.
;
; Uses $2 - $3
;
;
render_screen:
; Set up the base screen offset
lda #frame_buffer
sta $3
; Itterate through all tiles
ldx #0
render_screen_tile_loop:
; Blat out the pixels
ldy #0
lda screen_ram,x
sta ($2),y
iny
sta ($2),y
iny
sta ($2),y
iny
sta ($2),y
tya
clc
adc #29
tay
lda screen_ram,x
sta ($2),y
iny
sta ($2),y
iny
sta ($2),y
iny
sta ($2),y
tya
clc
adc #29
tay
lda screen_ram,x
sta ($2),y
iny
sta ($2),y
iny
sta ($2),y
iny
sta ($2),y
tya
clc
adc #29
tay
lda screen_ram,x
sta ($2),y
iny
sta ($2),y
iny
sta ($2),y
iny
sta ($2),y
; Go to the next tile
inx
; Update the screen base offset
clc
lda $2
adc #4
sta $2
lda $3
adc #0
sta $3
; If we have gone to a new row, jump ahead
txa
and #$07
bne render_screen_skip_row_adjust
clc
lda $2
adc #96
sta $2
lda $3
adc #0
sta $3
render_screen_skip_row_adjust:
cpx #64
bne render_screen_tile_loop
; Render the on-screen item if one is present
lda screen_item_idx
bmi render_screen_skip_item
; Add 4 to the item number to get the item sprite number
clc
adc #4
ldx screen_item_x
ldy screen_item_y
jsr blit_sprite
render_screen_skip_item:
rts
;
;
; DATA
;
;
world_map:
; 0 1 2 3 4 5 6 7 8 9 a b c d e f
dcb $04,$02,$00,$02,$00,$02,$00,$07,$17,$0f,$18,$19,$19,$19,$1a,$14 ; 0
dcb $04,$03,$08,$03,$05,$01,$ff,$0b,$16,$0e,$15,$14,$17,$0f,$13,$12 ; 1
dcb $ff,$01,$01,$06,$01,$06,$ff,$0c,$0f,$0f,$13,$12,$1b,$1c,$0e,$11 ; 2
dcb $ff,$06,$0a,$00,$09,$00,$ff,$0d,$0e,$0e,$10,$11,$16,$1d,$19,$1e ; 3
dcb $ff,$ff,$ff,$ff,$45,$43,$43,$43,$40,$3d,$36,$3a,$2c,$25,$25,$1f ; 4
dcb $ff,$ff,$ff,$ff,$45,$43,$40,$43,$37,$3e,$37,$3b,$2d,$2f,$30,$21 ; 5
dcb $ff,$ff,$ff,$ff,$46,$43,$37,$43,$41,$38,$38,$3c,$2e,$26,$27,$20 ; 6
dcb $ff,$ff,$ff,$ff,$47,$44,$44,$44,$42,$3f,$39,$39,$31,$28,$29,$21 ; 7
dcb $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$32,$22,$22,$20 ; 8
dcb $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$33,$2a,$2b,$20 ; 9
dcb $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$32,$28,$29,$21 ; a
dcb $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$33,$22,$22,$20 ; b
dcb $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$48,$4f,$4f,$4e,$32,$26,$27,$21 ; c
dcb $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$49,$4a,$50,$51,$34,$28,$29,$21 ; d
dcb $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$4b,$4c,$4e,$4b,$32,$22,$22,$20 ; e
dcb $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$4a,$4d,$4a,$4d,$35,$24,$24,$23 ; f
screen_data:
; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
dcb $55,$55,$55,$55,$55,$dd,$dd,$55,$dd,$99,$d9,$d9,$99,$99,$99,$99,$99,$99,$99,$99,$9d,$d9,$99,$dd,$55,$dd,$dd,$55,$55,$55,$55,$55 ; $00 Forest, E/W Path
dcb $55,$d9,$9d,$55,$55,$99,$9d,$55,$5d,$99,$9d,$d5,$5d,$99,$99,$d5,$5d,$9d,$99,$d5,$5d,$99,$99,$d5,$55,$d9,$99,$55,$55,$d9,$9d,$55 ; $01 Forest, N/S Path
dcb $55,$55,$55,$55,$55,$dd,$dd,$55,$d9,$99,$99,$9d,$99,$d9,$99,$99,$99,$99,$99,$99,$d9,$99,$d9,$99,$5d,$99,$99,$d5,$55,$d9,$9d,$55 ; $02 Forest, E/W/S Path
dcb $55,$d9,$9d,$55,$5d,$99,$99,$55,$99,$99,$99,$d5,$99,$9d,$99,$d5,$d9,$99,$99,$d5,$dd,$99,$99,$d5,$5d,$d9,$9d,$55,$55,$dd,$9d,$55 ; $03 Forest, N/S/W Path
dcb $55,$55,$55,$55,$55,$dd,$dd,$55,$5d,$d9,$99,$dd,$5d,$99,$99,$99,$5d,$99,$d9,$99,$5d,$d9,$99,$d9,$55,$dd,$dd,$55,$55,$55,$55,$55 ; $04 Forest, Dead End E
dcb $55,$55,$55,$55,$55,$d9,$dd,$55,$5d,$9d,$9d,$d5,$5d,$d9,$d9,$d5,$5d,$d9,$99,$d5,$5d,$9d,$d9,$d5,$55,$d9,$9d,$55,$55,$dd,$99,$55 ; $05 Forest, Dead End S
dcb $55,$99,$9d,$55,$55,$99,$9d,$55,$5d,$d9,$99,$d5,$5d,$99,$d9,$d5,$5d,$d9,$99,$d5,$5d,$9d,$9d,$d5,$55,$dd,$dd,$55,$55,$55,$55,$55 ; $06 Forest, Dead End N
dcb $55,$55,$55,$55,$55,$dd,$dd,$55,$dd,$9d,$9d,$d5,$d9,$99,$d9,$d5,$9d,$9d,$99,$d5,$d9,$d9,$9d,$d5,$5d,$dd,$dd,$d5,$55,$dd,$dd,$55 ; $07 Forest, Path W/S
dcb $55,$55,$55,$55,$55,$dd,$dd,$d5,$5d,$d9,$99,$dd,$5d,$9d,$99,$99,$5d,$99,$99,$d9,$5d,$99,$d9,$99,$55,$d9,$99,$d5,$55,$d9,$9d,$55 ; $08 Forest, Path E/S
dcb $55,$d9,$9d,$55,$5d,$d9,$99,$55,$dd,$99,$d9,$d5,$99,$9d,$99,$d5,$99,$99,$99,$d5,$dd,$99,$9d,$d5,$5d,$dd,$dd,$55,$55,$55,$55,$55 ; $09 Forest, Path N/W
dcb $55,$d9,$9d,$55,$5d,$99,$99,$d5,$5d,$9d,$9d,$9d,$5d,$99,$99,$99,$5d,$d9,$99,$99,$5d,$dd,$99,$dd,$5d,$dd,$dd,$55,$55,$55,$55,$55 ; $0a Forest, Path N/E
dcb $55,$d9,$dd,$55,$55,$9d,$d9,$d5,$5d,$dd,$dd,$d5,$55,$9d,$9d,$95,$55,$dd,$d9,$55,$55,$dd,$dd,$55,$5d,$d9,$dd,$55,$5d,$dd,$dd,$55 ; $0b Forest, River Transition 1
dcb $5d,$dd,$dd,$55,$5d,$dd,$d9,$d5,$5d,$dd,$d9,$dd,$5d,$9d,$d9,$99,$5d,$dd,$99,$ee,$55,$dd,$99,$ee,$55,$dd,$9e,$ee,$55,$5d,$9e,$e6 ; $0c Forest, River Transition 2
dcb $55,$5d,$9e,$e6,$55,$5d,$9e,$ee,$55,$5d,$9e,$ee,$55,$55,$d9,$ee,$55,$55,$d9,$99,$55,$55,$59,$9d,$55,$55,$55,$d5,$55,$55,$55,$55 ; $0d Forest, River Transition 3
dcb $66,$66,$66,$66,$e6,$6e,$e6,$6e,$ee,$ee,$ee,$ee,$ee,$ee,$ee,$ee,$99,$99,$99,$99,$dd,$9d,$dd,$9d,$55,$d5,$55,$d5,$55,$55,$55,$55 ; $0e River, E/W Channel Bottom
dcb $55,$55,$55,$55,$55,$55,$55,$d5,$d9,$dd,$dd,$dd,$99,$99,$99,$99,$ee,$ee,$ee,$ee,$ee,$ee,$ee,$ee,$e6,$ee,$66,$ee,$66,$66,$66,$66 ; $0f River, E/W Channel Top
dcb $66,$66,$66,$66,$e6,$6e,$e6,$6e,$ee,$ee,$ee,$ee,$ee,$ee,$ee,$ee,$9e,$ee,$99,$e9,$de,$ff,$ff,$9d,$5f,$ff,$ff,$f5,$11,$ff,$ff,$11 ; $10 River, White Transition
dcb $6e,$ee,$ed,$55,$ee,$ee,$ed,$d5,$ee,$ee,$e9,$d5,$ee,$ee,$99,$d5,$ee,$e9,$9d,$d5,$dd,$99,$dd,$55,$5d,$dd,$d5,$55,$55,$55,$55,$55 ; $11 River, N/W Channel
dcb $ee,$ee,$ed,$55,$ee,$ee,$9d,$55,$ee,$e9,$9d,$55,$ee,$ee,$99,$d5,$ee,$ee,$99,$d5,$ee,$e9,$9d,$55,$ee,$ee,$9d,$55,$6e,$ee,$ed,$55 ; $12 River, N/S Channel Right
dcb $55,$d9,$ee,$ee,$55,$99,$ee,$ee,$d9,$ee,$ee,$ee,$99,$ee,$ee,$ee,$ee,$ee,$ee,$ee,$ee,$ee,$ee,$ee,$e6,$6e,$e6,$ee,$66,$66,$66,$66 ; $13 River, N/W Channel Join E
dcb $55,$55,$55,$55,$5d,$dd,$d5,$55,$d9,$99,$9d,$d5,$e9,$99,$99,$d5,$ee,$ee,$99,$d5,$ee,$ee,$e9,$d5,$ee,$ee,$e9,$55,$ee,$ee,$ed,$55 ; $14 River, S/W Channel
dcb $6e,$ee,$9d,$55,$ee,$ee,$99,$d5,$ee,$ee,$e9,$9d,$ee,$ee,$ee,$99,$99,$ee,$ee,$ee,$d9,$9e,$ee,$ee,$5d,$99,$ee,$ee,$55,$d9,$ee,$ee ; $15 River, SE/NW Gap
dcb $55,$de,$ee,$e6,$55,$d9,$ee,$ee,$5d,$99,$ee,$ee,$5d,$99,$9e,$ee,$5d,$99,$99,$9e,$5d,$9d,$d9,$dd,$55,$d5,$5d,$d5,$55,$55,$55,$55 ; $16 River, N/E Channel
dcb $55,$55,$55,$55,$55,$5d,$dd,$d5,$55,$dd,$dd,$dd,$5d,$dd,$99,$9e,$5d,$d9,$9e,$ee,$5d,$d9,$ee,$ee,$5d,$d9,$ee,$ee,$55,$de,$ee,$e6 ; $17 River, E/S
dcb $55,$55,$55,$55,$5d,$dd,$dd,$dd,$dd,$dd,$99,$99,$99,$99,$ee,$ee,$ee,$ee,$ee,$ee,$ee,$ee,$ee,$99,$ee,$ee,$e9,$dd,$6e,$ee,$9d,$55 ; $18 River, Gulch Transition West
dcb $55,$55,$55,$55,$dd,$99,$dd,$dd,$99,$ee,$99,$99,$ee,$ee,$ee,$ee,$ee,$ee,$ee,$ee,$99,$99,$9e,$e9,$dd,$dd,$d9,$9d,$55,$55,$55,$55 ; $19 River, Gulch
dcb $55,$55,$55,$55,$dd,$dd,$dd,$55,$99,$99,$99,$dd,$ee,$ee,$99,$99,$ee,$ee,$e9,$9e,$99,$ee,$ee,$ee,$dd,$9e,$ee,$ee,$55,$d9,$ee,$ee ; $1a River, Gulch Transition East
dcb $55,$d9,$ee,$e6,$55,$d9,$9e,$ee,$5d,$d9,$99,$ee,$5d,$99,$ee,$ee,$55,$9e,$ee,$ee,$55,$9e,$ee,$e6,$5d,$d9,$ee,$66,$55,$d9,$ee,$e6 ; $1b River, Confluance SW
dcb $66,$66,$66,$66,$e6,$6e,$e6,$6e,$ee,$ee,$ee,$ee,$ee,$ee,$ee,$ee,$ee,$ee,$ee,$99,$6e,$ee,$e9,$9d,$6e,$ee,$99,$d5,$6e,$e9,$99,$d5 ; $1c River, Confluance SE
dcb $6e,$e9,$99,$d5,$ee,$97,$77,$dd,$ee,$97,$77,$d9,$ee,$e9,$99,$9e,$ee,$ee,$ee,$ee,$dd,$d9,$99,$99,$55,$5d,$dd,$dd,$55,$55,$55,$55 ; $1d River, Gluch Transition South by West
dcb $55,$55,$56,$66,$dd,$d9,$66,$66,$99,$9e,$ee,$66,$ee,$ee,$e7,$e6,$ee,$ee,$77,$e8,$9e,$e7,$7e,$e8,$d9,$77,$77,$88,$57,$77,$78,$88 ; $1e River, Desert Transition
dcb $88,$77,$77,$88,$87,$77,$78,$88,$77,$77,$78,$88,$77,$77,$77,$88,$77,$77,$78,$88,$77,$77,$88,$88,$77,$77,$78,$88,$77,$77,$77,$88 ; $1f Desert, Entrance
dcb $77,$77,$77,$88,$77,$77,$78,$88,$77,$87,$88,$88,$77,$78,$88,$88,$77,$77,$88,$88,$77,$77,$88,$88,$78,$77,$78,$88,$77,$77,$77,$88 ; $20 Desert, East Wall 1
dcb $77,$77,$77,$88,$77,$77,$78,$88,$77,$77,$88,$88,$77,$77,$78,$88,$78,$77,$77,$88,$77,$77,$78,$88,$77,$77,$78,$88,$77,$77,$77,$88 ; $21 Desert, East Wall 2
dcb $77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77 ; $22 Desert, Center
dcb $77,$77,$77,$88,$77,$87,$78,$88,$78,$77,$88,$88,$77,$77,$88,$88,$77,$78,$88,$88,$78,$88,$88,$88,$88,$88,$88,$88,$88,$88,$88,$88 ; $23 Desert, SE Wall
dcb $77,$77,$77,$77,$77,$77,$77,$77,$77,$78,$77,$87,$77,$77,$77,$77,$77,$77,$78,$77,$78,$87,$77,$77,$88,$88,$88,$88,$88,$88,$88,$88 ; $24 Desert, South Wall
dcb $88,$88,$88,$88,$88,$88,$88,$88,$78,$88,$87,$87,$77,$88,$77,$77,$77,$77,$77,$77,$77,$77,$78,$77,$77,$87,$77,$77,$77,$77,$77,$77 ; $25 Desert, North Wall
dcb $77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$78,$77,$77,$78,$88,$77,$77,$78,$88,$77,$77,$88,$88 ; $26 Desert, Rock Formation 1, NW
dcb $77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$87,$77,$77,$77,$88,$77,$77,$77,$88,$87,$77,$77,$88,$87,$77,$77 ; $27 Desert, Rock Formation 1, NE
dcb $77,$77,$88,$88,$77,$77,$78,$88,$77,$77,$77,$88,$77,$77,$77,$78,$77,$77,$77,$88,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77 ; $28 Desert, Rock Formation 1/2, SW
dcb $88,$87,$77,$77,$88,$77,$77,$77,$88,$87,$77,$77,$88,$87,$77,$77,$87,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77,$77 ; $29 Desert, Rock Formation 1/2, SE
dcb $77,$77,$77,$77,$78,$77,$77,$87,$78,$88,$78,$88,$77,$88,$88,$88,$77,$78,$87,$78,$77,$88,$77,$77,$77,$88,$87,$78,$77,$77,$88,$88 ; $2a Desert, Rock Formation 2, NW
dcb $77,$77,$77,$77,$77,$78,$88,$87,$87,$88,$87,$77,$88,$88,$77,$87,$88,$87,$78,$87,$77,$77,$88,$87,$88,$88,$88,$77,$88,$87,$77,$77 ; $2b Desert, Rock Formation 2, NE
dcb $18,$88,$88,$88,$18,$78,$88,$88,$17,$77,$88,$87,$11,$77,$78,$77,$ff,$17,$77,$77,$11,$77,$77,$87,$17,$78,$77,$77,$17,$77,$77,$77 ; $2c Desert, White Wall N/NE
dcb $17,$77,$77,$77,$17,$71,$11,$77,$17,$11,$f1,$17,$11,$1f,$ff,$11,$ff,$ff,$ff,$ff,$11,$1f,$ff,$11,$17,$1f,$ff,$17,$17,$1f,$ff,$17 ; $2d Desert, White Bastion 1, N
dcb $17,$1f,$ff,$17,$17,$1f,$ff,$17,$11,$1f,$ff,$17,$ff,$ff,$ff,$17,$11,$1f,$ff,$17,$17,$11,$f1,$17,$17,$71,$11,$77,$17,$77,$77,$77 ; $2e Desert, White Bastion 1, S
dcb $77,$77,$77,$77,$71,$11,$11,$11,$71,$ff,$ff,$ff,$11,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$11,$ff,$ff,$ff,$71,$11,$11,$11,$77,$77,$77,$77 ; $2f Desert, White Bastion 2, W
dcb $77,$77,$77,$77,$11,$11,$11,$17,$ff,$ff,$ff,$17,$ff,$ff,$ff,$17,$ff,$ff,$ff,$17,$ff,$ff,$ff,$17,$11,$11,$11,$17,$77,$77,$77,$77 ; $30 Desert, White Bastion 2, E
dcb $17,$77,$77,$77,$17,$77,$77,$77,$11,$77,$77,$77,$ff,$17,$77,$77,$11,$77,$77,$77,$17,$77,$77,$77,$17,$77,$77,$77,$17,$77,$77,$77 ; $31 Desert, White Wall S/SE
dcb $b7,$77,$77,$77,$b7,$77,$77,$77,$b7,$77,$77,$77,$b7,$77,$77,$77,$b7,$77,$77,$77,$b7,$77,$77,$77,$b7,$77,$77,$77,$b7,$77,$77,$77 ; $32 Desert, Black Wall
dcb $b7,$77,$77,$77,$b7,$77,$77,$77,$bb,$bb,$bb,$77,$ff,$ff,$fb,$77,$fb,$bb,$fb,$77,$ff,$ff,$fb,$77,$bb,$bb,$bb,$77,$b7,$77,$77,$77 ; $33 Desert, Black Bastion
dcb $b7,$77,$77,$77,$bb,$bb,$f7,$77,$bb,$bb,$ff,$77,$fb,$ff,$ff,$77,$bb,$bb,$ff,$77,$bb,$bb,$f7,$77,$b7,$77,$77,$77,$b7,$77,$77,$77 ; $34 Desert, Black Gate
dcb $b7,$77,$77,$77,$b8,$78,$77,$77,$b8,$77,$87,$77,$b8,$87,$88,$77,$b8,$88,$77,$77,$b8,$88,$88,$77,$b8,$88,$88,$88,$b8,$88,$88,$88 ; $35 Desert, Black Wall SW
dcb $11,$ff,$ff,$11,$1d,$ff,$ff,$d1,$1d,$df,$fd,$d1,$1d,$df,$fd,$d1,$1d,$ff,$ff,$d1,$11,$1f,$f1,$11,$11,$11,$11,$11,$11,$1f,$f1,$11 ; $36 White, Gate
dcb $11,$1f,$f1,$11,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$11,$11,$11,$11,$11,$11,$11,$11,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$11,$11,$11,$11 ; $37 White, W/E w/ N Door
dcb $11,$11,$11,$11,$1f,$ff,$ff,$f1,$1f,$ff,$ff,$f1,$1f,$f1,$1f,$f1,$1f,$f1,$1f,$f1,$1f,$f1,$1f,$f1,$1f,$f1,$1f,$f1,$1f,$f1,$11,$11 ; $38 White, S Snail
dcb $1f,$f1,$11,$11,$1f,$f1,$1f,$f1,$1f,$f1,$1f,$f1,$ff,$f1,$1f,$ff,$1f,$f1,$1f,$f1,$1f,$ff,$ff,$f1,$1f,$ff,$ff,$f1,$11,$11,$11,$11 ; $39 White, N Snail w/ E/W Doors
dcb $11,$11,$11,$11,$1f,$ff,$ff,$f1,$1f,$ff,$ff,$f1,$1f,$f1,$1f,$f1,$1f,$f1,$1f,$ff,$1f,$f1,$1f,$f1,$1f,$f1,$1f,$f1,$1f,$f1,$11,$11 ; $3a White, S Snail w/ E Door
dcb $1f,$f1,$11,$11,$ff,$f1,$1f,$f1,$ff,$f1,$1f,$f1,$1f,$f1,$1f,$f1,$1f,$f1,$1f,$ff,$ff,$f1,$1f,$f1,$ff,$f1,$1f,$f1,$11,$11,$1f,$f1 ; $3b White, 11x5
dcb $11,$11,$1f,$f1,$1f,$f1,$1f,$f1,$1f,$ff,$ff,$f1,$1f,$ff,$ff,$ff,$1f,$ff,$ff,$f1,$1f,$f1,$1f,$f1,$1f,$f1,$1f,$f1,$1f,$f1,$11,$11 ; $3c White, 11x6
dcb $11,$11,$11,$11,$ff,$ff,$ff,$f1,$ff,$ff,$ff,$f1,$11,$11,$1f,$f1,$11,$11,$1f,$f1,$ff,$f1,$1f,$f1,$ff,$f1,$1f,$f1,$1f,$f1,$1f,$f1 ; $3d White, Dual W/S Hall
dcb $1f,$f1,$1f,$f1,$ff,$f1,$1f,$ff,$ff,$f1,$1f,$ff,$11,$11,$11,$11,$11,$11,$11,$11,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$11,$11,$11,$11 ; $3e White, W/E, Dual N Hall
dcb $1f,$f1,$11,$11,$ff,$f1,$1f,$f1,$ff,$f1,$1f,$f1,$11,$11,$1f,$ff,$11,$11,$1f,$f1,$ff,$ff,$ff,$f1,$ff,$ff,$ff,$f1,$11,$11,$11,$11 ; $3f White, Dual W, N w/ E Door
dcb $11,$11,$11,$11,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$11,$1f,$f1,$11,$11,$1f,$f1,$11,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$11,$1f,$f1,$11 ; $40 White, Dual W/E, S Hall
dcb $11,$11,$11,$11,$ff,$ff,$ff,$f1,$ff,$ff,$ff,$f1,$11,$11,$1f,$f1,$11,$11,$1f,$f1,$ff,$ff,$ff,$f1,$ff,$ff,$ff,$f1,$11,$1f,$f1,$11 ; $41 White, Daul W, S Hall
dcb $11,$1f,$f1,$11,$1f,$ff,$ff,$ff,$1f,$ff,$ff,$ff,$1f,$f1,$11,$11,$1f,$f1,$11,$11,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$11,$11,$11,$11 ; $42 White, W, Dual E, N Hall
dcb $11,$11,$11,$11,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$11,$11,$11,$11,$11,$11,$11,$11,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$11,$11,$11,$11 ; $43 White, Dual E/W Hall
dcb $11,$11,$11,$11,$1f,$ff,$ff,$f1,$1f,$ff,$ff,$f1,$1f,$ff,$ff,$f1,$1f,$ff,$ff,$f1,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$11,$11,$11,$11 ; $44 White, Cell
dcb $11,$11,$11,$11,$1f,$ff,$ff,$ff,$1f,$ff,$ff,$ff,$1f,$ff,$11,$11,$1f,$ff,$11,$11,$1f,$ff,$11,$ff,$1f,$ff,$11,$ff,$11,$11,$11,$11 ; $45 White, E Snail
dcb $11,$11,$11,$11,$1f,$ff,$ff,$ff,$1f,$ff,$ff,$ff,$1f,$f1,$11,$11,$1f,$f1,$11,$11,$1f,$f1,$1f,$ff,$1f,$f1,$1f,$ff,$1f,$f1,$11,$11 ; $46 White, E/S Hall
dcb $1f,$f1,$11,$11,$1f,$ff,$ff,$f1,$1f,$ff,$ff,$f1,$11,$11,$11,$11,$11,$11,$11,$11,$1f,$ff,$ff,$ff,$1f,$ff,$ff,$ff,$11,$11,$11,$11 ; $47 White, Cell End
dcb $bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$ff,$fb,$bb,$bb,$ff,$ff,$ff,$bb,$ff,$fb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb ; $48 Black, E
dcb $bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$ff,$fb,$bb,$bb,$ff,$fb,$bb,$bb,$ff,$fb,$bb,$bb,$bf,$bb,$bb,$bb,$bf,$bb,$bb,$bb,$bf,$bb,$bb ; $49 Black, S
dcb $bb,$bf,$bb,$bb,$bb,$bf,$bb,$bb,$bb,$ff,$fb,$bb,$bb,$ff,$ff,$ff,$bb,$ff,$fb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb ; $4a Black, N/E
dcb $bb,$bf,$bb,$bb,$bb,$bf,$bb,$bb,$bb,$ff,$fb,$bb,$bb,$ff,$fb,$bb,$bb,$ff,$fb,$bb,$bb,$bf,$bb,$bb,$bb,$bf,$bb,$bb,$bb,$bf,$bb,$bb ; $4b Black, N/S
dcb $bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$ff,$fb,$bb,$bb,$ff,$ff,$ff,$bb,$ff,$fb,$bb,$bb,$bf,$bb,$bb,$bb,$bf,$bb,$bb,$bb,$bf,$bb,$bb ; $4c Black, S/E
dcb $bb,$bf,$bb,$bb,$bb,$bf,$bb,$bb,$bb,$ff,$fb,$bb,$ff,$ff,$fb,$bb,$bb,$ff,$fb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb ; $4d Black, N/W
dcb $bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$ff,$fb,$bb,$ff,$ff,$fb,$bb,$bb,$ff,$fb,$bb,$bb,$bf,$bb,$bb,$bb,$bf,$bb,$bb,$bb,$bf,$bb,$bb ; $4e Black, S/W
dcb $bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$ff,$fb,$bb,$ff,$ff,$ff,$ff,$bb,$ff,$fb,$bb,$bb,$bf,$bb,$bb,$bb,$bf,$bb,$bb,$bb,$bf,$bb,$bb ; $4f Black, S/E/W
dcb $bb,$bf,$bb,$bb,$bb,$bf,$bb,$bb,$bb,$ff,$fb,$bb,$ff,$ff,$ff,$ff,$bb,$ff,$fb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb ; $50 Black, N/E/W
dcb $bb,$bf,$bb,$bb,$bb,$bf,$bb,$bb,$bb,$ff,$fb,$bb,$ff,$ff,$ff,$ff,$bb,$ff,$fb,$bb,$bb,$bf,$bb,$bb,$bb,$bf,$bb,$bb,$bb,$bf,$bb,$bb ; $51 Black, N/E/S/W
sprite_data:
dcb $01,$cc,$11,$cc,$01,$cc,$01,$10 ; $00 Player Down
dcb $00,$1c,$01,$1c,$01,$1c,$00,$10 ; $01 Player Right
dcb $c1,$00,$c1,$10,$c1,$10,$01,$00 ; $02 Player Left
dcb $01,$1c,$11,$11,$01,$1c,$01,$10 ; $03 Player Up
dcb $00,$b0,$ee,$e0,$00,$0b,$0e,$ee ; $04 Flippers
dcb $01,$10,$11,$00,$01,$10,$01,$00 ; $05 White Key
dcb $0b,$0b,$bb,$bb,$00,$b0,$00,$00 ; $06 Black Key
dcb $e0,$0e,$70,$07,$77,$77,$77,$77 ; $07 Crown
dcb $00,$20,$22,$20,$02,$22,$02,$00 ; $08 Death Star
dcb $0c,$c0,$22,$22,$c2,$2c,$02,$20 ; $09 Evil Guy
; Tile flags meanings
; 0 Walkable
tile_flags:
dcb $00 ; 0 Void, darkness, nothingness
dcb $00 ; 1 White Castle wall
dcb $00 ; 2 ???
dcb $00 ; 3 ???
dcb $00 ; 4 ???
dcb $00 ; 5 Tress, forest
dcb $00 ; 6 Deep water
dcb $01 ; 7 Desert sand
dcb $00 ; 8 Desert rocks
dcb $01 ; 9 Dirt, road
dcb $00 ; a ???
dcb $00 ; b Black Castle Wall
dcb $00 ; c ???
dcb $01 ; d Grass
dcb $00 ; e Shallow water
dcb $01 ; f Castle Floor
; Spawn points.
; 16 spawn points per area
; 2 bytes per spawn point
; First byte is X position, second is Y position
; Hi-nibble of byte is map position, Lo is Screen position
spawn_points:
dcb $13,$13,$02,$13,$12,$35,$35,$15,$33,$23,$21,$12,$21,$36,$32,$32,$41,$31,$43,$24,$43,$11,$54,$25,$72,$03,$73,$16,$75,$25,$76,$36 ; Forest
dcb $b5,$35,$b5,$24,$b3,$13,$92,$15,$82,$15,$84,$04,$91,$02,$f4,$02,$f3,$15,$f2,$25,$d4,$26,$c6,$13,$c5,$22,$c3,$33,$d7,$32,$e4,$35 ; River
dcb $d2,$63,$d5,$85,$e4,$81,$e3,$97,$d5,$95,$e2,$a1,$d6,$a3,$c1,$91,$c6,$b4,$d2,$b2,$e5,$b4,$f3,$b2,$e3,$e3,$d1,$e5,$c3,$f3,$f2,$f2 ; Desert
dcb $c1,$44,$c4,$52,$c3,$53,$c5,$53,$c4,$56,$c4,$61,$c4,$65,$c3,$64,$c5,$64,$d3,$53,$d5,$53,$d7,$53,$e0,$53,$e2,$53,$e4,$53,$c1,$73 ; White Bastions
dcb $b6,$41,$b5,$51,$a6,$66,$a5,$71,$95,$71,$96,$66,$71,$71,$66,$71,$51,$71,$41,$75,$46,$72,$45,$66,$46,$54,$42,$55,$46,$46,$42,$45 ; White Castle
; Item patch data
; First byte is the table to patch, which indexes the item_patch_table_lo
; and item_patch_table_hi arrays.
; The tables are:
; 0 screen_data
; 1 sprite_data
; 2 tile_flags
; 3 object_flags
; Due to the lack of <> support for the dcb statement, we populate
; these pointers at startup time.
; The second and third bytes are the offest from the begining of the
; table to patch.
; The fourth byte is the value to insert.
; Each item has 8 patches thay may occur.
; A table index of $ff indicates that this patch is not valid.
item_patch_data:
; Flippers
dcb $02,$0e,$00,$01 ; Make shallow water walkable
dcb $01,$06,$00,$0e ; Sprite, Down, Left Foot
dcb $01,$07,$00,$e0 ; Sprite, Down, Right Foot
dcb $01,$0f,$00,$e0 ; Sprite, Right, Foot
dcb $01,$16,$00,$0e ; Sprite, Left, Foot
dcb $01,$1e,$00,$0e ; Sprite, Up, Left Foot
dcb $01,$1f,$00,$e0 ; Sprite, Up, Right Foot
dcb $ff,$ff,$ff,$ff ; Fill
; White Key
dcb $00,$d9,$06,$1f ; White castle gate 1
dcb $00,$da,$06,$f1 ; White castle gate 2
dcb $ff,$ff,$ff,$ff ; Fill
dcb $ff,$ff,$ff,$ff ; Fill
dcb $ff,$ff,$ff,$ff ; Fill
dcb $ff,$ff,$ff,$ff ; Fill
dcb $ff,$ff,$ff,$ff ; Fill
dcb $ff,$ff,$ff,$ff ; Fill
; Black Key
dcb $00,$8c,$06,$ff ; Black castle gate 1
dcb $ff,$ff,$ff,$ff ; Fill
dcb $ff,$ff,$ff,$ff ; Fill
dcb $ff,$ff,$ff,$ff ; Fill
dcb $ff,$ff,$ff,$ff ; Fill
dcb $ff,$ff,$ff,$ff ; Fill
dcb $ff,$ff,$ff,$ff ; Fill
dcb $ff,$ff,$ff,$ff ; Fill
; Crown
dcb $01,$00,$00,$08 ; Sprite, Down, Head
dcb $01,$09,$00,$8c ; Sprite, Right, Head
dcb $01,$10,$00,$c8 ; Sprite, Left, Head
dcb $01,$18,$00,$08 ; Sprite, Up, Head (Left)
dcb $01,$19,$00,$8c ; Sprite, Up, Head (Right)
dcb $03,$00,$00,$ff ; Crown object flag
dcb $ff,$ff,$ff,$ff ; Fill
dcb $ff,$ff,$ff,$ff ; Fill
; Death Star
dcb $01,$02,$00,$21 ; Sprite, Down, Hand
dcb $01,$0b,$00,$2c ; Sprite, Right, Hand
dcb $01,$1a,$00,$21 ; Sprite, Up, Hand
dcb $03,$01,$00,$ff ; Death Star object flag
dcb $ff,$ff,$ff,$ff ; Fill
dcb $ff,$ff,$ff,$ff ; Fill
dcb $ff,$ff,$ff,$ff ; Fill
dcb $ff,$ff,$ff,$ff ; Fill
item_patch_table_lo:
dcb $00,$00,$00,$00
item_patch_table_hi:
dcb $00,$00,$00,$00
;-----------------------------------------------------
; alive.asm ------------------------------------------
; I'm alive
; by PJP
start:
lda #15
sta $0 ;xpos
sta $1 ;ypos
loop:
lda $fe
and #3
cmp #0
beq go_left
cmp #1
beq go_right
cmp #2
beq go_down
dec $1
draw:
lda $1
and #$1f
asl
tax
lda ypos,x
sta $2
inx
lda ypos,x
sta $3
lda $0
and #$1f
tay
lda ($2),y
tax
inx
txa
sta ($2),y
jmp loop
go_down:
inc $1
jmp draw
go_left:
dec $0
jmp draw
go_right:
inc $0
jmp draw
ypos:
dcb $00,$02,$20,$02,$40,$02,$60,$02
dcb $80,$02,$a0,$02,$c0,$02,$e0,$02
dcb $00,$03,$20,$03,$40,$03,$60,$03
dcb $80,$03,$a0,$03,$c0,$03,$e0,$03
dcb $00,$04,$20,$04,$40,$04,$60,$04
dcb $80,$04,$a0,$04,$c0,$04,$e0,$04
dcb $00,$05,$20,$05,$40,$05,$60,$05
dcb $80,$05,$a0,$05,$c0,$05,$e0,$05
;------------------------------------------------------------
; backandforth.asm ------------------------------------------
;
; moves a dot back and forth
;
start:
lda #$f
sta $0 ; Xpos = 15
lda #$4
sta $1 ; Ypos = $02(0f) (top line)
lda #$01
sta $2 ; direction (0=left, 1=right)
mainloop:
lda $00 ; load Xpos
sta $03 ; save it..
lda $01 ; load Ypos
sta $04 ; save it..
lda $02 ; check direction
cmp #$00 ; left?
bne notLeft
inc $0 ; increment X
jmp checkBounce
notLeft:
dec $0 ; decrement X
checkBounce:
ldx $02 ; regX = direction
lda $0 ; load xpos
cmp #$1f ; at-most right?
bne notBounceLeft
ldx #$1 ; go left
jmp draw ; draw dot
notBounceLeft:
cmp #$0 ; at-most right?
bne draw
ldx #$0 ; go right
draw:
stx $02 ; update direction
lda #$1 ; A=1 white color
ldx #$0
sta ($0,x) ; draw dot
lda #$0 ; A=0 black color
ldx #$0
sta ($3,x) ; erase previous dot
jmp mainloop ; continue forever
;-----------------------------------------------------
; byterun.asm ----------------------------------------
; testing byterun compression
start:
lda #logo
sta $1
lda #$00
sta $2
lda #$02
sta $3
decrunchLoop:
lda $3
cmp #$6
bne moreWork
rts
moreWork:
ldy #0
lda ($0),y
cmp #$ff
bne notCrunched
iny
lda ($0),y ; repeat #
sta $4
iny
lda ($0),y ; color
ldy $4
drawLoop:
ldx #0
sta ($2,x)
jsr nextPixel
dey
bne drawLoop
jsr getNextByte
jsr getNextByte
jmp decrunchLoop
notCrunched:
ldx #0
sta ($2,x)
jsr nextPixel
jsr getNextByte
jmp decrunchLoop
getNextByte:
inc $0
lda $0
cmp #$00
bne notHi
inc $1
notHi:
rts
nextPixel:
inc $2
ldx $2
cpx #$00
bne notNextLine
inc $3
notNextLine:
rts
logo:
dcb $ff,43,1,$f,$f,$f,$c,$f,$f,$f,$ff,24,1,$c,$f,$c,0
dcb $c,$f,$c,$ff,24,1,0,$f,$c,0,$c,$f,$c,$ff,24,1
dcb $c,$f,$c,0,$c,$f,$c,$ff,24,1,0,$f,$c,0,$c,$f,$c
dcb $ff,24,1,$c,$f,0,0,$c,$f,$c,$ff,24,1,0,$f,$c,0
dcb $c,$f,$c,$ff,24,1,0,$f,$c,0,$c,$f,0,$ff,24,1
dcb 0,$f,$c,0,$c,$f,0,$ff,23,1,$f,0,$f,$c,0,$c,$f,0,$f
dcb $ff,22,1,$c,0,1,$c,0,$c,$f,0,$c,$ff,21,1
dcb $f,0,0,1,0,0,$c,1,0,0,$ff,21,1,$c,0,$c,1,$c,0
dcb $c,1,$c,0,$c,$ff,19,1,$f,0,0,$f,1,$c,0
dcb $c,1,$f,0,0,$f,$ff,17,1,$f,0,0,0,1,1,$c,0
dcb $c,1,1,0,0,0,$ff,16,1,$f,0,0,0,$f,1,1,0,0
dcb $c,1,1,$f,0,0,0,$f,$ff,13,1
dcb $c,0,0,0,$c,1,1,1,$c,0,$c,1,1,1,$c,0,0,0,$c
dcb $ff,10,1,$c,0,0,0,0,$c,1,1,1,1,0,0
dcb $c,1,1,1,1,0,0,0,0,0,$c,$ff,8,1
dcb 0,0,0,0,$c,1,1,1,1,1,0,0
dcb $c,1,1,1,1,1,$c,0,0,0,0,1,1,1,1,1
dcb 1,1,1,1,0,0,$c,1,1,1,1,1,1,1,$c,0
dcb $c,1,1,1,1,1,1,$f,$c,0,0,$ff,18,1,$f
dcb $ff,53,1,0,$f,1,0,0,0,0,0,$f,1,$c
dcb $c,1,1,1,$c,0,0,0,1,1,0,$f,$f,1,1,1
dcb 1,1,1,1,$c,0,0,1,1,1,0,$f,1,1,$f,0
dcb 0,$f,1,1,0,$f,1,$c,$c,1,0,$f,1,1,1,1
dcb 1,1,1,1,0,$f,0,$f,1,1,0,$f,1,1,$f,$c
dcb $c,$c,1,1,0,1,1,$f,0,1,0,$f,1,1,1,1
dcb 1,1,1,1,0,1,$c,$f,1,1,$c,$f,1,1,0,$f
dcb $f,0,1,1,0,$f,$f,0,$f,1,0,$f,1,1,1,1
dcb 1,1,1,$c,0,$c,0,0,1,1,0,$f,1,1,0,$c
dcb $c,0,$f,1,0,$f,0,$f,1,1,0,$f,1,1,1,1
dcb 1,1,1,0,$c,$f,$f,0,$f,1,$c,$f,1,$c,$c,$f
dcb $f,$c,$c,1,0,1,$f,$c,1,1,0,$f,1,1,1,1
dcb 1,1,$f,0,1,1,1,$c,$c,1,0,$f,1,0,$f,1
dcb 1,$f,0,1,0,$f,1,0,$f,1,0,$f,$ff,16,1
dcb $f,$ff,5,1,$f,1,1,1,$f,$ff,38,1
;-----------------------------------------------------
; colors.asm -----------------------------------------
; submitted by Anonymous
ldx #0
ldy #0
;init screen
lda #0
sta $0
lda #2
sta $1
loop:
lda colors,x
bpl ok
inc $0
ldx #0
lda colors,x
ok:
inx
sta ($0),y
iny
bne ok2
inc $1
ok2:
jmp loop
colors:
dcb 0,2,0,2,2,8,2,8,8,7,8,7,7,1,7,1,1,7,1,7,7,8,7,8,8,2,8,2,2,0,2,0
dcb 2,2,8,2,8,8,7,8,7,7,1,7,1,1,1,1,1,1,1,1,7,1,7,7,8,7,8,8,2,8,2,2,$ff
;-----------------------------------------------------------------------------
; compo-May07-1st.asm --------------------------------------------------------
; By DMSC - daniel.serpell@gmail.com
;
; This demo was programmed in ACME:
; http://www.esw-heim.tu-clausthal.de/~marco/smorbrod/acme/
;
; If you want the source code, send me an email :-)
;
dcb 76, 94, 11,133, 32,162, 8,160, 8,145, 16,136,208,251,165, 16
dcb 24,105, 32,133, 16,165, 17,105, 0,133, 17,165, 32,202,208,231
dcb 96,230, 48,165, 48, 41, 63,133, 48,170,189,106, 6,170,189, 8
dcb 3,105, 1, 41, 3,157, 8, 3,138, 73,231,170,189, 0, 2,105
dcb 1, 41, 3,157, 0, 2,165, 48, 73, 63,170,189,106, 6, 73,224
dcb 170,189, 8, 2,105, 1, 41, 3,157, 8, 2,138, 73,231,170,189
dcb 0, 3,105, 1, 41, 3,157, 0, 3, 96,224,192,160,128, 96,225
dcb 64,193,161,226,129, 32,194, 97,162,227,195,130,228, 65,163,196
dcb 98,229,131,164,197,230,231,132,165,198, 99, 66, 33, 0,199,166
dcb 133,100,167, 67,134,101,135, 34, 68,102,103, 69, 35, 70, 71, 36
dcb 1, 37, 38, 39, 2, 3, 4, 5, 6, 7,166, 48,189,198, 6,170
dcb 254, 24, 3, 73, 7,170,254, 16, 3, 73,231,170,254, 24, 2, 73
dcb 7,170,254, 16, 2, 96, 0, 32, 1, 33, 64, 2, 65, 34, 96, 66
dcb 3, 97, 35, 98, 67,128, 4,129, 36, 99,130, 68,160, 5,161,131
dcb 100, 37,162, 69,132,192,163,101, 6,193, 38,194, 70,164,133,195
dcb 102,224, 7,225, 39,165,226,196,134, 71,227,103,197,166,228,135
dcb 198,229,167,230,199,231,166, 49,189, 21, 7,170,189, 0,160,157
dcb 0, 5,230, 49, 96,195,227,194,162,228, 97,226,128,129,130,225
dcb 64,161,163,224, 96,160,193,196, 32, 98,192, 65, 0,131,229,164
dcb 33, 99,197, 66,132, 1,230, 34,165, 67,100,198, 2, 3, 68, 6
dcb 35,133,166, 5,101, 4,199, 7, 36,231, 69,134,167, 37, 38,102
dcb 135, 70,232, 71, 39,103,136,200,168, 8, 11, 10,169,233,104, 9
dcb 12,137,201, 13, 40, 44, 72, 43,170, 42, 45, 41,105, 73,202, 14
dcb 138,234, 74, 75,106,203, 76,171, 46, 77,235,107,139, 15,108,172
dcb 174,140,173,141,142,204,109,206,207,205, 78,175, 47,236,239,143
dcb 237,238,110,240,241,111,208, 16, 79,176,209,242, 48,144,243, 80
dcb 177,244,112,210, 17, 49,178,179, 52, 53,147, 18, 81,211,145, 19
dcb 146, 51, 85,180, 20, 54,113,148, 22, 50, 84,212, 21, 55,115,245
dcb 83,114,116, 23, 82, 86, 88, 89, 87,118,117,119,149,213, 56, 57
dcb 181,214, 90,121,122,150,151,182,183,215,246, 58,120,247, 24,153
dcb 184,152,216, 25, 26, 59, 91,248,123,185, 27, 60,217,154, 28, 92
dcb 249, 29,155,186, 61,218, 93,124,250,187, 30,251, 62,156, 94,125
dcb 219,188, 31,252,254,220,253, 63,126,255,157,221, 95,159,191,222
dcb 127,189,223,158,190,165, 66, 41,224,208, 72,165, 66, 24,105, 1
dcb 41, 31,133, 66,165, 67,240, 7,198, 67,169, 0, 76, 97, 8,198
dcb 69,240,247, 16, 37,166, 64,230, 64,189,177, 9, 16, 15, 41,127
dcb 133, 67, 73,127,208,228,169, 1,133, 70, 76, 42, 8,170,189,117
dcb 8,133, 69,234,234,189,181, 8,133, 65,166, 65,230, 65,189,245
dcb 8,133, 68,165, 66, 24,105,224,133, 66,166, 66,169, 1,102, 68
dcb 42,157, 0,160, 96, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2
dcb 3, 2, 3, 3, 3, 3, 3, 1, 2, 3, 1, 5, 3, 3, 3, 3
dcb 3, 2, 2, 3, 3, 5, 4, 3, 3, 5, 4, 4, 4, 3, 3, 4
dcb 4, 1, 3, 4, 3, 5, 5, 5, 4, 5, 4, 4, 3, 4, 4, 7
dcb 4, 4, 4, 2, 1, 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30
dcb 32, 35, 35, 38, 40, 43, 46, 49, 50, 52, 4, 55, 55, 60, 63, 65
dcb 68, 71, 73, 75, 78, 78, 33, 83, 86, 89, 94, 98,102,106,109,112
dcb 116, 94,120,123,127,130,134,139,144,148,153,157,161,164,167,171
dcb 178,171,182,186, 5, 56, 68, 56, 36,124, 4, 76, 84, 36, 68, 84
dcb 40, 24, 40,124,100, 84, 88, 56, 84, 72, 76, 80, 96, 40, 84, 40
dcb 36, 84, 56, 44, 28,124, 36, 24, 24, 36,124, 24, 52, 16, 60, 80
dcb 24, 37, 30,124, 32, 28,188, 1,190,124, 24, 36, 60, 32, 28, 32
dcb 28, 24, 36, 24, 63, 36, 24, 36, 63, 60, 16, 32, 52, 44,120, 36
dcb 56, 4, 60, 56, 4, 56, 4, 56, 57, 6, 56, 44, 52, 36, 12, 48
dcb 208, 48, 12,252,164,164, 88,120,132,132, 72,252,132,132,120,252
dcb 164,132,252,160,128,120,132,164, 56,252, 32, 32,252, 8, 4,248
dcb 252, 48, 80,140,252, 4, 4,252, 64, 60, 64,252, 64, 48, 8,252
dcb 120,132,132,132,120,252,144,144, 96,120,132,134,133,120,252,144
dcb 144,108, 68,164,164,152,128,252,128,248, 4, 4,248, 4, 8,240
dcb 224, 28, 16,224, 28, 16,224,204, 48, 48,204,140,148,164,196, 0
dcb 0,133, 41, 10, 28, 29, 63, 63, 63,136, 15, 10, 28, 29, 14, 27
dcb 63, 63, 63,132, 55, 17, 18, 28, 62, 18, 28, 62, 10,136, 27, 14
dcb 10, 21, 21, 34,143, 15, 10, 28, 29,142, 39, 40, 48, 50,149,145
dcb 10, 23, 13, 62, 23, 24, 32,136, 28, 24, 22, 14,136, 11, 14, 10
dcb 30, 29, 18, 15, 30, 21,128, 14, 15, 15, 14, 12, 29, 28, 63, 63
dcb 63,144,159,255, 55, 17, 18, 28, 62, 18, 28, 62, 10, 21, 21,129
dcb 15, 24, 27, 62, 23, 24, 32,136, 11, 34, 14, 63, 63, 63,141, 63
dcb 63, 63, 11, 34, 14,150,159,143, 11, 34, 62, 39, 48, 54, 38, 2
dcb 0, 0, 7, 63, 5, 63, 2, 9, 11, 34, 62, 39, 48, 54, 38, 2
dcb 0, 0, 7, 63, 5, 63, 2, 9, 11, 34, 62, 39, 48, 54, 38, 2
dcb 0, 0, 7, 63, 5, 63, 2, 9,143,159,255,169, 0,133, 42,169
dcb 1,133, 44,133, 45,169, 0,133, 32,169,160,133, 33,165, 42,133
dcb 43,162, 15,160, 15,145, 32, 24,101, 44,230, 44,136, 16,246,165
dcb 32, 24,105, 32,133, 32,165, 33,105, 0,133, 33,169, 1,133, 44
dcb 165, 43, 24,101, 45,133, 43,230, 45,202, 16,215,169, 0,133, 32
dcb 169,160,133, 33,169,224,133, 34,169, 3,133, 35,169, 0,133, 36
dcb 169, 4,133, 37,169,240,133, 38,169, 3,133, 39,169, 16,133, 40
dcb 169, 4,133, 41,169, 15,133, 46,160, 15,177, 32, 74, 74, 74, 74
dcb 170,189, 62, 11,209, 34,240, 18,145, 34,145, 36,170,152, 73, 15
dcb 168,138,145, 38,145, 40,152, 73, 15,168,136, 16,221,165, 32, 24
dcb 105, 32,133, 32,165, 33,105, 0,133, 33,165, 34, 24,105,224,133
dcb 34,165, 35,105,255,133, 35,165, 36, 24,105, 32,133, 36,165, 37
dcb 105, 0,133, 37,165, 38, 24,105,224,133, 38,165, 39,105,255,133
dcb 39,165, 40, 24,105, 32,133, 40,165, 41,105, 0,133, 41,198, 46
dcb 16,150,230, 42,165, 42, 41, 63,240, 3, 76, 95, 10, 96, 0, 11
dcb 12, 15, 1, 15, 12, 11, 0, 11, 12, 15, 1, 15, 12, 11, 0, 11
dcb 12, 15, 1, 15, 12, 11, 0, 11, 12, 15, 1, 15, 12, 11,169, 1
dcb 162,255,134, 16,162, 1,134, 17, 32, 3, 6,169, 2,162, 7,134
dcb 16,162, 2,134, 17, 32, 3, 6,169, 3,162, 7,134, 16,162, 3
dcb 134, 17, 32, 3, 6,169, 31,133, 66,169, 0,133, 70,133, 67,133
dcb 64,169, 1,141,109, 8,169, 0,141,114, 8,169,160,141,115, 8
dcb 169, 63,133, 48,169,128,133, 49,169, 3,141,109, 8,169, 0,170
dcb 157, 0,160,232,208,250, 32, 33, 6, 32,170, 6, 32, 6, 7, 32
dcb 21, 8,165, 66, 73, 31,208, 13,173,109, 8, 24,105, 2, 41, 3
dcb 105, 3,141,109, 8,165, 49,208,221,173, 17, 7, 73, 1,141, 17
dcb 7,165, 70,240,209, 32, 29, 12, 32, 91, 10,169, 31,133, 66,169
dcb 0,133, 70,133, 67,141,109, 8,169, 0,141,114, 8,169, 3,141
dcb 115, 8, 32, 29, 12, 32, 21, 8,165, 66, 73, 31,208,247,173,115
dcb 8, 73, 7,141,115, 8,165, 70,240,235, 76, 94, 11,169, 0,170
dcb 157, 0, 2,157, 0, 3,157, 0, 4,157, 0, 5,232,208,241, 96
;-------------------------------------------------------------------
; compo-May07-2nd.asm ----------------------------------------------
; 6502 assembler Sierpinsky Triangle ver.2
; by Magnus Wedmark 2007-05-02
; This program is especially written for
; the 6502asm.com competition and
; uses the 32*32 pixel display used in that
; virtual platform. The sierpinsky
; fractal is one of the simplest to
; implement. Here is a walk-through:
; 1) Specify 3 points that form a triangle
; 2) Choose one of them as a starting point
; 3) Choose one of them as targetpoint randomly
; 4) Set the new current position half-way
; between the current point and the target
; point.
; 5) Goto 3
LDX #0
LDY #0
new_rnd:
LDA $FE ; random 0-255
AND #3 ; only 0-3 left
CMP #3
BNE good_rnd
JMP new_rnd
good_rnd:
; random = 0-2
PHA
; transform X and Y values according to:
; X=X/2+(P*8) and Y=Y/2+(P*16)
ASL
ASL
ASL
STA $F3 ; P*8
PLA
AND #1
ASL
ASL
ASL
ASL
STA $F4 ; (P AND 1)*16
TXA
LSR
ADC $F3
TAX
TYA
LSR
ADC $F4
TAY
JSR set_point ; use and restore regs
JMP new_rnd
set_point: ; uses both X,Y,A and restores them
PHA ; backup all reg-value (X,Y,A)
TXA
PHA
TYA
PHA
PHA
PHA ; triple Y push, two for int. use
STX $F2 ; transfer X to Y using $F2
LDY $F2
LDA #0
STA $F0
LDA #$2
STA $F1 ; set base vector to $200
LDA #0
PLA ; transfer the pushed Y-coord to A
AND #$07 ; the value %0000'0111
ASL
ASL
ASL
ASL
ASL
CLC
ADC $F0
STA $F0
BCC no_carry
INC $F1
no_carry:
CLC
PLA ; transfer the pushed Y-coord to A
AND #$18
LSR
LSR
LSR
ADC $F1
STA $F1
CLC
TYA
ADC $F0
ADC $F1
LDA #1 ;1 = white for trouble-shooting
JSR set_toning_point ; use for shading
STA ($F0),Y ; set pixel
PLA ; restore all reg-value (X,Y,A)
TAY
PLA
TAX
PLA
RTS
; sub routine to shade the current pixel ($F0),Y
; lighter on a scale: $0, $B, $C, $F, $1
; Black, DarkGrey, Grey, LightGrey, White
set_toning_point:
LDA ($F0),Y
CMP #$00
BNE not_black
LDA #$0B
RTS
not_black:
CMP #$0B
BNE not_dgrey
LDA #$0C
RTS
not_dgrey:
CMP #$0C
BNE not_grey
LDA #$0F
RTS
not_grey:
CMP #$0F
BNE not_lgrey
LDA #$01
RTS
not_lgrey:
; white stays white
RTS
;-------------------------------------------------------------------
; compo-May07-3rd.asm ----------------------------------------------
; Brick Out by Blake Ramsdell http://www.blakeramsdell.com
; A poor attempt at brick out with no player involved. Maybe someday I'll
; let you play it, or you can view this as an exercise for the reader to put
; in a paddle that is user-controlled.
; I guess this is Copyright (C) 2007 Blake Ramsdell, and you have a license to
; do whatever you want with it, just tell me what you did and give me a
; mention. If you want to sell it, and you make a billion dollars, then good
; for you. You might at least throw a party and invite me.
; The gist of it is pretty simple -- you have a ball, and the ball has an X
; and a Y velocity. When it hits something, it bounces off of it. If the thing
; that it hits is not a wall, then it erases it. Pretty dead-simple behavior.
; I don't like the vertical movement -- there's a shortcut in here somewhere
; to make it less computationally expensive I think. Right now it just does a
; two byte add and subtract of $20.
; The ball motion is also a bit weird looking. I don't know if this is an
; artifact of the simulation environment combined with a normal tearing
; artifact related to refresh or what.
; Blake Ramsdell, May 2007
init:
lda #$fe
sta $2 ; X velocity (0 = fast, ff = slow)
; (low bit is direction, 0 = down or right, 1 = up or left)
lda #$ee
sta $3 ; Y velocity
drawbox:
lda #0 ; Use $0-$1 as a screen address for drawing the field
sta $0
lda #2
sta $1
ldx #$20 ; Loop $20 times
boxloop:
lda #2 ; Line color (red)
sta $1ff,x ; Top line
sta $5df,x ; Bottom line
ldy #0
sta ($0),y ; Left line
ldy #$1f
sta ($0),y ; Right line
cpx #$1 ; If we're just before the bottom line...
beq noblocks ; Don't draw any blocks there
lda #3 ; First block for this row, Cyan in color
ldy #$17 ; It's at X position $17
sta ($0),y ; Draw it
lda #4 ; Second block for this row, Purple in color
iny ; It's at the next X position
sta ($0),y ; Draw it
lda #5 ; Third block for this row, Green in color
iny ; It's at the next X position
sta ($0),y ; Draw it
lda #6 ; Fourth block for this row, Blue in color
iny ; It's at the next X position
sta ($0),y ; Draw it
noblocks:
clc ; Get ready to increment the row, clear the carry for add
lda $0 ; Get the low byte
adc #$20 ; Add $20 to it for the next row
sta $0 ; Put it back
lda $1 ; Get the high byte
adc #0 ; Factor in the carry
sta $1 ; Put it back
dex ; Decrement the loop counter
bne boxloop ; Do it again unless it's zero
ldx $2 ; Load the X velocity
ldy $3 ; Load the Y velocity
lda #$44 ; Pick a start point
sta $0 ; Ball position low
lda #$02
sta $1 ; Ball position high
drawball:
txa ; Preserve X
pha
lda #1 ; Ball color (white)
ldx #0 ; Clear X for indirect addressing for writing to screen
sta ($0,x) ; Draw the ball
pla ; Restore X
tax
decloop:
dex ; Decrement the X velocity
beq updatexpos ; If it's zero, time to adjust X
dey ; Decrement the Y velocity
bne decloop ; If it's not zero, loop, otherwise fall through to adjust Y
updateypos:
txa ; Preserve X
pha
jsr clearball ; Put background over the current ball position
updateyposnoclear:
lda $3 ; Get the Y velocity
and #1 ; See if it's down
bne moveup ; If not, then it's up, otherwise fall through to down
movedown:
clc ; Prepare for moving to the next Y line and doing the add
lda $0 ; Low byte of the current ball position
adc #$20 ; Next row
sta $0 ; Put it back
bcc ycollision ; If no carry, go on to check for collision
inc $1 ; Had a carry, fix the high byte of the address
bne ycollision ; Z flag is always clear ($1 will never be zero)
moveup:
sec ; Prepare for moving to the previous Y line and subtracting
lda $0 ; Low byte of the current ball position
sbc #$20 ; Previous row
sta $0 ; Put it back
lda $1 ; High byte
sbc #$0 ; Factor out the carry
sta $1 ; Put it back
ycollision:
ldx #0 ; Prepare for indirect read
lda ($0,x) ; Get the current pixel at the new ball position
bne ycollided ; If it's not zero (the background color) then we hit
ldy $3 ; Otherwise, load up the current Y velocity
pla ; Restore the X velocity
tax
jmp drawball ; Back to the top
ycollided:
cmp #$2 ; Border color?
beq ycollided2 ; If so, then we just bounce, don't eat a brick
; Erase brick
lda #0 ; Background color (black)
sta ($0,x) ; Erase it
ycollided2:
lda #1 ; Get ready to change direction
eor $3 ; Flip the low bit on the Y velocity (change direction)
sta $3 ; Put it back
jmp updateyposnoclear ; Go back to make sure we didn't hit anything else
updatexpos:
jsr clearball ; Put background over the current ball position
updatexposnoclear:
lda $2 ; Get the current X velocity
and #1 ; See if it's right by testing the low bit
bne moveleft ; If not, move left
moveright:
inc $0 ; Move right
bne xcollision ; Z flag is always clear
moveleft:
dec $0 ; Move left
xcollision:
ldx #0 ; Prepare for indirect read
lda ($0,x) ; Get the current pixel at the new ball position
bne xcollided ; If it's not zero (the background color) then we hit
ldx $2 ; Otherwise, load up the current X velocity
jmp drawball ; Back to the top
xcollided:
cmp #$2 ; Border color?
beq xcollided2 ; If so, then we just bounce, don't eat a brick
; Erase brick
lda #0 ; Background color (black)
sta ($0,x) ; Erase it
xcollided2:
lda #1 ; Get ready to change direction
eor $2 ; Flip the low bit on the X velocity (change direction)
sta $2 ; Put it back
jmp updatexposnoclear ; Go back to make sure we didn't hit anything else
clearball:
lda #0 ; Background color (black)
tax ; Clear X for indirect
sta ($0,x) ; Black out the ball
rts ; Return to caller
;-----------------------------------------------------
; demoscene.asm --------------------------------------
start:
ldx #0
c:lda bottombar,x
cmp #$ff
beq init
sta $4e0,x
sta $5e0,x
inx
jmp c
init:
jsr initDraw
lda #0
sta $10 ; scrptr
sta $11 ; txtptr
loop:
jsr drawMain
jsr putfont
jsr scrollarea
jmp loop
scrollarea:
ldx #0
g:lda $521,x
sta $520,x
lda $541,x
sta $540,x
lda $561,x
sta $560,x
lda $581,x
sta $580,x
lda $5a1,x
sta $5a0,x
inx
cpx #31
bne g
rts
putfont:
lda $10 ; scrptr
cmp #0
bne noNext
inc $11
ldx $11
lda scrolltext,x
tax
lda fontSize,x
sta $10
noNext:
dec $10
ldx $11
lda scrolltext,x
cmp #$ff
bne notResetText
lda #0
sta $10
sta $11
rts
notResetText:
asl
tax
lda fontlookup,x
sta $2
inx
lda fontlookup,x
sta $3
lda #fonts
adc $3
sta $1
ldy $10
lda ($00),y
sta $53f
tya
clc
adc #6
tay
lda ($00),y
sta $55f
tya
clc
adc #6
tay
lda ($00),y
sta $57f
tya
clc
adc #6
tay
lda ($00),y
sta $59f
tya
clc
adc #6
tay
lda ($00),y
sta $5bf
rts
initDraw:
lda #