As my machine code is *very* rusty, I've nipped to my local library and amazingly been able to borrow a copy of "Machine language programming made simple for your Sinclair" published my Melbourne House/Beam Software in 1981. It's aimed at owners of ZX80 and ZX81 computers.
On page 139 there is a "machine code editor" program...it's a hex loader wit some extra features. I'd like to use it and work through the book as the authors intended but I've come up against a weird problem. Line 200 of the program is:
200 LET V = 16* CODE (A$) + CODE (TL$(A$)) -476
The problem is TL$ of course is not recognised.
Is anyone familiar with this book? Was there a known typo and correction to this program? The only string used is A$, there is no variable TL either.
Machine Language book by Melbourne House
Re: Machine Language book by Melbourne House
Here is the program. It is for the ZX80 with the following page containing some additions for the ZX81.
- Attachments
-
- zx81m.JPG (59.37 KiB) Viewed 6413 times
Re: Machine Language book by Melbourne House
TL$ is a ZX80 only command, it returns the Whole string except the first character.
so that line is converting the first 2 characters of A$ from Hex to decimal.
on ZX81 you would use...
LET V = 16*CODE A$+CODE A$(2)-476
hth aNDY
so that line is converting the first 2 characters of A$ from Hex to decimal.
on ZX81 you would use...
LET V = 16*CODE A$+CODE A$(2)-476
hth aNDY
what's that Smell.... smells like fresh flux and solder fumes...
Re: Machine Language book by Melbourne House
Thanks, I was vaguely aware of TL$ being recognised by the ZX80. There's no alternative line given for the ZX81. I think I have an early hardback edition of the book, later editions seem to have one page more. Maybe they corrected this?
I'm still pleasantly surprised that the library had a copy. It was last out in 2002.
I'm still pleasantly surprised that the library had a copy. It was last out in 2002.
Re: Machine Language book by Melbourne House
double post. My laptop mouse button is playing up
Last edited by angus on Sat Mar 17, 2012 2:34 pm, edited 1 time in total.
Re: Machine Language book by Melbourne House
It's written ZX80 version in the second line of the scanned page in big letters.angus wrote: Is anyone familiar with this book? Was there a known typo and correction to this program? The only string used is A$, there is no variable TL either.

Have one book from E.Floegl with a machine code editor for 16 - has about 150 BASIC lines to enter.
Unfortunately I do not have a scanner.
Re: Machine Language book by Melbourne House
Umm...that's why I said it was a ZX80 program with modifications on the next page for the ZX81.
But there's no modification of line 200, which is why I needed Andy's help. Thanks
But there's no modification of line 200, which is why I needed Andy's help. Thanks

Re: Machine Language book by Melbourne House
The 1981 revision on page 138 has the corrected ZX81 program
Looks like the change is exactly what Andy proposed:
The program appears to work correctly. It is barebones and displays 10 lines, until it exits the loop. Enter hex digits when modifying, but decimal at the START prompt
NOTE: the listing still has the ZX80 style "GO TO" which must be changed to "GOTO". Ditto for GO SUB
Looks like the change is exactly what Andy proposed:
- ZX80: 200 LET V=16*CODE (A$)+ CODE(TL$(A$))-476
- ZX81: 200 LET V=16*CODE (A$)+CODE(A$(2))-476
The program appears to work correctly. It is barebones and displays 10 lines, until it exits the loop. Enter hex digits when modifying, but decimal at the START prompt
NOTE: the listing still has the ZX80 style "GO TO" which must be changed to "GOTO". Ditto for GO SUB
MACHINE CODE EDITOR
ZX81 VERSION
100 PRINT "START?"
110 INPUT S
120 CLS
130 PRINT "MEMORY";TAB 10;"CODE"
140 FOR I=0 TO 10
150 LET V=PEEK (S+I)
160 GOSUB 500
170 PRINT S+1;TAB 7;A$;
180 INPUT A$
190 IF A$="" THEN GOTO 220
200 LET V=16*CODE (A$)+CODE (A$(2))-476
210 POKE S+1,V
220 LET V=PEEK (S+1)
230 GOSUB 500
240 PRINT TAB 10;A$
250 IF V=201 THEN GOTO 270
260 NEXT I
270 PRINT "CHANGES?";
280 INPUT A$
289 REM 62="Y"N
290 IF CODE (A$)=62 THEN GOTO 120
300 PRINT " MORE?"
310 INPUT A$
320 LET S=S+10
330 IF CODE (A$)=62 THEN GOTO 120
340 CLS
350 PRINT "START FOR USR?"
360 INPUT S
370 PRINT USR (S)
380 STOP
500 LET H=INT (V/16)
510 LET L=V-16*H
520 LET A$=CHR$ (H+28)+CHR$ (L+28)
530 RETURN
NOTE: This program will fit into the standard 1K ZX81 machine and allow code to be entered in hexadecimal format into free memory, REM
statements (e.g. Line 90 REM AAAAAAAAAAA ), or into variables (e.g. Line 90 DIM A(4) ).
This program will also "RUN" the machine language program if required. If you do not desire to "RUN" the program, reply "XX" to query "START FOR USR?"