Scratch Pad

Scratch pad for Displacer, please do not edit

DO NOT COUNT ON THIS DATA TO BE ACCURATE!
{{transcript|text=

A470 A4F4 A515 A526 A54B A5C3 - Overwrites one fixed encounter with another A611 - Overwrites one loot record with another A699 - Gas attack, knocks out all characters without gas masks A6F5 A738 A773 - Give ? (random character?) an affliction A795 - Give first character an affliction A7B6 - Give all characters an affliction A7E7 - Does nothing, just returns A7E8 A879 A8AF - Switch all character's sex A8D2 A903 - Decreases the range of monsters to use for random encounters by 1 A919 - Decreases random encounter probability by 2 A931 - Decreases the number of simultaneous random encounters on a map by 1 A947 - Increases random encounter probability by 2 A961 - Increases the number of simultaneous random encounters on a map by 1 (to a max of 14h) A977 - Increases the range of monsters to use for random encounters by 1 (to a max of 0Bh) A98D - Increases the range of monsters to use for random encounters by 1 (to a max of 0Ch) A9A3 - Increases the range of monsters to use for random encounters by 1 (to a max of 11h) A9B9 - Jumps to code subroutine 142Bh (plays the catapult sound) A9BC - Sets random encounter probability to 14h (1 in 20) A9C7 - Decreases random encounter probability by a factor of 0Ah (10), to a max entry of C8h (1 in 200) A9DD - Alters the flag byte of fixed encounters 10h - 21h. This must be a special case of some sort AA12 - Alters the flag byte of fixed encounter 22h. This must be a special case of some sort, Finster perhaps? AA3D - Just sets the carry flag and returns AA3F - Alters byte 3 (monster type) and 9 (flag byte) of fixed encounters 1Dh - 00h AA8E - Sets the flag byte of encounters 21h - 28h to 1 AABF - Alters the amount of cash in loot record 9 AB0E AB35 AB7B ABCA AC03 ACF0 - Turns off random encounters (sets probability to zero) ACFC - Sets random encounter probability to 1Eh (1 in 30) AD08 - Sets random encounter probability to 64h (1 in 100) AD14 - Checks if a party has 1 item out of a list, full explanation to follow.

ds:4653h Number of party members in current group ds:4654h Current party group ds:4655h Current map id ds:4656h Total number of party members (even if they're split into several groups) ds:4657h Current number of party groups (0 - 3) ds:46A6 Active party groups current x position ds:46A7 Active party groups current y position ds:7A31 Location of item list 7169 battle related A96F - A9AF 4 byte encounter battle headers A96F: Battle x position A970: Battle y position A971: Map battle is on A972: Distance from battle This limits the number of encounter battles as a whole to 16 on each map(?) 6B31, start of encounter data structure
 * Up arrow
 * 48h
 * Down arrow
 * 50h
 * Left arrow
 * 4Bh
 * Right arrow
 * 4Dh ||
 * 4Bh
 * Right arrow
 * 4Dh ||
 * 4Dh ||

Header
6B31: Group x position 6B32: Group y position 6B33: Map group is on 6B34: Distance from group 6B35 - 6B48: Start of calculated monster hit points for this group, 2 bytes each (low/high) 6B49 - 6B52: Attack flag for each monster 1 in this group - Attack, 0 - Don't attack This repeats for each group in encounter This limits encounters to 4 groups total, with a max of 10 monsters each

Code Rewrite to load decompressed tile layouts
Change relocate entry at 0058h from EA 15 to 5D 15 Alteration starts at 154A 53 push bx 8A 1E 55 46 mov bl, ds:4655 8A 87 1C BF mov al, [bx-40E4] 3C 40 cmp al, 40 74 03 je continue B9 00 04 mov cx, 400h continue: 5B pop bx 1E push ds B8 E2 0C mov ax, seg seg002 8E D8 mov ds, ax E8 4E FE call 13B2 1F pop ds 33 DB xor bx, bx 33 D2 xor dx, dx C3 retn

Code to load external save game
File name at ds:918Dh Alteration starts at 8744 BA 8D 91 mov dx, 918Dh address of ASCIIz file name "save" E8 3A 8C call 1384 open the file BA 31 71 mov dx, 7131h Address to read to B9 00 08 mov cx, 0800h Number of bytes to read, first part of save file E8 92 8E call 15E5 read in first part of save game BA 62 C0 mov dx, C062h Address of second part of save game B9 00 0A mov cx, 0A00h Number of bytes to read E8 89 8E call 15E5 read in second part of save game E8 64 91 call 18C3 close up the file E9 85 00 jmp 87E7h let original code set up the rest Works!

Code to save external save game
Alteration starts at 8813h BA 8D 91 mov dx, 918Dh E8 6B 8B call 1384 EB 28 jmp 8843 8849: E8 E4 8E call 1730

Code to load external item lists
Alteration starts at 85F3 File name now at ds:9196h 04 30 add al, 30h ; Convert item list number to ascii A2 99 91 mov ds:9199h, al ; Build the file name, name is now 'itmx' where x is the ascii number of the item list needed BA 96 91 mov dx, 9196h ; Location of our newly built file name E8 86 8D call 1384h ; Open the file EB 45 jmp 8645 ; Let original code finish up 864B: call 15E5 Works!

Code to save external item lists
Alteration starts at 8655h BA 96 91 mov dx, 9196h E8 29 8D call 1384 EB 4C jmp 86A9 86AF: call 1730 Works!

Code to load external maps
New header: 0000: Offset within map data to tile layout data (minus header) 0002: Size of map - 20h for 32x32, 40h for 64x64 0003: Start of map data This header will remove all reliance on data contained in the exe map00 - world map 0000: 81 21 (2181) 0002: 40 File name now at ds:91ABh Header now at ds:91B1h Alteration starts at 841F A0 55 46 mov al, ds:4655 84 C0 test al, al 79 09 jns blah 8A D8 mov bl, al 8A 87 1C BF mov al, [bx-40E4] ; sub map A2 55 46 mov ds:4655, al ; new sub map blah: 50 push ax ; Save original map number D4 0A aam ;convert al to decimal in ax 05 30 30 add ax, 3030h ; convert ax into 2 digit ascii number 86 E0 xchg al, ah ; fix little endianness A3 AE 91 mov ds:91AEh, ax ; This will complete file name build BA AB 91 mov dx, 91ABh ; Address of file name E8 44 8F call 1384 ; Open the file BA B1 91 mov dx, 91B1h ; Load address for header B9 03 00 mov cx, 03 ; Number of bytes to read, header length E8 9C 91 call 15E5 ; Read in the header 8B 0E B1 91 mov cx, ds:91B1h ; Length of map data up to tile data A1 B3 91 mov ax, ds:91B3h ; Get map size BA 00 06 mov dx, 0600 ; Assume its a 32x32 map 3C 40 cmp al, 40 ; Check map size 75 03 jne continue ; 32x32 BA 00 18 mov dx, 1800 ; 64x64 continue: 89 16 B0 46 mov ds:46B0, dx ; Pointer to map pointer table 33 D2 xor dx, dx ; map data loads to ds:0000 E8 82 91 call 15E5 ; Read in the map data B9 00 10 mov cx, 1000h BA 48 34 mov dx, 3448h E8 DE 90 call 154A ; Read in the tile layout E8 54 94 call 18C3h ; Close up the file 58 pop ax C3 retn Works!

Code to save maps
Alteration starts at 83BC BA AB 91 mov dx, 91ABh ; Offset to file name, will always contain the name of the currently loaded map E8 C2 8F call 1384 ; Open the file BA B1 91 mov dx, 91B1h ; Read address for header. This should still contain the data from the load, but lets just make sure B9 03 00 mov cx, 03 ; Number of bytes to read E8 1A 92 call 15E5 ; Read in the header 8B 0E B1 91 mov cx, ds:91B1h ; length of map data - tile layout 33 D2 xor dx, dx ; Map data starts at offset 0 E8 5C 93 call 1730 ; write the data E8 EC 94 call 18C3 ; Close up the file C3 retn Works!

Code to load external tile sets
Alteration starts at 86B6 ds:4655h holds the tile set needed File name at ds:91B4h mov al, ds:4655 push ax ; Save original map number D4 0A aam ;convert al to decimal in ax 05 30 30 add ax, 3030h ; convert ax into 2 digit ascii number 86 E0 xchg al, ah ; fix little endianness A3 B8 91 mov ds:91B8h, ax ; This will complete file name build BA B4 91 mov dx, 91B4h ; Address of file name E8 BA 8C call 1384 ; Open the file 8B D8 mov bx, ax ; File handle 1E push ds B8 E2 1A mov ax, 1AE2h ; This is seg003, need to add this to the offset list in the header! 8E D8 mov ds, ax ; ds now points to seg003 B9 80 51 mov cx, 5180h ; length of the file BA 60 2F mov dx, 2F60h ; Address to read to E8 D7 8C call 13B2h ; And read in the data 1F pop ds 8B 1E 74 91 mov bx, ds:9174 E8 E0 91 call 18C3h ; Close up the file 58 pop ax C3 retn Works!

Code to load external animations
Alteration starts at 851F File name now at ds:91A5h 50 push ax ; Save original animation number aam ;convert al to decimal in ax add ax, 3030h ; convert ax into 2 digit ascii number xchg al, ah ; fix little endianness A3 D5 2A mov ds:91A8h, ax ; This will complete file name build mov dx, 91A5h ; Address of file name call 1384 ; Open the file mov cx, 0FC0h ; Length of starting pic mov dx, ds:472Dh ; Address to load it to call 15E5 ; Load in first part of data cmp byte ptr ds:0BF12h, 34h ; Special end animation jz fixup mov cx, 0D48h ; Length of animation data mov dx, 2700 ; area to read it to call 15E5 ; load in the data pop ax jmp 85D6 ; Display the pic, and pass off control of animation to INT 8 handler fixup: mov cx, 4648h ; Length of special animation xor dx, dx ; Loads to 00 pop ax Jmp 85D6 Alteration at 85D9 (removes call to vertical xor routine) nop nop nop Works! }}