Reputation: 1
For example, if I have the number #1020h represented in hexadecimal, the most significant part is the 10 and the least is the 20. Is there an easy way of doing this? I'm using a 8 bit risc assembly simulator
Edit: I was told I had to use the JC conditional
Upvotes: 0
Views: 119
Reputation: 365237
In an 8-bit system (like 8-bit RISC AVR for example) a 16-bit number is already stored as 2 separate bytes. You don't have to do anything special; it's already in separate registers so you literally already have the 0x10
high byte isolated in a register with zero instructions.
Or you already need to deal with its storage in memory as 2 separate bytes, e.g. using 2 separate load instructions.
Also, if you need to branch then there's some other part of the problem you aren't mentioning, like maybe adding two other numbers to get this 16-bit number.
Upvotes: 1