[01:41] * Michael1 wields his notes [01:42] :o [01:42] >:D [01:42] what did you do while I was gone Michael? XD [01:42] Notes :o [01:43] Michael how much stuff do you know that we don't have documented? [01:43] Not a huge amount, I think [01:44] ah okay. STill anything is good :D [01:44] Still* [01:44] I think Michael1 documents everything he knows :B [01:44] ...out of curiosity, what's the last-modified date on your copy of memory_functions.txt? [01:46] wait [01:46] * Captain_Bozo goes and looks [01:46] are we talking about information about EB that Michael1 knows and hasn't documented? [01:46] UM [01:46] or just any information at all? [01:46] I dunno Michael1. I apparently modified it without knowing [01:46] XD [01:46] Heh, okay ;D [01:46] Might've instinctively hit ctrl-S [01:47] There's some stuff that's "documented" in the "I wrote it this way so I'd remember to be suspicious and check it again" variety [01:47] For example, this one... [01:47] C2/16AD (C2/16AD to C2/16C8) L look into Change music [01:47] mhm [01:47] I kept "look into" on there because some stuff calls the underlying function [01:47] I must've [01:47] missed that XD [01:48] Which is in C4/F...somewhere [01:48] and then I went and labelled it everywhere. XD [01:48] anyways I gotta go. Sorry for being so abrubt XD [01:48] I'll be b ack later maybe [01:49] Wasn't sure what needed the C2-bank wrapper and what could use the C4-bank underlying stuff directly [01:51] FunctionC2_6BB8 is: [01:51] C2/6BB8 (C2/6BB8 to C2/6BDA) S A = 1 (success) or 0 (failure). [01:51] Argument: A = Probability of success (out of 256) [01:51] Function766, immediately following: [01:51] * Captain_Bozo has quit IRC (Ping timeout) [01:51] C2/6BDB (C2/6BDB to C2/6BFA) S A = 1 (success) or 0 (failure). [01:51] Argument: A = Probability of success (out of 500) [01:51] ...I'll keep adding comments. [01:52] The next few functions... I think they mess with some battler-related bit flags [01:52] 7EA96C to 7EA96F = Battler bit flags [01:52] (One for each battler) [01:53] One bit* [01:54] 7EA970 to 7EA971 = Current attacker (Pointer to a 7E9FAC battler entry) [01:54] 7EA972 to 7EA973 = Current target (Pointer to a 7E9FAC battler entry) [01:54] 7EA974 to 7EA977 = Scratch space for battle-end experience calculations [01:54] 7EA978 to 7EA979 = Scratch space for battle-end money calculations [01:56] The battler table starts at 9FAC; the first six entries are Ness, Paula, Jeff, Poo, Party NPC #1 and Party NPC #2. [01:56] The seventh slot is used by both Buzz Buzz and the Tiny Li'l Ghost. [01:56] The eighth slot is, so far as I know, unused. [01:57] The ninth slot onward (A21C and up) are used for enemies. [01:58] The battler table has 32 entries of 0x4E bytes each; it runs from 7E9FAC to 7EA96B, inclusive [02:00] By "next few" being related to the battler bit flags, I think maybe Function767 to... *reads* [02:01] 767-770 clear the bits up front [02:02] 771 seems to read those bits [02:04] Function785 knocks a specified target unconscious: [02:04] C2/7550 (C2/7550 to C2/7C95) L Knock out target [02:04] Argument: A = 7E9FAC battler pointer [02:08] You can thank the Tiny Li'l Ghost for most of that function's size :P [02:08] http://pkhack.fobby.net/misc/txt/C27550.txt [02:09] XD [02:09] C2/7C96 is aptly named "Fail_on_Luck", but it might need to be called Fail_on_Luck_80 or something - I'm pretty sure there's an identical function with 40 instead of 80 as the threshold for success or failure or whatever [02:09] C2/7C96 (C2/7C96 to C2/7CAE) S A = 1 (success) or 0 (failure) [02:09] Probability of failure: Target's Luck / 80 [02:10] ...Yep, there is [02:10] C2/8D41 is the other fail-on-luck function [02:10] C2/8D41 (C2/8D41 to C2/8D59) S A = 1 (success) or 0 (failure) [02:10] Probability of failure: Target's Luck / 40 [02:11] C2/7CAF is accurately described as "Fail_on_Speed": [02:11] C2/7CAF (C2/7CAF to C2/7CFC) S A = 1 (success) or 0 (failure) [02:11] Probability of failure: ((2 * Target's Speed) - Attacker's Speed) / A [02:13] Semantics of C2/7CFD ("Fail_on_NPC"): [02:13] C2/7CFD (C2/7CFD to C2/7D27) S Attack failure check (Attacks that fail against NPCs) [02:13] Prints "It did not work on !" if the target is an NPC [02:13] Returns: A = 0 (Chosen Four, ordinary enemies) [02:13] A = 1 (Party NPCs, Buzz Buzz, Tiny Li'l Ghost) [02:13] ...the term "NPC" is somewhat overloaded with meanings, especially in the context of combat [02:14] Here's the categories I'm using (at least until Murphy throws another curveball) [02:15] - The Chosen Four (Ness, Paula, Jeff, Poo) [02:16] - Party NPCs: Computer-controlled with behaviour based on an entry in enemy data. These use the "Party NPC #1" and "Party NPC #2" slots of the out-of-battle statistics table when in your party, and as such have persistent stats. [02:18] The out-of-battle statistics table is the one that starts at 7E99CE with Ness' name. Six entries, 0x5F bytes per entry. [02:19] If you see 0x5F being loaded and shortly thereafter a call to C08FF7 (A = A * low byte of Y), it's a good bet that function involves that table. [02:19] But I'm digressing. List of "Party NPCs" follows. [02:20] Pokey, Picky, King, Tony, Bubble Monkey, Brick Road, Flying Man 1, Flying Man 2, Flying Man 3, Flying Man 4, Flying Man 5, Teddy Bear, Super Plush Bear. [02:21] Buzz Buzz does not qualify because he doesn't occupy a party NPC slot; he gets his own category: [02:21] - Buzz Buzz [02:21] As does the Ghost: [02:21] - Tiny Li'l Ghost [02:22] And last but not least, the largest category of all: [02:22] - Ordinary enemies [02:24] Function788 swaps the attacker (A970) and target (A972): [02:24] C2/7E8A (C2/7E8A to C2/7EAE) S Swap the current Attacker and Target (A970 <--> A972) [02:24] Used to reflect attacks. [02:26] Function789 (C2/7EAF) is the basic damage function; it's what actually deals the damage (usually) after all the wrangling with resistances and effectiveness factors and randomness is solved [02:28] It has the code governing Giygas' phase-one omnireflecting shield, Master Belch and Giygas invincibility, and survival of mortal blows due to Guts [02:29] Wait, missed a comment; the actually HP subtraction is done by calls to C2/7126 and C2/71F0 (SetRollingHPTarget and ReduceHP) [02:29] Incidentally, this is why you can defeat Master Belch using the HP Sucker [02:30] :O [02:30] The HP Sucker works on the HP stats directly, without going through here, so it bypasses that check [02:31] In theory you could defeat Giygas phase one the same way, except I think there's a clause in C2/7550 ("Knock out target", from earlier) that makes Giygas properly death-immune [02:32] Function790 (C2/8125) is the standard damage metafunction [02:33] It takes an amount, and an "effectiveness" value (out of 256); 0xFF effectiveness skips the calculation so 0xFF-effectiveness is 100% instead of ~99.61% (255/256) [02:34] Consider, for example, PSI Freeze. [02:35] ...now that I try to describe the example accurately, it gets kind of unwieldy [02:37] I'll come back to this when I reach the two functions that translate enemy data "effectiveness" values into values that are out of 256 (why bother with the translation? why not just have the raw effectiveness values in enemy data? silly EB programmers ;D) [02:39] Other things in 8125: [02:40] If the amount of damage given to 8125 is negative, it's set to 0 [02:41] Next, if the battle effect inflicting this damage is of type 01 ("type" is the third byte of each battle effects entry), then damage is halved if the target is on-guard or has a physical shield [02:42] If damage at this point is 0, we set it to 1; damage is applied via C2/7EAF, which we just saw [02:42] 8125 handles the effects on a physical shield, as well as the 50% chance of waking a sleeping target [02:44] good old 8125 [02:45] Function794 (C2/8523) is a minimal-frills Level 2 attack: [02:45] C2/8523 (C2/8523 to C2/856A) S Level 2 attack [02:45] Minimum damage of 1. [02:45] Damage formula: ((2 * Attacker's Offense) - Target's Defense) +- 25% [02:46] It will not miss; it will not SMAAAASH; it will not be dodged. [02:48] Function796 (C2/859F) is the standard Bash. [02:49] It can miss (C2/82F8, attacker miss calculation); it can SMAAAASH (C2/83F8, SMAAAASH calculation); it can be dodged (C2/84AD, target dodge calculation) [02:49] It calls C2/8523 for the actual damage. [02:49] ...I'd like to take a moment to point out the rather lengthy chain here. [02:51] When you select Bash, you call C2/859F (standard Bash), which calls the miss/SMAAAASH/dodge functions above and then C2/8523 if appropriate (Level 2 attack), which calls C2/8125 (damage metafunction), which calls C2/7EAF (damage function), which calls either SetRollingHPTarget or ReduceHP depending on what's getting hit. Whew! [02:52] *insert joke about bureaucracy here!* [02:52] the EB programmer cashews do not allow directness and simplicity! [02:53] butts [02:54] Does it have to submit a 5405 Form to the IRS as well Michael1? [02:55] IN TRIPLICATE. [02:55] ;D [02:57] (Remember to fill in "Onett", "Beak Point Real Estate", etc. in all the appropriate fields.) [02:58] Oh, and Bash can cure feeling strange (call to C2/856B), but that's already named (CureFeelingStrange) :D [02:58] Function797 (C2/85DA) is "Level 4 attack" [02:59] Function798 (C2/8651) is "Level 3 attack" [02:59] Function799 (C2/86CB) is "Level 1 attack" [02:59] oh my goodness whats going on in here [03:00] These three, like Bash, are eligible to: miss, SMAAAASH, be dodged, and cure feeling strange (as well as all the stuff from calls deeper in, like waking sleeping targets) [03:01] ur a level 4 butt [03:01] NLA AHHHHHHHHHH [03:01] The reason for C2/8523 (no-frills L2 attack) becomes clear with our next function [03:02] NLA, do you know what's going on? [03:02] Function800 is the Shoot function, which can miss and be dodged, but will never SMAAAASH [03:02] Nor will it cure feeling strange [03:03] I.. I do not! :o [03:04] This way Bash and Shoot aren't duplicating code [03:05] Function801 (C2/8770) is the Spy battle effect [03:07] Function802 is a "do nothing" (REP #$31, RTL) - there's a bunch of these later on, so if we're looking to save space, we can scrap all but one and repoint stuff [03:07] * Michael1 points at C2/9033 through 9050 [03:08] And I'm sort of drifting into reciting memory_functions, so let's see what other comments are in this ebasm file... *scroll scroll* [03:12] In Function897, the check for defense increasing is to prevent underflow (2, 1, 0, 65535, 65534...) from turning "defense down" into "make nigh-invulnerable" [03:16] * MrAccident has quit IRC (Ping timeout) [03:16] * MrAccident has joined #pkhax [03:16] * ClumsyRobot sets mode: +oq MrAccident MrAccident [03:18] It's not listed at the top of the file, so... [03:19] oh futs D: [03:19] 7E97BA to C9 = Control code argument storage [03:19] 7E97CA = Counter used when gathering control code argument bytes [03:21] Also, I concur with the assessment that [1F 18] does nothing but burn seven argument bytes. O_o [03:22] CASHEWS! [03:22] oh yeah [03:22] I think I documented that one on datacrystal a while back [03:23] 1F 19 is the same [03:24] I'm pretty sure almost every control code that takes arguments could be simplified by increasing its argument constant (for [1F 18], LDA #$0006) by one and using a BCC instead of that four-branch madness [03:24] (The joys of compilers :D) [03:25] Also, since I'm not sure how well known these two are: [03:25] C3/0184 (C3/0184 to C3/0185) D [DB 01] - Event flag (Search ebasm.txt for "LDA $C30184") [03:25] C3/0186 (C3/0186 to C3/0187) D [ED 02] - Event flag (Search ebasm.txt for "LDA $C30186") [03:25] One of those is the pyjama flag [03:25] ah, the fabled pyjama flag [03:26] Yeah, [ED 02] [03:26] I'm not sure if the next few bytes are read via long accesses in a similar fashion [03:27] But there are a few unknowns before Movement 221 (0x0DD) starts at C3/0195 [03:27] Namely: [03:27] C3/0188 (C3/0188 to C3/0194) D look into [3C 00 44 80 00 41 3C 00 49 3C 00 42 00] [03:27] ...actually, maybe that's a scrap of movement code. I'm not sure. [03:28] [3C 00][44][80... or not [03:29] C2/B608 (C2/B608 to C2/B638) L A = { (0, 0xFF), (1, 0xB3), (2, 0x66), (3, 0x0D) } [03:29] C2/B639 (C2/B639 to C2/B669) L A = { (0, 0xFF), (1, 0x80), (2, 0x1A), (3, 0x00) } [03:30] These are the functions I mentioned earlier that turn the "effectiveness" values in enemy data into values out of 256 [03:32] ...they could have just stored the effectiveness values directly *headscratch* [03:34] ...though that would mess up the shared Hypnosis/Brainshock byte, I suppose [03:35] keep in mind, Mike: as silly as these EB programmers were, there's probably some method to their madness [03:35] some [03:36] Those are functions 964 and 965; the former for Fire and Freeze (100/70/40/5), the latter for Paralysis, Flash, Brainshock and Hypnosis (100/50/10/0) [03:38] yes, NLA [03:38] a method [03:38] that method is [03:38] 1. consume cashews [03:38] 2. do what the cashews tell you [03:39] the cashews haven't steered me wrong yet :) [03:40] well, that is to say.. not since the accident.. [03:42] AHA! [03:42] :D [03:42] C0/3FFD: AF 86 01 C3 LDA $C30186 [03:42] (Right after those two flags from earlier) [03:42] ...wait, no [03:42] That's the latter of the two [03:46] * Disconnected Session Close: Sun Apr 17 03:46:32 2011 Session Start: Sun Apr 17 03:47:12 2011 Session Ident: #pkhax [03:47] * Now talking in #pkhax [03:47] * Topic is 'http://translated.by/you/functional-programming-koans-in-ocaml/original/ | Today's verb of the day is: butts' [03:47] * Set by Penguin on Mon Feb 07 00:27:12 [03:47] * ClumsyRobot sets mode: +oa Michael1 Michael1 [03:49] Regarding Function49: there are a bunch of tables with 30 entries (each 2 bytes in size), related to onscreen sprites. $112E,X in Function48 likely references one of these. [03:50] 7E0B8E to 7E0BC9 = X coordinates of onscreen TPT entries [03:50] 7E0BCA to 7E0C05 = Y coordinates of onscreen TPT entries [03:50] From C0/94BA: JSR ($11A6,X) <-- 7E11A6 is a TPT-related table of assembly pointers? [03:50] From C0/94B7: JSR ($121E,X) <-- 7E121E is a TPT-related table of assembly pointers? [03:50] 7E1372 to 7E13AD = Wait timer for onscreen TPT entries [03:51] I think 7E1A42 is "onscreen entity we're meddling with right now" (00-1D), but I'm unsure [03:51] 7E436C = General debug toggle (Normally set to zero at C0/B9B4 and never changed) <-- Useful for finding stuff that's not supposed to be run :D [03:52] 7E467E to 7E4A02 = Table with 5-byte entries, related to drawing of onscreen sprites? <-- I've been meaning to look up the details on how the SNES does sprites hardwarewise in case this is related somehow [03:52] that one's supposed to interact with the battle debug mode in some way, but I haven't figured out how [03:52] the debug toggle [03:53] 7E4DC2 = Debug flag for battle engine (0x00 = Debug mode) <-- There's also this separate flag [03:54] I think that one's actually something else [03:54] it just happens to trigger debug mode at 0 [04:05] haven't really looked very far into it, though. [04:06] *adds note to 4DC2* [04:06] a quick search seems to indicate it's read in many places [04:09] C03CFD seems to read it. [04:13] * Disconnected Session Close: Sun Apr 17 04:13:52 2011 .