C64 BTII: FILE5636010.PRG - DARGOTH"S TOWER LEVEL 1 MAGIC MOUTH

Any developer realated stuff
Post Reply
User avatar
Darendor
Posts: 1502
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

C64 BTII: FILE5636010.PRG - DARGOTH"S TOWER LEVEL 1 MAGIC MOUTH

Post by Darendor »

Okay so I've managed to de-encrypt a randomly selected ML file on the BT2 Dungeon #1 disk.

Specifically, FILE5636010.PRG.

This file appears to be the magic mouth on the first floor of Dargoth's Tower which asks if it's better to burn out or fade away. Interestingly, it appears to also contain text from the "Battletest" event found 1 level up. :shock:

I will publish my raw annotated findings thusly.

Code: Select all

BT2 Dungeon 1
"FILE5636010"  PRG - MAGIC MOUTH (DARGOTH'S TOWER LEVEL1)
#$EA | 234 | 11101010
2 blocks
18919 - 18666 = 253 bytes

EOR all bytes against 11101010


48ea ca       dex | 11001010 vs 11101010 = 00100000 / 20   JSR
48eb 0b       ??? | 00001011 vs 11101010 = 11100001 / e1   SBC
48ec e2       ??? | 11100010 vs 11101010 = 00001000 / 08   PHP
48ed 0c       ??? | 00001100 vs 11101010 = 11100110 / e6   INC
48ee 2b       ??? | 00101011 vs 11101010 = 11000001 / c1   CMP
48ef 48       pha | 01001000 vs 11101010 = 10100010 / a2   LDX
48f0 a3       ??? | 10100011 vs 11101010 = 01001001 / 49   EOR
48f1 ca       dex | 11001010 vs 11101010 = 00100000 / 20   JSR
48f2 f1 e2    sbc ($e2),y | 1b   SLO | 08   PHP
48f4 4a       lsr a | a0   LDY
48f5 48       pha | a2   LDX
48f6 48       pha | a2   LDX
48f7 8a       txa | 60   RTS
48f8 ca       dex | 20   JSR
48f9 ec e2 ca cpx $cae2 | 06   ASL | 08   PHP | 20   JSR
48fc 92       ??? | 78   SEI
48fd e2       ??? | 08   PHP
48fe ca       dex | 20   JSR
48ff 6d e2 23 adc $23e2 | 87   SAX | 08   PHP | c9   CMP
4902 28       plp | c2   NOP
4903 1a       ??? | f0   BEQ
4904 ca       dex | 20   JSR
4905 23       ??? | c9   CMP
4906 2c 3a 18 bit $183a | c6   DEC | d0   BNE | f2   ???
4909 ca       dex | 20   JSR
490a 0b       ??? | e1   SBC
490b e2       ??? | 08   PHP
490c 4a       lsr a | a0   LDY
490d 48       pha | a2   LDX
490e 48       pha | a2   LDX
490f 24 ca    bit $ca | ce   DEC | 20   JSR
4911 ec e2 0c cpx $0ce2 | 06   ASL | 08   PHP | e6   INC
4914 f7       ??? | 1d   ORA
4915 0c       ??? | e6   INC
4916 05 ca    ora $ca | ef   ISB
4918 e3       ??? | 09   ORA
4919 7a       ??? | 90   BCC
491a 4e c3 5b lsr $5bc3 | a4   LDY | 29   AND | b1   LDA
491d 84 c3    sty $c3 | 6e   ROR | 29   AND
491f 11 7b    ora ($7b),y | fb   ISB | 91   STA
4921 84 a6    sty $a6 | 6e   ROR | 4c   JMP
4923 e9 7a    sbc #$7a | 03   SLO | 90   BCC
4925 ca       dex | ef  ISB
4926 e3       ??? | 09   ORA
4927 7a       ??? | 90   BCC
4928 4e c3 5b lsr $5bc3 | a4   LDY | 6e   ROR | b1   LDA
492b 84 c3    sty $c3 | 6e   ROR | 23   AND
492d 11 7b    ora ($7b),y | fb   ISB | 91   STA
492f 84 48    sty $48 | 6e   ROR | a2   LDX
4931 ea       nop | 0   NOP
4932 ca       dex  | ef   ISB
4933 e8       inx | 02   ???
4934 e3       ??? | 09   ORA
4935 4a       lsr a | a0   LDY
4936 ea       nop | 0   NOP
4937 6e d0 43 ror $43d0 | 84   STY | 3a   NOP | a9   LDA
493a fa       ??? | 10   BPL
493b 7b       ??? | 91   STA
493c 8d 4a fe sta $fe4a | 67   RRA | a0   LDY | 14  NOP
493f 43       ??? | a9   LDA
4940 eb       ??? | 01   ORA
4941 7b       ??? | 91   STA
4942 8d 6f 1f sta $1f6f | 67   RRA | 85   STA | f5   SBC
4945 43       ??? | a9   LDA
4946 15 a6    ora $a6,x | FF   ISB | 4c   JMP
4948 73       ??? | 99   STA
4949 e2       ??? | 08   PHP
494a 2b       ??? | c1   CMP
494b 4a       lsr a | a0   LDY
494c 07       ??? | ed   SBC
494d 0b       ??? | e1   SBC
494e 0d 03 09 ora $0903 | e7   ISB | e9   SBC | e3   ISB
4951 4a       lsr a | a0   LDY
4952 07       ??? | ed   SBC
4953 05 1f    ora $1f | ef   ISB | f5   SBC
4955 1e 02 4a asl $4a02,x | f4   NOP | e8   INX | a0   LDY
4958 05 04    ora $04 | ef   ISB | ee   INC
495a 4a       lsr a | a0   LDY
495b 1e 02 0f asl $0f02,x | f4   NOP | e8   INX | e5   SBC
495e 4a       lsr a | a0   LDY
495f 1d 0b 06 ora $060b,x | f7   ISB | e1   SBC | ec   CPX
4962 06 4a    asl $4a | ec   CPX | a0   LDY
4964 19 1a 0f ora $0f1a,y | f3   ISB | f0   BEQ | e5   SBC
4967 0b       ??? | e1   SBC
4968 01 19    ora ($19,x) | eb   SBC | f3   ISB
496a 50 4a    bvc $49b6 | ba   TSX | a0   LDY
496c 48       pha | a2   LDX
496d 2b       ??? | c1   CMP						A
496e 04       ??? | ee   INC						n
496f 19 1d 0f ora $0f1d,y | f3   ISB | f7   ISB | e5   SBC		swe
4972 18       clc | f2   ???						r
4973 4a       lsr a | a0   LDY						[SPC]
4974 1e 02 03 asl $0302,x | f4   NOP | e8   INX | e9   SBC		thi
4977 19 46 4a ora $4a46,y | f3   ISB | ac   LDY | a0   LDY		s,[SPC]
497a 0c       ??? | e6   INC						f
497b 05 05    ora $05 | ef   ISB | ef   ISB				oo
497d 06 03    asl $03 | ec   CPX | e9   SBC				li
497f 19 02 4a ora $4a02,y | f3   ISB | e8   INX | a0   LDY		sh[SPC]
4982 05 04    ora $04 | ef   ISB | ee   INC				on
4984 0f       ??? | e5   SBC						e
4985 19 50 4a ora $4a50,y | f3   ISB | ba   TSX | a0   LDY		s:[SPC]
4988 23       ??? | c9   CMP						I
4989 19 4a 03 ora $034a,y | f3   ISB | a0   LDY | e9   SBC		s[SPC]i
498c 1e 4a 08 asl $084a,x | f4   NOP | a0   LDY | e2   NOP		t[SPC]b
498f 0f       ??? | e5   SBC						e
4990 1e 1e 0f asl $0f1e,x | f4   NOP | f4   NOP | e5   SBC		tte
4993 18       clc  | f2   ???						r
4994 4a       lsr a | LDY   a0						[SPC]
4995 1e 05 ea asl $ea05,x | f4   NOP | ef   ISB | 00   NOP		to[CR]
4998 ea       nop | 00   NOP						[CR]
4999 42       ??? | a8   TAY						(
499a 28       plp | c2   NOP						B
499b 43       ??? | a9   LDA						)
499c 1f       ??? | f5   SBC						u
499d 18       clc | f2   ???						r
499e 04       ??? | ee   INC						n
499f 4a       lsr a | a0   LDY						[SPC]
49a0 05 1f    ora $1f | ef   ISB | f5   SBC				ou
49a2 1e 46 4a asl $4a46,x | f4   NOP | ac   LDY | a0   LDY		t,[SPC]
49a5 05 18    ora $18 | ef   ISB | f2   ???				or
49a7 4a       lsr a | a0   LDY						[SPC]
49a8 1e 05 ea asl $ea05,x | f4   NOP | ef   ISB | 00   NOP		to[CR]
49ab 42       ??? | a8   TAY						(
49ac 2c 43 0b bit $0b43 | c6   DEC | a9   LDA | e1   SBC		F)a
49af 0e 0f 4a asl $4a0f | e4   CPX | e5   SBC | a0   LDY		de[SPC]
49b2 0b       ??? | e1   SBC						a
49b3 1d 0b 13 ora $130b,x | f7   ISB | e1   SBC | f9   SBC		way
49b6 55 36    eor $36,x | bf   SHA | dc   NOP				?[END-OF-TEXT-STRING MARKER]
49b8 48       pha | a2   LDX						"
49b9 3e 02 0f rol $0f02,x | d4   NOP | 	e8   INX | e5   SBC 		The
49bc 04       ??? | ee   INC						n
49bd 4a       lsr a | a0   LDY						[SPC]
49be 0e 05 4a asl $4a05 | e4   CPX | ef   ISB | a0   LDY		do[SPC]
49c1 19 05 4b ora $4b05,y | f3   ISB | ef   ISB | a1   LDA		so!
49c4 48       pha | a2   LDX						"
49c5 36 0f    rol $0f,x | dc   NOP | e5   SBC				[E-O-T-S]e
49c7 12       ??? | f8   SED						x
49c8 0b       ??? | e1   SBC						a
49c9 07       ??? | ed   SBC						m
49ca 03       ??? | e9   SBC						i
49cb 04       ??? | ee   INC						n
49cc 0f       ??? | e5   SBC						e
49cd 55 ea    eor $ea,x | bf   SHA | 00   NOP				?[CR]
49cf ea       nop | 00   NOP						[CR]
49d0 31 5b    and ($5b),y | db   DCP | b1   LDA				[1
49d2 47       ??? | ad   LDA						-
49d3 5d 37 4a eor $4a37,x | b7   LAX | dd   CMP | a0   LDY		7j[SPC]
49d6 0f       ??? | e5   SBC						e
49d7 12       ??? | f8   SED						x
49d8 0b       ??? | e1   SBC						a
49d9 07       ??? | ed   SBC						m
49da 03       ??? | e9   SBC						i
49db 04       ??? | ee   INC						n
49dc 0f       ??? | e5   SBC						e
49dd 46 4a    lsr $4a | ac   LDY | a0   LDY				,[SPC]
49df 05 18    ora $18 | ef   ISB | f2   ???				or
49e1 ea       nop | 00   NOP						[CR]
49e2 42       ??? | a8   TAY						(
49e3 2f       ??? | c5   CMP						E
49e4 43       ??? | a9   LDA						)
49e5 12       ??? | f8   SED						x
49e6 03       ??? | e9   SBC						i
49e7 1e 4a 00 asl $004a,x | f4   NOP | a0   LDY | ea   NOP		t[SPC][CR]
Last edited by Darendor on Fri Apr 19, 2019 7:29 pm, edited 2 times in total.
User avatar
Darendor
Posts: 1502
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Re: FILE5636010.PRG

Post by Darendor »

Here's a picture of my computer screen as I try to decipher the meaning of this file.

Don't laugh at me. :oops:

Image
User avatar
Darendor
Posts: 1502
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Re: FILE5636010.PRG

Post by Darendor »

So in case anyone is wondering, this event is found at 13N 16E on level 1 of Dargoth's Tower.

A magic mouth is here and asks the party if it's better to burn out or fade away.

Answering with "B" loads a fight with 1 Burner (30'). Defeating it appears to do nothing, but it seems to me that it should do something.

Answering with "F" simply generates a "Then do so!" reponse.

The event clears in either event, including if the party runs from the fight.

As an anecdote, I think this was inspired by the Def Leppard song "Rock of Ages", as that is the opening lyric. I could be off base here.

Image
Image
Image
User avatar
Darendor
Posts: 1502
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Re: FILE5636010.PRG

Post by Darendor »

Alllllllllllllllllll right.

I've completely decrypted (not de-encrypted) this file and reassembled the code in its native configuration.

Or something.

FIrst off, I used our thread from the last decade found here: viewtopic.php?f=17&t=910

I put my own comments/labels/observations alongside each code piece. These are based on ZeroZero's findings during the exploration of the Bard's Tale I game engine. Where the file appears to call on those pre-determined subroutines I've noted as such.

While this code piece seems to call a few of those subroutines (i.e. they persist into BTII), it becomes clear that there are unfamiliar memory locations that are called. $0899, $0887, $0878, $9009, and $9003 to name most.


The file properly demystified is found here, sans text strings (those are found on the opening post).

Code: Select all

REASSEMBLED CODE
48ea jsr $08e1		Call to unknown subroutine ($08e1)
48ed inc $c1		Add 1 to memory location $00c1 ("??? time counter ??? pass 1 round of time?")
48ef ldx #$49		Place hex value 49 in the X register
48f1 jsr $081b		Call to subroutine: "prompts and receives a line of input into buffer at 0334. Sets carry, if input was aborted. Returns in x number of chars." ($081b)
48f4 ldy #$a2		Place hex value a2 in the Y register
48f6 ldx #$60		Place hex value 60 in the X register
48f8 jsr $0806		Call to subroutine to clear the text window ($0806)
48fb jsr $0878		Call to unknown subroutine ($0878; different from BTI)
48fe jsr $0887		Call to unknown subroutine ($0887; also unknown in BTI)
4901 cmp #$c2		Compare hex value c2 against contents of accumulator ("A" register)
4903 beq $4925		Branch to location $4925 if zero flag is set
4905 cmp #$c6		Compare hex value c6 against contents of accumulator ("A" register)
4907 bne $48fb		Branch to location $48fb if zero flag is not set
4909 jsr $08e1		Call to unknown subroutine ($08e1)
490c ldy #$a2		Place hex value a2 in the Y register
490e ldx #$ce		Place hex value ce in the X register
4910 jsr $0806		Call to subroutine to clear the text window ($0806)
4913 inc $1d		Add 1 to memory location $001d ("the y position in the text window")
4915 inc $ef		Add 1 to memory location $00ef (Unknown function)
4917 jsr $9009		Call to unknown subroutine ($9009)
491a ldy #$29		Place hex value 29 in the Y register
491c lda ($6e),y	Place the contents of memory location $006e ("pointer to the present dungeon line {N coor offset in map}"), offset by the contents of Y register, in accumulator 
491e and #$fb		Performs AND operation against hex value fb and stores result in accumulator
4920 sta ($6e),y	Place contents of accumulator in memory location $00e6, offset by contents of the Y register
4922 jmp $9003		Jump to memory location $9003 (unknown function)
4925 jsr $9009		Call to unknown subroutine ($9009)
4928 ldy $6e		Place the contents of memory location $006e into the Y register
492a lda ($6e),y	Place the contents of memory location $006e, offset by contents of the Y register, into the accumulator
492c and #$fb		Performs AND operation against hex value fb and stores result in accumulator
4930 ldx #$00		Place the hex value 00 into the X register
4932 jsr $0902		Call to unknown subroutine ($0902)
4935 ldy #$00		Place the hex value 00 into the Y register
4937 sty $3a		Place the contents of the Y register into memory location $003a ("index of highest set group of foes")
4939 lda #$10		Place the hex value 10 into the accumulator
493b sta ($67),y	Place the contents of the accumulator into memory location $0067 (Unknown function), offset by the contents of the Y register
493d ldy #$14		Place the hex value of 14 into the Y register
493f lda #$01		Place the hex value of 01 into the accumulator
4941 sta ($67),y	Place the contents of the accumulator into memory locatoin $0067, offset by the contents of the Y register
4943 sta $f5		Place the contents of memory location $00f5 ("??? for fights: holds the group that attacks first ??? or maybe attacks last ???") into the accumulator
4945 lda #$ff		Place the hex value ff into the accumulator
4947 jmp $0899		Jump to memory location $0899 ("cause a special attack of an enemy in 03b0 to the char in 44")

What is both interesting and mildly worrying to me is that the file contains part of the text string found in a separate event. This file isn't one of those "split event" files I made during my campaign to add Drez'Brae to BTI. It seems to me the file was erroneously truncated.

As usual: I may be, and most likely am, wrong about at least some of this.

Nevertheless, please give me your feedback.
Post Reply