Nukey Shay Posted September 18, 2001 Share Posted September 18, 2001 Tempest-- The instructions INC, DEC, INY, DEY, INX, and DEX also affect the N flag...which will be set if the result was negative. This is a little something that I overlooked when I suggested fixing Cafeman's DL move loop by using the carry flag (which these instructions do not affect), and also shows in that example why BPL worked (as long as bit 7 was not on) when BCC failed. Anyway, back to the point... They work much the same way that the instructions for the X and Y registers work...just that the result is placed at a memory location instead of the registers. The CPU flops the rightmost bit and continues to the next bit if the result could not be stored in one bit (i.e. if it were to result in -1 or 2...values that cannot exist in binary code). When finished, the Z flag is set if the result is zero, and the N flag is set if the result is "negative" (if bit seven is on). Cafeman-- I'd be surprised if there were a limit to the number of labels or variables in an assembler. The source code is basically just text, and the assembler should just search and replace any number of these with the correct values as it compiles it into executable code. Languages like Basic have these limitations, since it does the dirty work for you. Quote Link to comment Share on other sites More sharing options...
DanBoris Posted September 18, 2001 Share Posted September 18, 2001 The limit on the length of variables and labels is determined by the specific assembler you are using. In most cases the limits are probably so large (128 character or more) it really would not become an issue. Dan Quote Link to comment Share on other sites More sharing options...
+Cafeman Posted September 18, 2001 Share Posted September 18, 2001 Thanks. I was just wondering if I had 2 similar long labels such as: DrawSomethingGreatBig1 and DrawSomethingGreatBig2 ..if the assembler would truncate 'em and get an error or not. I don't have labels/variables THAT long, so great! No problem it seems. Quote Link to comment Share on other sites More sharing options...
Tempest Posted September 18, 2001 Author Share Posted September 18, 2001 Ok, here's another stupid assembler question for you: How does INC and DEC work? Can I for instance say: INC Counter and have it increase the value of the Counter by 1? If not how does INC and DEC work? Tempest Quote Link to comment Share on other sites More sharing options...
+Cafeman Posted September 18, 2001 Share Posted September 18, 2001 I used it like that and it works. It will skip from $FF to $00 and set that Z flag thing, so be careful. I've been using INC in particular for variables like ScanLine. After Vblank I move zero to Scanline and in my DLI I have the stmt "INC Scanline", followed by some checks which change colors based on which scanline its on. Here's another question tacked on to Tempest's thread -- is there a limit to the length (# chars) of Labels and Variable names in 6502 ASM? What is it? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.