Jump to content
IGNORED

inc and dec limitations ?


Grevle

Recommended Posts

I had some problems with the inc and dec instrucions.

 

when i had one instance of incrementing a variable (PX)

 

inc px

 

the loop worked

 

and then was trying to use one more variable (P2X)

 

inc p2x.

 

this was in the same loop but that didnt work, i tried many different ways of using both variables but ,still it would now work, So i had to use some other metode that didnt use two insances of the inc command , and that worked right away so this lead me to think that the inc and dec instructions have some limitations, does it have something to do with the accumulator ?

Link to comment
Share on other sites

Inc and dec don't change C and V flag, so if you use bcc,bcs,bvc and bvs after inc or dec they jump based on some previous operation.

Other than that it should be pretty simple. Values go from 0-255, and new value influences Z and N flag.

 

Your error was probably somewhere else and not because of dec or inc. Could it be something with "p2x" variable name ? I'm not sure if such variable name with 'number between letters' is allowed in assembler you're using ?

Link to comment
Share on other sites

im using Atasm, hmm i think i used number between letter some other places, like the player equates p0x, p1x, p2x, p3x.. player X postionregisters and it seem to work normal.

 

The error probably is somwhere else. the code is getting quite complicated, for me anyway.

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...