Hedge1970 wrote: ↑Wed Dec 27, 2023 11:02 am
I am on my third attempt using “Mastering Machine Code”. First I tried using the spectrum Zeus assembler and disassembler programs by Crystal. This was my first ever attempt at both machine code and the programs, I really stumbled at the first attempts with the books examples but I did learn about the construct and general principles of machine code. My second attempt was using Pasmo and a text editor (notepad ++) I got a lot further this time and almost managed to complete the draughts game and got my first own program snippets working but I struggled to follow all the examples in the book using pasmo and was not able to learn everything due to this. I am now in my third attempt but this time I am doing it using the books own machine code program. Now of course I’ve learned from each previous attempt but I am finding this attempt the very best of all three.
We are fairly certain that Toni is a woman.
Unfortunately, one of the problems when learning machine code, is, that assembler language is one person or one organisations mnemonics. Not all assemblers use the exact same set of mnemonics (compare the 8080 compatible instructions used on the Z80 with the 8080 mnemonics. For the exact same machine code instruction, mnemonics are often different).
Just to be clear, a machine code instruction as far as a 8 bit microprocessor is concerned is one, or a short series of numbers, each in the range 0 to 255 (decimal). The mnemonics are for use by humans, as we find working with long series of numbers hard work and are likely to make mistakes if we try to write long programs using this method. Using hexadecimal numbers only makes this slightly easier.
An assembler takes the mnemonics and the values (source code), and processes this to produce the actual machine code (known by various names, including object code, binary, executable, depending on if a linker is being used, or if this is an intermediate stage, or the final output file).
Secondly, each assembler is different in terms of symbols (which of these are acceptable for meaning a hexadecimal number "#nn", "$nn", "&nn" or 0xnn), assembler operations/operators (instructions) (as opposed to actual microprocessor instructions) and acceptable syntax.
Then there are different methods for the layout of the code (does it use tabs or spaces, do labels need a prefix or a suffix?).
And then there are the undocumented instructions that, because they are not documented by the microprocessor manufacturer, can't have 'official' mnemonics. And don't even start me on macros...
Actual machine code is very simple. As it has to be. Because for the 8 bit microprocessors like the 8080, Z80, 6800, 6502 etc, they only understand 8 bit binary numbers (yes, parts are 9 bit or 16 bit, but in memory, it's all 8 bit).
Break the vast majority of microprocessor instructions down and most are just copy instructions (LD), simple maths instructions (ADD), jump/branch (including subroutines) or combined with yes/no decisions.
Mark