Machine code

Discussion about ZX80 / ZX81 Software
spilldig
Posts: 12
Joined: Fri Oct 08, 2010 8:20 pm

Machine code

Post by spilldig »

Hello to all.
What I would like is to find out if anyone knows how the old machine code programs worked that used the whole of the keyboard ?
The one I saw would take the form of: for example.......................
Line 200 1!"£$5^&*():;/./.><.:;-%*(£"%^+=8
That sort of thing using the zx81s symbols.
As I said before, I saw this type of machine code in sinclair user, on a snooker game it crammed so much in and the game worked really smoothly,so does anyone know how that sort of machine code worked or even better, has anyone got the programe ?
Last edited by spilldig on Wed Jan 05, 2011 5:50 pm, edited 1 time in total.
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: Machine code

Post by sirmorris »

Hi,

sorry - I just don't understand what you're asking. I don't see what using the whole of the keyboard has to do with anything?

If it's a type-in machine code snooker game which possibly once appeared in a magazine 25 years ago that you're after then I can honestly say no, I haven't got it and your chances of finding it are close to zero. I have been proved wrong before now though.

I dare say that most people here know how machine language programs work but your best bet is a little self-improvement starting here. I'm not trying to be rude but it's a big subject not really suited for forum lessons.

C
User avatar
thewiz
Posts: 58
Joined: Sun Aug 16, 2009 8:36 pm
Location: Crewe

Re: Machine code

Post by thewiz »

Hi Spilldig,

You could be refering to the ability to store machine code in the first line of a basic program in a REM statement. What your actually seeing are the bytes of a Z80 program displayed as characters. see http://www.zx81stuff.org.uk/zx81/genera ... ic%29.html as an example of what I mean.

As for which snooker you had, I've no idea.

thewiz
Memotech rules
spilldig
Posts: 12
Joined: Fri Oct 08, 2010 8:20 pm

Re: Machine code

Post by spilldig »

Hello Sirmorris and thewiz,
First of all thank's to you both for your replies.
Well the charecters in that programme were not just random characters for the first line of the rem statement,they were part of the programme.
As to what the advantage was,I don't know,but there must have been something in it.What I am wondering is if it squeezed things down to take even less space by somehow using the character associated with the machine code in order to enter it in 1 digit.
Yes I remember, the programme was in a pullout or a supplement in one of the magazines.I have been searching all last month but you were right,I cannot find it. :?
Last edited by spilldig on Mon Dec 27, 2010 3:28 pm, edited 1 time in total.
User avatar
bobs
Posts: 325
Joined: Thu Aug 27, 2009 10:49 pm
Location: UK
Contact:

Re: Machine code

Post by bobs »

The ZX81 can only show you programs written in BASIC - A language which uses English words to tell the computer what to do, such as "PRINT 'Hello World'". The program you mention uses machine code but since the ZX81 doesn't know how to display that correctly (as it can only display BASIC program listings) it looks like random numbers. Machine code is used because you can fit more into memory using it, it is much faster than BASIC, and also allows you do to more things with it.
spilldig
Posts: 12
Joined: Fri Oct 08, 2010 8:20 pm

Re: Machine code

Post by spilldig »

Hello Bobs,
Well the programme which really suprised me was the snooker game for the zx81 and I loaded it all in as it was written in the magazine but to cram all that detail in was amazing and it appeared to do it by using this form of machine code using lines of characters but not in a rem statement.
I know if you got just one character wrong it would not work.So it wasn't really displaying the characters because you were entering them in.
The thing was that I have never seen a programme written like it before because usually the machine code went in just in numbers so for some time now I have been searching for a programme like that to try to see how it worked.
User avatar
bobs
Posts: 325
Joined: Thu Aug 27, 2009 10:49 pm
Location: UK
Contact:

Re: Machine code

Post by bobs »

You say that you had to enter the numbers yourself? Did you have to type in a small BASIC program first, which you then ran, and then you would enter each number as listed? That used to be a common way of entering machine code programs. It is very difficult to enter the numbers directly into a REM statement, but much easier to do it using another program which you type the numbers into.

As for the program itself, finding that could be very difficult, as there were a lot of books of programs around at the time, and then all the listings available in monthly magazines and the like. I'm afraid I cannot help with that.
spilldig
Posts: 12
Joined: Fri Oct 08, 2010 8:20 pm

Re: Machine code

Post by spilldig »

As I remember I think there was a basic programme first,but the thing was that one of the lines used about 2 or 300 random characters consisting of letters, numbers,fullstops,commas,colons,inverted commas,brackets,question marks,strings signs,=signs,etc,basically anything on the keyboard and I experimented with it and if you got just one wrong it either did'nt work at all or it didn't work properly,and it's the only programme I have seen like that and I don't think it gave an explanation at the time either.
My old spectrum stuff packed up years ago and I thought that was the end to it untill someone told me about the emulator, so I have been writing some standard machine code programmes but this one still has me baffled.
User avatar
bobs
Posts: 325
Joined: Thu Aug 27, 2009 10:49 pm
Location: UK
Contact:

Re: Machine code

Post by bobs »

spilldig wrote:As I remember I think there was a basic programme first,but the thing was that one of the lines used about 2 or 300 random characters consisting of letters, numbers,fullstops,commas,colons,inverted commas,brackets,question marks,strings signs,=signs,etc,basically anything on the keyboard and I experimented with it and if you got just one wrong it either did'nt work at all or it didn't work properly,and it's the only programme I have seen like that and I don't think it gave an explanation at the time either.
The "random characters consisting of letters, numbers,fullstops,commas,colons,inverted commas,brackets,question marks,strings signs,=signs,etc,basically anything on the keyboard" is the machine code. As I stated in one of my previous posts the ZX81 cannot show machine-code correctly as it can only show BASIC programs, and so instead has to show it as a seemingly random sequence of characters. This is done because it is difficult to save a purely machine-code program to tape unless it is somehow held within the BASIC program. Therefore a REM statement is usually used to store the code, therefore allowing it to be saved. Not all of the machine code will be shown however as some of the numbers will not convert into printable characters, and so cannot be shown, but it will all be there.
spilldig wrote:My old spectrum stuff packed up years ago and I thought that was the end to it untill someone told me about the emulator, so I have been writing some standard machine code programmes but this one still has me baffled.
You can pretty much find this in most ZX81 programs which use machine code. For example follow the link in my signature to my own website and download any of the ZX81 games you'll find there. They all have their machine code stored in the BASIC program as described above.
spilldig
Posts: 12
Joined: Fri Oct 08, 2010 8:20 pm

Re: Machine code

Post by spilldig »

Ok bobs,
Many thanks for that information and I will certainly have a look at your site.
In the book not only 30 programmes for the zx81 the machine code for the DRAUGHTS game is entered into the programme in the normal form i'e, AF 21 3C ,etc etc, and then changes the REM statement on the first line into the variuos keyboard characters, so in this case,as you say the machine code is displayed as characters,but this is the not the way that the SNOOKER programme was written because in that programme you entered in the machine code as characters and I am wondering if there was some sort of a converter written in for that purpose ?
Post Reply