I wanted to start a separate thread about the Bard's Tale II C64 game engine.
It seems there are many, many, many subroutines to dissect and analyze, so this thread will be an attempt to catalogue them all.
I will dedicate 1 post to each subroutine I find and will annotate, commentate, exasperate, and possibly meditate them accordingly.
These will in all probability be works in progress in the long-term, since I work at about a snail's pace at this.
C64 BTII: Game Engine Subroutines
C64 BTII: Game Engine Subroutines
Last edited by Darendor on Mon Apr 15, 2019 11:55 pm, edited 1 time in total.
08E1 to ????
BARD'S TALE 2 - C64 GAME ENGINE SUBROUTINE - $08e1 to ???? INCLUSIVE
- Work In Progress as of: 9 April 2019
VinVICE emulation of BT2 frozen via monitor
Party/Game state: Level 3 of the Maze of Dread, facing North, coordinates: 17N 21E
GRRE, MALE, MACO, SOSI, YMCA spells all active (via BASP)
Bard's Song: INACTIVE (no bard in party)
Party of 7 characters (6 AM, 1 RO, no MN)
COMMENTS: Jesus H, 32 JMP commands at the get-go. What the hell...
Seems unlikely since the bytes at the end of these 32 JMP commands make perfect sense.
The engine code goes from 08e1 to 0a0a inclusive. Immediately beyond that is the text layout for the
game screen, i.e. "Character Name Hit Pts Spl Pts Cl" etc. One JSR sends the code to immediately AFTER this field.
This disassembly is INCONCLUSIVE; no RTS instruction encountered thus far.
- Work In Progress as of: 9 April 2019
VinVICE emulation of BT2 frozen via monitor
Party/Game state: Level 3 of the Maze of Dread, facing North, coordinates: 17N 21E
GRRE, MALE, MACO, SOSI, YMCA spells all active (via BASP)
Bard's Song: INACTIVE (no bard in party)
Party of 7 characters (6 AM, 1 RO, no MN)
COMMENTS: Jesus H, 32 JMP commands at the get-go. What the hell...
Seems unlikely since the bytes at the end of these 32 JMP commands make perfect sense.
The engine code goes from 08e1 to 0a0a inclusive. Immediately beyond that is the text layout for the
game screen, i.e. "Character Name Hit Pts Spl Pts Cl" etc. One JSR sends the code to immediately AFTER this field.
This disassembly is INCONCLUSIVE; no RTS instruction encountered thus far.
Code: Select all
.C:08e1 4C 9A 40 JMP $409A
.C:08e4 4C D5 40 JMP $40D5
.C:08e7 4C 15 41 JMP $4115
.C:08ea 4C 77 60 JMP $6077
.C:08ed 4C 95 60 JMP $6095
.C:08f0 4C 51 61 JMP $6151
.C:08f3 4C 8E 61 JMP $618E
.C:08f6 4C 16 55 JMP $5516
.C:08f9 4C 70 54 JMP $5470
.C:08fc 4C 7B 62 JMP $627B
.C:08ff 4C CC 61 JMP $61CC
.C:0902 4C 07 55 JMP $5507
.C:0905 4C BE 55 JMP $55BE
.C:0908 4C 5D 46 JMP $465D
.C:090b 4C 87 46 JMP $4687
.C:090e 4C F4 54 JMP $54F4
.C:0911 4C 41 56 JMP $5641
.C:0914 4C 2D 67 JMP $672D
.C:0917 4C D9 60 JMP $60D9
.C:091a 4C 77 1D JMP $1D77
.C:091d 4C 7C 60 JMP $607C
.C:0920 4C DF 66 JMP $66DF
.C:0923 4C E3 66 JMP $66E3
.C:0926 4C E4 55 JMP $55E4
.C:0929 4C AE 4A JMP $4AAE
.C:092c 4C E5 5F JMP $5FE5
.C:092f 4C 9F 63 JMP $639F
.C:0932 4C F7 55 JMP $55F7
.C:0935 4C BC 63 JMP $63BC
.C:0938 4C 6D 52 JMP $526D
.C:093b 4C 38 67 JMP $6738
.C:093e 4C 74 45 JMP $4574
.C:0941 78 SEI
.C:0942 A9 35 LDA #$35
.C:0944 85 01 STA $01
.C:0946 A2 0A LDX #$0A
.C:0948 A9 00 LDA #$00
.C:094a 95 00 STA $00,X
.C:094c E8 INX
.C:094d D0 FB BNE $094A
.C:094f A9 1F LDA #$1F
.C:0951 85 EC STA $EC "present time of day: after midnite 0 - 3, midnite 4 - 7, evening 8 - b, dusk c - f, afternoon 10 - 13, noon 14 - 17, mid morning 18 - 1b, early morning 1c - 1f" Seems to be set to 1f; i.e. early morning
.C:0953 A9 50 LDA #$50
.C:0955 85 DE STA $DE
.C:0957 A9 20 LDA #$20
.C:0959 85 87 STA $87
.C:095b A9 0A LDA #$0A
.C:095d 85 60 STA $60
.C:095f A2 18 LDX #$18
.C:0961 A9 00 LDA #$00
.C:0963 9D 00 D4 STA $D400,X
.C:0966 CA DEX
.C:0967 10 FA BPL $0963
.C:0969 85 F6 STA $F6 "the bard song that is playing, or 0 if none"
.C:096b A9 0C LDA #$0C
.C:096d 8D 18 D4 STA $D418
.C:0970 A0 00 LDY #$00
.C:0972 8C 4D 03 STY $034D
.C:0975 8C 4B 03 STY $034B
.C:0978 98 TYA
.C:0979 A2 04 LDX #$04
.C:097b 99 00 BC STA $BC00,Y
.C:097e C8 INY
.C:097f D0 FA BNE $097B
.C:0981 EE 7D 09 INC $097D
.C:0984 CA DEX
.C:0985 D0 F4 BNE $097B
.C:0987 A2 06 LDX #$06
.C:0989 A9 00 LDA #$00
.C:098b 9D 80 02 STA $0280,X
.C:098e CA DEX
.C:098f 10 FA BPL $098B
.C:0991 A9 03 LDA #$03
.C:0993 8D 14 03 STA $0314
.C:0996 A9 1E LDA #$1E
.C:0998 8D 15 03 STA $0315
.C:099b 20 00 40 JSR $4000
.C:099e 58 CLI
.C:099f A2 FF LDX #$FF
.C:09a1 86 F8 STX $F8
.C:09a3 86 A2 STX $A2
.C:09a5 9A TXS
.C:09a6 A9 08 LDA #$08
.C:09a8 85 88 STA $88
.C:09aa A9 10 LDA #$10
.C:09ac 85 54 STA $54 "next text output cursor y position (in whole screen width!)"
.C:09ae A9 00 LDA #$00
.C:09b0 85 55 STA $55 "next text output cursor y position (in whole screen width!)"
.C:09b2 A2 00 LDX #$00
.C:09b4 BD 19 0A LDA $0A19,X
.C:09b7 C9 DC CMP #$DC
.C:09b9 F0 06 BEQ $09C1
.C:09bb 20 5E 0A JSR $0A5E
.C:09be E8 INX
.C:09bf D0 F3 BNE $09B4
.C:09c1 A9 11 LDA #$11
.C:09c3 85 54 STA $54 "next text output cursor y position (in whole screen width!)"
.C:09c5 A5 54 LDA $54 "next text output cursor y position (in whole screen width!)"
.C:09c7 38 SEC
.C:09c8 E9 11 SBC #$11
.C:09ca 0A ASL A
.C:09cb 0A ASL A
.C:09cc 18 CLC
.C:09cd 69 42 ADC #$42
.C:09cf AA TAX
.C:09d0 A9 0A LDA #$0A
.C:09d2 69 00 ADC #$00
.C:09d4 A8 TAY
.C:09d5 A9 00 LDA #$00
.C:09d7 85 55 STA $55 "next text output cursor x position (in whole screen width!)"
.C:09d9 20 33 0B JSR $0B33
.C:09dc E6 54 INC $54 "next text output cursor y position (in whole screen width!)"
.C:09de A5 54 LDA $54 "next text output cursor y position (in whole screen width!)"
.C:09e0 C9 18 CMP #$18
.C:09e2 90 E1 BCC $09C5
.C:09e4 20 B3 11 JSR $11B3
.C:09e7 A9 26 LDA #$26
.C:09e9 20 85 47 JSR $4785
.C:09ec A9 01 LDA #$01
.C:09ee 85 A8 STA $A8
.C:09f0 A9 00 LDA #$00
.C:09f2 85 29 STA $29 09f2 to 09f7 inclusive places the party at 8N 0E
.C:09f4 A9 08 LDA #$08
.C:09f6 85 28 STA $28
.C:09f8 A9 01 LDA #$01
.C:09fa 85 24 STA $24 $0024 = "the direction the party looks/moves into (double in 0002?)"; #$00 could mean north
.C:09fc A2 B0 LDX #$B0
.C:09fe A9 00 LDA #$00
.C:0a00 9D 41 09 STA $0941,X
.C:0a03 CA DEX
.C:0a04 10 F8 BPL $09FE
.C:0a06 A9 02 LDA #$02
.C:0a08 4C DC 1C JMP $1CDC Passes control of the engine to $1cdc? [SUBROUTINE EXITS HERE?]
.C:0a0b 00 BRK START OF VARIABLES/DATA/TEXT?
.C:0a0c B8 CLV 8
.C:0a0d 80 B8 NOOP #$B8
.C:0a0f 00 BRK
.C:0a10 B9 80 B9 LDA $B980,Y 9_9
.C:0a13 00 BRK
.C:0a14 BA TSX :
.C:0a15 80 BA NOOP #$BA _:
.C:0a17 00 BRK
.C:0a18 BB A0 A0 LAS $A0A0,Y ;[SPC][SPC]
.C:0a1b C3 E8 DCP ($E8,X) Ch
.C:0a1d E1 F2 SBC ($F2,X) ar
.C:0a1f E1 E3 SBC ($E3,X) ac
.C:0a21 F4 E5 NOOP $E5,X te
.C:0a23 F2 JAM r
.C:0a24 A0 CE LDY #$CE [SPC]N
.C:0a26 E1 ED SBC ($ED,X) am
.C:0a28 E5 A0 SBC $A0 e[SPC]
.C:0a2a C1 C3 CMP ($C3,X) AC
.C:0a2c A0 A0 LDY #$A0 [SPC][SPC]
.C:0a2e C8 INY H
.C:0a2f E9 F4 SBC #$F4 it
.C:0a31 A0 D0 LDY #$D0 [SPC]P
.C:0a33 F4 F3 NOOP $F3,X ts
.C:0a35 A0 A0 LDY #$A0 [SPC][SPC]
.C:0a37 D3 F0 DCP ($F0),Y Sp
.C:0a39 EC A0 D0 CPX $D0A0 l[SPC]P
.C:0a3c F4 F3 NOOP $F3,X ts
.C:0a3e A0 C3 LDY #$C3 [SPC]C
.C:0a40 EC DC B0 CPX $B0DC l~0
.C:0a43 A0 A0 LDY #$A0 [SPC][SPC]
.C:0a45 DC B1 A0 NOOP $A0B1,X ~1[SPC]
.C:0a48 A0 DC LDY #$DC [SPC]~
.C:0a4a B2 JAM 2
.C:0a4b A0 A0 LDY #$A0 [SPC][SPC]
.C:0a4d DC B3 A0 NOOP $A0B3,X ~3[SPC]
.C:0a50 A0 DC LDY #$DC [SPC]~
.C:0a52 B4 A0 LDY $A0,X 4[SPC]
.C:0a54 A0 DC LDY #$DC [SPC]~
.C:0a56 B5 A0 LDA $A0,X 5[SPC]
.C:0a58 A0 DC LDY #$DC [SPC]~
.C:0a5a B6 A0 LDX $A0,Y 6[SPC]
.C:0a5c A0 DC LDY #$DC [SPC]~
.C:0a5e 8E FA 0A STX $0AFA
.C:0a61 8C FC 0A STY $0AFC
.C:0a64 48 PHA
.C:0a65 A2 00 LDX #$00
.C:0a67 86 91 STX $91
.C:0a69 8E E4 0A STX $0AE4
.C:0a6c A0 03 LDY #$03
.C:0a6e A5 55 LDA $55
.C:0a70 DD FF 0A CMP $0AFF,X
.C:0a73 90 1B BCC $0A90
.C:0a75 E8 INX
.C:0a76 DD FF 0A CMP $0AFF,X
.C:0a79 B0 16 BCS $0A91
.C:0a7b E8 INX
.C:0a7c A5 54 LDA $54
.C:0a7e DD FF 0A CMP $0AFF,X
.C:0a81 90 0F BCC $0A92
.C:0a83 E8 INX
.C:0a84 DD FF 0A CMP $0AFF,X
.C:0a87 B0 0A BCS $0A93
.C:0a89 A9 FF LDA #$FF
.C:0a8b 8D E4 0A STA $0AE4
.C:0a8e D0 03 BNE $0A93
.C:0a90 E8 INX
.C:0a91 E8 INX
.C:0a92 E8 INX
.C:0a93 E8 INX
.C:0a94 88 DEY
.C:0a95 D0 D7 BNE $0A6E
.C:0a97 68 PLA
.C:0a98 48 PHA
.C:0a99 D0 06 BNE $0AA1
.C:0a9b 20 F1 0B JSR $0BF1
.C:0a9e 4C F9 0A JMP $0AF9
.C:0aa1 38 SEC
.C:0aa2 E9 A0 SBC #$A0
.C:0aa4 0A ASL A
.C:0aa5 0A ASL A
.C:0aa6 26 91 ROL $91
Re: BTII - C64 Game Engine Subroutines
Darendor,
The dungeon-subroutines should be really similar to the ones in BT1 - perhaps even in the same order. Mind that BT2 was based on BT1. Cranford probably didn't change a working legacy structure unless he decided to completely rewrite it.
The dungeon-subroutines should be really similar to the ones in BT1 - perhaps even in the same order. Mind that BT2 was based on BT1. Cranford probably didn't change a working legacy structure unless he decided to completely rewrite it.
/Twoflower
Re: BTII - C64 Game Engine Subroutines
Hi.
I'm aware. I'll resume investigating the in-memory subroutines once I finish with the dungeons level disassemblies.
I'm aware. I'll resume investigating the in-memory subroutines once I finish with the dungeons level disassemblies.