Commodore User


Machine Language For The Absolute Beginner
By Melbourne House
Commodore 64

 
Published in Commodore User #18

Machine Language For The Absolute Beginner

Machine Language For The Absolute Beginner is also aimed at beginners but differs greatly in presentation and content. It deals only with the Commodore 64. Mr Davis does not waste any time in getting to grips with machine language. A very short first chapter goes straight into subroutines and memory addressing. The next chapter looks at some of the addressing modes.

Chapter three slows the pace a little, it is concerned with teaching hexadecimal. This is in preparation for ALPA in the next chapter. ALPA is a Machine Language Monitor (MLM) written in Basic which lets you type in machine-language programs.

Using ALPA with lots of examples the book moves through simple arithmetic, control loops and index registers. All of the fundamentals of 6502 are covered up to interrupts which are mentioned but not dealt with. ALPA lets you type in lines a bit like Basic and all branches and JMPs are made to a line number of the desired instruction. ALPA works out the branch distance and this removes the cause of a large number of crashes in hand assembled code. The little example here shows the flavour of ALPA:

10 20L50 JSR L50 20 C9FA CMP £$FA 30 C0L10 BNE L10 40 60 RTS 50 EE00D0 INC $D000 60 AD00D0 LDA $D000 70 60 RTS

You type in the first bit, like 10 20L50, and ALPA displays JSR L50 to let you check your code. There are several command to disassemble memory, move the program, load or save and run programs. But it does require you to work out the hex value for each instruction, but after working through the examples you should be able to make use of a proper MLM which will do this for you. The example programs are no longer than 30 lines, and are for particular aspects of the C64 like moving sprites or clearing a screen.

After 100 pages the book goes into appendices and covers the 6510 instruction set, hex to decimal conversion, calculating branches and brief explanations of the registers in VIC, SID and CIA chips. Also given is a memory map and list of ROM routine entry points plus a listing of ALPA.

Verdict: Learning from this book would be harder than from Butterfield's but the examples are at least relevant to the C64. For a complete beginner or the owner of a VIC/PET/C16/Plus 4 I would recommend the Butterfield book first. If you have a C64 then Davis is probably a better choice.

David Bolton