Hello everybody, I'm writing a disassembler and will need help on HEX and Assembly to write it. I'll make a proper thread on it later Smile

These are my Assembly and Hexadecimal Assembly questions.

QUESTION 1:According to the table here, [22] is:


Code:
ld (**),hl


In Assembly I'dd just:


Code:
ld (12),hl


But how should I do that in Hexadecimal?

QUESTION 2


Code:
ld hl,(**)


The same doubt as above but for [2A].

QUESTION 3

Since I'm coding a Disassembler, how should I handle bytes like [CB], [DD], [ED],[EF]? These link to other tables.



Thanks much for the help!

Edit by Merth: Moved out of the Open Topic board and in to the z80 board.
ScoutDavid wrote:
Hello everybody, I'm writing a disassembler and will need help on HEX and Assembly to write it. I'll make a proper thread on it later Smile

These are my Assembly and Hexadecimal Assembly questions.

QUESTION 1:According to the table here, [22] is:


Code:
ld (**),hl


In Assembly I'dd just:


Code:
ld (12),hl


But how should I do that in Hexadecimal?

QUESTION 2


Code:
ld hl,(**)


The same doubt as above but for [2A].


My advice is look at the Hex code of that after you made the ASM file.
The "**" are the bytes that come after the "ld (12),hl". For example, ld (12),hl assembles into $220C00. If you look at this hex, you'll see $22, which is ld (**),hl, and $0C00 is 12 in little endian.
souvik1997 wrote:
The "**" are the bytes that come after the "ld (12),hl". For example, ld (12),hl assembles into $220C00. If you look at this hex, you'll see $22, which is ld (**),hl, and $0C00 is 12 in little endian.


Thanks very much, 2 out of 3 questions have already been answered and I can continue coding Very Happy
I recommend consulting the Instruction Set section of the Z80 CPU User Manual for a reference on how instructions are encoded.

As for decoding instructions, this page suggests a simple table-based decoder which may provide a handy starting point.
ScoutDavid wrote:
souvik1997 wrote:
The "**" are the bytes that come after the "ld (12),hl". For example, ld (12),hl assembles into $220C00. If you look at this hex, you'll see $22, which is ld (**),hl, and $0C00 is 12 in little endian.


Thanks very much, 2 out of 3 questions have already been answered and I can continue coding Very Happy
Which is the third question that hasn't been answered, then?
QUESTION 3

Since I'm coding a Disassembler, how should I handle bytes like [CB], [DD], [ED],[EF]? These link to other tables.

According to the table here:

www.davidgom.co.cc/z80table.html
I suppose you'll need a quadruplet of conditional statements that each jump into a new table-lookup section of your disassembler? That seems more like a "how do I write a program" than a "how do I write a disassembler" question to me. Did you mention what language you're using and I missed it?
I'd like to take a wild guess and say that he is using Axe because he's one of our Axe coders, but I don't really know.
_player1537 wrote:
I'd like to take a wild guess and say that he is using Axe because he's one of our Axe coders, but I don't really know.
Oh, I was assuming that he was writing this computer side, because he's been trying to dabble in Python and C# to build a TI-BASIC tokenizer.
Oh yeah, that's a good point. I instantly assumed this was an on-calculator project, but it very well could be a computer project. We'll just have to see when he gets here Smile
Also Merth, thanks for the correct move. And ScoutDavid, you're driving me up the wall with your discussion of HEX. There's no HEX (acronym? Holy Emphasis Xcess?!). There's hex, short for hexadecimal, which is a number system. Wink
New Question...

inc (ix+*)
dec (ix+*)
ld (ix+*),*

How would these be used in Hexadecimal?

res 6,(ix+*),l

This one too xD

Thanks much, probably the last Hexadecimal question for my program Very Happy
ScoutDavid wrote:
[...]

How would these be used in Hexadecimal?

benryves wrote:
I recommend consulting the Instruction Set section of the Z80 CPU User Manual for a reference on how instructions are encoded.
benryves wrote:
ScoutDavid wrote:
[...]

How would these be used in Hexadecimal?

benryves wrote:
I recommend consulting the Instruction Set section of the Z80 CPU User Manual for a reference on how instructions are encoded.
Seconded; after Ben reminded me about that a few dozen times, I finally got it through my head that it's awesome.
I read it and have no more doubts ;D Thanks much.
ScoutDavid wrote:
I read it and have no more doubts ;D Thanks much.
Excellent, that's great to hear. So how is this project progressing, and what language is this in?
New Questions: RAM Addreses.

Everything that is in parentheses is a RAM Address, right?

However, I know that jr and jp are also RAM Addresses.

Are there any other instructions that are written in Hexadecimal, even in Assembly code? (EXAMPLE being: ld ($BAAB),hl)
You can write anything in hex. Labels and equates are just names that are given to hex addresses, so basically most of the names in ti83plus.inc is numbers.
So...

ld hl,$FFFF
ld hl,65535

Can both be done and are both possible?

Are there instructions that need to be Hexadecimal? And can't be written in decimal?
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 4
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement