Opcodes and ASM

Started by
8 comments, last by Xtremehobo 21 years ago
Hey, Im looking at a list of opcodes for the Zilog z80 CPU. I noticed that the HALT assembly command''s opcode (in hex) is 76. I tried assembling some code that had just the HALT command in it, but instead of the assembled file having 76 (opcode for HALT), it had ''v''. Now, am I not understanding something? (is a binary executable file NOT a big long string of the CPU''s Opcodes?)? Thanks
pixelwrench.com | [email="matt[nospam]@pixelwrench[nospam]com"]email[/email] lethalhamster: gamedev keeps taking my money, but im too lazy to not let them
Advertisement
Everything you want to know about the Z80:

http://www.geocities.com/SiliconValley/Peaks/3938/z80_home.htm
v is 0x76. You''re obviously viewing the binary file through a text editor. If you want to see the hex values for each character you should use a hex editor.
ahhh =D
pixelwrench.com | [email="matt[nospam]@pixelwrench[nospam]com"]email[/email] lethalhamster: gamedev keeps taking my money, but im too lazy to not let them
/me fires up visual c++''s hex editor
pixelwrench.com | [email="matt[nospam]@pixelwrench[nospam]com"]email[/email] lethalhamster: gamedev keeps taking my money, but im too lazy to not let them
What Im trying to do is write an operating system that will run on my gameboy pocket
Since the Gameboy''s CPU is a lot like the z80, Im using the z80 as a reference. My OS is going to have an assembler (and I might make a c-like compiler for it) so I can develop software on it too

pixelwrench.com | [email="matt[nospam]@pixelwrench[nospam]com"]email[/email] lethalhamster: gamedev keeps taking my money, but im too lazy to not let them
I have another question now..
When I do:
inc h

it shows up as a $ in notepad (and just plain old 24 in my hex editor).
Infact, heres my entire ASM code:
di
inc h
halt

and heres what it looks like in notepad:
ó$v

and heres what it looks like in hex:
F324 76
Im just wondering where the ''h'' is stored when I did inc (INC H is suppose to be 24 in the opcodes...)
pixelwrench.com | [email="matt[nospam]@pixelwrench[nospam]com"]email[/email] lethalhamster: gamedev keeps taking my money, but im too lazy to not let them
oh nevermind
I DID have 24 in there
Whats the two empty spaces between 24 and 76 then? thx
pixelwrench.com | [email="matt[nospam]@pixelwrench[nospam]com"]email[/email] lethalhamster: gamedev keeps taking my money, but im too lazy to not let them
hex editors tend to break up 2, 4, 8, or 16-digit blocks of hexadecimal, for ease in visually parsing the hex.

I have to say, if you are unfamiliar with hexadecimal, as well as with executable file formats, and yet are planning to write an OS, you are most likely biting off much much more than you can chew.

How appropriate. You fight like a cow.
Actually, I was unfamilier with this new hex editor (hex workshop). I''ve been using Visual c++ to edit hex files in the past, and it breaks it up in two-digit blocks. Hex workshop breaks it up in four.
pixelwrench.com | [email="matt[nospam]@pixelwrench[nospam]com"]email[/email] lethalhamster: gamedev keeps taking my money, but im too lazy to not let them

This topic is closed to new replies.

Advertisement