Jump to content
IGNORED

Another Stupid Assembler Question


Tempest

Recommended Posts

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...