øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1889.0;prev_next=preve:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index2201.htmldelayedslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1889.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index2201.html.zxyJg^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈpn&[OKtext/htmlISO-8859-1gzip@øÕ&[ÿÿÿÿÿÿÿÿÑHTue, 10 Mar 2020 08:22:40 GMT0ó°° ®0®P®€§²ð®xJg^ÿÿÿÿÿÿÿÿ0&[ Editing the probabilities of formations in an encounter

Author Topic: Editing the probabilities of formations in an encounter  (Read 1559 times)

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Editing the probabilities of formations in an encounter
« on: August 16, 2013, 12:31:26 PM »
Each map has associated with it the index of what I call an encounter. An encounter consists of eight formations (particular battles) which could be fought when you run into a battle on that map. We now know that the probability of each formation being selected is as follows:

1: 43/256
2: 43/256
3: 43/256
4: 43/256
5: 32/256
6: 32/256
7: 16/256
8: 4/256

The question then is, where are these probabilities stored, and can we change them? Can we make it so that, for example, encounter 8 only has 1/256, or has more of a chance, like say 12 or 16/256, and adjust the others accordingly?
Let's dance!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Editing the probabilities of formations in an encounter
« Reply #1 on: September 30, 2013, 07:47:36 AM »
I decided to finally take a look at this and have found some interesting information on it.

A Random Number is created when you go into an encounter... somehow (not really sure how) but those listings are appropriate...

Code: [Select]
$00/8AF1 E6 87 INC $87    [$00:0687] A:00CB X:0006 Y:0008 P:eNvMxdizc +1 to 000687.
$00/8AF3 D0 0E BNE $0E    [$8B03] A:00FF X:0006 Y:0008 P:envMxdizc - Does A read 00?
$00/8B03 A6 3D LDX $3D    [$00:063D] A:00FF X:0006 Y:0008 P:envMxdizc - Load X from 063D.
$00/8B05 C9 2B CMP #$2B A:00FF X:0000 Y:0008 P:envMxdiZc - Is it 2B (43)or Higher?
$00/8B07 90 1F BCC $1F    [$8B28] A:00FF X:0000 Y:0008 P:eNvMxdizC - If not branch to 008B28.
$00/8B09 E8 INX A:00FF X:0000 Y:0008 P:eNvMxdizC - +1 to X.
$00/8B0A C9 56 CMP #$56 A:00FF X:0001 Y:0008 P:envMxdizC - Is it 56 (86) or Higher?
$00/8B0C 90 1A BCC $1A    [$8B28] A:00FF X:0001 Y:0008 P:eNvMxdizC - If not branch to 008B28
$00/8B0E E8 INX A:00FF X:0001 Y:0008 P:eNvMxdizC  - +1 to X.
$00/8B0F C9 81 CMP #$81 A:00FF X:0002 Y:0008 P:envMxdizC - Is it 81 (129) or Higher?
$00/8B11 90 15 BCC $15    [$8B28] A:00FF X:0002 Y:0008 P:envMxdizC - If not branch to 008B28.
$00/8B13 E8 INX A:00FF X:0002 Y:0008 P:envMxdizC - +1 to X.
$00/8B14 C9 AC CMP #$AC A:00FF X:0003 Y:0008 P:envMxdizC - Is it AC (172) or Higher?
$00/8B16 90 10 BCC $10    [$8B28] A:00FF X:0003 Y:0008 P:envMxdizC - If not branch to 008B28.
$00/8B18 E8 INX A:00FF X:0003 Y:0008 P:envMxdizC  - +1 to X.
$00/8B19 C9 CC CMP #$CC A:00FF X:0004 Y:0008 P:envMxdizC - Is it CC (204) or Higher?
$00/8B1B 90 0B BCC $0B    [$8B28] A:00FF X:0004 Y:0008 P:envMxdizC - If not branch to 008B28.
$00/8B1D E8 INX A:00FF X:0004 Y:0008 P:envMxdizC - +1 to X.
$00/8B1E C9 EC CMP #$EC A:00FF X:0005 Y:0008 P:envMxdizC - Is it EC (236) or Higher?
$00/8B20 90 06 BCC $06    [$8B28] A:00FF X:0005 Y:0008 P:envMxdizC - If not branch to 008B28.
$00/8B22 E8 INX A:00FF X:0005 Y:0008 P:envMxdizC - +1 to X.
$00/8B23 C9 FC CMP #$FC A:00FF X:0006 Y:0008 P:envMxdizC Is it FC (251) or Higher?
$00/8B25 90 01 BCC $01    [$8B28] A:00FF X:0006 Y:0008 P:envMxdizC - It not branch to 008B28 (not sure how that could happen)
$00/8B27 E8 INX A:00FF X:0006 Y:0008 P:envMxdizC - +1 to X.
$00/8B28 86 3D STX $3D    [$00:063D] A:00FF X:0007 Y:0008 P:envMxdizC - Store X in 3D (Where the Encounter is decided)
$00/8B2A 60 RTS A:00FF X:0007 Y:0008 P:envMxdizC - Return

And there you have it. That is the code which decides the encounter. Curiously enough it isn't taken by a random number alone. It is a Random Number +94 allowing for looping. So EC would loop back to a much less value.


Or maybe it's not so random after all... Hmm, I may have stumbled upon the true "RNG" of the game, at least in dealing with battles...

Code: [Select]
$00/8AE6 A5 87 LDA $87    [$00:0687] A:0000 X:006C Y:0008 P:envMxdiZc - Load Number of Battles Fought Since Starting Game (resets when you reset the game.)
$00/8AE8 AA TAX A:0016 X:006C Y:0008 P:envMxdizc - Transfer A to X.
$00/8AE9 BF 00 EE 14 LDA $14EE00,x[$14:EE16] A:0016 X:0016 Y:0008 P:envMxdizc - Load A starting from  14EE00 - (This is a value that changes everytime the file is loaded and Only when the File is Loaded it seems. Meaning if you're having bad RNG during a particular play session it may be because of this.
$00/8AEE 6D EE 17 ADC $17EE  [$00:17EE] A:002D X:0016 Y:0008 P:envMxdizc - Add this Value into A to create the "random number".

Now this is where things really start to fall off. I never expected FFIV to take such a cheap way for RNG (at least battle RNG.

14EE00 is a sequence of bytes that all have an assortment of bytes that never change, but all differ in value. From 14EE00 to 14EEFF. Which means a talented hacker could check their RNG at all times and know what is coming up. The value only moves when a battle occurs. It goes from 00 to 01, 01 to 02, etc.

Now this was informative and quite enlightening! I'm glad to see I could not just figure out battle probabilities but the underlying factors in their generation.
« Last Edit: September 30, 2013, 02:27:30 PM by Grimoire LD »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Editing the probabilities of formations in an encounter
« Reply #2 on: September 30, 2013, 02:28:41 PM »
Enormous Update above! I stress any FFIV player with even a modicum of interest to check it out. The Battle Probability RNG is completely laid bare. (as in what encounter you will have, not the chance you will go into a battle mind you.)

Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: Editing the probabilities of formations in an encounter
« Reply #3 on: September 30, 2013, 05:13:52 PM »
I was fully aware how not random FF4 battles ran and it's not random.

The plus is that you know you are guaranteed to fight every possible on the encounter list the longer you are in a specific location.

It was more problematic in FF4A, but significantly better in FF4:TAY (although, I think the emulation is screwing with the drop distribution).
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Editing the probabilities of formations in an encounter
« Reply #4 on: September 30, 2013, 07:59:28 PM »
Hmm? I never knew that this information was already found. Did I waste my time looking for it then? If so, could you point me to where I can see the notes another may have written, they might shed some more light on the subject for me.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Editing the probabilities of formations in an encounter
« Reply #5 on: September 30, 2013, 11:16:09 PM »
Here's the information on how to edit Drop Rates

Code: [Select]
$03/ED26 AD A3 16 LDA $16A3  [$7E:16A3] A:0004 X:00E4 Y:0004 P:envMxdiZC - Load Random Number (seems to be a true Random number) into A.
$03/ED29 65 97 ADC $97    [$00:0097] A:0019 X:00E4 Y:0004 P:envMxdizC - Add the value in 97 (looks to be another true random number)
$03/ED2B 85 97 STA $97    [$00:0097] A:008C X:00E4 Y:0004 P:eNVMxdizc - Store the new value back into 07.
$03/ED2D 20 93 85 JSR $8593  [$03:8593] A:008C X:00E4 Y:0004 P:eNVMxdizc - Jump to Subroutine
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/8593 7B TDC A:008C X:00E4 Y:0004 P:eNVMxdizc - Transfer Direct Flag
$03/8594 AA TAX A:0000 X:00E4 Y:0004 P:enVMxdiZc - Transfer A to X.
$03/8595 A9 FF LDA #$FF A:0000 X:0000 Y:0004 P:enVMxdiZc - Load FF into A.
$03/8597 20 79 83 JSR $8379  [$03:8379] A:00FF X:0000 Y:0004 P:eNVMxdizc - Jump to Subroutine
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/8379 E2 10 SEP #$10 A:00FF X:0000 Y:0004 P:eNVMxdizc - Set Processor Status.
$03/837B 86 96 STX $96    [$00:0096] A:00FF X:0000 Y:0004 P:eNVMXdizc - Store X in 96.
$03/837D E0 FF CPX #$FF A:00FF X:0000 Y:0004 P:eNVMXdizc - Is X FF?
$03/837F D0 02 BNE $02    [$8383] A:00FF X:0000 Y:0004 P:enVMXdizc  - If so branch to 038383
------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------
$03/8383 C9 00 CMP #$00 A:00FF X:0000 Y:0004 P:enVMXdizc - Is it 00?
$03/8385 F0 2F BEQ $2F    [$83B6] A:00FF X:0000 Y:0004 P:eNVMXdizC - If so branch 0383B6.
$03/8387 C5 96 CMP $96    [$00:0096] A:00FF X:0000 Y:0004 P:eNVMXdizC - Is it 96? (150)
$03/8389 F0 2B BEQ $2B    [$83B6] A:00FF X:0000 Y:0004 P:eNVMXdizC - If so branch to 038B86.
$03/838B A6 97 LDX $97    [$00:0097] A:00FF X:0000 Y:0004 P:eNVMXdizC - Load X from 0097.
$03/838D 38 SEC A:00FF X:008C Y:0004 P:eNVMXdizC - Set Carry Flag.
$03/838E E5 96 SBC $96    [$00:0096] A:00FF X:008C Y:0004 P:eNVMXdizC - Subtract the value from 96 into A.
$03/8390 C9 FF CMP #$FF A:00FF X:008C Y:0004 P:eNvMXdizC - Is it FF?
$03/8392 D0 05 BNE $05    [$8399] A:00FF X:008C Y:0004 P:envMXdiZC If not branch to 038399
$03/8394 BD 00 19 LDA $1900,x[$7E:198C] A:00FF X:008C Y:0004 P:envMXdiZC - Load A from 7E1900+x (Faux random number, created by a real Random Number, strange...)
$03/8397 80 1D BRA $1D    [$83B6] A:00B0 X:008C Y:0004 P:eNvMXdizC - Branch to 038987.
$03/83B6 C2 10 REP #$10 A:00B0 X:008C Y:0004 P:eNvMXdizC - Reset Processor Status
$03/83B8 60 RTS A:00B0 X:008C Y:0004 P:eNvMxdizC - Return
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/859A 60 RTS A:00B0 X:008C Y:0004 P:eNvMxdizC - Return
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/ED30 C9 80 CMP #$80 A:00B0 X:008C Y:0004 P:eNvMxdizC - Is the Value in A 80 or Above?
$03/ED32 B0 04 BCS $04    [$ED38] A:00FF X:008C Y:0004 P:envMxdizC - If so branch to 03ED38
-----------------------------------------------------------------------------------------------------------------------------------------------------
$03/ED34 A9 00 LDA #$00 A:0060 X:0010 Y:0004 P:eNvMxdizc - Load 00 (Common Item) into A.
$03/ED36 80 12 BRA $12    [$ED4A] A:0000 X:0010 Y:0004 P:envMxdiZc - Branch to 03ED4A.
-----------------------------------------------------------------------------------------------------------------------------------------------------
$03/ED38 C9 D0 CMP #$D0 A:00FF X:008C Y:0004 P:envMxdizC - Is the Value in A D0 or Above?
$03/ED3A B0 04 BCS $04    [$ED40] A:00FF X:008C Y:0004 P:envMxdizC - If so branch to 03ED40.
-------------------------------------------------------------------------------------------------------------------------------------------------------
$03/ED3C A9 01 LDA #$01 A:00AA X:0020 Y:0004 P:eNvMxdizc - Load 01 (Uncommon Item) into A.
$03/ED3E 80 0A BRA $0A    [$ED4A] A:0001 X:0020 Y:0004 P:envMxdizc - Branch to 03ED4A.
----------------------------------------------------------------------------------------------------------------------------------------------------------
$03/ED40 C9 FC CMP #$FC A:00FF X:008C Y:0004 P:envMxdizC - Is the Value in A FC or Above?
$03/ED42 B0 04 BCS $04    [$ED48] A:00FF X:008C Y:0004 P:envMxdizC - If so branch to 03ED48.
---------------------------------------------------------------------------------------------------------------------------------------------------------
$03/ED44 A9 02 LDA #$02 A:00ED X:0043 Y:0004 P:eNvMxdizc - Load 02 (Rare Item) into A.
$03/ED46 80 02 BRA $02    [$ED4A] A:0002 X:0043 Y:0004 P:envMxdizc - Branch Always to 03ED4A.
---------------------------------------------------------------------------------------------------------------------------------------------------------
$03/ED48 A9 03 LDA #$03 A:00FF X:008C Y:0004 P:envMxdizC - Load 03 (Mythic Item) into A.
$03/ED4A AA TAX A:0003 X:008C Y:0004 P:envMxdizC - Transfer A to X.
$03/ED4B BD 9C 28 LDA $289C,x[$7E:289F] A:0003 X:0003 Y:0004 P:envMxdizC - Load A from current location of Monster Drops.
$03/ED4E A6 B5 LDX $B5    [$00:00B5] A:00E7 X:0003 Y:0004 P:eNvMxdizC - Load X from B5.

This is as far as we need to go for our purposes.

So yes, as long thought the changes are as labeled. When an item obtain occurs the game runs through a routine to see what the item obtained will be. 00-7F Common, 80-CF Uncommon, D0-FB Rare FD-FF. The values are listed above and are easily changed. I always thought the idea of a 1/64 Item a rather silly notion. It guarantees that you will most likely never get it and the item will be just a stupidly rare item. A novelty at best. Thank goodness for the Treasure Hunter Augment in FFIV:DS and the Rare Ring's in FFIV:TAY.

I still need to determine the chance that you will get an item in the first place.





Deathlike2

  • Moderator
  • *
  • Posts: 3,538
  • I'm looking at you, bitch!
    • View Profile
Re: Editing the probabilities of formations in an encounter
« Reply #6 on: October 01, 2013, 12:36:11 AM »
Hmm? I never knew that this information was already found. Did I waste my time looking for it then? If so, could you point me to where I can see the notes another may have written, they might shed some more light on the subject for me.

It's known about the behavior... not as much know about where to look for it (unless some of the data is already someplace like DataCrystal).

I still need to determine the chance that you will get an item in the first place.

It's probably a good idea to just get a monster that summons another monster (like an Imp/Goblin) and trace it after killing a bunch of them.

5/96 chance to drop for most monsters (set by the data, as referenced in zyrothgar's editor) with certain ones getting the 25% chance to drop (it's the monsters that drop Tents and Cabins).
Working on the next Yet To Be Named FF4 "Hardtype" Hack Download Latest: v1.48

Video Demos: #1 #2 #3

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Editing the probabilities of formations in an encounter
« Reply #7 on: October 01, 2013, 12:19:17 PM »
I've been using an Imp with a Drop Rate of 2 (80) for tests, and that did lead me pretty far but only in terms of collecting items not their original chance of obtaining them.

The DataCrystal's RAM Map is pretty interesting, but it doesn't contain a lot of what's already known in the Tower of Babil Docs and barely anything about battle is even referred to.

For what its worth the exact same "random" sequence of bytes pointed out by Yousei long ago in 1900-19FF are the exact same sequence found in 14EE00 (LoRom/HiRom).


And I have found it! (At least the Item Chance. It was exactly as you thought DeathLike2. 5, 25, and 100%.)

Code: [Select]
$03/ECE5 BD 8E 35 LDA $358E,x[$7E:358E] A:0000 X:0000 Y:0004 P:envMxdiZc - Load A from Group Item Byte.
$03/ECE8 85 B3 STA $B3    [$00:00B3] A:00B8 X:0000 Y:0004 P:eNvMxdizc - Store A in B3.
$03/ECEA BD 8E 35 LDA $358E,x[$7E:358E] A:00B8 X:0000 Y:0004 P:eNvMxdizc - Load A from Group Item Byte (Why? It's already loaded?)
$03/ECED 29 C0 AND #$C0 A:00B8 X:0000 Y:0004 P:eNvMxdizc - Remove bytes that don't correspond with next checks.
$03/ECEF C9 C0 CMP #$C0 A:0080 X:0000 Y:0004 P:eNvMxdizc - Is it C0?
$03/ECF1 F0 17 BEQ $17    [$ED0A] A:0080 X:0000 Y:0004 P:eNvMxdizc - If so branch to 03ED0A. (Skip the Item Chance - Always Obtain Item.)
$03/ECF3 C9 40 CMP #$40 A:0080 X:0000 Y:0004 P:eNvMxdizc - Is it 40?
$03/ECF5 D0 04 BNE $04    [$ECFB] A:0080 X:0000 Y:0004 P:envMxdizC - If not branch to 03ECFB.
------------------------------------------------------------------------------------------------------------------------------------------------
$03/ECF7 A9 05 LDA #$05 A:0040 X:0001 Y:0004 P:envMxdiZC - Load 05 (5% ) into A.
$03/ECF9 80 06 BRA $06    [$ED01] A:0005 X:0001 Y:0004 P:envMxdizC - Branch to 03ED01
-----------------------------------------------------------------------------------------------------------------------------------------------
$03/ECFB C9 80 CMP #$80 A:0080 X:0000 Y:0004 P:envMxdizC - Is it 80?
$03/ECFD D0 5B BNE $5B    [$ED5A] A:0080 X:0000 Y:0004 P:envMxdiZC - If not branch to 03ED5A.
$03/ECFF A9 19 LDA #$19 A:0080 X:0000 Y:0004 P:envMxdiZC - Load 19 (25%) into A.
$03/ED01 85 B4 STA $B4    [$00:00B4] A:0019 X:0000 Y:0004 P:envMxdizC - Store A in B4.
$03/ED03 20 8B 85 JSR $858B  [$03:858B] A:0019 X:0000 Y:0004 P:envMxdizC - Jump to Subroutine
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/858B 7B TDC A:0019 X:0000 Y:0004 P:envMxdizC - Transfer Direct Page.
$03/858C AA TAX A:0000 X:0000 Y:0004 P:envMxdiZC - Transfer A to X.
$03/858D A9 62 LDA #$62 A:0000 X:0000 Y:0004 P:envMxdiZC - Load 62 (98?) into A.
$03/858F 20 79 83 JSR $8379  [$03:8379] A:0062 X:0000 Y:0004 P:envMxdizC - (We've covered the subroutine before (above) so I will skip to the new and important dealings.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
...
$03/838B A6 97 LDX $97    [$00:0097] A:0062 X:0000 Y:0004 P:envMXdizC - Load Random Number from 0097 into X.
$03/838D 38 SEC A:0062 X:0035 Y:0004 P:envMXdizC - Set Carry Flag.
$03/838E E5 96 SBC $96    [$00:0096] A:0062 X:0035 Y:0004 P:envMXdizC - Subtract A ?from 96?
$03/8390 C9 FF CMP #$FF A:0062 X:0035 Y:0004 P:envMXdizC - Is it FF?
$03/8392 D0 05 BNE $05    [$8399] A:0062 X:0035 Y:0004 P:envMXdizc - If not, branch to 038399.
----------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------
$03/8399 1A INC A A:0062 X:0035 Y:0004 P:envMXdizc - +1 to A (Making it 99)
$03/839A 8D 47 39 STA $3947  [$7E:3947] A:0063 X:0035 Y:0004 P:envMXdizc - Store A in 7E3947
$03/839D 9C 48 39 STZ $3948  [$7E:3948] A:0063 X:0035 Y:0004 P:envMXdizc - Store Zero in 7E3948.
$03/83A0 BD 00 19 LDA $1900,x[$7E:1935] A:0063 X:0035 Y:0004 P:envMXdizc - Load A from faux-RNG at 7E1935+x (again a real random number used to generate a false random number)
$03/83A3 AA TAX A:00CA X:0035 Y:0004 P:eNvMXdizc - Transfer A to X.
$03/83A4 8E 45 39 STX $3945  [$7E:3945] A:00CA X:00CA Y:0004 P:eNvMXdizc - Store X in 7E3945.
$03/83A7 C2 10 REP #$10 A:00CA X:00CA Y:0004 P:eNvMXdizc - Reset Processor Status.
$03/83A9 20 07 84 JSR $8407  [$03:8407] A:00CA X:00CA Y:0004 P:eNvMxdizc - Jump to Subroutine (Random Number Generator - In this case likely between 1-99 (the 63 above))
$03/83B8 60 RTS A:0004 X:0000 Y:0004 P:envMxdizc - Return
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/8592 60 RTS A:0004 X:0000 Y:0004 P:envMxdizc
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$03/ED06 C5 B4 CMP $B4    [$00:00B4] A:0004 X:0000 Y:0004 P:envMxdizc - Is the value less or the same as the one in B4 (5% or 19%)
$03/ED08 B0 50 BCS $50    [$ED5A] A:0004 X:0000 Y:0004 P:eNvMxdizc - If not branch to 03ED5A. (Cancel Item Obtaining).
$03/ED0A 06 B3 ASL $B3    [$00:00B3] A:0004 X:0000 Y:0004 P:eNvMxdizc - x2 the amount in B3.
$03/ED0C 06 B3 ASL $B3    [$00:00B3] A:0004 X:0000 Y:0004 P:envMxdizC - x2 the amount in B3.
$03/ED0E A5 B3 LDA $B3    [$00:00B3] A:0004 X:0000 Y:0004 P:eNvMxdizc - Load A from B3.
$03/ED10 AA TAX A:00E0 X:0000 Y:0004 P:eNvMxdizc - Transfer A to X.
$03/ED11 7B TDC A:00E0 X:00E0 Y:0004 P:envMxdizc - Transfer Direct Page.
$03/ED12 A8 TAY A:0000 X:00E0 Y:0004 P:envMxdiZc - Transfer A to Y.
$03/ED13 84 A9 STY $A9    [$00:00A9] A:0000 X:00E0 Y:0000 P:envMxdiZc - Store Y in A9.
---------------------------------------------(Looping Point)--------------------------------------------------------------------------
$03/ED15 BF 00 9F 0E LDA $0E9F00,x[$0E:9FE0] A:0000 X:00E0 Y:0000 P:envMxdiZc - Load A from Monster's Item Table.
$03/ED19 99 9C 28 STA $289C,y[$7E:289C] A:00CE X:00E0 Y:0000 P:eNvMxdizc - Store A in 7E289C.
$03/ED1C E8 INX A:00CE X:00E0 Y:0000 P:eNvMxdizc - +1 to X
$03/ED1D C8 INY A:00CE X:00E1 Y:0000 P:envMxdizc - +1 to Y.
$03/ED1E E6 A9 INC $A9    [$00:00A9] A:00CE X:00E1 Y:0001 P:envMxdizc - +1 to A9
$03/ED20 A5 A9 LDA $A9    [$00:00A9] A:00CE X:00E1 Y:0001 P:envMxdizc - Load A9 into A.
$03/ED22 C9 04 CMP #$04 A:0001 X:00E1 Y:0001 P:envMxdizc - Is it 04?
$03/ED24 D0 EF BNE $EF    [$ED15] A:0001 X:00E1 Y:0001 P:eNvMxdizc  - If not repeat the process until all of the items have been laid out.

The rest of the relevant code is above.

And there it is! All issues of Item Dealings that can be obtained from enemies. You can make the chance to obtain an item as high or as low as you like, but C0 seems to always be 100% because it skips the check to obtain the item. These things are quite simple to change and would likely be quite simple to include into the editor in time.