Session Start (hexnet.forgetit.net:#disch): Mon Mar 22 16:22:05 2004 *** Now talking in #disch. *** Topic of #disch: Shop Smart. Shop S-Mart. | #Disch, the channel of slickness. *** Set by Atma 12771 minutes ago *** Users on #disch: windwaker101 @Yona @Disch *** End of /NAMES list. *** Mode for channel #disch is "+ntr" *** Channel #disch was created at Mon Mar 22 07:47:00 2004 baaaack yep hmm Disch... [04:03:04 PM] just like to say I love 1337 speak disch <--- hahahaha... cool do you know ASM? 6502: yes x86: no lol ok I know a little about using a debugger and that stuff and I was looking for a little lesson if possible TFG is idle right now well how much asm do you know? any? I know how to give a character infinite lives erm well ok but and how to find a byte that controls things like jumping lol basically but little to none, just using a debugger so you don't know any asm then =P lol aight lol asm is actually pretty easy, once you have the concept It's a lot like algebra cool (basic algebra... like 5 = 3 + x stuff) gotcha the NES, has 3 major 'registers' that you can use heh back registers are just like variables (like 'x' in the above example).. .all they do is hold a number hmm just a wild guess is this like STA? They are: the accumulator (A), X-Index (X), and Y-Index (Y) oh yeah i read about that in yoshi's NES doc cool yeah they're important to know ok you know about STA.. .that's one of the basic instructions *** Apophis (AyagonaBur@gamepit-28520C53.tnt1.petersburg.va.da.uu.net) has joined channel #disch STA is "Store Accumulator" ok i knew that meaning you take A and store it in memory somewhere ok another is LDA, which is "Load Accumulator", which sets A to a certain value ok LDA #$FF <-- that sets the Accumulator to $FF ok that's not to hard a concept there's also LDX/STX and LDY/STY... which do the same thing, but with X and Y instead of A loading a variable and storing a variable, right? basically yeah cool ok... now... how much binary do you know? hmm like... do you know about OR operations.. and AND operations? yes i know basic C and C++ ah great ok and logic gates another common 6502 instruction is AND AND #$3F <--- will AND the Accumulator with $3F ok which is like saying (A = A & 0x3F) in C/C++ ok I get that there's also ORA... which does an OR operation 3 letter words all the time and EOR, which does an exclusive OR operation (sometimes called XOR) ok yeah A = A | 0x3F <-- ORA A = A ^ 0x3F <-- EOR (just for examples) ok i get that the rest of the 6502 instructions are like that... they're all VERY basic cool I'm not going to go through them all... but lemme get a link for you ok There's 3 other registers you should know about besides A, X and Y ok let me guess (Link: http://www.obelisk.demon.co.uk/6502/reference.html)http://www.obelisk.demon.co.uk/6502/reference.html <--- the link you should check out sometime ok been there lol lol but i'll read it this time lol not all of it will make sense.. .at least not until you understand addressnig modes... and the other 3 registers did you want to guess? =P lol not at all I lost my instruction list, so that link help mes, too. Thanks. This is a million times better than my old list. haha... np ok the other IMPORTANT register is the Processor Status register ok which is 8-bits in size... but rather than storing a whole number, each bit is more like a flag which indicates current status of the processor This register consists of eight "flags" (a flag = something that indi- cates whether something has, or has not occurred). Bits of this register are altered depending on the result of arithmetic and logical operations. These bits are described below: right Bit No. 7 6 5 4 3 2 1 0 S V B D I Z C 'S' is usually called 'N'... to avoid confusion ok let's start with the easiest flag... Z ok Zero flag represented by 1, right? after -nearly- every instruction is executed.. the Z flag is changed depending on the result of the operation flags are always on (1) or off (0).. there's no other value ok Z is set (on) when the last operation resulted in zero ok and cleared (off) when the last operation resulted in nonzero so i get that LDA #$43 <-- Z would be cleared after this... since A is nonzero LDA #$00 <-- Z would be set, since A is zero ok simple! so they are loading stuff into the accumulator, right? that's what LDA does, yeah most instructions affect Z though... like ADC (which is for addition) ADC #$43 <-- would add $43 to the current contents of A because it wouldn't result in 0, right? yeah and if that result is zero Z would be set ok and if not it wouldn't be it -could- be zero yeah, exactly ok example... $80 + $80 = $100... but since registers are only 8-bit.. that turns out to be $00 ok so if you do: LDA #$80 ADC #$80 Z would be set ok (set after the ADC command) ok next flag is N sign flag? the 'sigN' or 'Negative' flag cool it is set... when the highest bit of the last operation was on set if the operation is negative and cleared if positive yes cool high bit on <-- means negative k so for more examples (I love examples) LDA #$23 <-- N would be clear LDA #$C5 <-- N would be set how does that result negative? the high bit is on oh gotcha C5 = 1100 0101 ^ high bit oh i get it N and Z are the 2 flags that are used most often more than a certain amount of binary digits, right? hm? that's high bit, right? having more than a certain amount of binary digits, right? the high bit is the most significant one.... when you're dealing with 8-bit registers... the 'high' would be the 8th bit h000 000l <-- h = high bit, l = low bit ok gotcha ok now: C C = "Carry" carry flag holds and carries out significant opperations and is used -only- in Artimatic operations (like addition, subtraction, and bit shifting) ok let's do ASL because it's the simplest ASL means "Arithmatic Shift Left" ok ASL A <--- would shift the accumulator left 1 bit is that a status register? oh it's an operation yeah sorry ^^ ok, I get it do you know how bitshifting works? yeah ok well after ASL... C is set if the bit that got "shifted out" was on and is cleared otherwise ok so if the accumulator was on 01 and it got shifted left it would be 02 and 01 was on ok and the C flag would be cleared ok if A was 80 and you left shift it A would be 00, and C would be SET ok since the bit that got shifted out was on it works the same way for LSR (shift right) and ROL and ROR (more bitshifting instructions) for ADC, it works a little different ADC = addition instruction yeah, you told me ADC stands for "Add to Accumulator with Carry" yeah now that means... if C is set when you do an ADC operation ok the sum will actually be 1 higher than normal ok so LDA #$20, ADC #$10 <-- could be either $30 or $31 ...depending on whether or not C was set ok I get it that's easy C is also set at the end of ADC, if the sum was greater than $FF and is cleared if the sum was less than or equal to $FF ok kinda make sense? yeah aight but what happens if the sum is greater than FF? well it wraps to $00 since A can only hold 8 bits but the C flag is set so the game can know that the addition was too great by checking the C flag ok but really... it's there for doing multi-byte addition think of it like basic adding you're back in 1st grade and you're doing math: 15 + 19 34 5 + 9 = 14 yeah ok so you write down the 4 ok and write the CARRY up in the 10's place so you know to count it for the next addition that's how it works in asm C4 then? hm? well... right Carry in place of the 10 place oh no no lol I mean in 1st grade when you did math like that on paper yeah you'd add the 1's first ok then if it was > 10, you'd put the carry up in the 10's place ooooooooooooh gotcah like say you want to add $03F2 and $0522 together in asm *gotcha that would be hard to do with only 8-bit registers.. since the highest value you can hold is $FF and both those numbers are greater than $FF so when this happens... what games do is the clear the carry flag (with the CLC instruction) after carrying the number, right? well... it's common practice to clear carry before you start adding ok so that you don't get that extra 1 added when you don't want it I would think so yeah then they add the 2 low bytes together ($F2 and $22 in this example) that gives them $14 and the C flag is set ok then they add the 2 high bytes together ($03 and $05 in this example) and since C is set it adds one? $03 + $05 = $09 yes! yeah so $0914 is the sum sweet ok SBC is the subtraction instruction and it works the same way but is weird ok SBC uses the C flag -backwards- ie... if the C flag is CLEAR, and extra 1 is subtracted and if it's SET, subtraction is normal that's what I thought this is the opposite of ADC so be careful ok so it would be subtracting without the Carry flag well say A is $08 ok and the C flag is CLAR and you do SBC #$04 take a guess at what A could be after that *would #$04 right? you'd think so ;) but no because C is clear lol you'd subtract an extra 1 if C was SET, you'd be right oh of course so it's #$03 right? yep since it's backwards you subtract one instead of adding it because C is set SBC also changes the C flag like that too ok like if subtracting causes a number to be less than zero.... C is -CLEAR- and if not, C is set ok cool? that's one of the harder flags oh cool next flag is I... which isn't all -that- important for romhacking if I is set... it disables IRQs from occuring but that don't matter this is an interrupt enable/disable flag. If it is set, interrupts are disabled. If it is cleared, interrupts are enabled. shouldn't even have mentioned it lol yeah cool lol you don't have to worry about that for ROM hacking messing with I will just mess up your ROM unless you know what you're doing ok D, B, and the 'reserverd' flag aren't really used so the only other one is 'V' which is Overflow overflow flag Overflow is kind of stupid... I haven't figured it out ADC, SBC, and CLV are the only instructions to change it when an arithmetic operation produces a result too large to be represented in a byte, V is set (well... and RTI and PLP.. but nm those) lol ok see that's misleading yea that description makes it sound more like what Carry does yeah How overflow works on ADC is like this: when Positive + Positive = Negative, V is set ok i get it or when Negative + Negative = Positive, V is set otherwise, V is clear so here's a test question ;) ok A = $62... C is clear ADC #$31 would V be set or clear? clear * Disch makes incorrect buzz noise * windwaker101 bet's he got it wrong lol $62 and $31 are oth positive *both the sum $93 <-- is negative (high bit is on ok ooooooooooooooooooooh of course positive + positive = negative ----> V set yeah ok SBC does the same thing... kinda I was comparing it to $100 instead of the high bit ok Positive - Negative = Negative <-- V set ok Negative - Positive = Positive <-- V set otherwise V is clear ok that's the same idea as ADC... since subtracting a negative is like adding a positive =P V is hardly ever used... so don't sweat it too much ok lol ok now for the other registers! let's see.... you now know A, X, Y, and the Status let's do the PC next cool sweet PC = Program Counter unlike the other registers... this one is 16-bit meaning it can be $0000 - $FFFF woohoo! less negative #'s well... the game doesn't really use it though ;P o all this register does... it track the position of the code being executed ok IE... if the PC is $8F32 the next instruction to be executed is located at $8F32 ok that's all the PC does gotcha instruction like JMP... which jump to another area in code all JMP really does is change the PC ok so if the PC is $8F32 then JMP could change it to something completely different? well yeah.... it's like this as long as it is $9999 or below you've got a bunch of code $FFFF or below ;P lol oops that was an incredibly dumb mistake how to explain this ok.. gimmie a sec.. gonna paste something ok 8000: LDA #$43 8002: ADC #$01 8004: JMP $8000 ok the numbers on the left (8000, etc) are the offset... or location of the code so it is loading $43 into the accumulator then adding 01 with the carry flag set and than it is changing the PC to $8000 right? yeah but like ignore what I said about JMP changing the PC before lol you're right but I want to show this ok so when this code is being run is does the LDA and STA thing then it JMP "jumps" to $8000 ok which would jump back to the LDA comman *command oh I get it since it's at offset $8000 it was referring to the offset oh so that code would continually loop yeah I get it i thought it was changing the PC thing well it is ok the PC tells which instruction is being executed so if the PC is $8000 ok you're going to run the instruction at $8000 so it is saying "move back to offset $8000" yeah and loops cool easy just think of the PC as where the computer is looking ok that's what I thought ok cool next is the Stack Pointer k which... well... isn't all that important (I'm getting lazy now lol) lol kind of like a location of variable data, right? ok... $100 bytes in the NES RAM is reserved for "Stack" space yes! wow cool ok how it works on the NES... is the stack is at offset $0100 - $01FF ok *** Signoff: Apophis (hexnet.forgetit.net netho.forgetit.net) *** Signoff: Disch (hexnet.forgetit.net netho.forgetit.net) hmm odd server split, perhaps yeah I'll reconnect a lot of them went off at the same time on other IRC rooms same here *** Apophis (AyagonaBur@gamepit-28520C53.tnt1.petersburg.va.da.uu.net) has joined channel #disch *** Disch (~disch@gamepit-7472EC5.direcpc.com) has joined channel #disch *** Mode change "+o Disch" for channel #disch by netho.forgetit.net *** Mode change "+o Yona" for channel #disch by ChanServ haha they are back cool there we go damn server lol servers must have split what was the last thing you saw? lemme guess, it looked like we left =P yep lol wierd shall we continue? ok brace yourself... gonna paste a bunch of crap k [05:19:17 PM] the "bottom" of the stack is always $01FF [05:19:19 PM] ok [05:19:33 PM] when a value is "pushed" onto the stack [05:19:46 PM] it's placed at the position implied by the stack pointer [05:19:50 PM] then the stack pointer is decremented [05:20:06 PM] so say the Stack pointer is $F3 [05:20:19 PM] and A is $10 [05:20:36 PM] and I do a PHA command (PHA pushes Accumulator onto the stack) [05:21:09 PM] the contents of A ($10) would be stored at $0100+StackPointer (which would be $01F3) [05:21:32 PM] then the Stack Pointer would be decremented ( it would be $F2 afterwards) [05:21:55 PM] so that the next value to be pushed would go to $01F2 [05:21:58 PM] then $01F1 [05:21:59 PM] etc ok I get it PHA moves what is loaded into the accumulator onto the Stack right? lemme know when that all reaches you sweet as you might have guessed.. when you "pull" stuff off the stack (like with the PLA instruction) the Stack pointer increments *** Disconnected from irc.forgetit.net 10054 Session Close (#disch): Mon Mar 22 17:31:27 2004 Session Start (hexnet.forgetit.net:#disch): Mon Mar 22 17:31:37 2004 *** Now talking in #disch. *** Topic of #disch: Shop Smart. Shop S-Mart. | #Disch, the channel of slickness. *** Set by Atma 12840 minutes ago *** Users on #disch: windwaker101 @Disch Apophis @Yona *** End of /NAMES list. *** Your user mode is "+ix" *** Mode for channel #disch is "+ntr" *** Channel #disch was created at Mon Mar 22 07:47:00 2004 sorry about that got disconected np happens [05:26:16 PM] I get it [05:26:24 PM] sweet [05:26:54 PM] as you might have guessed.. when you "pull" stuff off the stack (like with the PLA instruction) the Stack pointer increments [05:27:33 PM] alrighty ok got it well that's all the 6502 registers! next thing is addressing modes ok cool but before that... it's important to understand the NES addressing space okk when you perform instructions, you usually have to specify an address ok what you're reading/writing depends on that address like it could be ROM... or it could be RAM ok or it could be a PPU register (and writing would change what's on the screen) I am familiar with that Picture Proccessing Unit you are? something like that and the CPU yeah do you know how the NES's addressing space is layed out? no ok $0000 - $07FF <--- RAM ok $0800 - $1FFF <--- mirrored RAM (this can't really be used as RAM... rather, read/writes to it just reflect what's at $0000-$07FF) ok $2000 - $2FFF <--- PPU registers (for drawing to the screen) this is in RAM, right? $3000 - $3FFF <--- Unused I think... might be a mirror of PPU registers this is -addressing space- not necessarily RAM like ok when you say LDA $8534... you're loading A with what's at location $8534 ok like the ASM area kinda it's called addressing space though =P ok like LDA $8534 <-- would read what's in ROM (since the $8000 range is ROM) ok but LDA $0345 <-- would read from RAM (since $0300 range is RAM) and LDA $2002 would read a PPU register... which is NEITHER RAM nor ROM anyway... continuing got it ram, rom, ppu got it $4000 - $4FFF <--- pAPU registers (for sound)... as well as some other registers (joypad and PPU related) $5000 - $5FFF <-- unused ok $6000 - $7FFF <-- SRAM.... which is not always available. Games that allow you to 'save' your game use this area for that RAM $8000 - $FFFF <--- ROM ok so LDA $7215 <-- where is that reading from? SRAM right? w00t yep cool I'm going to reconnect, but I'm logging this. Can you wait for me? yes guess we gotta take a little break ww I am logging this is well ok maybe I should be logging it too lol XD do you mind if I release a txt file of this later? very, very useful info *** dszv (AyagonaBur@gamepit-3F2B538.tnt1.petersburg.va.da.uu.net) has joined channel #disch back although I apparently haven't left yet. lol go head ww ok (about releasing it) this is very useful ok and I am honored to be being taught this heh.. np... I needed a break from working on my thing anyway anyway... if you noticed *** Signoff: Apophis (Ping timeout) ok lol *** dszv is now known as Apophis there's only $8000 bytes in ROM addressing space I finally left! lol what that means... is that -normally-... games would not be allowed to have more than $8000 bytes of code! oh since that's unacceptable... most games use a 'mapper' o which swaps out different areas of ROM to the addressing space but that's a subject for another day now that you know what's what in addressing space... I can touch addressing modes o cool first... is "Immediate" mode Immediate mode is signaled by a # symbol in asm LDA #$54 <--- is immediate mode LDA $54 <--- is NOT those are both 2 valid instructions.. but they both do very different things ok Immediate mode means you use the immediate given value ie: with, LDA #$54, you would actually load A -with- $54 ok for a C parallel.. .that would be like "A = 0x54;" ok to Carry it I meant C like the language... like C/C++ XD o lol C wouldn't be affected by LDA like the C flag gah I should be more clear lol anyway the 2nd example (LDA $54) is called "Zero Page" mode what this does... is it loads A with what's at addressing space $54 Is either of you logging this? I am (which... if you look at the above ranges, is RAM) ok can you load from the RAM, PPU, and SRAM? good, because I have to leave and let my brother get online. I'll get you to send me a copy later. so for another C/C++ parallel.. that'd be like saying "A = memory[ 0x54 ];" *** Signoff: Apophis (Forgotten: ) bye Apophis! I'll get him the log l8r You can read from anywhere in addressing space... so yeah.. it could be RAM, ROM, even PPU registers (which isn't the PPU itself) ok cool "Zero Page" mode is called Zero Page because it always references "page zero"... which is addressing space $0000-$00FF so it's impossible to read ROM using Zero Page mode... because ROM is in $8000 range ok however... the next addressing mode is "Absolute" mode ooooooh LDA $8534 <-- Absolute um... just a sec... it's -exactly- the same as zero page... only it can read from any page (ie... anywhere in addressing space) k just checked up there because it is in the ROM space, right? $8534 is ROM, yes... but that's not why that's Absolute mode it's absolute because it uses a 2-byte address instead of a 1-byte address o i see that's easy yeah =) Zero page is used because it takes up less space... and it's a little faster cool so that's "Immediate", "Zero Page", and "Absolute" next is Implied right? sure.. why not =P they don't really have any order o Implied is easy though so let's do that one cool "Implied" mode is when you don't need ANY extra info for the instruction... because the instruction's usage is implied by the instruction name itself example: CLC CLC = Clear Carry flag it takes no address ok that's really easy so it's Implied right now... "Accumulator" you might confuse Accumulator mode with Implied ok I'll try not to When using Accumulator mode... no adderess is taken... and the instruction is instead performed on the accumulator example: ASL A <-- left shifts the Accumulator that's not implied.. because you -could- left shift memory... like so: ok ASL $10 <--- Zero Page.. would left shift $10 in RAM ok cool? That one's easy this is where they start getting a little trickier "Absolute Indexed" mode cool or sometimes called "Absolute X" or "Absolute Y" ok these instruction would look like this: LDA $8000,X <-- Absolute X ok the comma in that syntax indicated indexing now what that means is you take the given address ok ($8000) and add the contents of X to it and that is the final address that you use ok so if X was $32 8032 *$8032 you'd be loading A with what's at $8032 in addressing space exactly easy easy easy Absolute Y is the same thing... just with the Y register LDA $8000,Y ok but be careful depending on the instruction.. you might not be able to use the Y register oh Y and X are variables of course yeah... X and Y are the other 2 main registers cool for an example of what I'm talking about... go to that 6502 reference page I linked ot *to and look at ASL ok Absolute,X addressing mode is listed... but NOT Absolute,Y so ASL $0342,Y <--- is not a valid instruction, because that addressing mode can't be used with ASL ok brb Session Close (#disch): Mon Mar 22 18:03:36 2004 Session Start (hexnet.forgetit.net:#disch): Mon Mar 22 18:04:30 2004 *** Now talking in #disch. *** Topic of #disch: Shop Smart. Shop S-Mart. | #Disch, the channel of slickness. *** Set by Atma 12873 minutes ago *** Users on #disch: windwaker101 @Disch @Yona *** End of /NAMES list. *** Mode for channel #disch is "+ntr" *** Channel #disch was created at Mon Mar 22 07:47:00 2004 lol wb back so continuing on k "Zero Page Indexed" or "Zero Page,X" and "Zero Page,Y" ok same idea... only with Zero Paged addresses (1-byte only) LDA $F2,X ok there's a catch, though don't know what the value of X is I was just showing syntax o but yeah if X is 3 ok you're read from $F5 in that example but now.... if X is $10 hmm you'd read from $02 A = $02 NOT $0102 yeah yeah... the final address has to remain Zero page cool again... Zero Page,Y isn't available as often as Zero Page,X is gotcha in fact, it rarely is available at all now... they get REALLY tricky ooooh "Pre-Indexed Indirect".... or "Indirect,X" note that this mode uses ONLY the X register a instruction that uses it would look like so: ok LDA ($52,X) <--- the parenthesis signal indirection now this is tricky ok first, you take $52 and add the contents of X ok to get a ZERO PAGE address (between $00-FF) hmm then you read 2 bytes from that address and THAT is the address you use for the instruction hmm to clear that up a bit hang on... lemme get an example going ok Assume you have the following: 001F = 03 0020 = 1F 0021 = 02 0022 = 30 ... 0230 = FF 0231 = 80 ... X = 2 and now let's say you do this: ok LDA ($1F,X) hmm first... you'd take $1F and add X to it... giving you $21 then you'd read 2 bytes from $21... giving you $02 and $30 gotcha and this was a terrible example because I put the bytes in the wrong order lol nm IGNORE THIS EXAMPLE XD lol let's try this again: 0020 = 1F 0021 = 03 0022 = 30 0023 = 02 ... 0230 = FF 0231 = 80 ... 80FF = 61 *** Flood detected from Disch. Ignoring for 15 seconds. first you take the given value ($20), add X to it to give you $22 lol wait... then you read 2 bytes from $22 .... $30 and $02 a flood has been detected ? nm ok so after reading those 2 bytes... we turn them into an address (with the first byte read being the low byte) so $30 and $02 become $0230 i get it and THAT'S the final address we use... so A would be loaded with $FF sweet since 0230 is FF uhhuh that's probably the trickiest but the next one is also kinda tricky ok "Post-Indexed Indirect" or "Indirect Y" this is a LOT more common and you can ONLY use the Y register... never X o In this mode the contents of a zero-page address (and the following byte) give the indirect addressm which is added to the contents of the Y-register to yield the actual address of the operand. Again, inassembly language, the instruction is indicated by parenthesis. An example instruction would look like so: LDA ($10),Y <-- indirect Y mode note that the parenthesis are placed a little different how THIS works... is like so: ok 1st) you take the Address given ($10) 2nd) read 2 bytes from that address ok $0010 3rd) turn those 2 bytes into an address (with the first byte read being the low byte) 4th) Add Y to that address and that's the final address lemme cook up an example... hopefully I'll do it right this time XD lol 0010 = 80 0011 = 02 ... 02A2 = F1 ... Y = A2 LDA ($10),Y ok i'll take a stab at this k um F1? yep =) lol yay! although it's kinda of easy since it had to be one of those values XD yep lol but yeah... you read 2 bytes from the address given ($10)... which gets you $80 and $02 ah shit what? [06:19:40 PM] Y = A2 <-- I meant 22 >_< sorry sorry lol lol anyway yeah... $80 and $02 ok make that an address: $0280 I get it add Y (which should be $22) to it.. giving you $02A2 and yeah ok! only 2 more modes! cool! "Indirect" mode which is only used in 1 instruction! JMP ($0436) <-- indirect JMP JMP $0436 <--- normal JMP (Absolute mode) ok that's easy yeah all you do... is read 2 bytes from the address give ($0436) and those 2 bytes are the address you jump to simple yep last mode! and the address is never more than 2 bytes "Relative" cool This mode is used with Branch-on-Condition instructions. It is probably the mode you will use most often. A 1 byte value is added to the program counter, and the program continues execution from that address. The 1 byte number is treated as a signed number - i.e. if bit 7 is 1, the number given byt bits 0-6 is negative; if bit 7 is 0, the number is positive. This enables a branch displacement of up to 127 bytes in either direction. lol yes but that doc explains it bad and even wrong o like the example it gives is incorrect anyway Like it says... it's only used in Branch commands (branch commands are like "if" statements) I always have a hard time explaining this one let's look at a branch instruction... BNE $05 <--- Relative mode (even though it looks like Zero Page) BNE = "Branch on Not Equal to Zero" ok meaning the program will skip ahead $05 bytes... ONLY if the Z flag is clear so what is it doing to $05? that's how many bytes it skips ahead o cool here's an example: 8000: BCC $01 8002: CLC 8003: ... BCC = "Branch on Carry Clear" ok CLC = Clear Carry flag *** FP[Worked_12h] (~FrenziedP@39A82C2.5C35FBC3.116543FB.IP) has joined channel #disch sup disch, yona, windwaker so it is skipping ahead to the CLC and then it is just stopping well there'd be more code after that but yeah if C is clear ... it skips past the next byte homemade? or regual 6502 stuff? explaining asm ah yeah 6502 If C is set... code continues as normal cool i get it ok but there's a trick the relative value could be negative and if it is, you jump BACKWARDS... not forewards ok like with subtraction kinda lemme cook up an example cool Disch, do i need a WM_KEYUP after a WM_KEYDOWN ? for what? after sending a msg it couldn't hurt, but I don't think you'd need it clc bcc #$05 .. .. .. .. 8000: DEX 8001: BNE $FD will go to target ok cool $FD is a negative number what's DEX? it actually is -3 Decrease X o cool DEX decrements the X register disch easy way to explain if its $80+ just - the num with 256 256-255 = 1, therefore its -1 cool yeah there you go =P so anyway if the BNE branches in that example it will jump back to $8000 and do the DEX command again make sense? yes it jumps back because of the negative number yeah well that's really it! Disch do you know comatosis? cool take a look at all the 6502 instructions and familiarize yourself with them hehe just never do -2 I'll release the log at TEK this helped a lot mind if I snag a copy from you? no prob 1