4f.s
.setcpu "6502"
player_xpos := $0010
player_ypos := $0011
tile_xpos := $0012
tile_ypos := $0013
map_x := $0014
map_y := $0015
@britannia := $0019
current_location:= $001A
game_mode := $001B
dungeon_level := $001C
player_transport:= $001E
party_size := $001F
dng_direction := $0020
light_duration := $0021
moon_phase_trammel:= $0022
moon_phase_felucca:= $0023
horse_mode := $0024
ship_hull := $002B
move_counter := $002C
key_buf := $0030
key_buf_len := $0038
charptr := $003D
magic_aura := $0046
aura_duration := $0047
tile_under_player:= $0048
tile_north := $0049
tile_south := $004A
tile_east := $004B
tile_west := $004C
music_volume := $004D
console_xpos := $004E
console_ypos := $004F
diskid := $0050
numdrives := $0051
currdisk_drive1 := $0052
currdisk_drive2 := $0053
currplayer := $0054
hexnum := $0056
bcdnum := $0057
zptmp1 := $005A
reqdisk := $005E
currdrive := $005F
lt_y := $0060
lt_x := $0061
lt_rwflag := $0062
lt_addr_hi := $0063
monster_type := $0066
game_mode_temp := $0068
moongate_tile := $006D
moongate_xpos := $006E
moongate_ypos := $006F
movement_mode := $0074
direction := $0075
ptr2 := $007C
ptr1 := $007E
L8C03 := $8C03
gettile_bounds := $9F00
gettile := $9F26
mul11 := $9F49
L9F54 := $9F54
L9F78 := $9F78
gettile_combat := $9F85
L9F8C := $9F8C
gettile_town := $9FAF
gettile_dungeon := $9FCE
j_fileio := $A100
j_readblock := $A103
j_loadtitle := $A106
j_togglesnd := $A109
j_kernalin := $A10C
j_setirqv := $A10F
j_clearkbd := $A112
j_irqhandler := $A115
party_stats := $AA00
game_stats := $AB00
food_hi := $AB10
food_lo := $AB11
food_frac := $AB12
gold := $AB13
mixtures := $AB40
map_status := $AC00
object_xpos := $AC20
object_ypos := $AC40
object_tile := $AC60
monster_xpos := $AD00
monster_ypos := $AD10
monster_hp := $AD40
cbt_monster_type:= $AD50
monster_tile := $AD60
cbt_player_xpos := $AD80
cbt_player_ypos := $AD90
player_tile := $ADA0
missile := $ADFD
missile_xpos := $ADFE
missile_ypos := $ADFF
currmap := $AE00
tempmap := $AE80
music_ctl := $AF20
music_nop := $AF23
bmplineaddr_lo := $E000
bmplineaddr_hi := $E0C0
chrlineaddr_lo := $E180
chrlineaddr_hi := $E198
tile_color := $E1B0
music_init := $EC00
.word $0800
j_waitkey:
jmp waitkey
j_player_teleport:
jmp player_teleport
j_move_east:
jmp move_east
j_move_west:
jmp move_west
j_move_south:
jmp move_south
j_move_north:
jmp move_north
j_drawinterface:
jmp drawinterface
j_drawview:
jmp drawview
j_update_britannia:
jmp update_britannia
nop
nop
nop
j_primm_xy:
jmp primm_xy
j_primm:
jmp primm
j_console_out:
jmp console_out
j_clearbitmap:
jmp clearbitmap
j_mulax:
jmp mulax
j_get_stats_ptr:
jmp get_stats_ptr
j_printname:
jmp printname
j_printbcd:
jmp printbcd
j_drawcursor:
jmp drawcursor
j_drawcursor_xy:
jmp drawcursor_xy
j_drawvert:
jmp drawvert
j_drawhoriz:
jmp drawhoriz
j_request_disk:
jmp request_disk
j_update_status:
jmp update_status
j_blocked_tile:
jmp blocked_tile
j_idle:
jmp idle
j_rand:
jmp rand
j_loadsector:
jmp loadsector
j_playsfx:
jmp playsfx
j_idle_combat:
jmp idle_combat
j_getnumber:
jmp getnumber
j_getplayernum:
jmp getplayernum
j_update_wind:
jmp update_wind
j_animate_view:
jmp animate_view
j_printdigit:
jmp printdigit
j_clearstatwindow:
jmp clearstatwindow
j_animate_creatures:
jmp animate_creatures
j_centername:
jmp centername
j_print_direction:
jmp print_direction
j_clearview:
jmp clearview
j_invertview:
jmp invertview
j_centerstring:
jmp centerstring
j_printstring:
jmp printstring
j_gettile_bounds:
jmp gettile_bounds
j_gettile:
jmp gettile
jmp L9F54
jmp L9F78
j_gettile_combat:
jmp gettile_combat
jmp L9F8C
j_gettile_town:
jmp gettile_town
j_gettile_dungeon:
jmp gettile_dungeon
move_east:
inc player_xpos
inc tile_xpos
lda tile_xpos
cmp #$18
bcc @notileborder
jsr music_nop
@notileborder:
cmp #$1B
bcc movedone
and #$0F
sta tile_xpos
jsr map_scroll_east
inc map_x
lda map_x
and #$0F
sta map_x
jsr loadtiles_east
movedone:
rts
move_west:
dec player_xpos
dec tile_xpos
lda tile_xpos
cmp #$08
bcs @notileborder
jsr music_nop
@notileborder:
cmp #$05
bcs movedone
ora #$10
sta tile_xpos
jsr map_scroll_west
dec map_x
lda map_x
and #$0F
sta map_x
jmp loadtiles_west
move_south:
inc player_ypos
inc tile_ypos
lda tile_ypos
cmp #$18
bcc @notileborder
jsr music_nop
@notileborder:
cmp #$1B
bcc @done
and #$0F
sta tile_ypos
jsr map_scroll_south
inc map_y
lda map_y
and #$0F
sta map_y
jsr loadtiles_south
@done:
rts
move_north:
dec player_ypos
dec tile_ypos
lda tile_ypos
cmp #$08
bcs @notileborder
jsr music_nop
@notileborder:
cmp #$05
bcs @done
ora #$10
sta tile_ypos
jsr map_scroll_north
dec map_y
lda map_y
and #$0F
sta map_y
jsr loadtiles_north
@done:
rts
map_scroll_east:
ldx #$00
@scroll:
lda $E900,x
sta $E800,x
lda $EB00,x
sta $EA00,x
inx
bne @scroll
rts
map_scroll_west:
ldx #$00
@scroll:
lda $E800,x
sta $E900,x
lda $EA00,x
sta $EB00,x
inx
bne @scroll
rts
map_scroll_south:
ldx #$00
@scroll:
lda $EA00,x
sta $E800,x
lda $EB00,x
sta $E900,x
inx
bne @scroll
rts
map_scroll_north:
ldx #$00
@scroll:
lda $E800,x
sta $EA00,x
lda $E900,x
sta $EB00,x
inx
bne @scroll
rts
loadtiles_east:
lda #$01
sta lt_rwflag
clc
lda map_x
adc #$01
and #$0F
sta lt_x
lda map_y
sta lt_y
lda #$E9
sta lt_addr_hi
jsr loadsector
clc
lda map_y
adc #$01
and #$0F
sta lt_y
lda #$EB
sta lt_addr_hi
jmp loadsector
loadtiles_west:
lda #$01
sta lt_rwflag
clc
lda map_x
sta lt_x
lda map_y
sta lt_y
lda #$E8
sta lt_addr_hi
jsr loadsector
clc
lda map_y
adc #$01
and #$0F
sta lt_y
lda #$EA
sta lt_addr_hi
jmp loadsector
loadtiles_south:
lda #$01
sta lt_rwflag
clc
lda map_y
adc #$01
and #$0F
sta lt_y
lda map_x
sta lt_x
lda #$EA
sta lt_addr_hi
jsr loadsector
clc
lda map_x
adc #$01
and #$0F
sta lt_x
lda #$EB
sta lt_addr_hi
jmp loadsector
loadtiles_north:
lda #$01
sta lt_rwflag
clc
lda map_y
sta lt_y
lda map_x
sta lt_x
lda #$E8
sta lt_addr_hi
jsr loadsector
clc
lda map_x
adc #$01
and #$0F
sta lt_x
lda #$E9
sta lt_addr_hi
jmp loadsector
player_teleport:
lda player_xpos
jsr div16
sta map_x
lda player_xpos
and #$0F
sta tile_xpos
cmp #$08
bcs @eastern
clc
adc #$10
sta tile_xpos
dec map_x
lda map_x
and #$0F
sta map_x
@eastern:
lda player_ypos
jsr div16
sta map_y
lda player_ypos
and #$0F
sta tile_ypos
cmp #$08
bcs @southern
clc
adc #$10
sta tile_ypos
dec map_y
lda map_y
and #$0F
sta map_y
@southern:
lda #$01
sta lt_rwflag
lda map_x
sta lt_x
lda map_y
sta lt_y
lda #$E8
sta lt_addr_hi
jsr loadsector
clc
lda map_x
adc #$01
and #$0F
sta lt_x
lda #$E9
sta lt_addr_hi
jsr loadsector
clc
lda map_y
adc #$01
and #$0F
sta lt_y
lda #$EB
sta lt_addr_hi
jsr loadsector
lda map_x
sta lt_x
lda #$EA
sta lt_addr_hi
loadsector:
lda lt_rwflag
sta $A000
lda #$01
sta $A001
lda #$00
sta $A002
lda lt_addr_hi
sta $A003
lda lt_y
asl a
asl a
asl a
asl a
ora lt_x
adc #$01
sta $A004
lda #$00
adc #$00
sta $A005
jsr j_readblock
bcs loadsector
rts
waitkey:
lda #$80
sta idletimeout
@wait:
jsr scankey
jsr drawcursor
jsr getkey
bmi @gotkey
jsr idle
dec idletimeout
bne @wait
jsr clearcursor
lda #$00
rts
@gotkey:
pha
jsr clearcursor
pla
cmp #$00
rts
idletimeout:
.byte $00
idle:
lda game_mode
beq delay
bmi idle_other
idle_britannia:
cmp #$01
bne idle_towne
jsr update_wind
jsr update_balloon
jsr update_britannia
rts
idle_towne:
cmp #$02
bne idle_dungeon
jsr update_towne
rts
idle_dungeon:
cmp #$03
bne idle_delay
jsr animatetiles
jsr animate_fire
jsr L8C03
idle_delay:
jmp delay
idle_other:
cmp #$FF
beq @animate
jmp idle_combat
@animate:
jmp animate_view
delay:
ldx #$4B
ldy #$00
@delay:
dey
bne @delay
dex
bne @delay
rts
update_balloon:
lda player_transport
cmp #$18
bne @done
lda movement_mode
beq @done
dec movement_counter
lda movement_counter
and #$03
bne @done
@east:
ldx direction
bne @south
jmp move_east
@south:
dex
bne @west
jmp move_south
@west:
dex
bne @north
jmp move_west
@north:
jmp move_north
@done:
rts
movement_counter:
.byte $00
animate_view:
jsr animatetiles
jsr animate_fire
jmp drawview
idle_combat:
jsr animatetiles
jsr animate_fire
ldx #$7F
@copy:
lda tempmap,x
sta currmap,x
dex
bpl @copy
ldx #$0F
@nextmonster:
ldy monster_ypos,x
lda mul11,y
clc
adc monster_xpos,x
tay
lda cbt_monster_type,x
beq @next
lda $AD70,x
bne @dontanim
lda cbt_monster_type,x
cmp #$90
bcs @checkmimic
jsr rand
and #$01
@settile:
clc
adc cbt_monster_type,x
sta monster_tile,x
sta currmap,y
jmp @next
@checkmimic:
cmp #$AC
bne @anim4
lda monster_tile,x
cmp #$3C
bne @anim4
sta currmap,y
jmp @next
@anim4:
jsr rand
and #$01
beq @dontanim
inc monster_tile,x
lda monster_tile,x
and #$03
jmp @settile
@dontanim:
lda monster_tile,x
sta currmap,y
@next:
dex
bpl @nextmonster
animateplayers:
ldx party_size
@nextplayer:
lda $AD9F,x
beq @next
ldy $AD8F,x
lda mul11,y
clc
adc $AD7F,x
tay
lda $AD9F,x
cmp #$38
beq @settile
cpx $45
bne @animate
dec movement_counter
lda movement_counter
and #$03
bne @animate
lda #$7D
jmp @settile
@animate:
jsr rand
and #$01
clc
adc $AD9F,x
@settile:
sta currmap,y
@next:
dex
bne @nextplayer
lda missile
beq @done
ldx missile_ypos
lda mul11,x
clc
adc missile_xpos
tay
lda missile
sta currmap,y
@done:
jmp drawview
update_towne:
jsr animate_creatures
sec
lda player_xpos
sbc #$05
sta $40
sec
lda player_ypos
sbc #$05
sta $41
lda #$00
sta $42
sta $43
tay
tax
@nexttile:
clc
lda $40
adc $42
sta $44
cmp #$20
bcs @grass
clc
lda $41
adc $43
sta $45
cmp #$20
bcs @grass
sta ptr2+1
lda #$00
lsr ptr2+1
ror a
lsr ptr2+1
ror a
lsr ptr2+1
ror a
adc $44
sta ptr2
clc
lda ptr2+1
adc #$E8
sta ptr2+1
lda (ptr2),y
jmp @settile
@grass:
lda #$04
@settile:
sta tempmap,x
inx
inc $42
lda $42
cmp #$0B
bne @nexttile
sty $42
inc $43
lda $43
cmp #$0B
bne @nexttile
jmp update_monsters
update_britannia:
jsr animate_creatures
jsr update_moons
sec
lda tile_xpos
sbc #$05
sta $40
sec
lda tile_ypos
sbc #$05
sta $41
lda #$00
sta $42
sta $43
tay
tax
@copymap:
clc
lda $40
adc $42
sta $44
clc
lda $41
adc $43
sta $45
jsr mul16
sta ptr2
lda $44
and #$0F
ora ptr2
sta ptr2
lda $45
and #$10
asl a
ora $44
jsr div16
clc
adc #$E8
sta ptr2+1
lda (ptr2),y
sta tempmap,x
inx
inc $42
lda $42
cmp #$0B
bne @copymap
sty $42
inc $43
lda $43
cmp #$0B
bne @copymap
update_monsters:
ldx #$1F
@nextmonster:
lda map_status,x
beq @nomonster
lda object_xpos,x
clc
adc #$05
sec
sbc player_xpos
cmp #$0B
bcs @nomonster
sta $44
lda object_ypos,x
clc
adc #$05
sec
sbc player_ypos
cmp #$0B
bcs @nomonster
sta $45
ldy $45
lda mul11,y
clc
adc $44
tay
lda map_status,x
sta tempmap,y
@nomonster:
dex
bpl @nextmonster
lda moongate_tile
beq @skipmoongates
lda moongate_xpos
clc
adc #$05
sec
sbc player_xpos
cmp #$0B
bcs @skipmoongates
sta $44
lda moongate_ypos
clc
adc #$05
sec
sbc player_ypos
cmp #$0B
bcs @skipmoongates
sta $45
ldy $45
lda mul11,y
clc
adc $44
tay
lda moongate_tile
sta tempmap,y
@skipmoongates:
lda tempmap+49
sta tile_north
lda tempmap+71
sta tile_south
lda tempmap+61
sta tile_east
lda tempmap+59
sta tile_west
lda tempmap+60
sta tile_under_player
lda player_transport
sta tempmap+60
lda $1D
beq lineofsight
ldx #$78
@copy:
lda tempmap,x
sta currmap,x
dex
bpl @copy
jmp drawview
lineofsight:
ldx #$78
lda #$7E
@clear:
sta currmap,x
dex
bpl @clear
lda #$78
sta $70
lda #$0A
sta $44
sta $45
lospass1:
lda $44
sta $40
lda $45
sta $41
lda $70
sta $71
@nexttile:
ldx $40
ldy $41
lda $71
clc
adc deltax,x
clc
adc deltay,y
cmp #$3C
beq @playertile
sta $71
tax
lda tempmap,x
cmp #$06
beq @blocking
cmp #$08
beq @blocking
cmp #$49
beq @blocking
cmp #$7E
beq @blocking
cmp #$7F
beq @blocking
lda $40
tax
clc
adc deltax,x
sta $40
lda $41
tax
clc
adc deltax,x
sta $41
jmp @nexttile
@playertile:
ldx $70
lda tempmap,x
sta currmap,x
@blocking:
dec $70
dec $44
bpl lospass1
lda #$0A
sta $44
dec $45
bpl lospass1
lospass2:
lda #$78
sta $70
lda #$0A
sta $44
sta $45
@next:
lda $44
sta $40
lda $45
sta $41
lda $70
sta $71
tax
lda currmap,x
cmp #$7E
bne @blocking
@continue:
ldx $40
ldy $41
lda distance,x
cmp distance,y
beq @diagonal
bcc @vertical
bcs @horizontal
@diagonal:
lda $71
clc
adc deltax,x
clc
adc deltay,y
jsr nexthoriz
jsr nextvert
jmp @checkblock
@horizontal:
lda $71
clc
adc deltax,x
jsr nexthoriz
jmp @checkblock
@vertical:
lda $71
clc
adc deltay,y
jsr nextvert
@checkblock:
cmp #$3C
beq @playertile
sta $71
tax
lda tempmap,x
cmp #$06
beq @blocking
cmp #$08
beq @blocking
cmp #$49
beq @blocking
cmp #$7E
beq @blocking
cmp #$7F
beq @blocking
jmp @continue
@playertile:
ldx $70
lda tempmap,x
sta currmap,x
@blocking:
dec $70
dec $44
bpl @next
lda #$0A
sta $44
dec $45
bmi drawview
jmp @next
drawview:
lda ptr1
pha
lda ptr1+1
pha
lda ptr2
pha
lda ptr2+1
pha
lda $58
pha
lda $59
pha
lda #$00
sta @ldy_addr
lda #$29
sta $58
lda #$04
sta $59
ldy #$08
lda bmplineaddr_lo,y
sta ptr2
lda bmplineaddr_hi,y
sta ptr2+1
lda ptr2
clc
adc #$08
sta ptr2
lda ptr2+1
adc #$00
sta ptr2+1
lda #$00
sta $72
@nextline:
lda #$00
sta tilenum
@nexttile:
.byte $AC
@ldy_addr:
.word $AE00
tya
pha
jsr gettileaddr
lda tilenum
sec
asl a
tay
pla
tax
lda tile_color,x
sta ($58),y
iny
sta ($58),y
pha
tya
clc
adc #$27
tay
pla
sta ($58),y
iny
sta ($58),y
ldy #$0F
@drawupper:
lda (ptr1),y
sta (ptr2),y
dey
bpl @drawupper
lda ptr1+1
eor #$70
sta ptr1+1
lda ptr2
pha
clc
adc #$40
sta ptr2
lda ptr2+1
pha
adc #$01
sta ptr2+1
ldy #$0F
@drawlower:
lda (ptr1),y
sta (ptr2),y
dey
bpl @drawlower
lda ptr1+1
eor #$70
sta ptr1+1
pla
sta ptr2+1
pla
sta ptr2
inc @ldy_addr
lda ptr2
clc
adc #$10
sta ptr2
lda ptr2+1
adc #$00
sta ptr2+1
inc tilenum
lda tilenum
cmp #$0B
bne @nexttile
lda $58
clc
adc #$50
sta $58
lda $59
adc #$00
sta $59
lda ptr2
clc
adc #$D0
sta ptr2
lda ptr2+1
adc #$01
sta ptr2+1
inc $72
lda $72
cmp #$0B
beq @done
jmp @nextline
@done:
pla
sta $59
pla
sta $58
pla
sta ptr2+1
pla
sta ptr2
pla
sta ptr1+1
pla
sta ptr1
rts
tilenum:
.byte $00
deltax:
.byte $01,$01,$01,$01,$01,$00,$FF,$FF
.byte $FF,$FF,$FF
deltay:
.byte $0B,$0B,$0B,$0B,$0B,$00,$F5,$F5
.byte $F5,$F5,$F5
distance:
.byte $05,$04,$03,$02,$01,$00,$01,$02
.byte $03,$04,$05
nexthoriz:
pha
lda $40
tax
clc
adc deltax,x
sta $40
pla
rts
nextvert:
pha
lda $41
tax
clc
adc deltax,x
sta $41
pla
rts
animate_creatures:
ldx #$00
@animate_next:
lda object_tile,x
beq @animend
bpl @animate_nonmonster
cmp #$90
bcs @animate_monster
cmp #$80
beq @animdone
@animate_seamonster:
jsr fastrand
cmp #$C0
bcs @animdone
lda map_status,x
eor #$01
and #$01
ora object_tile,x
sta map_status,x
jmp @animdone
@animate_monster:
jsr fastrand
cmp #$C0
bcs @animdone
lda map_status,x
clc
adc #$01
and #$03
ora object_tile,x
sta map_status,x
jmp @animdone
@animate_nonmonster:
cmp #$50
bcc @animate_player
cmp #$60
bcs @dontanim
@animate_npc:
jmp @animate_seamonster
@animate_player:
cmp #$20
bcc @dontanim
cmp #$30
bcs @dontanim
jmp @animate_seamonster
@dontanim:
lda object_tile,x
sta map_status,x
jmp @animdone
@animend:
lda #$00
sta map_status,x
@animdone:
inx
cpx #$20
bcc @animate_next
jsr animatetiles
jsr animate_fire
jmp animate_flags
primm_xy:
stx console_xpos
sty console_ypos
primm:
pla
sta primmaddr
pla
sta L1018
@next:
inc primmaddr
bne @skip
inc L1018
@skip:
primmaddr := * + 1
L1018 := * + 2
lda $FFFF
beq @done
jsr console_out
jmp @next
@done:
lda L1018
pha
lda primmaddr
pha
rts
console_out:
cmp #$8D
beq console_newline
and #$7F
ldx console_xpos
cpx #$28
bcc @noteol
pha
jsr console_newline
pla
@noteol:
jsr drawchar
inc console_xpos
rts
console_newline:
lda #$18
sta console_xpos
inc console_ypos
lda console_ypos
cmp #$18
bcc @notbottom
dec console_ypos
jsr console_scroll
@notbottom:
rts
get_stats_ptr:
lda currplayer
sec
sbc #$01
jsr mul32
sta ptr1
lda #$AA
sta ptr1+1
rts
centername:
jsr get_stats_ptr
lda #$00
sta zptmp1
@count:
ldy zptmp1
lda (ptr1),y
beq @gotlen
inc zptmp1
lda zptmp1
cmp #$0F
bcc @count
@gotlen:
lda #$0F
sec
sbc zptmp1
lsr a
clc
adc console_xpos
sta console_xpos
printname:
jsr get_stats_ptr
lda #$00
sta zptmp1
@print:
ldy zptmp1
lda (ptr1),y
beq @done
jsr console_out
inc zptmp1
lda zptmp1
cmp #$0F
bcc @print
@done:
rts
printname8:
jsr get_stats_ptr
lda #$00
sta zptmp1
@print:
ldy zptmp1
lda (ptr1),y
beq @done
jsr console_out
inc zptmp1
lda zptmp1
cmp #$08
bcc @print
@done:
rts
drawcursor_xy:
stx console_xpos
sty console_ypos
drawcursor:
dec cursor_ctr
lda cursor_ctr
and #$7F
ora #$7C
bne dodrawcursor
clearcursor:
lda #$20
dodrawcursor:
jsr console_out
dec console_xpos
rts
cursor_ctr:
.byte $00
printbcd:
sta zptmp1
jsr div16
clc
adc #$30
jsr console_out
lda zptmp1
and #$0F
printdigit:
clc
adc #$30
jmp console_out
clearstatwindow:
jsr drawhoriz
.byte $18,$00,$04,$05,$04,$05,$04,$05
.byte $04,$05,$04,$05,$04,$05,$04,$05
.byte $04,$FF
ldx #$08
@clearstatline:
lda bmplineaddr_lo,x
sta ptr1
lda bmplineaddr_hi,x
sta ptr1+1
lda ptr1
clc
adc #$C0
sta ptr1
lda ptr1+1
adc #$00
sta ptr1+1
ldy #$00
@clear:
lda #$00
sta (ptr1),y
iny
cpy #$78
bcc @clear
txa
clc
adc #$08
tax
cpx #$48
bcc @clearstatline
rts
.byte $CD
update_status:
lda #$E5
sta ptr1+1
lda #$00
sta ptr1
ldx #$00
@next_virtue:
lda game_stats,x
beq @partial_avatar
lda #$00
beq @not_avatar
@partial_avatar:
txa
clc
adc #$78
tay
lda (ptr1),y
@not_avatar:
pha
txa
clc
adc #$28
tay
pla
sta (ptr1),y
inx
cpx #$08
bne @next_virtue
jsr stats_save_pos
lda currplayer
pha
lda party_size
sta currplayer
@nextplayer:
ldx currplayer
jsr get_stats_ptr
lda currplayer
sta console_ypos
lda #$18
sta console_xpos
lda currplayer
jsr printdigit
lda #$AD
jsr console_out
jsr printname8
lda #$23
sta console_xpos
jsr get_stats_ptr
ldy #$18
lda (ptr1),y
jsr printdigit
ldy #$19
lda (ptr1),y
jsr printbcd
ldy #$12
lda (ptr1),y
jsr console_out
jsr scankey
dec currplayer
bne @nextplayer
@printfood:
ldx #$18
ldy #$0A
jsr primm_xy
.byte $C6,$BA,$00
ldy #$10
lda game_stats,y
jsr printbcd
ldy #$11
lda game_stats,y
jsr printbcd
lda #$A0
jsr console_out
lda magic_aura
jsr console_out
lda player_transport
cmp #$14
bcc @ship
jsr primm
.byte $A0,$C7,$BA,$00
ldy #$13
lda game_stats,y
jsr printbcd
ldy #$14
lda game_stats,y
jsr printbcd
jmp @done
@ship:
jsr primm
.byte $A0,$D3,$C8,$D0,$BA,$00
lda ship_hull
jsr printbcd
@done:
pla
sta currplayer
jmp stats_rest_pos
stats_saved_xpos:
.byte $00
stats_saved_xpos:
.byte $00
update_wind:
jsr rand
bne @nochange
jsr rand
jsr getsign
clc
adc direction
and #$03
sta direction
@nochange:
jsr stats_save_pos
lda #$17
sta console_ypos
lda #$06
sta console_xpos
jsr primm
.byte $1E,$D7,$C9,$CE,$C4,$A0,$00
ldx direction
beq @west
dex
beq @north
dex
beq @east
dex
beq @south
bne @done
@west:
jsr printwest
jmp @done
@north:
jsr printnorth
jmp @done
@east:
jsr printeast
jmp @done
@south:
jsr printsouth
@done:
lda #$1D
jsr console_out
jmp stats_rest_pos
print_direction:
jsr stats_save_pos
lda #$17
sta console_ypos
lda #$07
sta console_xpos
jsr primm
.byte $C4,$C9,$D2,$BA,$A0,$00
ldx dng_direction
beq @north
dex
beq @east
dex
beq @south
bne @west
@north:
jsr printnorth
jmp @printlevel
@east:
jsr printeast
jmp @printlevel
@south:
jsr printsouth
jmp @printlevel
@west:
jsr printwest
@printlevel:
lda #$00
sta console_ypos
lda #$0B
sta console_xpos
lda #$CC
jsr console_out
lda dungeon_level
clc
adc #$01
jsr printdigit
jmp stats_rest_pos
printnorth:
jsr primm
.byte $CE,$CF,$D2,$D4,$C8,$00
rts
printsouth:
jsr primm
.byte $D3,$CF,$D5,$D4,$C8,$00
rts
printeast:
jsr primm
.byte $A0,$C5,$C1,$D3,$D4,$00
rts
printwest:
jsr primm
.byte $A0,$D7,$C5,$D3,$D4,$00
rts
getsign:
cmp #$00
beq @zero
bmi @negative
lda #$01
rts
@negative:
lda #$FF
@zero:
rts
stats_save_pos:
lda console_xpos
sta stats_saved_xpos
lda console_ypos
sta stats_saved_xpos
rts
stats_rest_pos:
lda stats_saved_xpos
sta console_xpos
lda stats_saved_xpos
sta console_ypos
rts
getnumdel:
dec console_xpos
getnumber:
jsr waitkey
sec
sbc #$B0
cmp #$0A
bcs getnumber
sta bcdnum
sta hexnum
jsr printdigit
@seconddigit:
jsr waitkey
cmp #$8D
beq @done
cmp #$88
beq getnumdel
sec
sbc #$B0
cmp #$0A
bcs @seconddigit
sta hexnum
jsr printdigit
@notretordel:
jsr waitkey
cmp #$8D
beq @convhex
cmp #$88
bne @notretordel
dec console_xpos
bpl @seconddigit
@convhex:
lda bcdnum
jsr mul16
ora hexnum
sta bcdnum
ldx #$00
sed
sec
@count:
sbc #$01
bcc @counted
inx
bne @count
@counted:
stx hexnum
cld
@done:
rts
getplayernum:
jsr waitkey
beq @gotnum
sec
sbc #$B0
cmp #$09
bcc @gotnum
lda #$00
@gotnum:
sta currplayer
jsr printdigit
jsr console_newline
lda currplayer
rts
blocked_tile:
ldx #$28
@next:
dex
bmi @blocked
cmp walkable_tiles,x
bne @next
rts
@blocked:
lda #$FF
rts
walkable_tiles:
.byte $03,$04,$05,$06,$07,$09,$0A,$0B
.byte $0C,$10,$11,$12,$13,$14,$15,$16
.byte $17,$18,$19,$1A,$1B,$1C,$1D,$1E
.byte $3C,$3E,$3F,$43,$44,$46,$47,$49
.byte $4A,$4C,$4C,$4C,$8C,$8D,$8E,$8F
clearbitmap:
lda #$00
sta ptr1
tay
ldx #$20
stx ptr1+1
@clear:
sta (ptr1),y
iny
bne @clear
inc ptr1+1
dex
bne @clear
rts
clearchars:
lda #$00
sta ptr1
lda #$04
sta ptr1+1
ldx #$04
ldy #$00
lda #$10
@clear:
sta (ptr1),y
iny
bne @clear
inc ptr1+1
dex
bne @clear
rts
clearview:
lda #$40
sta ptr1
lda #$21
sta ptr1+1
ldx #$01
@nextline:
lda #$00
ldy #$08
@clear:
sta (ptr1),y
iny
cpy #$B8
bne @clear
lda ptr1
clc
adc #$40
sta ptr1
lda ptr1+1
adc #$01
sta ptr1+1
inx
cpx #$17
bne @nextline
rts
invertview:
lda #$40
sta ptr1
lda #$21
sta ptr1+1
ldx #$01
@nextline:
ldy #$08
@invert:
lda (ptr1),y
eor #$FF
sta (ptr1),y
iny
cpy #$B8
bne @invert
lda ptr1
clc
adc #$40
sta ptr1
lda ptr1+1
adc #$01
sta ptr1+1
inx
cpx #$17
bne @nextline
rts
mulax:
sta zptmp1
lda #$00
cpx #$00
beq @zero
@add:
clc
adc zptmp1
dex
bne @add
@zero:
rts
lda tile_ypos
jsr mul16
sta ptr2
lda tile_xpos
and #$0F
ora ptr2
sta ptr2
lda tile_ypos
and #$10
asl a
ora tile_xpos
jsr div16
clc
adc #$E8
sta ptr2+1
rts
animatetiles:
lda #$00
jsr @animate
lda #$01
jsr @animate
lda #$02
jsr @animate
lda #$4C
jmp @animate
@animate:
tay
txa
pha
lda ptr1
pha
lda ptr1+1
pha
jsr animatetile
pla
sta ptr1+1
pla
sta ptr1
pla
tax
rts
animatetile:
jsr gettileaddr
jsr @shiftcolumn
lda ptr1
clc
adc #$08
sta ptr1
@shiftcolumn:
ldy #$00
lda (ptr1),y
sta @savebyte
iny
ldx #$0F
@shift:
lda (ptr1),y
pha
lda @savebyte
sta (ptr1),y
pla
sta @savebyte
iny
cpy #$08
bne @s
ldy #$00
lda ptr1+1
eor #$70
sta ptr1+1
@s: dex
bne @shift
ldy #$00
lda @savebyte
sta (ptr1),y
rts
@savebyte:
.byte $22
gettileaddr:
sty ptr1
lda #$00
sta ptr1+1
asl ptr1
rol ptr1+1
asl ptr1
rol ptr1+1
asl ptr1
rol ptr1+1
asl ptr1
rol ptr1+1
lda ptr1+1
clc
adc #$B0
sta ptr1+1
rts
animate_fire:
ldy #$44
jsr gettileaddr
jsr fillrand
lda ptr1+1
eor #$70
sta ptr1+1
jsr fillrand
ldy #$4A
jsr gettileaddr
jsr randfire
lda ptr1+1
eor #$70
sta ptr1+1
jsr randfire
rts
fillrand:
ldy #$00
@fill:
jsr fastrand
sta (ptr1),y
iny
cpy #$40
bne @fill
rts
randfire:
ldy #$00
@rand:
jsr fastrand
and (ptr1),y
pha
tya
clc
adc #$10
tay
pla
eor (ptr1),y
sta (ptr1),y
tya
sec
sbc #$10
tay
iny
cpy #$10
bne @rand
rts
iny
cpy #$08
bne L1503
ldy #$00
lda ptr1+1
eor #$70
sta ptr1+1
L1503:
rts
animate_flags:
jsr fastrand
bmi @castle
ldx $B0A3
ldy $B0A4
sty $B0A3
stx $B0A4
@castle:
jsr fastrand
bmi @lbcastle
ldx $B0B9
ldy $B0BA
sty $B0B9
stx $B0BA
@lbcastle:
jsr fastrand
bmi @shipwest
ldx $B0E1
ldy $B0E2
sty $B0E1
stx $B0E2
@shipwest:
jsr fastrand
bmi @shipeast
ldx $B102
ldy $B103
sty $B102
stx $B103
ldx $B10A
ldy $B10B
sty $B10A
stx $B10B
@shipeast:
jsr fastrand
bmi @flagsdone
ldx $B122
ldy $B123
sty $B122
stx $B123
ldx $B12A
ldy $B12B
sty $B12A
stx $B12B
@flagsdone:
rts
div32:
lsr a
div16:
lsr a
lsr a
lsr a
lsr a
rts
mul32:
asl a
mul16:
asl a
asl a
asl a
asl a
rts
scankey:
lda $C6
php
lda $0277
ora #$80
plp
beq @done
cmp #$A0
bne @notspace
ldy #$00
sty key_buf_len
@notspace:
nop
ldy key_buf_len
cpy #$08
bcs @done
sta key_buf,y
inc key_buf_len
jsr clearkbd
@done:
rts
clearkbd:
pha
lda #$00
sta $C6
pla
rts
getkey:
lda key_buf_len
beq @empty
lda key_buf
pha
dec key_buf_len
beq @gotkey
ldy #$00
@movebuf:
lda key_buf+1,y
sta key_buf,y
iny
cpy key_buf_len
bcc @movebuf
@gotkey:
pla
cmp #$00
@empty:
rts
rand:
txa
pha
clc
ldx #$0E
lda rndf
@add:
adc rnd0,x
sta rnd0,x
dex
bpl @add
ldx #$0F
@inc:
inc rnd0,x
bne @done
dex
bpl @inc
@done:
pla
tax
lda rnd0
rts
rnd0:
.byte $64
rnd1:
.byte $76
rnd2:
.byte $85
rnd3:
.byte $54,$F6,$5C,$76,$1F,$E7,$12,$A7
.byte $6B,$93,$C4,$6E
rndf:
.byte $1B
fastrand:
lda rnd3
adc rnd2
sta rnd2
eor rnd1
sta rnd1
adc rnd0
sta rnd0
sta rnd3
rts
console_scroll:
ldx #$60
doscroll:
lda bmplineaddr_lo,x
clc
adc #$C0
sta @scrolldst
lda bmplineaddr_hi,x
adc #$00
sta @scrolldst+1
lda bmplineaddr_lo+8,x
clc
adc #$C0
sta @scrollsrc
lda bmplineaddr_hi+8,x
adc #$00
sta @scrollsrc+1
ldy #$00
@scroll:
.byte $B9
@scrollsrc:
.word $FFFF
.byte $99
@scrolldst:
.word $FFFF
iny
bpl @scroll
txa
lsr a
lsr a
lsr a
tay
lda chrlineaddr_lo,y
sta @scdst
lda chrlineaddr_hi,y
sta @scdst+1
lda chrlineaddr_lo+1,y
sta @scsrc
lda chrlineaddr_hi+1,y
sta @scsrc+1
ldy #$18
@scrollchar:
.byte $B9
@scsrc:
.word $FFFF
.byte $99
@scdst:
.word $FFFF
iny
cpy #$28
bne @scrollchar
txa
clc
adc #$08
tax
cpx #$B8
bne doscroll
jsr drawhoriz
.byte $18,$17,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$FF
rts
drawchar:
sta charptr
lda console_ypos
asl a
asl a
asl a
sta charptr+1
lda charptr
jsr mul8
sta @charsrc
txa
clc
adc #$E4
sta @charsrc+1
ldy charptr+1
lda bmplineaddr_lo,y
sta @chardst
lda bmplineaddr_hi,y
sta @chardst+1
lda console_xpos
jsr mul8
clc
adc @chardst
sta @chardst
txa
adc @chardst+1
sta @chardst+1
ldy #$07
@drawchar:
.byte $B9
@charsrc:
.word $FFFF
.byte $99
@chardst:
.word $FFFF
dey
bpl @drawchar
ldy console_ypos
lda chrlineaddr_lo,y
sta @charaddr
lda chrlineaddr_hi,y
sta @charaddr+1
ldy charptr
lda $E2B0,y
ldy console_xpos
.byte $99
@charaddr:
.word $FFFF
ldy #$00
rts
mul8:
pha
lda #$00
sta @msb
pla
asl a
rol @msb
asl a
rol @msb
asl a
rol @msb
ldx @msb
rts
@msb:
.byte $2C
drawvert:
lda #$80
sta draw_hvflag
jmp dodrawvh
drawhoriz:
lda #$00
sta draw_hvflag
dodrawvh:
lda console_xpos
sta draw_savex
lda console_ypos
sta draw_savey
pla
sta ptr2
pla
sta ptr2+1
jsr @next
ldy #$00
lda (ptr2),y
sta console_xpos
jsr @next
lda (ptr2),y
sta console_ypos
@draw:
jsr @next
lda (ptr2),y
bmi @drawdone
jsr drawchar
bit draw_hvflag
bmi @vert
inc console_xpos
jmp @draw
@vert:
inc console_ypos
jmp @draw
@drawdone:
lda ptr2+1
pha
lda ptr2
pha
lda draw_savex
sta console_xpos
lda draw_savey
sta console_ypos
rts
@next:
inc ptr2
bne @gotnext
inc ptr2+1
@gotnext:
rts
draw_hvflag:
.byte $00
draw_savex:
.byte $00
draw_savey:
.byte $00
drawinterface:
jsr clearbitmap
jsr clearchars
jsr drawhoriz
.byte $00,$00,$10,$05,$04,$05,$04,$05
.byte $04,$05,$04,$05,$1E,$20,$20,$1D
.byte $04,$05,$04,$05,$04,$05,$04,$05
.byte $04,$01,$04,$05,$04,$05,$04,$05
.byte $04,$05,$04,$05,$04,$05,$04,$05
.byte $04,$13,$FF
jsr drawvert
.byte $00,$01,$0A,$0A,$0A,$0A,$0A,$0A
.byte $0A,$0A,$0A,$0A,$0A,$0A,$0A,$0A
.byte $0A,$0A,$0A,$0A,$0A,$0A,$0A,$0A
.byte $14,$FF
jsr drawhoriz
.byte $01,$17,$03,$02,$03,$02,$03,$02
.byte $03,$02,$03,$02,$03,$02,$03,$02
.byte $03,$02,$03,$02,$03,$02,$03,$02
.byte $FF
jsr drawvert
.byte $17,$01,$0D,$0D,$0D,$0D,$0D,$0D
.byte $0D,$0D,$09,$0D,$09,$0D,$0D,$0D
.byte $0D,$0D,$0D,$0D,$0D,$0D,$0D,$0D
.byte $0B,$FF
jsr drawvert
.byte $27,$01,$09,$09,$09,$09,$09,$09
.byte $09,$09,$01,$09,$05,$FF
jsr drawhoriz
.byte $18,$09,$06,$07,$06,$07,$06,$07
.byte $06,$07,$06,$07,$06,$07,$06,$07
.byte $06,$FF
jsr drawhoriz
.byte $18,$0B,$06,$07,$06,$07,$06,$07
.byte $06,$07,$06,$07,$06,$07,$06,$07
.byte $06,$FF
rts
moon_gfx:
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$10,$20,$40,$40,$20,$10,$00
.byte $00,$10,$30,$70,$70,$30,$10,$00
.byte $00,$18,$38,$7C,$7C,$38,$18,$00
.byte $00,$18,$3C,$7E,$7E,$3C,$18,$00
.byte $00,$18,$1C,$3E,$3E,$1C,$18,$00
.byte $00,$08,$0C,$0E,$0E,$0C,$08,$00
.byte $00,$08,$04,$02,$02,$04,$08,$00
update_moons:
txa
pha
clc
lda moon_counter
adc #$40
sta moon_counter
bne @noupdate
inc moon_ctr_trammel
inc moon_ctr_trammel
lda moon_ctr_trammel
and #$E0
lsr a
lsr a
tay
ldx #$00
@trammel:
lda moon_gfx,y
sta $2058,x
iny
inx
cpx #$08
bne @trammel
clc
lda moon_ctr_felucca
adc #$06
sta moon_ctr_felucca
and #$E0
lsr a
lsr a
tay
pha
ldx #$00
@felucca:
lda moon_gfx,y
sta $2060,x
iny
inx
cpx #$08
bne @felucca
pla
tay
@noupdate:
pla
tax
lda moon_ctr_trammel
jsr div32
sta moon_phase_trammel
lda moon_ctr_felucca
jsr div32
sta moon_phase_felucca
lda moon_ctr_trammel
and #$1F
beq @moongate_appears
cmp #$1E
beq @moongate_disappears
rts
@moongate_appears:
jsr moongate_update
lda $71
clc
adc #$40
sta moongate_tile
rts
@moongate_disappears:
jsr moongate_update
lda $71
eor #$03
clc
adc #$40
sta moongate_tile
rts
moongate_update:
lda moon_ctr_trammel
and #$E0
jsr div32
tax
lda moongate_xtab,x
sta moongate_xpos
lda moongate_ytab,x
sta moongate_ypos
lda moon_counter
and #$C0
rol a
rol a
rol a
sta $71
rts
moon_counter:
.byte $00
moon_ctr_trammel:
.byte $00
moon_ctr_felucca:
.byte $00
moongate_xtab:
.byte $E0,$60,$26,$32,$A6,$68,$17,$BB
moongate_ytab:
.byte $85,$66,$E0,$25,$13,$C2,$7E,$A7
request_disk:
sta reqdisk
@request:
lda reqdisk
cmp #$02
beq @twodrives
cmp #$04
beq @twodrives
@onedrive:
lda #$01
sta currdrive
lda reqdisk
cmp currdisk_drive1
beq @checkdisk
@askchange:
jsr primm
.byte $8D,$D0,$CC,$C5,$C1,$D3,$C5,$A0
.byte $D0,$CC,$C1,$C3,$C5,$A0,$D4,$C8
.byte $C5,$8D,$00
jsr askdisk
jsr primm
.byte $A0,$C4,$C9,$D3,$CB,$8D,$C9,$CE
.byte $D4,$CF,$A0,$C4,$C5,$D6,$C9,$C3
.byte $C5,$A0,$00
lda currdrive
clc
adc #$07
jsr printdigit
jsr primm
.byte $8D,$C1,$CE,$C4,$A0,$D0,$D2,$C5
.byte $D3,$D3,$A0,$DB,$C6,$B1,$DD,$8D
.byte $00
@wait:
jsr waitkey
cmp #$85
bne @wait
beq @checkdisk
@twodrives:
lda numdrives
cmp #$02
bcc @onedrive
lda #$02
sta currdrive
lda reqdisk
cmp currdisk_drive2
beq @checkdisk
bne @askchange
@checkdisk:
lda currdrive
lda #$CC
ldx #$00
jsr j_fileio
ldx currdrive
lda diskid
sta numdrives,x
cmp reqdisk
beq @done
jmp @request
@done:
rts
askdisk:
ldx reqdisk
@program:
dex
bne @britannia
jsr primm
.byte $D0,$D2,$CF,$C7,$D2,$C1,$CD,$00
rts
@britannia:
dex
bne @towne
jsr primm
.byte $C2,$D2,$C9,$D4,$C1,$CE,$CE,$C9
.byte $C1,$00
rts
@towne:
dex
bne @underworld
jsr primm
.byte $D4,$CF,$D7,$CE,$C5,$00
rts
@underworld:
jsr primm
.byte $D5,$CE,$C4,$C5,$D2,$D7,$CF,$D2
.byte $CC,$C4,$00
rts
playsfx:
jsr @play
lda #$0F
sta $D418
rts
@play:
asl a
tay
lda sfxtab+1,y
pha
lda sfxtab,y
pha
rts
sfxtab:
.word sfx_walk-1
.word sfx_error2-1
.word sfx_error1-1
.word sfx_unknown1-1
.word sfx_attack-1
.word sfx_unknown2-1
.word sfx_player_hits-1
.word sfx_monster_hits-1
.word sfx_flee-1
.word sfx_magic2-1
.word sfx_magic1-1
.word sfx_unknown3-1
.word sfx_unknown4-1
sfx_walk:
ldy #$06
@repeat:
jsr rand
and #$3F
ora #$20
tax
@delay:
dex
bne @delay
jsr j_togglesnd
dey
bne @repeat
rts
sfx_error2:
ldy #$32
@delay:
pha
pla
dex
bne @delay
jsr j_togglesnd
dey
bne @delay
rts
sfx_error1:
ldy #$32
@delay:
nop
nop
dex
bne @delay
jsr j_togglesnd
dey
bne @delay
jmp sfx_error2
sfx_unknown1:
ldx #$00
stx zptmp1
@delay:
inx
bne @delay
jsr j_togglesnd
dec zptmp1
ldx zptmp1
bne @delay
rts
sfx_attack:
lda #$FF
tax
tay
@delay:
dex
bne @delay
jsr j_togglesnd
dey
tya
tax
bmi @delay
rts
sfx_unknown2:
lda #$80
tax
tay
@delay:
dex
bne @delay
jsr j_togglesnd
iny
tya
tax
bmi @delay
rts
sfx_player_hits:
ldy #$FF
@repeat:
jsr rand
and #$7F
tax
@delay:
dex
bne @delay
jsr j_togglesnd
dey
bne @repeat
rts
sfx_monster_hits:
ldy #$FF
@repeat:
jsr rand
ora #$80
tax
@delay:
dex
bne @delay
jsr j_togglesnd
dey
bne @repeat
rts
sfx_magic2:
stx sfx_m2_ctr2
lda #$01
sta sfx_m2_ctr1
@1: lda #$30
sta $70
@2: ldx sfx_m2_ctr2
@3: dex
bne @3
jsr j_togglesnd
ldx sfx_m2_ctr1
@4: dex
bne @4
jsr j_togglesnd
dec $70
bne @2
dec sfx_m2_ctr2
inc sfx_m2_ctr1
lda sfx_m2_ctr1
cmp #$1B
bne @1
@5: lda #$30
sta $70
@6: ldx sfx_m2_ctr2
@7: dex
bne @7
jsr j_togglesnd
ldx sfx_m2_ctr1
@8: dex
bne @8
jsr j_togglesnd
dec $70
bne @6
dec sfx_m2_ctr1
inc sfx_m2_ctr2
lda sfx_m2_ctr1
cmp #$00
bne @5
rts
sfx_m2_ctr1:
brk
sfx_m2_ctr2:
brk
sfx_flee:
ldx #$7F
stx zptmp1
@delay:
dex
bne @delay
jsr j_togglesnd
dec zptmp1
ldx zptmp1
bne @delay
rts
sfx_magic1:
stx $70
@again:
jsr rand
ldx #$28
@repeat:
tay
@delay:
dey
bne @delay
jsr j_togglesnd
dex
bne @repeat
dec $70
bne @again
rts
sfx_unknown3:
lda #$40
@1: ldy #$20
@2: tax
@3: pha
pla
dex
bne @3
jsr j_togglesnd
dey
bne @2
clc
adc #$01
cmp #$C0
bcc @1
rts
sfx_unknown4:
lda #$C0
@1: ldy #$20
@2: tax
@3: pha
pla
dex
bne @3
jsr j_togglesnd
dey
bne @2
sec
sbc #$01
cmp #$40
bcs @1
rts
centerstring:
pha
tay
lda #$BA
sta ptr1
lda #$1B
sta ptr1+1
ldx #$00
stx $58
@checkeos:
lda (ptr1,x)
bpl @endofstr
@next:
jsr nextstrchar
jmp @checkeos
@endofstr:
dey
beq @foundstr
jmp @next
@foundstr:
jsr nextstrchar
ldx #$00
lda (ptr1,x)
bpl @lastchar
inc $58
jmp @foundstr
@lastchar:
inc $58
lda #$0F
sec
sbc $58
lsr a
clc
adc console_xpos
sta console_xpos
pla
printstring:
tay
lda #$BA
sta ptr1
lda #$1B
sta ptr1+1
ldx #$00
@checkeos:
lda (ptr1,x)
bpl @endofstr
@next:
jsr nextstrchar
jmp @checkeos
@endofstr:
dey
beq @foundstr
jmp @next
@foundstr:
jsr nextstrchar
ldx #$00
lda (ptr1,x)
bpl @lastchar
jsr console_out
jmp @foundstr
@lastchar:
ora #$80
jmp console_out
nextstrchar:
inc ptr1
bne @nomsb
inc ptr1+1
@nomsb:
rts
strings:
.byte $00
@pirate0:
.byte $D0,$C9,$D2,$C1,$D4,$45
@pirate:
.byte $D0,$C9,$D2,$C1,$D4,$45
@nixie:
.byte $CE,$C9,$D8,$C9,$45
@squid:
.byte $D3,$D1,$D5,$C9,$44
@serpent:
.byte $D3,$C5,$D2,$D0,$C5,$CE,$54
@seahorse:
.byte $D3,$C5,$C1,$C8,$CF,$D2,$D3,$45
@whirlpool:
.byte $D7,$C8,$C9,$D2,$CC,$D0,$CF,$CF
.byte $4C
@twister:
.byte $D4,$D7,$C9,$D3,$D4,$C5,$52
@rat:
.byte $D2,$C1,$54
@bat:
.byte $C2,$C1,$54
@spider:
.byte $D3,$D0,$C9,$C4,$C5,$52
@ghost:
.byte $C7,$C8,$CF,$D3,$54
@slime:
.byte $D3,$CC,$C9,$CD,$45
@troll:
.byte $D4,$D2,$CF,$CC,$4C
@gremlin:
.byte $C7,$D2,$C5,$CD,$CC,$C9,$4E
@mimic:
.byte $CD,$C9,$CD,$C9,$43
@reaper:
.byte $D2,$C5,$C1,$D0,$C5,$52
@insects:
.byte $C9,$CE,$D3,$C5,$C3,$D4,$53
@gazer:
.byte $C7,$C1,$DA,$C5,$52
@phantom:
.byte $D0,$C8,$C1,$CE,$D4,$CF,$4D
@orc:
.byte $CF,$D2,$43
@skeleton:
.byte $D3,$CB,$C5,$CC,$C5,$D4,$CF,$4E
@rogue:
.byte $D2,$CF,$C7,$D5,$45
@python:
.byte $D0,$D9,$D4,$C8,$CF,$4E
@ettin:
.byte $C5,$D4,$D4,$C9,$4E
@headless:
.byte $C8,$C5,$C1,$C4,$CC,$C5,$D3,$53
@cyclops:
.byte $C3,$D9,$C3,$CC,$CF,$D0,$53
@wisp:
.byte $D7,$C9,$D3,$50
@mage:
.byte $CD,$C1,$C7,$45
@liche:
.byte $CC,$C9,$C3,$C8,$45
@lava_lizard:
.byte $CC,$C1,$D6,$C1,$A0,$CC,$C9,$DA
.byte $C1,$D2,$44
@zorn:
.byte $DA,$CF,$D2,$4E
@daemon:
.byte $C4,$C1,$C5,$CD,$CF,$4E
@hydra:
.byte $C8,$D9,$C4,$D2,$41
@dragon:
.byte $C4,$D2,$C1,$C7,$CF,$4E
@balron:
.byte $C2,$C1,$CC,$D2,$CF,$4E
@hands:
.byte $C8,$C1,$CE,$C4,$53
@staff:
.byte $D3,$D4,$C1,$C6,$46
@dagger:
.byte $C4,$C1,$C7,$C7,$C5,$52
@sling:
.byte $D3,$CC,$C9,$CE,$47
@mace:
.byte $CD,$C1,$C3,$45
@axe:
.byte $C1,$D8,$45
@sword:
.byte $D3,$D7,$CF,$D2,$44
@bow:
.byte $C2,$CF,$57
@crossbow:
.byte $C3,$D2,$CF,$D3,$D3,$C2,$CF,$57
@flaming_oil:
.byte $C6,$CC,$C1,$CD,$C9,$CE,$C7,$A0
.byte $CF,$C9,$4C
@halberd:
.byte $C8,$C1,$CC,$C2,$C5,$D2,$44
@magic_axe:
.byte $CD,$C1,$C7,$C9,$C3,$A0,$C1,$D8
.byte $45
@magic_sword:
.byte $CD,$C1,$C7,$C9,$C3,$A0,$D3,$D7
.byte $CF,$D2,$44
@magic_bow:
.byte $CD,$C1,$C7,$C9,$C3,$A0,$C2,$CF
.byte $57
@magic_wand:
.byte $CD,$C1,$C7,$C9,$C3,$A0,$D7,$C1
.byte $CE,$44
@mystic_sword:
.byte $CD,$D9,$D3,$D4,$C9,$C3,$A0,$D3
.byte $D7,$CF,$D2,$44
@skin:
.byte $D3,$CB,$C9,$4E
@cloth:
.byte $C3,$CC,$CF,$D4,$48
@leather:
.byte $CC,$C5,$C1,$D4,$C8,$C5,$52
@chain_mail:
.byte $C3,$C8,$C1,$C9,$CE,$A0,$CD,$C1
.byte $C9,$4C
@plate_mail:
.byte $D0,$CC,$C1,$D4,$C5,$A0,$CD,$C1
.byte $C9,$4C
@magic_chain:
.byte $CD,$C1,$C7,$C9,$C3,$A0,$C3,$C8
.byte $C1,$C9,$4E
@magic_plate:
.byte $CD,$C1,$C7,$C9,$C3,$A0,$D0,$CC
.byte $C1,$D4,$45
@mystic_robe:
.byte $CD,$D9,$D3,$D4,$C9,$C3,$A0,$D2
.byte $CF,$C2,$45
@hnd:
.byte $C8,$CE,$44
@stf:
.byte $D3,$D4,$46
@dag:
.byte $C4,$C1,$47
@sln:
.byte $D3,$CC,$4E
@mac:
.byte $CD,$C1,$43
@axe:
.byte $C1,$D8,$45
@swd:
.byte $D3,$D7,$44
@bow:
.byte $C2,$CF,$57
@xbo:
.byte $D8,$C2,$4F
@oil:
.byte $CF,$C9,$4C
@hal:
.byte $C8,$C1,$4C
@max:
.byte $AB,$C1,$58
@msw:
.byte $AB,$D3,$57
@mbo:
.byte $AB,$C2,$4F
@wnd:
.byte $D7,$CE,$44
@ysw:
.byte $DE,$D3,$57
@mage:
.byte $CD,$C1,$C7,$45
@bard:
.byte $C2,$C1,$D2,$44
@fighter:
.byte $C6,$C9,$C7,$C8,$D4,$C5,$52
@druid:
.byte $C4,$D2,$D5,$C9,$44
@tinker:
.byte $D4,$C9,$CE,$CB,$C5,$52
@paladin:
.byte $D0,$C1,$CC,$C1,$C4,$C9,$4E
@ranger:
.byte $D2,$C1,$CE,$C7,$C5,$52
@shepherd:
.byte $D3,$C8,$C5,$D0,$C8,$C5,$D2,$44
@guard:
.byte $C7,$D5,$C1,$D2,$44
@merchant:
.byte $CD,$C5,$D2,$C3,$C8,$C1,$CE,$54
@bard:
.byte $C2,$C1,$D2,$44
@jester:
.byte $CA,$C5,$D3,$D4,$C5,$52
@beggar:
.byte $C2,$C5,$C7,$C7,$C1,$52
@child:
.byte $C3,$C8,$C9,$CC,$44
@bull:
.byte $C2,$D5,$CC,$4C
@lord_british:
.byte $CC,$CF,$D2,$C4,$A0,$C2,$D2,$C9
.byte $D4,$C9,$D3,$48
@sulfur_ash:
.byte $D3,$D5,$CC,$C6,$D5,$D2,$A0,$C1
.byte $D3,$48
@ginseng:
.byte $C7,$C9,$CE,$D3,$C5,$CE,$47
@garlic:
.byte $C7,$C1,$D2,$CC,$C9,$43
@spider_silk:
.byte $D3,$D0,$C9,$C4,$C5,$D2,$A0,$D3
.byte $C9,$CC,$4B
@blood_moss:
.byte $C2,$CC,$CF,$CF,$C4,$A0,$CD,$CF
.byte $D3,$53
@black_pearl:
.byte $C2,$CC,$C1,$C3,$CB,$A0,$D0,$C5
.byte $C1,$D2,$4C
@nightshade:
.byte $CE,$C9,$C7,$C8,$D4,$D3,$C8,$C1
.byte $C4,$45
@mandrake:
.byte $CD,$C1,$CE,$C4,$D2,$C1,$CB,$45
@awaken:
.byte $C1,$D7,$C1,$CB,$C5,$4E
@blink:
.byte $C2,$CC,$C9,$CE,$4B
@cure:
.byte $C3,$D5,$D2,$45
@dispell:
.byte $C4,$C9,$D3,$D0,$C5,$CC,$4C
@energy:
.byte $C5,$CE,$C5,$D2,$C7,$59
@fireball:
.byte $C6,$C9,$D2,$C5,$C2,$C1,$CC,$4C
@gate:
.byte $C7,$C1,$D4,$45
@heal:
.byte $C8,$C5,$C1,$4C
@iceball:
.byte $C9,$C3,$C5,$C2,$C1,$CC,$4C
@jinx:
.byte $CA,$C9,$CE,$58
@kill:
.byte $CB,$C9,$CC,$4C
@light:
.byte $CC,$C9,$C7,$C8,$54
@magic_misl:
.byte $CD,$C1,$C7,$C9,$C3,$A0,$CD,$C9
.byte $D3,$4C
@negate:
.byte $CE,$C5,$C7,$C1,$D4,$45
@open:
.byte $CF,$D0,$C5,$4E
@protection:
.byte $D0,$D2,$CF,$D4,$C5,$C3,$D4,$C9
.byte $CF,$4E
@quickness:
.byte $D1,$D5,$C9,$C3,$CB,$CE,$C5,$D3
.byte $53
@ressurect:
.byte $D2,$C5,$D3,$D3,$D5,$D2,$C5,$C3
.byte $54
@sleep:
.byte $D3,$CC,$C5,$C5,$50
@tremmor:
.byte $D4,$D2,$C5,$CD,$CD,$CF,$52
@undead:
.byte $D5,$CE,$C4,$C5,$C1,$44
@view:
.byte $D6,$C9,$C5,$57
@winds:
.byte $D7,$C9,$CE,$C4,$53
@xit:
.byte $D8,$AD,$C9,$54
@yup:
.byte $D9,$AD,$D5,$50
@zdown:
.byte $DA,$AD,$C4,$CF,$D7,$4E
@britannia:
.byte $C2,$D2,$C9,$D4,$C1,$CE,$CE,$C9
.byte $41
@the_lycaeum:
.byte $D4,$C8,$C5,$A0,$CC,$D9,$C3,$C1
.byte $C5,$D5,$4D
@empath_abbey:
.byte $C5,$CD,$D0,$C1,$D4,$C8,$A0,$C1
.byte $C2,$C2,$C5,$59
@serpants_hold:
.byte $D3,$C5,$D2,$D0,$C1,$CE,$D4,$D3
.byte $A0,$C8,$CF,$CC,$44
@moonglow:
.byte $CD,$CF,$CF,$CE,$C7,$CC,$CF,$57
@britain:
.byte $C2,$D2,$C9,$D4,$C1,$C9,$4E
@jhelom:
.byte $CA,$C8,$C5,$CC,$CF,$4D
@yew:
.byte $D9,$C5,$57
@minoc:
.byte $CD,$C9,$CE,$CF,$43
@trinsic:
.byte $D4,$D2,$C9,$CE,$D3,$C9,$43
@skara_brae:
.byte $D3,$CB,$C1,$D2,$C1,$A0,$C2,$D2
.byte $C1,$45
@magincia:
.byte $CD,$C1,$C7,$C9,$CE,$C3,$C9,$41
@paws:
.byte $D0,$C1,$D7,$53
@buccaneers_den:
.byte $C2,$D5,$C3,$C3,$C1,$CE,$C5,$C5
.byte $D2,$D3,$A0,$C4,$C5,$4E
@vesper:
.byte $D6,$C5,$D3,$D0,$C5,$52
@cove:
.byte $C3,$CF,$D6,$45
@deceit:
.byte $C4,$C5,$C3,$C5,$C9,$54
@despise:
.byte $C4,$C5,$D3,$D0,$C9,$D3,$45
@dasterd:
.byte $C4,$C1,$D3,$D4,$C5,$D2,$44
@wrong:
.byte $D7,$D2,$CF,$CE,$47
@covetous:
.byte $C3,$CF,$D6,$C5,$D4,$CF,$D5,$53
@shame:
.byte $D3,$C8,$C1,$CD,$45
@hylothe:
.byte $C8,$D9,$CC,$CF,$D4,$C8,$45
@the_greatstygian_abyss:
.byte $D4,$C8,$C5,$A0,$C7,$D2,$C5,$C1
.byte $D4,$8D,$D3,$D4,$D9,$C7,$C9,$C1
.byte $CE,$A0,$C1,$C2,$D9,$D3,$D3
@honesty:
.byte $21,$C8,$CF,$CE,$C5,$D3,$D4
@compassion:
.byte $59,$C3,$CF,$CD,$D0,$C1,$D3,$D3
.byte $C9,$CF
@valor:
.byte $4E,$D6,$C1,$CC,$CF
@justice:
.byte $52,$CA,$D5,$D3,$D4,$C9,$C3
@sacrifice:
.byte $45,$D3,$C1,$C3,$D2,$C9,$C6,$C9
.byte $C3
@honor:
.byte $45,$C8,$CF,$CE,$CF
@spirituality:
.byte $52,$D3,$D0,$C9,$D2,$C9,$D4,$D5
.byte $C1,$CC,$C9,$D4
@humility:
.byte $59,$C8,$D5,$CD,$C9,$CC,$C9,$D4
.byte $59
_garbage:
.byte "T3"
.byte $0D,$02
.byte ";"
.byte $0D,$05,$CD,$01
.byte "PL"
.byte $0D,$03,$99,$00,$0D,$05,$C0,$02
.byte "#8"
.byte $0D,$05,$D0,$01
.byte "PL"
.byte $0D,$02
.byte ";"
.byte $0D,$0A
.byte "ROT3 :"
.byte $0D,$05,$CF,$02
.byte "#0"
.byte $0D,$09,$CD,$05
.byte "(PL),Y"
.byte $0D,$0A,$D0,$01
.byte "ROTTEMP"
.byte $0D,$03,$9F
4f.html; generated on Thu Sep 21 17:08:53 2006 by ca65html
uz@cc65.org