INMC 80 News

  

September 1980 – January 1981, Issue 2

Page 4 of 59

Letters

Machine Code Programming – made easy ?

Dear Sir,

Firstly, to those Nascom owners who read with trepidation every article purporting to teach machine code programming the ‘EASY’ way (apologies to Dave Hunt). When I bought my Nascom 2 early this year I found that excellent though it is, the Basic very soon lost its challenge as familiarity made programming a fairly easy matter and I became interested in machine code routines as being so much faster and more versatile. So in my innocience I went out and bought the SARGON book (a chess program listing in 8080 ASSEMBLY language (TDL MNEMONICS)). Naturally, I was utterly lost immediately, although I understood what ‘Hex’ numbers were and what various instructions did to the Z80 registers. It was then that I discovered Assemblers, essential to comfortable machine code work. I sent for the V & T Assembler as reviewed in your pages (issue 5/17) and began the laborious process of translating the TDL mnemonics to Z80 Mnemonics using the assmbler to store the precious listings on tape. Purely by coincidence I came across the Liverpool Software Gazette feature on converting Sargon for Nascom 1. Suffice it to say that eventually, by assembling Sargon in two halves and spending a week or two debugging I got a working program! Worse than that, it beat me every time!

Now, I had read articles ad nauseam on machine code programming and understood each step as explained, but still I never knew how to get off the ground, what registers to use for which functions, etc. It was not until I had spent a month immersed up to the elbows in Sargon and an assembler that I began to see what it was all about. I started by assembling blindly and finished by understanding how the program works, how an assembler works and how to use the Z80 instructions in a practical way. I have even written an alternative routine for Sargon to have it play itself at different levels, a feat I could never have considered 2 months ago! I think the point is that to pick up the ideas of machine programming, it takes TIME to become familiar with the concepts concerned, a practical program to work on to provide the motivation to ‘get things right’ (I never found that slogging through examples of 16 bit multiplication interested me enough for the details to sink in) and good software to lend a hand (in this case V & T’s assembler).

Incidentally, I recently bought the Bits and PC’s toolkit which has brought back the excitement to Basic programming by eliminating tedious processes such as numbering lines, re-numbering entire programs, appending programs onto each other, listing contents of variables used after a run, finding strings, listing lines in compressed form, finding lines containing errors, single stepping with display of variable contents, converting hex numbers to decimal, repeating keyboard inputs, and much more, by providing Direct-mode commands to do it all for you. (Ed. See reviews elsewhere in this issue.) The only drawback it has is that it uses the input and output tables – excluding their use by Basic machine code routines (I’m sure there’s a way round this), and to run under the toolkit ‘old’ Nas-Sys programs in BASIC may need minor input modifications. A pity Toolkit has “find string” without “change string” but this is just a quibble. For those who have entered Super Startrek or similar programs with the X0 command so as to get 72 characters per line, Toolkit has trouble with finding strings in these lines, but other functions seem to work OK.

For two Eproms (the contents of which are relocatable) it’s a bit heavy on the pocket, but a dream to use, and all things considered, good value for the ‘Keen Programmer’ in Basic.


Page 4 of 59