Page 2 of 4

Re: Hello, I'm Restarting ZX81 Programming After... 30 Years

Posted: Tue Jul 28, 2015 9:08 am
by IanB
Thank you everyone for being so helpful. There seems to be a lot of expertise here! I think this is enough to get me started :)

Just one more question I'm not clear on, is it possible at all to detect the start of the second user programme execution block, that is (4) in my list, the set of lines below the screen?

Re: Hello, I'm Restarting ZX81 Programming After... 30 Years

Posted: Tue Jul 28, 2015 12:19 pm
by 1024MAK
Welcome to the forum Ian!

:D :D :D

Mark

Re: Hello, I'm Restarting ZX81 Programming After... 30 Years

Posted: Tue Jul 28, 2015 2:45 pm
by IanB
Thank you 1024MAK, I'm glad to be here!

And also my brain is starting to frazzle with Z80 machine code... :)

Re: Hello, I'm Restarting ZX81 Programming After... 30 Years

Posted: Tue Jul 28, 2015 3:46 pm
by PokeMon
IanB wrote: Just one more question I'm not clear on, is it possible at all to detect the start of the second user programme execution block, that is (4) in my list, the set of lines below the screen?
Yes - you may read IX register for that purpose.
If it is $0281 it is indicating top margin and if it is $028F it is indicating bottom margin.

Re: Hello, I'm Restarting ZX81 Programming After... 30 Years

Posted: Thu Jul 30, 2015 12:28 pm
by IanB
Thanks, another question, is it safe to store stuff in the System Variable areas PRBUFF (the printer buffer) and MEMBOT (the calculator memory area) and under what conditions do these get cleared by the ROM? E.g. if I RET from the machine code to BASIC?

Re: Hello, I'm Restarting ZX81 Programming After... 30 Years

Posted: Thu Jul 30, 2015 12:43 pm
by dr beep
Take a look in the sources of the 1K hires games.

You can use the PRBUFF without problems. I suggest to start MC and NEVER return to BASIC.
Why? You can use the BASIC as part of your screen and clear it for use on screen. Also no tests needed for ROOM in Basic.
What would be the advantage of BASIC over a MC-routune?

http://sinclairzxworld.com/viewtopic.ph ... ces#p16917

Re: Hello, I'm Restarting ZX81 Programming After... 30 Years

Posted: Thu Jul 30, 2015 4:50 pm
by PokeMon
Well - I like your 1k programs, dr.beep but in fact creating those programs is more or less a personal passion.
This is not always the best way for beginners (or retired programmers :mrgreen: ).

I like the coexsistance of BASIC and Assembler more - both can benefit from each other.
Assembler is fast and BASIC is more powerful in functionality.
And only a few enthusiasts really work with Zeddy without any additional memory. 16k is the most common.

To answer your question - you may use the printer buffer as long as you don't print and as long as no other application has the same idea.
It's not used from the normal BASIC I think (not 100% sure).
I would avoid MEMBOT as this is used from BASIC routines.

You may use the ZX-IDE as development tool when developing under WIN.
viewtopic.php?f=6&t=1064

It does also support the usage of the EightyOne Emulator which are both together a winning team in my eyes.
It is very easy to mix BASIC and Assembly commands in one file - can see the ZX81DEMO.ASM and the tutorial thread.
Changes in your program can be tested automatically with pressing F8 in the code editor which starts or restarts the EightyOne with the actually compiled program (when autoload is switched on in the emulator).

Re: Hello, I'm Restarting ZX81 Programming After... 30 Years

Posted: Thu Jul 30, 2015 6:01 pm
by dr beep
PokeMon wrote:Well - I like your 1k programs, dr.beep but in fact creating those programs is more or less a personal passion.
This is not always the best way for beginners (or retired programmers :mrgreen: ).


I like the coexsistance of BASIC and Assembler more - both can benefit from each other.
Assembler is fast and BASIC is more powerful in functionality.
And only a few enthusiasts really work with Zeddy without any additional memory. 16k is the most common.
True, but in 1K the use of MEMBOT and BASIC will likely cost more than the routine in MC.
When coding in 16K I would say, use both for the simpliest use, but in 1K you will need all the space available.
To answer your question - you may use the printer buffer as long as you don't print and as long as no other application has the same idea.
It's not used from the normal BASIC I think (not 100% sure).
I would avoid MEMBOT as this is used from BASIC routines.

You may use the ZX-IDE as development tool when developing under WIN.
viewtopic.php?f=6&t=1064

It does also support the usage of the EightyOne Emulator which are both together a winning team in my eyes.
It is very easy to mix BASIC and Assembly commands in one file - can see the ZX81DEMO.ASM and the tutorial thread.
Changes in your program can be tested automatically with pressing F8 in the code editor which starts or restarts the EightyOne with the actually compiled program (when autoload is switched on in the emulator).

Re: Hello, I'm Restarting ZX81 Programming After... 30 Years

Posted: Fri Jul 31, 2015 5:57 am
by IanB
I am looking at using PRBUFF and MEMBOT (and the two more unused bytes) because I see there 65 lovely bytes that can store program data, "sprite" data etc, for "free" and which are loaded in by the LOAD command, that's why I'm interested in what circumstances might erase or corrupt their contents. For instance, I am not sure (despite looking through the ROM dissassembly) whether the completion of the LOAD routine will do so. I don't want to use BASIC at all, but somehow the program must be loaded in on a standard ZX81, which is performed by part of the BASIC system.

I am writing for the 1K standard machine because I am interested in the challenge of what could be achieved with it (meaning, what could have been achieved back in 1981, compared to those crummy official Sinclair software tapes haha). Also, any 1K program by definition must be short. A 16k must be a big impressive program to be worth doing, and that's a greater commitment of time and effort. I see some fabulous 16k programs here on this forum and I don't have the time to commit to competing with that standard :)

It is a nice challenge here in 2015 to take a machine that even at the time was considered too little memory to do anything useful, and prove otherwise :) There is obviously no "rational" reason for ZX81 software of any kind in this day and age. It is just something I want to do as a personal thing.

And yes, I am using ZX-IDE and EightyOne :)

Re: Hello, I'm Restarting ZX81 Programming After... 30 Years

Posted: Fri Jul 31, 2015 10:20 am
by dr beep
After loading you can use the first 30 addresses from #4000 in MC without problems.