Jump to content
Sign in to follow this  
BeeryMiller

Assembly Language Instruction

Recommended Posts

OK, I was using an assembly language instruction I have never used in the past.  I am obviously using it incorrectly as I am not getting expected results.  Please advise what I might do to correct.  Thanks.  

 

P.S., I ended up using the MOV instruction which used another word of instruction that solved the issue, but I would still like to understand where I am making my mistake.

 

START

            SETO @TOGGLE

            ABS    @TOGGLE

            JNE      SEC1

SEC2     BLWP   @THERE

             JMP      END

SEC1     BLWP   @HERE

END       BLWP    @>0000

TOGGLE DATA     0

 

I thought my code should JMP to SEC1, however it appears the EQ bit is not set and goes to SEC2.  Is there something I am overlooking with the use of the SETO command to set it to >FFFF I am overlooking?


Thanks for the feedback.

 

Beery

 

Share this post


Link to post
Share on other sites

I just tested this in Classic99 and it worked as expected. ABS on a value of -1 converts it to 1, which fails to set the equality bit, as it's not equal to zero.

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Hmmm, will need to check my code again.  Something wasn't adding up, somewhere.  My code is a bit more complicated than that example, so something else must be happening after I go through all the program initialization.

 

Beery

Share this post


Link to post
Share on other sites

9900 Family Systems Design p 8-132 says Single Operand Instructions that compare results to zero are:

 

INV, NEG, INC, INCT, DEC, DECT

 

These do NOT compare results to zero:

 

B, BL, BLWP, CLR, SETO, ABS, SWPB, X

 

So, either SETO or ABS leave the jump undetermined.

 

  • Like 1

Share this post


Link to post
Share on other sites
13 minutes ago, FarmerPotato said:

9900 Family Systems Design p 8-132 says Single Operand Instructions that compare results to zero are:

 

INV, NEG, INC, INCT, DEC, DECT

 

These do NOT compare results to zero:

 

B, BL, BLWP, CLR, SETO, ABS, SWPB, X

 

So, either SETO or ABS leave the jump undetermined.

 

 

That's interesting because both the TI Tech Pages and Classic99 contradict that.

Share this post


Link to post
Share on other sites

Page 41 of the E/A manual is my goto when I am confused.

 

Well actually I used to be confused, but now I am not too sure. 😟

 

0xBF

EA MANUAL PG41.jpg

Share this post


Link to post
Share on other sites
2 minutes ago, TheBF said:

Page 41 of the E/A manual is my goto when I am confused.

 

Well actually I used to be confused, but now I am not too sure. 😟

 

0xBF

 

Aha, there is a footnote to ABS. "Operand is compared to zero for status bit." Not the result.

 

So, the status tells you about prior to ABS.  I would expect 


 

 ABS R1
 JLT  HERE

to jump if the sign had been -1 before ABS.

I've never known or knowingly relied on this.

  • Like 1

Share this post


Link to post
Share on other sites

Actually, there is an error in the Editor/Assembler manual concerning the ABS command. It says that the Carry bit is unaffected, but I just tested it on my Geneve (TMS9995), and the Carry bit is always reset.

 

*          
*           LAECOPX
*   FFFE    10000***
*   FFFF    10000***
*   0000    00100***
*   0001    11000***
*   0002    11000***
*   7FFE    11000***
*   7FFF    11000***
*   8000    10001***
*   8001    10000***

 

I'm glad to say that I did it right with ABS in MAME (had to make sure first). This can be the cause of such extremely rare bugs that stay unnoticed for years.

Share this post


Link to post
Share on other sites
46 minutes ago, mizapf said:

Actually, there is an error in the Editor/Assembler manual concerning the ABS command. It says that the Carry bit is unaffected, but I just tested it on my Geneve (TMS9995), and the Carry bit is always reset.

 

 

*          
*           LAECOPX
*   FFFE    10000***
*   FFFF    10000***
*   0000    00100***
*   0001    11000***
*   0002    11000***
*   7FFE    11000***
*   7FFF    11000***
*   8000    10001***
*   8001    10000***

 

 

I'm glad to say that I did it right with ABS in MAME (had to make sure first). This can be the cause of such extremely rare bugs that stay unnoticed for years.

So the table on page 41 is correct for ABS right?  

Share this post


Link to post
Share on other sites

Yes, and the corresponding information in the 9900 and 9995 specs.

 

BTW, this was one of the rare occasions where I used the LST command of the 9995 (to preload the status flags).

Share this post


Link to post
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.

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...