50.s
.setcpu "6502"
player_xpos := $0010
player_ypos := $0011
tile_xpos := $0012
tile_ypos := $0013
map_x := $0014
map_y := $0015
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
j_waitkey := $0800
j_player_teleport:= $0803
j_move_east := $0806
j_move_west := $0809
j_move_south := $080C
j_move_north := $080F
j_drawinterface := $0812
j_drawview := $0815
j_update_britannia:= $0818
j_primm_xy := $081E
j_primm := $0821
j_console_out := $0824
j_clearbitmap := $0827
j_mulax := $082A
j_get_stats_ptr := $082D
j_printname := $0830
j_printbcd := $0833
j_drawcursor := $0836
j_drawcursor_xy := $0839
j_drawvert := $083C
j_drawhoriz := $083F
j_request_disk := $0842
j_update_status := $0845
j_blocked_tile := $0848
j_idle := $084B
j_rand := $084E
j_loadsector := $0851
j_playsfx := $0854
j_idle_combat := $0857
j_getnumber := $085A
j_getplayernum := $085D
j_update_wind := $0860
j_animate_view := $0863
j_printdigit := $0866
j_clearstatwindow:= $0869
j_animate_creatures:= $086C
j_centername := $086F
j_print_direction:= $0872
j_clearview := $0875
j_invertview := $0878
j_centerstring := $087B
j_printstring := $087E
j_gettile_bounds:= $0881
j_gettile := $0884
j_gettile_combat:= $088D
j_gettile_town := $0893
j_gettile_dungeon:= $0896
L4553 := $4553
L8D46 := $8D46
gettile_bounds := $9F00
gettile := $9F26
mul11 := $9F49
gettile_combat := $9F85
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 $6000
lda #$CC
ldx #$44
jsr j_fileio
ldx #$43
jsr j_fileio
jsr L607A
lda #$CC
ldx #$9E
jsr j_fileio
jsr j_clearbitmap
jsr setgfx
lda #$BC
sta dng_direction
lda #$6F
sta light_duration
lda #$00
sta moon_phase_trammel
ldx #$00
txa
@clear:
sta map_status,x
dex
bne @clear
jsr draw_lb_logo
jsr longdelay
jsr draw_and
jsr longdelay
jsr draw_line
jsr longdelay
jsr fade_in_origin_sys_inc
jsr fade_in_present
jsr longdelay
jsr fade_in_ultima_iv_logo
jsr longdelay
jsr fade_in_quest_of_the_avatar
jsr longdelay
jsr fade_in_title_view
jsr fade_in_monsters
jmp title_drawn
xpos:
.byte $52
ypos:
.byte $45
L6063:
.byte $3B
L6064:
.byte $20
L6065:
.byte $53
L6066:
.byte $45
L6067:
.byte $4C
L6068:
.byte $46
L6069:
.byte $8D
setgfx:
lda #$3B
sta $D011
lda #$18
sta $D018
lda #$80
sta $028A
rts
L607A:
lda #$00
sta $0A
lda #$D8
sta $0B
ldy #$00
ldx #$04
tya
L6087:
sta ($0A),y
iny
bne L6087
inc $0B
dex
bne L6087
rts
draw_lb_logo:
lda #$68
sta $0A
lda #$62
sta $0B
@next:
ldx #$00
lda ($0A,x)
beq @done
clc
adc #$14
sta xpos
jsr next_lb_byte
lda #$BF
sec
sbc ($0A,x)
sta ypos
jsr next_lb_byte
jsr plotpixel
lda #$40
jsr delay_checkkey
jmp @next
@done:
rts
draw_and:
lda #$00
sta L61CB
lda #$12
sta L6063
sta L6065
lda #$11
sta L6064
sta L6066
ldx #$05
ldy #$04
jsr L6136
rts
draw_line:
lda #$50
sta xpos
lda #$1F
sta ypos
L60E7:
jsr plotpixel
lda #$30
jsr delay_checkkey
inc xpos
inc xpos
lda xpos
cmp #$EE
bcc L60E7
rts
fade_in_ultima_iv_logo:
lda #$FF
sta L61CB
lda #$00
sta L61CC
L6107:
lda #$05
sta L6063
sta L6065
lda #$22
sta L6064
sta L6066
lda a:$C6
beq L6121
lda #$38
sta L61CC
L6121:
ldx #$1E
ldy #$2D
jsr L6136
lda L61CC
clc
adc #$01
sta L61CC
cmp #$39
bcc L6107
rts
L6136:
stx L61CA
sty L6067
L613C:
lda L61CA
sta L6068
ldy L6064
lda bmplineaddr_lo,y
sta $0A
lda bmplineaddr_hi,y
clc
adc #$20
sta $0B
ldy L6066
lda bmplineaddr_lo,y
sta $0C
lda bmplineaddr_hi,y
sta $0D
lda L6065
asl a
asl a
asl a
tay
bcc L616C
inc $0B
inc $0D
L616C:
lda ($0A),y
beq L61A9
bit L61CB
beq L61A7
pha
lda L61C8
adc #$1D
tax
adc L61C9
sta L61C8
stx L61C9
pha
and #$07
sta L61CD
pla
clc
adc L61CC
bcc L6195
jsr j_togglesnd
L6195:
lda L61CC
clc
adc L61CD
tax
lda L61CF,x
sta L61CE
pla
and L61CE
L61A7:
sta ($0C),y
L61A9:
tya
clc
adc #$08
tay
bcc L61B4
inc $0B
inc $0D
L61B4:
dec L6068
bne L616C
inc L6064
inc L6066
dec L6067
beq L61C7
jmp L613C
L61C7:
rts
L61C8:
.byte $35
L61C9:
.byte $9B
L61CA:
.byte $41
L61CB:
.byte $50
L61CC:
.byte $4F
L61CD:
.byte $4E
L61CE:
.byte $3F
L61CF:
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$01,$02,$04,$08,$12,$20,$21
.byte $10,$18,$40,$24,$42,$25,$14,$1A
.byte $48,$29,$14,$52,$54,$55,$4A,$59
.byte $45,$5A,$2A,$6C,$36,$37,$6A,$67
.byte $4D,$5E,$7F,$6D,$3B,$FD,$57,$7D
.byte $5D,$FE,$6B,$7F,$F7,$FF,$5F,$3F
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
plotpixel:
inc xpos
jsr @plot
dec xpos
@plot:
lda ypos
tay
lda bmplineaddr_lo,y
sta $0E
lda bmplineaddr_hi,y
sta $0F
lda xpos
pha
and #$F8
tay
pla
and #$07
tax
lda @bittab,x
ora ($0E),y
sta ($0E),y
rts
@bittab:
.byte $80,$40,$20,$10,$08,$04,$02,$01
next_lb_byte:
inc $0A
bne :+
inc $0B
: rts
longdelay:
ldy #$04
: lda #$FF
jsr delay_checkkey
dey
bne :-
rts
delay_checkkey:
pha
lda a:$C6
bne @gotkey
pla
sec
@delay:
pha
: sbc #$01
bne :-
pla
sbc #$01
bne @delay
rts
@gotkey:
pla
rts
lord_british_logo:
.byte $54,$BD,$55,$BC,$57,$BC,$59,$BC
.byte $5B,$BC,$5C,$BD,$5C,$BE,$5B,$BF
.byte $59,$BF,$58,$BE,$58,$BD,$57,$BB
.byte $56,$BA,$56,$B9,$55,$B8,$55,$B7
.byte $54,$B6,$54,$B5,$53,$B4,$53,$B3
.byte $52,$B2,$52,$B1,$51,$B0,$4F,$B0
.byte $4E,$B0,$4D,$B1,$4D,$B2,$4E,$B3
.byte $50,$B3,$51,$B2,$54,$B2,$55,$B1
.byte $56,$B1,$57,$B0,$59,$B0,$5B,$B0
.byte $5D,$B0,$5F,$B0,$61,$B0,$63,$B0
.byte $65,$B0,$67,$B0,$69,$B0,$6B,$B0
.byte $6D,$B0,$6F,$B0,$71,$B0,$73,$B0
.byte $75,$B0,$77,$B0,$79,$B0,$7B,$B0
.byte $7D,$B0,$7F,$B0,$81,$B0,$83,$B0
.byte $85,$B0,$87,$B0,$89,$B0,$8B,$B0
.byte $8D,$B0,$8F,$B0,$91,$B0,$93,$B0
.byte $95,$B0,$97,$B0,$99,$B0,$9B,$B0
.byte $9D,$B0,$9F,$B0,$A1,$B0,$A3,$B0
.byte $A5,$B0,$A7,$B0,$A9,$B0,$AB,$B0
.byte $AD,$B0,$AF,$B0,$B1,$B0,$B3,$B0
.byte $B5,$B0,$B7,$B0,$B9,$B0,$BB,$B0
.byte $BD,$B0,$BF,$B0,$C1,$B0,$C3,$B0
.byte $C5,$B0,$C7,$B0,$C9,$B0,$CA,$B0
.byte $CB,$B1,$CC,$B1,$CD,$B2,$5E,$B8
.byte $5E,$B7,$5D,$B6,$5D,$B5,$5C,$B4
.byte $5C,$B3,$5D,$B2,$5F,$B2,$60,$B2
.byte $61,$B3,$61,$B4,$62,$B5,$62,$B6
.byte $63,$B7,$63,$B8,$62,$B9,$60,$B9
.byte $5F,$B9,$69,$B9,$6A,$B8,$6A,$B7
.byte $69,$B6,$69,$B5,$68,$B4,$68,$B3
.byte $67,$B2,$6B,$B8,$6C,$B9,$6E,$B9
.byte $77,$B9,$75,$B9,$74,$B9,$73,$B8
.byte $73,$B7,$72,$B6,$72,$B5,$71,$B4
.byte $71,$B3,$72,$B2,$74,$B2,$75,$B3
.byte $76,$B4,$77,$B5,$77,$B6,$78,$B7
.byte $78,$B8,$79,$B9,$79,$BA,$7A,$BB
.byte $7A,$BC,$7B,$BD,$7B,$BE,$76,$B3
.byte $77,$B2,$8B,$BE,$8B,$BD,$8A,$BC
.byte $8A,$BB,$89,$BA,$89,$B9,$88,$B8
.byte $88,$B7,$87,$B6,$87,$B5,$86,$B4
.byte $86,$B3,$85,$B2,$8C,$BF,$8E,$BF
.byte $8F,$BF,$90,$BE,$90,$BD,$8F,$BC
.byte $8F,$BB,$8E,$BA,$8E,$B9,$8C,$B9
.byte $8F,$B8,$8F,$B7,$8E,$B6,$8E,$B5
.byte $8D,$B4,$8D,$B3,$8C,$B2,$8A,$B2
.byte $88,$B2,$87,$B3,$96,$B9,$97,$B8
.byte $97,$B7,$96,$B6,$96,$B5,$95,$B4
.byte $95,$B3,$94,$B2,$98,$B8,$99,$B9
.byte $9B,$B9,$A1,$B9,$A0,$B8,$A0,$B7
.byte $9F,$B6,$9F,$B5,$9E,$B4,$9E,$B3
.byte $9D,$B2,$A2,$BC,$A2,$BB,$A9,$BC
.byte $A9,$BB,$A8,$BA,$A8,$B9,$A7,$B8
.byte $A7,$B7,$A6,$B6,$A6,$B5,$A5,$B4
.byte $A5,$B3,$A6,$B2,$A8,$B2,$A9,$B2
.byte $AA,$B3,$A5,$B9,$A6,$B9,$AA,$B9
.byte $B2,$B9,$B1,$B8,$B1,$B7,$B0,$B6
.byte $B0,$B5,$AF,$B4,$AF,$B3,$AE,$B2
.byte $B3,$BC,$B3,$BB,$BB,$B8,$BA,$B9
.byte $B8,$B9,$B7,$B9,$B6,$B8,$B6,$B7
.byte $B7,$B6,$B8,$B5,$B9,$B4,$B9,$B3
.byte $B8,$B2,$B6,$B2,$B5,$B2,$B4,$B3
.byte $C5,$BE,$C5,$BD,$C4,$BC,$C4,$BB
.byte $C3,$BA,$C3,$B9,$C2,$B8,$C2,$B7
.byte $C1,$B6,$C1,$B5,$C0,$B4,$C0,$B3
.byte $BF,$B2,$C5,$B9,$C6,$B9,$C7,$B8
.byte $C7,$B7,$C6,$B6,$C6,$B5,$C5,$B4
.byte $C5,$B3,$C6,$B2,$00
fade_in_origin_sys_inc:
lda #$40
sta L6069
lda #$00
sta L64DE
L6487:
lda #$00
sta L64DF
L648C:
lda #$09
sta L64E0
L6491:
lda L64E0
sta L6063
sta L6065
lda #$15
clc
adc L64DF
sta L6064
lda #$1D
clc
adc L64DF
sec
sbc L64DE
sta L6066
jsr L64E1
inc L64E0
lda L64E0
cmp #$1E
bcc L6491
beq L6491
inc L64DF
lda L64DF
cmp L64DE
bcc L648C
beq L648C
lda #$C0
jsr delay_checkkey
inc L64DE
lda L64DE
cmp #$08
bcc L6487
beq L6487
rts
L64DE:
.byte $45
L64DF:
.byte $4E
L64E0:
.byte $45
L64E1:
lda #$20
jmp L64E8
L64E6:
lda #$54
L64E8:
sta L6069
ldy L6064
lda bmplineaddr_lo,y
sta $0A
lda bmplineaddr_hi,y
clc
adc L6069
sta $0B
ldy L6066
lda bmplineaddr_lo,y
sta $0C
lda bmplineaddr_hi,y
sta $0D
lda L6063
asl a
asl a
asl a
tay
bcc L6514
inc $0B
L6514:
lda ($0A),y
pha
lda L6065
asl a
asl a
asl a
tay
bcc L6522
inc $0D
L6522:
pla
sta ($0C),y
rts
ldy L6064
lda bmplineaddr_lo,y
sta $0A
lda bmplineaddr_hi,y
clc
adc L6069
sta $0B
ldy L6063
lda ($0A),y
rts
txa
pha
clc
ldx #$06
lda L6565
L6545:
adc L655E,x
sta L655E,x
dex
bpl L6545
ldx #$07
L6550:
inc L655E,x
bne L6558
dex
bpl L6550
L6558:
pla
tax
lda L655E
rts
L655E:
.byte $09,$0A,$0B,$0C,$0D,$0E,$0F
L6565:
.byte $10
fade_in_present:
lda #$00
sta L64DE
L656B:
lda #$00
sta L64DF
L6570:
lda #$10
sta L64E0
L6575:
lda L64E0
sta L6063
sta L6065
lda #$04
clc
adc L64DF
sec
sbc L64DE
sta L6064
lda #$21
clc
adc L64DF
sta L6066
jsr L64E1
inc L64E0
lda L64E0
cmp #$18
bcc L6575
beq L6575
inc L64DF
lda L64DF
cmp L64DE
bcc L6570
beq L6570
lda #$C0
jsr delay_checkkey
inc L64DE
lda L64DE
cmp #$04
bcc L656B
beq L656B
rts
fade_in_quest_of_the_avatar:
lda #$20
sta L6069
lda #$00
sta L64DE
L65CC:
lda #$00
sta L64DF
L65D1:
lda #$03
sta L64E0
L65D6:
lda L64E0
sta L6063
sta L6065
lda #$51
clc
adc L64DF
sta L6064
lda #$56
clc
adc L64DF
sec
sbc L64DE
sta L6066
jsr L64E1
lda #$5C
clc
adc L64DF
sec
sbc L64DE
sta L6064
lda #$57
clc
adc L64DF
sta L6066
jsr L64E1
inc L64E0
lda L64E0
cmp #$24
bcc L65D6
beq L65D6
inc L64DF
lda L64DF
cmp L64DE
bcc L65D1
beq L65D1
lda #$C0
jsr delay_checkkey
inc L64DE
lda L64DE
cmp #$05
bcc L65CC
beq L65CC
rts
fade_in_title_view:
lda #$20
sta L6069
lda #$00
sta L64DF
L6646:
lda #$60
sta L64E0
L664B:
lda L64E0
sta L6064
sta L6066
lda #$13
sec
sbc L64DF
sta L6063
lda #$13
sec
sbc L64DF
sta L6065
jsr L64E1
lda #$14
clc
adc L64DF
sta L6063
sta L6065
jsr L64E1
inc L64E0
lda L64E0
cmp #$BF
bcc L664B
beq L664B
lda #$C0
jsr delay_checkkey
inc L64DF
lda L64DF
cmp #$13
bcc L6646
beq L6646
rts
fade_in_monsters:
lda #$E1
sta ypos
lda #$1E
sta L6A4F
sta L6A50
L66A3:
jsr animate_monster1
jsr animate_monster2
jsr title_view_animate
lda a:$C6
beq L66B2
rts
L66B2:
inc ypos
lda ypos
cmp #$01
bne L66A3
rts
animate_monster1:
ldx L6A4F
ldy L6A51,x
lda L6B1B,y
sta L66F0
lda L6B09,y
sta L66FF
ldx L6A50
ldy L6AC9,x
lda L6B3F,y
sta L6717
lda L6B2D,y
sta L672D
lda #$00
sta L64DE
L66E6:
lda #$00
sta L64DF
L66EB:
lda L64DF
clc
L66F0 := * + 1
adc #$FF
sta L6063
lda L64DF
sta L6065
lda L64DE
clc
L66FF := * + 1
adc #$FF
sta L6064
lda L64DE
clc
adc ypos
bmi L6712
sta L6066
jsr L64E6
L6712:
lda L64DF
clc
L6717 := * + 1
adc #$FF
sta L6063
lda L64DF
clc
adc #$22
cmp #$28
bcs L6740
sta L6065
lda L64DE
clc
L672D := * + 1
adc #$FF
sta L6064
lda L64DE
clc
adc ypos
bmi L6740
sta L6066
jsr L64E6
L6740:
inc L64DF
lda L64DF
cmp #$07
bcc L66EB
inc L64DE
lda L64DE
cmp #$1F
bcc L66E6
rts
animate_monster2:
inc L6A4F
lda L6A4F
and #$7F
sta L6A4F
inc L6A50
lda L6A50
and #$3F
sta L6A50
rts
title_drawn:
lda #$00
sta game_mode
sta currdisk_drive2
lda #$01
sta numdrives
sta currdisk_drive1
lda #$FF
sta music_volume
jsr title_view_animate
lda #$00
sta ypos
jsr animate_monster1
jsr animate_monster2
lda #$CC
ldx #$55
jsr j_fileio
jsr music_init
lda #$00
sta $04
lda #$D4
jsr music_change
lda #$01
jsr music_change
title_main:
jsr animate_view
php
cli
lda $04
sta $03
plp
jsr clear_view
L67AF:
lda #$10
sta L6953
lda #$17
sta L6952
ldx #$02
ldy #$0E
jsr j_primm_xy
.byte $C9,$CE,$A0,$C1,$CE,$CF,$D4,$C8
.byte $C5,$D2,$A0,$D7,$CF,$D2,$CC,$C4
.byte $AC,$A0,$C9,$CE,$A0,$C1,$A0,$D4
.byte $C9,$CD,$C5,$A0,$D4,$CF,$A0,$C3
.byte $CF,$CD,$C5,$AE,$00
ldx #$0F
ldy #$10
jsr j_primm_xy
.byte $CF,$D0,$D4,$C9,$CF,$CE,$D3,$BA
.byte $00
ldx #$0B
ldy #$11
jsr j_primm_xy
.byte $D2,$E5,$F4,$F5,$F2,$EE,$A0,$F4
.byte $EF,$A0,$F4,$E8,$E5,$A0,$F6,$E9
.byte $E5,$F7,$00
ldx #$0B
ldy #$12
jsr j_primm_xy
.byte $CE,$F5,$ED,$E2,$E5,$F2,$A0,$EF
.byte $E6,$A0,$E4,$F2,$E9,$F6,$E5,$F3
.byte $AD
ndrivechr:
.byte $B1,$00
ldx #$0D
ldy #$13
jsr j_primm_xy
.byte $CA,$EF,$F5,$F2,$EE,$E5,$F9,$A0
.byte $EF,$EE,$F7,$E1,$F2,$E4,$00
ldx #$0B
ldy #$14
jsr j_primm_xy
.byte $C9,$EE,$E9,$F4,$E9,$E1,$F4,$E5
.byte $A0,$EE,$E5,$F7,$A0,$E7,$E1,$ED
.byte $E5,$00
title_menu:
jsr waitkey
cmp #$B0
bcc title_menu
cmp #$BA
bcs @checkkeys
sec
sbc #$B0
jsr music_change
jmp title_menu
@checkkeys:
cmp #$D4
beq @changemusic
cmp #$CF
beq @changemusic
cmp #$C4
beq @changemusic
cmp #$C2
beq @changemusic
cmp #$C3
bne @returntoview
@changemusic:
jsr music_change
jmp title_menu
@returntoview:
cmp #$D2
bne @numdrives
jmp title_main
@numdrives:
cmp #$CE
bne @journeyonward
jmp toggle_num_drives
@journeyonward:
cmp #$CA
bne @initiatenewgame
jmp journey_onward
@initiatenewgame:
cmp #$C9
bne :+
jmp initiate_new_game
: jmp title_menu
music_change:
tax
bpl L68B3
sta L68BA
ldx #$01
stx L68B9
jmp music_ctl
L68B3:
sta L68B9
jmp music_ctl
L68B9:
.byte $FF
L68BA:
.byte $FF
L68BB:
.byte $CF,$D4,$C4,$C3,$C2,$00
L68C1:
.byte $01,$02,$03,$00,$01,$00,$00,$04
.byte $01,$00,$00,$00,$01,$00,$00,$00
.byte $01,$00,$00,$00,$FF
L68D6:
lda $04
cmp $03
beq L68DD
rts
L68DD:
cmp #$00
beq L68E4
sta L68B9
L68E4:
ldx #$00
lda L68BA
L68E9:
cmp L68BB,x
beq L68F1
inx
bne L68E9
L68F1:
txa
asl a
asl a
clc
adc L68B9
tax
L68F9:
lda L68C1,x
bne L6901
inx
bne L68F9
L6901:
bpl L6907
ldx #$00
beq L6901
L6907:
txa
lsr a
lsr a
tay
lda L68BB,y
cmp L68BA
beq L691F
ldy #$00
sty $03
ldy $04
bne L691E
jsr music_change
L691E:
rts
L691F:
lda L68C1,x
sta $03
rts
waitkey:
ldx L6952
ldy L6953
jsr j_drawcursor_xy
lda #$00
sta ypos
jsr animate_monster1
jsr animate_monster2
jsr j_rand
jsr L6E49
lda a:$C6
beq waitkey
jsr j_clearkbd
lda $0277
ora #$80
pha
jsr j_console_out
pla
rts
L6952:
.byte $00
L6953:
.byte $00
journey_onward:
jsr check_copy_protection
lda #$00
sta party_size
sta key_buf_len
lda #$00
jsr music_change
lda #$D2
ldx #$5B
jsr j_fileio
initiate_new_game:
jsr check_copy_protection
lda #$00
jsr music_change
lda numdrives
cmp #$01
beq @gotdisk
lda #$02
jsr request_disk
lda #$01
sta diskid
@gotdisk:
jsr clear_view
ldx #$04
ldy #$10
jsr j_primm_xy
.byte $C2,$F9,$A0,$F7,$E8,$E1,$F4,$A0
.byte $EE,$E1,$ED,$E5,$A0,$F3,$E8,$E1
.byte $EC,$F4,$A0,$F4,$E8,$EF,$F5,$A0
.byte $E2,$E5,$A0,$EB,$EE,$EF,$F7,$EE
.byte $00
ldx #$04
ldy #$11
jsr j_primm_xy
.byte $E9,$EE,$A0,$F4,$E8,$E9,$F3,$A0
.byte $F7,$EF,$F2,$EC,$E4,$A0,$E1,$EE
.byte $E4,$A0,$F4,$E9,$ED,$E5,$BF,$A0
.byte $00
lda #$13
sta console_ypos
lda #$0C
sta console_xpos
jsr L6D9C
jsr clear_view
ldx #$04
ldy #$11
jsr j_primm_xy
.byte $C1,$F2,$F4,$A0,$F4,$E8,$EF,$F5
.byte $A0,$CD,$E1,$EC,$E5,$A0,$EF,$F2
.byte $A0,$C6,$E5,$ED,$E1,$EC,$E5,$BF
.byte $A0,$00
lda console_xpos
sta L6952
lda console_ypos
sta L6953
L6A04:
jsr waitkey
cmp #$CD
beq L6A13
cmp #$C6
bne L6A04
lda #$7B
bne L6A15
L6A13:
lda #$5C
L6A15:
sta $3C
jsr clear_view
lda #$00
jsr music_change
lda #$01
sta currdrive
lda #$D2
ldx #$51
jsr j_fileio
animate_view:
jsr title_view_animate
lda #$00
sta ypos
jsr animate_monster1
jsr animate_monster2
jsr L68D6
lda a:$C6
beq animate_view
jsr j_clearkbd
lda $0277
ora #$80
rts
.byte $00,$00,$FF,$FF,$00,$00
L6A4F:
.byte $FF
L6A50:
.byte $FF
L6A51:
.byte $01,$01,$01,$00,$00,$01,$01,$01
.byte $00,$00,$01,$01,$02,$02,$03,$03
.byte $04,$04,$01,$02,$03,$04,$01,$02
.byte $05,$06,$07,$08,$05,$06,$07,$08
.byte $05,$06,$07,$08,$05,$06,$07,$08
.byte $05,$06,$07,$08,$05,$06,$07,$08
.byte $09,$0A,$09,$0A,$09,$0A,$0B,$0B
.byte $0B,$0B,$0C,$0C,$0D,$0D,$0C,$0D
.byte $0C,$0D,$0C,$0B,$0B,$0B,$00,$00
.byte $01,$02,$03,$04,$01,$02,$05,$06
.byte $07,$08,$05,$06,$07,$08,$09,$0A
.byte $0B,$0B,$0B,$00,$00,$0E,$0E,$0E
.byte $0F,$10,$10,$10,$11,$11,$11,$10
.byte $10,$10,$11,$11,$11,$10,$10,$10
.byte $0F,$0E,$0E,$00,$00,$0B,$0B,$0B
L6AC9:
.byte $01,$00,$01,$02,$03,$04,$03,$02
.byte $01,$00,$01,$02,$03,$04,$05,$06
.byte $05,$06,$05,$06,$04,$07,$08,$09
.byte $0A,$09,$08,$07,$08,$09,$0A,$0B
.byte $0C,$0B,$0C,$0D,$0B,$0C,$0D,$01
.byte $0D,$01,$0E,$01,$0F,$01,$0E,$01
.byte $0F,$0A,$09,$08,$10,$11,$10,$11
.byte $10,$11,$09,$08,$07,$04,$03,$02
L6B09:
.byte $00,$20,$40,$60,$80,$A0,$00,$20
.byte $40,$60,$80,$A0,$00,$20,$40,$60
.byte $80,$A0
L6B1B:
.byte $00,$00,$00,$00,$00,$00,$07,$07
.byte $07,$07,$07,$07,$0E,$0E,$0E,$0E
.byte $0E,$0E
L6B2D:
.byte $00,$20,$40,$60,$80,$A0,$00,$20
.byte $40,$60,$80,$A0,$00,$20,$40,$60
.byte $80,$A0
L6B3F:
.byte $22,$22,$22,$22,$22,$22,$1C,$1C
.byte $1C,$1C,$1C,$1C,$16,$16,$16,$16
.byte $16,$16
L6B51:
ldx #$5E
L6B53:
lda L6CBF,x
sta currmap,x
dex
bpl L6B53
ldx #$00
L6B5E:
lda map_status,x
beq L6B74
ldy object_ypos,x
lda L6CBA,y
clc
adc object_xpos,x
tay
lda map_status,x
sta currmap,y
L6B74:
inx
cpx #$20
bne L6B5E
rts
title_view_animate:
jsr L6D1E
jsr j_animate_creatures
jsr L6B51
lda ptr1
pha
lda ptr1+1
pha
lda ptr2
pha
lda ptr2+1
pha
lda $58
pha
lda $59
pha
lda #$00
sta L6BC5
lda #$09
sta $58
lda #$06
sta $59
ldy #$68
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
L6BBF:
lda #$00
sta L6C6D
L6BC4:
L6BC5 := * + 1
ldy currmap
tya
pha
jsr L6C9C
lda L6C6D
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
L6BEA:
lda (ptr1),y
sta (ptr2),y
dey
bpl L6BEA
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
L6C08:
lda (ptr1),y
sta (ptr2),y
dey
bpl L6C08
lda ptr1+1
eor #$70
sta ptr1+1
pla
sta ptr2+1
pla
sta ptr2
inc L6BC5
lda ptr2
clc
adc #$10
sta ptr2
lda ptr2+1
adc #$00
sta ptr2+1
inc L6C6D
lda L6C6D
cmp #$13
bne L6BC4
lda $58
clc
adc #$50
sta $58
lda $59
adc #$00
sta $59
lda ptr2
clc
adc #$50
sta ptr2
lda ptr2+1
adc #$01
sta ptr2+1
inc $72
lda $72
cmp #$05
beq L6C5A
jmp L6BBF
L6C5A:
pla
sta $59
pla
sta $58
pla
sta ptr2+1
pla
sta ptr2
pla
sta ptr1+1
pla
sta ptr1
rts
L6C6D:
.byte $35
check_copy_protection:
lda #$01
sta $A000
lda #$01
sta $A001
lda #$73
sta $A004
lda #$00
sta $A005
lda #$00
sta $A002
lda #$9E
sta $A003
jsr j_readblock
bcs @pass
pla
pla
jmp title_main
@pass:
lda #$00
sta $D020
rts
L6C9C:
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
L6CBA:
.byte $00,$13,$26,$39,$4C
L6CBF:
.byte $06,$06,$06,$04,$04,$04,$01,$01
.byte $00,$00,$00,$00,$01,$04,$04,$0D
.byte $0E,$0F,$04,$06,$06,$04,$04,$04
.byte $01,$01,$01,$01,$00,$00,$01,$01
.byte $04,$04,$04,$04,$04,$04,$06,$04
.byte $04,$01,$01,$01,$02,$02,$01,$01
.byte $01,$01,$01,$01,$0A,$04,$04,$04
.byte $06,$06,$04,$04,$01,$01,$02,$02
.byte $01,$01,$09,$08,$01,$01,$01,$01
.byte $04,$06,$06,$06,$04,$04,$04,$04
.byte $01,$01,$01,$01,$04,$04,$08,$08
.byte $01,$01,$01,$01,$01,$06,$06
L6D1E:
dec moon_phase_trammel
bpl L6D3A
ldy #$00
L6D24:
lda (dng_direction),y
bpl L6D45
tax
and #$F0
cmp #$80
bne L6D3B
txa
and #$0F
sta moon_phase_trammel
L6D34:
inc dng_direction
bne L6D3A
inc light_duration
L6D3A:
rts
L6D3B:
lda #$BC
sta dng_direction
lda #$6F
sta light_duration
bne L6D24
L6D45:
pha
and #$0F
tax
pla
and #$F0
lsr a
lsr a
lsr a
lsr a
cmp #$07
beq L6D7F
sta object_ypos,x
jsr L6D34
lda (dng_direction),y
pha
and #$1F
sta object_xpos,x
pla
lsr a
lsr a
lsr a
lsr a
lsr a
clc
adc L6D8D,x
sta map_status,x
cpx #$01
bne L6D76
lda L6D8D,x
L6D76:
sta object_tile,x
jsr L6D34
jmp L6D24
L6D7F:
lda #$00
sta map_status,x
sta object_tile,x
jsr L6D34
jmp L6D24
L6D8D:
rti
.byte $80,$10,$38,$38,$C8,$C8,$24,$20
.byte $88,$F0,$F8,$4D,$4F,$4E
L6D9C:
lda #$00
sta a:$6A
L6DA1:
ldx console_xpos
ldy console_ypos
jsr j_drawcursor_xy
lda #$00
sta ypos
jsr animate_monster1
jsr animate_monster2
lda #$00
sta moon_phase_felucca
L6DB7:
inc moon_phase_felucca
bmi L6DA1
ldy #$00
L6DBD:
dey
bne L6DBD
lda a:$C6
beq L6DB7
jsr j_clearkbd
lda $0277
ora #$80
cmp #$8D
beq L6E07
cmp #$94
beq L6DEC
cmp #$A0
bcc L6DB7
ldx a:$6A
cpx #$0F
beq L6DB7
sta $AF00,x
jsr j_console_out
inc a:$6A
jmp L6DB7
L6DEC:
lda a:$6A
beq L6DB7
dec a:$6A
lda #$A0
jsr j_console_out
dec console_xpos
dec console_xpos
lda #$A0
jsr j_console_out
dec console_xpos
jmp L6DB7
L6E07:
ldx a:$6A
beq L6DB7
lda #$00
L6E0E:
sta $AF00,x
inx
cpx #$10
bcc L6E0E
lda #$8D
jsr j_console_out
rts
clear_view:
lda #$0D
sta console_ypos
@nextline:
lda #$01
sta console_xpos
@nextchar:
lda #$A0
jsr j_console_out
lda console_xpos
cmp #$27
bne @nextchar
inc console_ypos
lda console_ypos
cmp #$17
bne @nextline
rts
toggle_num_drives:
lda numdrives
eor #$03
sta numdrives
lda ndrivechr
eor #$03
sta ndrivechr
jmp L67AF
L6E49:
ldx #$96
ldy #$00
L6E4D:
dey
bne L6E4D
dex
bne L6E4D
rts
lda #$12
sta console_ypos
L6E58:
lda #$00
sta console_xpos
L6E5C:
lda #$A0
jsr j_console_out
lda console_xpos
cmp #$28
bne L6E5C
inc console_ypos
lda console_ypos
cmp #$18
bne L6E58
lda #$00
sta console_xpos
lda #$12
sta console_ypos
rts
.byte $20
request_disk:
sta reqdisk
L6E7B:
jsr clear_view
lda #$10
sta console_ypos
lda reqdisk
cmp #$02
beq L6EF4
cmp #$04
beq L6EF4
L6E8C:
lda #$01
sta currdrive
lda reqdisk
cmp currdisk_drive1
beq L6EF1
ldy console_ypos
ldx #$0B
jsr j_primm_xy
.byte $D0,$CC,$C5,$C1,$D3,$C5,$A0,$D0
.byte $CC,$C1,$C3,$C5,$A0,$D4,$C8,$C5
.byte $00
inc console_ypos
jsr L6F54
ldy console_ypos
ldx #$0D
jsr j_primm_xy
.byte $C9,$CE,$D4,$CF,$A0,$C4,$C5,$D6
.byte $C9,$C3,$C5,$A0,$B8,$00
L6EC8:
inc console_ypos
ldy console_ypos
ldx #$0B
jsr j_primm_xy
.byte $C1,$CE,$C4,$A0,$D0,$D2,$C5,$D3
.byte $D3,$A0,$DB,$C6,$B1,$DD,$00
lda console_xpos
sta L6952
lda console_ypos
sta L6953
L6EEA:
jsr waitkey
cmp #$85
bne L6EEA
L6EF1:
jmp L6F39
L6EF4:
lda numdrives
cmp #$02
bcc L6E8C
lda #$02
sta currdrive
lda reqdisk
cmp currdisk_drive2
beq L6F39
ldy console_ypos
ldx #$0B
jsr j_primm_xy
.byte $D0,$CC,$C5,$C1,$D3,$C5,$A0,$D0
.byte $CC,$C1,$C3,$C5,$A0,$D4,$C8,$C5
.byte $00
inc console_ypos
jsr L6F54
ldy console_ypos
ldx #$0D
jsr j_primm_xy
.byte $C9,$CE,$D4,$CF,$A0,$C4,$C5,$D6
.byte $C9,$C3,$C5,$A0,$B9,$00
jmp L6EC8
L6F39:
lda currdrive
lda #$CC
ldx #$00
jsr j_fileio
ldx currdrive
lda diskid
sta numdrives,x
cmp reqdisk
beq L6F53
dec console_ypos
dec console_ypos
jmp L6E7B
L6F53:
rts
L6F54:
ldx reqdisk
dex
bne L6F6F
ldy console_ypos
ldx #$0D
jsr j_primm_xy
.byte $D5,$CC,$D4,$C9,$CD,$C1,$A0,$C4
.byte $C9,$D3,$CB,$00
inc console_ypos
rts
L6F6F:
dex
bne L6F8B
ldy console_ypos
ldx #$0C
jsr j_primm_xy
.byte $C2,$D2,$C9,$D4,$C1,$CE,$CE,$C9
.byte $C1,$A0,$C4,$C9,$D3,$CB,$00
inc console_ypos
rts
L6F8B:
dex
bne L6FA2
ldy console_ypos
ldx #$0E
jsr j_primm_xy
.byte $D4,$CF,$D7,$CE,$A0,$C4,$C9,$D3
.byte $CB,$00
inc console_ypos
rts
L6FA2:
dex
bne L6FBB
ldy console_ypos
ldx #$0D
jsr j_primm_xy
.byte $C4,$D5,$CE,$C7,$C5,$CF,$CE,$A0
.byte $C4,$C9,$D3,$CB,$00
inc console_ypos
L6FBB:
rts
.byte $88,$20,$11,$80,$20,$31,$80,$20
.byte $51,$80,$20,$71,$88,$27,$11,$84
.byte $27,$10,$84,$17,$10,$84,$07,$10
.byte $84,$77,$88,$20,$51,$80,$20,$31
.byte $80,$20,$11,$80,$70,$88,$01,$66
.byte $84,$11,$66,$84,$07,$10,$84,$17
.byte $10,$82,$11,$46,$82,$17,$0F,$82
.byte $11,$47,$82,$17,$0E,$82,$11,$48
.byte $27,$0E,$84,$11,$49,$77,$84,$11
.byte $4A,$88,$27,$0E,$84,$17,$0E,$84
.byte $17,$0D,$84,$28,$0E,$84,$18,$0E
.byte $84,$11,$2A,$80,$1C,$0B,$80,$1C
.byte $0C,$80,$7C,$1D,$0D,$81,$7D,$84
.byte $1E,$0D,$80,$1E,$0C,$80,$1E,$0B
.byte $80,$1E,$0A,$81,$7E,$84,$11,$4A
.byte $84,$11,$4B,$07,$0D,$84,$11,$4C
.byte $07,$0E,$84,$15,$0C,$84,$15,$0D
.byte $84,$05,$0D,$16,$0C,$84,$16,$0D
.byte $84,$0D,$0E,$81,$7D,$84,$1D,$0E
.byte $81,$7D,$84,$0D,$0D,$81,$7D,$84
.byte $1C,$0D,$81,$7C,$84,$0D,$0E,$81
.byte $7D,$84,$1D,$0E,$81,$7D,$84,$0D
.byte $0D,$81,$7D,$75,$03,$0D,$84,$1D
.byte $0D,$81,$7D,$84,$1C,$0E,$81,$7C
.byte $84,$1D,$0D,$81,$7D,$76,$14,$0D
.byte $88,$18,$0D,$84,$18,$0C,$17,$0E
.byte $84,$78,$17,$0D,$84,$17,$0C,$84
.byte $77,$88,$71,$12,$4C,$84,$12,$6C
.byte $84,$12,$0C,$84,$4B,$00,$73,$82
.byte $3B,$01,$82,$2B,$02,$12,$0B,$82
.byte $2B,$03,$82,$12,$0A,$1B,$04,$74
.byte $82,$1B,$05,$82,$1B,$06,$12,$6A
.byte $82,$1B,$07,$82,$1C,$09,$80,$1C
.byte $08,$80,$7C,$1D,$07,$81,$7D,$88
.byte $1B,$08,$82,$1C,$09,$80,$7C,$1D
.byte $08,$81,$7D,$7B,$84,$3A,$09,$84
.byte $4A,$09,$84,$4A,$08,$12,$0A,$84
.byte $12,$09,$84,$12,$08,$84,$2C,$08
.byte $80,$3C,$08,$80,$7C,$4D,$08,$81
.byte $7D,$7A,$88,$12,$68,$84,$22,$68
.byte $84,$32,$68,$84,$32,$08,$84,$32
.byte $07,$84,$32,$67,$84,$42,$67,$88
.byte $47,$07,$84,$47,$08,$84,$47,$09
.byte $48,$07,$84,$37,$09,$48,$08,$84
.byte $77,$48,$09,$84,$38,$09,$84,$78
.byte $88,$37,$09,$84,$47,$09,$84,$47
.byte $08,$38,$09,$84,$47,$07,$48,$09
.byte $84,$77,$48,$08,$84,$48,$07,$84
.byte $78,$88,$42,$07,$84,$42,$06,$84
.byte $42,$05,$84,$42,$04,$84,$42,$24
.byte $84,$32,$24,$84,$32,$04,$84,$32
.byte $03,$88,$37,$03,$84,$37,$02,$84
.byte $37,$01,$38,$03,$84,$47,$01,$38
.byte $02,$82,$09,$09,$82,$47,$00,$48
.byte $02,$19,$08,$82,$29,$07,$82,$47
.byte $01,$39,$06,$82,$3E,$05,$80,$3E
.byte $04,$80,$3E,$03,$81,$7E,$72,$82
.byte $39,$05,$82,$39,$04,$48,$03,$37
.byte $01,$82,$39,$03,$82,$3E,$03,$37
.byte $02,$81,$7E,$83,$4D,$03,$81,$7D
.byte $78,$44,$03,$84,$3D,$03,$81,$7D
.byte $82,$3D,$02,$81,$7D,$82,$3D,$03
.byte $81,$7D,$79,$88,$47,$02,$84,$47
.byte $03,$74,$88,$20,$01,$80,$20,$21
.byte $80,$20,$41,$80,$20,$61,$85,$47
.byte $02,$84,$37,$02,$84,$27,$02,$84
.byte $27,$01,$84,$77,$88,$20,$61,$80
.byte $20,$41,$80,$20,$21,$80,$20,$01
.byte $80,$70,$88,$FF,$45,$54,$44,$49
.byte $53,$4B,$31,$D9,$20,$48,$50,$52
.byte $49,$4E,$54,$2B,$33,$0D,$15,$53
.byte $54,$41,$54,$53,$20,$20,$20,$D9
.byte $20,$47,$45,$54,$47,$07,$48,$09
.byte $84,$77,$48,$08,$84,$48,$07,$84
.byte $78,$88,$42,$07,$84,$42,$06,$84
.byte $42,$05,$84,$42,$04,$84,$42,$24
.byte $84,$32,$24,$84,$32,$04,$84,$32
.byte $03,$88,$37,$03,$84,$37,$02,$84
.byte $37,$01,$38,$03,$84,$47,$01,$38
.byte $02,$82,$09,$09,$82,$47,$00,$48
.byte $02,$19,$08,$82,$29,$07,$82,$47
.byte $01,$39,$06,$82,$3E,$05,$80,$3E
.byte $04,$80,$3E,$03,$81,$7E,$72,$82
.byte $39,$05,$82,$39,$04,$48,$03,$37
.byte $01,$82,$39,$03,$82,$3E,$03,$37
.byte $02,$81,$7E,$83,$4D,$03,$81,$7D
.byte $78,$44,$03,$84,$3D,$03,$81,$7D
.byte $82,$3D,$02,$81,$7D,$82,$3D,$03
.byte $81,$7D,$79,$88,$47,$02,$84,$47
.byte $03,$74,$88,$20,$01,$80,$20,$21
.byte $80,$20,$41,$80,$20,$61,$85,$47
.byte $02,$84,$37,$02,$84,$27,$02,$84
.byte $27,$01,$84,$77,$88,$20,$61,$80
.byte $20,$41,$80,$20,$21,$80,$20,$01
.byte $80,$70,$88,$FF,$0D,$20,$08,$C4
.byte $02,$23,$22,$4D,$22,$0D,$20,$06
.byte $87,$01,$3E,$32,$0D,$20,$08,$C4
.byte $02,$23,$22,$46,$22,$0D,$20,$06
.byte $86,$01,$3C,$32,$0D,$20,$08,$CD
.byte $02,$23,$31,$32,$33,$0D,$20,$06
.byte $86,$01,$3E,$33,$0D,$20,$0F,$5E
.byte $32,$20,$20,$20,$20,$20,$20,$CD
.byte $02,$23,$39,$32,$0D,$20,$13,$5E
.byte $33,$20,$20,$20,$20,$20,$20,$D0
.byte $01,$50,$41,$53
50.html; generated on Thu Sep 21 17:08:53 2006 by ca65html
uz@cc65.org