Spectrum Machine Language For The Absolute Beginner
Not quite sure if this should be in here but here goes.
Having never delved into machine code before I thought id have a go at this book and its quite easy to follow for a while, I got to the part where you have to type in the programs to continue anyway. I typed in the ezcode routine. Now ive checked, double checked, triple checked, done it all again and im pretty certain i got no errors in the basic program whatsoever yet when i enter a line or command into it i either get C nonscence in basic or 0 OK, 0:1. Can anyone confirm that this program actually works properly? Did you/anyone you know ever type it in and use it?
http://www.worldofspectrum.org/infoseekid.cgi?id=2000363
I saved a snapshot of the program after i typed it in too if anyone cares to check this http://www.geetechperformance.co.uk/index_files/ezcode.z80
In the listing in the book the font shows a triangle as a character, I have replaced this with an underscore seeing as the spectrum has no such character.
ZX-MAD
Having never delved into machine code before I thought id have a go at this book and its quite easy to follow for a while, I got to the part where you have to type in the programs to continue anyway. I typed in the ezcode routine. Now ive checked, double checked, triple checked, done it all again and im pretty certain i got no errors in the basic program whatsoever yet when i enter a line or command into it i either get C nonscence in basic or 0 OK, 0:1. Can anyone confirm that this program actually works properly? Did you/anyone you know ever type it in and use it?
http://www.worldofspectrum.org/infoseekid.cgi?id=2000363
I saved a snapshot of the program after i typed it in too if anyone cares to check this http://www.geetechperformance.co.uk/index_files/ezcode.z80
In the listing in the book the font shows a triangle as a character, I have replaced this with an underscore seeing as the spectrum has no such character.
ZX-MAD
Post edited by ZX-MAD on
Comments
The little triangles represent a "space" character.
The triangles have been used because whitespace in BASIC can be important but at the same time difficult to spot, particularly in a tokenised editor such as the ZX BASIC editor.
The program is attempting to parse the string that you input (e.g. 1 210064) but because you have used underscores, it doesn't detect the "space" character that separates the line number (1) with the hex codes (210064).
Change the underscores back to spaces on the following lines and the program will work:
Line 1120: 7 spaces
Line 2030: 4 spaces
Line 2060: 1 space
Line 2140: 1 space
Line 2210: 2 spaces
Line 2290: 2 spaces
Line 2360: 2 spaces
(Ideally, work through the whole program changing your underscores back to spaces)
You've spelt "Command" wrong on line 2020! :-)
There are a number of great "assembler" programs written for the spectrum around which allow you to type your assembly code in directly, load, save it, and compile it.
Other Wossers will tell you what they use.
You can still work through the book but try using an assembler software instead to write the code as it is much more intuitive and easier as you don't have to reconsile all of your addresses.
Alternatively, use Dunny's BASin program. It has a built in assembler.
1) Install BASin from here
2) Launch it from the start menu
3) Click Tools --> Assembler
4) Paste in the following
5) Press CTRL + A to assemble the code (it will tell you that 28 bytes were compiled)
6) Run the code by clicking in the main BASin window and typing: for a cool sound effect.
You can save the source code in a text editor and save the code using SAVE "sound" CODE 32768,28
Glad you like it. Good to hear you got to grips with it.
I should have said, it would be better to put an DI just after the org statement and an EI just after before the ret statement - for a smoother sound.
Cheers!
Yes, I like that book. That and An Expert Guide to the Spectrum
suggestions welcome!
Unless ZXMAD has fixed his version and uploaded it, you may need to fix it as per BloodBaz's post
I think the trouble is Mr Tang has made it dificult to follow the basic programming in the listing for novices like me whose knowledge extends little beyond typing in LOAD"" but even i can tell there's a lot of what appears to be deliberately going around the houses, referring to the variables ZE ON TW TH and FR which could have just been replaced with 1, 2, 3 and 4.
Digressing aside, i noticed that ZXMAD had posted that he had got his version working simply by replacing the underscores with spaces, when i typed in the listing myself i started using spaces after getting numerous 'variable not found' and 'nonsense in BASIC' messages
Perhaps ZXMAD could post a link to a working EZCODE listing? i'd be really grateful :)
Can't say fairer that that :-)
We would all like to see you get this one working.