Jump to content
Ranger03

how was machine language done on the TS1000 and zx80/81?

Recommended Posts

i'm curious. i've viewed some of the sync magazines (thanks to archive.org) and was wondering: how did they ever get the listings to work. i can understand using the REM statement to hold them in memory but outside of poking memory, how else did they get them to work?

Share this post


Link to post
Share on other sites

That was exactly how to do it. First define a line that will hold your routine:

 

10 REM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

 

Then POKE values directly into the BASIC program, which requires knowledge of the memory map and that you can't use certain values like 0 which would indicate end of line. Once you had put everything in memory, save and don't edit the line.

 

Once again, what is wrong with POKE?

Share this post


Link to post
Share on other sites

i dont understand the point here... Poke was a Basic command to insert a value in a position of memory, as every other basic of the era did, from Apple to to Trs 80... what exactly is the prejudice with the zx-81/sinclair models ? they have a lot of other points to criticize, like the keyboard or initial memory, but that...

Share this post


Link to post
Share on other sites

most of us are used to IDE's so going back to basics is alien. it is for me. yet i like the ts1000 and zx81, to the point where i had a weird dream involving one the size of a wristwatch

Share this post


Link to post
Share on other sites

You could put machine language above RAMTOP but that was problematic: saving a BASIC program didn't save the machine code. And, on the ZX81/TS1000, there was no easy way to say "save this portion of memory". It was a little easier with the 2068.

 

This book might help you with ZX81/TS1000 machine language programming.

Share this post


Link to post
Share on other sites

do i use Rand or run for machine code or run? also, does the zx81 actually use anything in the REM command or does it ignore it?

Share this post


Link to post
Share on other sites

I think on the ZX81 we put the numbers in data statements, then made a short program to read those and poke them into the REM statement. Doing math for the jumps was fun. ;)

Share this post


Link to post
Share on other sites

I think on the ZX81 we put the numbers in data statements, then made a short program to read those and poke them into the REM statement. Doing math for the jumps was fun. ;)

could you provide an example

Share this post


Link to post
Share on other sites

That's the same way you can embed assembly in most Microsoft BASICs.
You can use a REM or a string variable on the first line.
This is how I created a few of the BASIC patches for the MC-10, CoCo 3, and Plus/4. I also used it on a TRS-80 Model III when I was in high school.
The one limitation was that you couldn't use a zero in your code because that's the end of line terminator and that would screw up the interpreter.
Once the code is embedded in the string or REM, you can delete the code that POKEs it into memory and the data statements.

  • Like 1

Share this post


Link to post
Share on other sites

would this be an example of a machine code program?

 

and yes i read it and it mentioned just printing to the screen, not actually running the machine code

post-65222-0-83238700-1532554135.png

Edited by Ranger03

Share this post


Link to post
Share on other sites

Well... it could be. The code is all over the place and won't execute. You're missing NEXT statements, the DATA statements are inside your (non-existent) FOR loops... and then there's that RESTORE 10 that'll be executed 25 times.

 

This isn't ZX-81/TS-1000 BASIC: it lacked READ, DATA and RESTORE.

 

Machine language on the ZX81/1000 is usually executed with a USR statement, like LET A = USR(16514)

 

A would receive any value the machine code returns.

Share this post


Link to post
Share on other sites

If you know what the address is for the first byte after the REM (it should always be the same on startup) then you just assemble your code to start at that address.
Have the assembler output a lst (or equivalent) file that shows the addresses, machine code as hex, and original code.
Then you just convert from hex to decimal and put it in data statements.
No fun math to do for the jumps, the assembler does it.
On the TRS-80 you had to beware of zeros in the data (the line terminator) but I don't know if that's an issue on the ZX-80

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...