Jump to content
IGNORED

MOVB question


Willsy

Recommended Posts

One for the guru's: What is the condition of the EQ bit after executing this:

LI R0,>0011
LI R1,>2233
MOVB R0,R1

Subtle eh? The byte moved into R1 is 0, so R1 contains >0033.

 

Now the question: Since this is a BYTE operation, and we moved a 0 to the destination, does the EQ bit go on, or does the CPU check all 16 bits of R1 for 0 and set the EQ bit accordingly?

 

As usual, the Editor Assembler manual is absolutely pathetic on this point.

Edited by Willsy
Link to comment
Share on other sites

In the absence of more explicit information to the contrary, I would expect the comparison to be a byte comparison just as is CB, which is adequately explained. If it were not so, the GPL interpreter would likely be much bigger than it is, with its byte operations and all! I checked it with the Forth Assembler on Classic99 and the real iron. Both give the expected result, viz., if a 0 byte is copied, EQ is set to 1, otherwise to 0. Here is the code I used, which requires on the stack the number to be loaded in R0:

 

HEX
ASM: XXX
*SP R0 MOV, ( move number on stack to R0)
*SP CLR, ( reset number on stack to 0)
R1 2233 LI, ( load 2233h in R1)
R0 R1 MOVB, ( copy MSB of R0 to MSB of R1)
EQ IF, ( if result is 0 [EQ=1]...)
*SP INC, ( ...set number on stack to 1)
THEN,
;ASM

Running with 0011h on the stack (computer responses are underlined):

 

0011 XXX . 1 ok:0

 

and with FFFFh:

 

FFFF XXX . 0 ok:0

 

...lee

Link to comment
Share on other sites

The source byte is compared to zero during the operation, so EQ will be set (as InsaneMultitasker mentioned). The 9990 datasheet indicates this but not very clearly. I have another book that TI published on the 9990 architecture (http://www.amazon.com/Microprocessors-Microcomputers-System-Instruments-electronics/dp/007063758X/) that describes each instruction in much better detail. It was probably the reference from which the E/A manual was written. I also tested this extensively during the F18A GPU development.

  • Like 1
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...