"Extreme" 1k programs for ZX80 and ZX81: starter kit
"Extreme" 1k programs for ZX80 and ZX81: starter kit
Hoping to contribute to the community and development on this little computers, attached there is an extract of my experience with Super Micro Chess porting to the old Zeddy platform: elaborating all the information got from many sources (documents, support from community, and my own experiments) I synthetized a little starter kit for the 1k in the form of a minimal starting code with ready places to fill the program…
Some notes:
- I use it in a Linux development environment, but since fasmg (the assembler) is multiplatform you can easily switch to windows
- the kit is not a ready program, but a skeleton for a multiplatform source: as used in Super Micro Chess, with external define switches ("-i" parameter with the line to include) I generate all the various versions for ZX80 and ZX81 from a single source
- In the comments I tried to be didascalic even if the standard user of this kit should be a tough assembler programmer!
- I inserted already fasmg and ez80 includes for convenience, but please have a look also the original websites: https://flatassembler.net/download.php and https://github.com/jacobly0/fasmg-ez80
This is a “pre-release”: I tried to clean up as much as possible, but there are surely still edge to smooth up. If you use/improve it please let me know and I'll keep the kit updated! And let’s discuss it here!
Happy hacking!
_Stefano
Some notes:
- I use it in a Linux development environment, but since fasmg (the assembler) is multiplatform you can easily switch to windows
- the kit is not a ready program, but a skeleton for a multiplatform source: as used in Super Micro Chess, with external define switches ("-i" parameter with the line to include) I generate all the various versions for ZX80 and ZX81 from a single source
- In the comments I tried to be didascalic even if the standard user of this kit should be a tough assembler programmer!
- I inserted already fasmg and ez80 includes for convenience, but please have a look also the original websites: https://flatassembler.net/download.php and https://github.com/jacobly0/fasmg-ez80
This is a “pre-release”: I tried to clean up as much as possible, but there are surely still edge to smooth up. If you use/improve it please let me know and I'll keep the kit updated! And let’s discuss it here!
Happy hacking!
_Stefano
- Attachments
-
- zx80zx81-1k-kit.zip
- (74.49 KiB) Downloaded 539 times
Re: "Extreme" 1k programs for ZX80 and ZX81: starter kit
My experience:
LASTK, MARGIN, FLAGX, FRAMES and CDFLAG can't be used.
You can set the start to machine code (only BASIC-command ever on reusable memory (best on variablesmemory or array or on screen that gets cleared directly after loading)
Smallest needed code is 11 bytes. where 4 bytes can be coded.
BASIC-prog:
Linenumber: 2 bytes, byte 1 max value 63 second all values allowed
Linelength: 2 bytes, every length (and code) allowed
BASIC-call: 3 bytes defb 249, 212, 28 "RANDOMIZE USR 0"
Marker start floating point: 1 byte, 126
Floating point short: 3 bytes defb 143, 0, 18 (address #4009 where you code JP START)
Final 2 bytes of floatingpoint number can be skipped as can end of BASIC.
LASTK, MARGIN, FLAGX, FRAMES and CDFLAG can't be used.
You can set the start to machine code (only BASIC-command ever on reusable memory (best on variablesmemory or array or on screen that gets cleared directly after loading)
Smallest needed code is 11 bytes. where 4 bytes can be coded.
BASIC-prog:
Linenumber: 2 bytes, byte 1 max value 63 second all values allowed
Linelength: 2 bytes, every length (and code) allowed
BASIC-call: 3 bytes defb 249, 212, 28 "RANDOMIZE USR 0"
Marker start floating point: 1 byte, 126
Floating point short: 3 bytes defb 143, 0, 18 (address #4009 where you code JP START)
Final 2 bytes of floatingpoint number can be skipped as can end of BASIC.
Re: "Extreme" 1k programs for ZX80 and ZX81: starter kit
Code: Select all
ORG #4009 ;#4009
JP init
d_file DEFW dfile
dfcc DEFW dfile+1
.... rest of sysvar
basic DEFB 0,0 ; only used to start program
DEFB 0,0 ; cleared by code
DEFB 249,212,28
DEFB 126
DEFB 143,0,18
BASIC jumps to #4009 which then goes whereever you want.
Re: "Extreme" 1k programs for ZX80 and ZX81: starter kit
Talking about ZX81 (and not thinking to have a custom display routine anyway needing a pointer) also DFILE cannot be used and I added also DB_ST (but on this I may be wrong), while FLAGX in my experience can be used (I mean if you put values there they will be kept when program will be run), while I think you can use CDFLAG (and many others listed with xx and maybe also the ? ones) as memory after the asm program start.
In the kit is at the end, and infact all the memory after "maxstack available line" is used by stack in SuperMicro (in order of clearing: basic pgm -firsto to go-, asm init code, initial chess playing logic - last to go but cleared when main logic start playing)
Yes, you gave me this idea!!
I highlighted this in ZX80 basic routine, but infact I should write properly the limits for ZX81!
The final 2 bytes can be whateve value since they are the decimal digits of the FP number. In order to save (and use differently) also the useful 3 bytes at 4009 I developed the formula you can see in the kit (calculated by the assembler at compile time) based on reported documentation to jump directly to init (without the double jump).
Last note: hope that you also will start to develop for ZX80! The kit is already multiplatform, meaning you can use the same source for both platforms!
Happy hacking!
_Stefano
Re: "Extreme" 1k programs for ZX80 and ZX81: starter kit
I have optimized the base model further for coding machine code in 1K.
The whole BASIC-call to MC is set over sysvar and the repair after loading too.
This will give the maximum codeable bytes in 1K.
The whole BASIC-call to MC is set over sysvar and the repair after loading too.
This will give the maximum codeable bytes in 1K.
Re: "Extreme" 1k programs for ZX80 and ZX81: starter kit
Hi Stefano,
Off topic - can I include your 1K chess port into my iOS ZX81 emulator?
Thanks,
Kevin
Off topic - can I include your 1K chess port into my iOS ZX81 emulator?
Thanks,
Kevin
Re: "Extreme" 1k programs for ZX80 and ZX81: starter kit
Can I get a cleared version with only ZX80 with flickering. I want to try something but I don't want to clear the code as it is now.marste wrote: ↑Sun Apr 23, 2017 12:19 am Hoping to contribute to the community and development on this little computers, attached there is an extract of my experience with Super Micro Chess porting to the old Zeddy platform: elaborating all the information got from many sources (documents, support from community, and my own experiments) I synthetized a little starter kit for the 1k in the form of a minimal starting code with ready places to fill the program…
Some notes:
- I use it in a Linux development environment, but since fasmg (the assembler) is multiplatform you can easily switch to windows
- the kit is not a ready program, but a skeleton for a multiplatform source: as used in Super Micro Chess, with external define switches ("-i" parameter with the line to include) I generate all the various versions for ZX80 and ZX81 from a single source
- In the comments I tried to be didascalic even if the standard user of this kit should be a tough assembler programmer!
- I inserted already fasmg and ez80 includes for convenience, but please have a look also the original websites: https://flatassembler.net/download.php and https://github.com/jacobly0/fasmg-ez80
This is a “pre-release”: I tried to clean up as much as possible, but there are surely still edge to smooth up. If you use/improve it please let me know and I'll keep the kit updated! And let’s discuss it here!
Happy hacking!
_Stefano
Re: "Extreme" 1k programs for ZX80 and ZX81: starter kit
Ciao Johan, not sure I've got exactly what you're looking for. Anyway if you want to eliminate the ZX81 parts is enough to delete the lines that will be included just if ROMPLATFORM eq "ZX81" (and ZX80 autorun and ZX80 flickerfree if you don't want them ). If I didn't make mistake in deleting attached the ZX80 "flickering" and "no autorun trick" version of the skeleton.
Happy hacking!
_Stefano
- Attachments
-
- kit_zx1k - just ZX80.asm
- (6.16 KiB) Downloaded 373 times
Re: "Extreme" 1k programs for ZX80 and ZX81: starter kit
Thank you! Now in the latest version (1.6.0) on the App Store.