ZX81-IDE Software Development Tool, IDE

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

ZX81-IDE Software Development Tool, IDE

Post by PokeMon »

I am not sure, but I think I did not post it before, anyway worth now for a new thread.
I am working on an IDE for ZX81 software developments and used to take FASM (flat assembler) as engine and ported it to Z80 instruction set.
The assembler supports macro instructions and full instruction set of Z80 but not the undocumented instructions. This maybe added later, has now no priority for me. There is also one additional matter, labels are supported only with ':' at the end or label directive (sparely used in programs, the ':' is mostly used as I found). I did found some source code where labels at the beginning of the line are interpreted without ':'. This could be added later too.

FASM for Z80 is supported as either WIN, LINUX or DOS Version, as command line version and for WIN or DOS as IDE with some multi window syntax highlight editor. I integrated a tape loader interface which is quite new and working only with WIN. Could be ported ot other OSes on request. There is a small framework for letting own assembler program code run on a ZX81, a simple data structure for a REM statement and a auto run feature for programs. I plan to support full basic programming not as macros, deeply integrated like the assembler instructions which allows a wild mix of BASIC and Z80 Assembler programming in the near future. For now the framework has to do the job.

Programs can simply loaded from PC to ZX81 via sound card and a audio cable. The ear phone output brings enough power to load software into the Zeddy. But you have to be sure to use mono cables or adapters. It does not work with stereo cables. I use a stereo cable with mono adapters at the end, did not found pure mono cables. Output of about 65% (about 1.6 Vss) is enough, higher output works same good, so you can use 100% but better not with big amplifiers. :mrgreen: With only one keypress (F9) code is compiled and loaded automatically, interrupted with a message box to let your start LOAD "" at ZX81. Programs could be compiled (assembled) without transfer using CTRL-F9 or in "Run" menu. This is loaded with normal speed of about 38 chars/second. Programs from disk could be transferred same way but (for now) can not be loaded into the IDE, just transferred: .p files, .o, .80 or .81 files.

The loader should work for ZX80 programs same way but did never try due to missing this model in my collection. :mrgreen: New feature is the fast loader which can transfer with approx 1kByte/second which is 25 times faster. It's a two stage loader which is 1k compatible, so does not use memory above 16508 ($407C). The loader has 72 byte program code and uses a 65 byte window in the variable section to run. A bit tricky programmed but working very well with all programs I could test. Due to the 2-stage concept it does not need to transfer the loader on a ZX81 before, this is done automatically with normal speed first and continue with the desired program with high speed after. So miminum loading time is now about 7 seconds for even small programs. But could load a 8 kByte program within 17 seconds total loading time. I try to upspeed it with another loading algorithm which needs more ressources and will not work with 1k programs, e.g need a memory module. I try to realize about 4 kByte/second or more with increasing speed and compressing data. But needs of course more code and can not be run in variables section. And I am working on data encryption / password protection for programs created or transmitted with the IDE. For whom it may concern. ;)

The loader can create automatically (or manually) desired wav files either with normal loading speed or 2-stage-fastloader. Could be used/transmitted to anybody with ZX81 and desired memory kit depending on program. WAV files are created with 30 kHz sample frequency, optimized for the fast loader but could be compressed with any zip engine to about 2 or 3 % of original size.
FASMW.zip
(141.35 KiB) Downloaded 3101 times
So have fun with this program, will have more updates in future. Comments or ideas for realizing welcome. 8-)
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: ZX81-IDE Software Development Tool, IDE

Post by sirmorris »

Nice work, thanks!

One feature I keep needing is automatic conversion of ascii strings -> zeddy strings. You could have a special operator for definng auto-translated strings;

.db $00,$01
....
.ds 'this string will be in ascii'
.dts 'this string will be in zeddy char codes when compiled'

etc.
MOB-i-L
Posts: 62
Joined: Mon Apr 19, 2010 12:13 am
Location: Lund, Skåne/Scania, Sweden
Contact:

Re: ZX81-IDE Software Development Tool, IDE

Post by MOB-i-L »

I tested it in Linux (Ubuntu 10.04 LTS) under WINE, a Windows XP emulator. I tried to compile ZX81DEMO.ASM but there was an undefined symbol AUTOLD in the file ZX81VARS.INC and the compilation stopped, so the program is not useful to me now.

Does the program only generate wav-files? In that case I think it should be extended to also generate p-files. Is this program supposed to be FOSS (Free Open Source Software)?

Another bug on my system is that the About-box looks strange, e.g. the button is on top of the text.
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: ZX81-IDE Software Development Tool, IDE

Post by sirmorris »

I like the speed - whoosh!

In agree that it would be nice to have the demo compilable 'out of the box'. Even if it needs additional work the tester should have a shell which 'just works'. I had to define MEMST & change the AUTOLD behaviour. I have an advantage in that I know what I'm doing, a newbie would be completely put-off.

The option to have a full display file would be good. I suppose it's just a simple hack of the appropriate include. Collapsed files are redundant for most developers these days - an extra couple of milliseconds to load from SD card is nothing. For tape it may save a second or 2 but I liked the regular pattern of the dfile loading which told me that my wait was nearly over :)

Can it generate a listing or symbol file?
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81-IDE Software Development Tool, IDE

Post by PokeMon »

sirmorris wrote: One feature I keep needing is automatic conversion of ascii strings -> zeddy strings. You could have a special operator for definng auto-translated strings;

.db $00,$01
....
.ds 'this string will be in ascii'
.dts 'this string will be in zeddy char codes when compiled'
Yes I thought about that to enter strings with ZX character set easy.
Not sure how to do.

Could be a kind of sign like § ^ ° | - I think most unused char would be § if there is no lawyer programming here. :mrgreen:
db '§A' ; for single character A
db '§this string is translated complete' ; for a string

Could be a pseudo instruction like your proposal - could use dbzx for zx characters.
db 'pc message'
dbzx 'zx message'

Could be a switch for char conversion for multiple use in source
zxcharset on
zxcharset off

But is an important feature, I know. Come soon, maybe in the next few days. ;)
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81-IDE Software Development Tool, IDE

Post by PokeMon »

MOB-i-L wrote:I tested it in Linux (Ubuntu 10.04 LTS) under WINE, a Windows XP emulator. I tried to compile ZX81DEMO.ASM but there was an undefined symbol AUTOLD in the file ZX81VARS.INC and the compilation stopped, so the program is not useful to me now.

Does the program only generate wav-files? In that case I think it should be extended to also generate p-files. Is this program supposed to be FOSS (Free Open Source Software)?

Another bug on my system is that the About-box looks strange, e.g. the button is on top of the text.
Thanks for testing.
Sorry for the mistake with DEMO (sample) program. I changed a name from AUTOLD (Autoload) to AUTORUN and did forget to pack the changed include file. :oops:
There was another mistake when loading ZX80 files which could not be loaded due to program name (now suppressed). Should work now but I do not have this machine for testing. Paul may do for me.

The program mainly creates .p files (or .81 if you want, can change in first line format binary as "..." instruction gives the extension).
It creates WAV files too if you switch it on with Auto Create WAV in Run menu (default, is stored in INI file).
And yes, it is used Open Source flatassembler (Z80 version). You can find documentation of assembler here http://flatassembler.net/
I will post source files in a few weeks on my homepage, can send you with email right now if you want. Just give me PM.
Flatassembler itself is written in x86 assembler. ;)
FASMW.zip
(141.44 KiB) Downloaded 1774 times
The message box should look like this, I am using WIN XP. It just uses standard function MessageBox in WIN.
MB1.gif
MB1.gif (10.23 KiB) Viewed 23895 times
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81-IDE Software Development Tool, IDE

Post by PokeMon »

sirmorris wrote: In agree that it would be nice to have the demo compilable 'out of the box'. Even if it needs additional work the tester should have a shell which 'just works'. I had to define MEMST & change the AUTOLD behaviour. I have an advantage in that I know what I'm doing, a newbie would be completely put-off.
You are right with the AUTOLD which I renamed in AUTORUN, forgot to attach the changed include files ZX81VARS.INC and ZX81VAFL.INC.
ZX81VARS.INC is standard definition of variables and ZX81VALD changed for Fastloader.
MEMST is defined in ZX81DEF.INC and this should be okay, I did not change.
I think you tried to assemble ZX81VARS.INC which caused this error because ZX81DEF.INC is included in ZX81DEMO.ASM but not in ZX81VARS.INC.
Should not be defined twice. Okay could maybe confuse. ;)

sirmorris wrote: The option to have a full display file would be good. I suppose it's just a simple hack of the appropriate include. Collapsed files are redundant for most developers these days - an extra couple of milliseconds to load from SD card is nothing. For tape it may save a second or 2 but I liked the regular pattern of the dfile loading which told me that my wait was nearly over :)
DFILE is defined in ZX81POST.INC and included at the end of ZX81DEMO.ASM.
I put in my message, that program was transferred with ZX81-IDE. But could be loaded other way. Looked very crypty due to missing char conversion. :mrgreen:
You can change (comment) the DFILE db definition and use following for a complete expanded DFILE:

Code: Select all

                        db NEWLINE
                        repeat 24
                        db 32 dup(0),NEWLINE
                        end repeat
sirmorris wrote: Can it generate a listing or symbol file?
Listing module is available in general but did not check yet after changing instruction set from x86 to Z80. I have to test this, would be helpful I think. So available soon.

With CTRL-F8 (or in Run menu) you can create a "symbols" file which is not readable but described for further processing with debuggers or so.
You can find the information on the doc site: http://flatassembler.net/docs.php (Symbolic information file format).
But maybe this is not what you like. I think you mean a readable symbol table like you sometimes find at the end of listings ? ;)
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81-IDE Software Development Tool, IDE

Post by PokeMon »

* UPDATE *

Last update before Mahlerts. :mrgreen:

The main purpose of the update is the realized character translation from ASCII to ZX charset. Only the lower ASCII characters are translated ($00 - $7F) and there are some characters I used for characters in ZX set but not in ASCII set. So there is no rule, this is just a convention. If somebody think this make no sense it all, would disturb existing projects/source or if there is already existing a general concept of translation, please respond. I think there won't be an official RFC for this.

So in the include directory there is a description file ZX81CONV.TXT which describes how characters are translated. Most characters not exisiting in ZX set I translated to $00 (SPACE). Some characters I treated special, not used now but maybe I use in future in my software except somebody stop me to do so. ;)

This is the list of special character conversion

Code: Select all

ASCII	purpose 	ZX char 	purpose
$08	BACKSPACE	$77		RUBOUT
$09	TAB		$73		CURSOR RIGHT
$0A	LINEFEED	$76		NEWLINE
$0B	VERTICAL TAB	$71		CURSOR DOWN
$0C	FORMFEED	$FD		CLEAR
$0D	CARRIAGE RETURN $76		NEWLINE
$23	#		$D8		**
$5B	[		$DB		<=
$5C	\		$DD		<>
$5D	]		$DC		>=
$7F	DEL		$77		RUBOUT
To use translation function I created the new directive "dbzx" which corresponds to "db" for string representation.
But it also works for single byte representation used with numbers (they are also translated).

I thought about a solution of translating single characters / bytes to allow easy codings and that was not easy to implement if you don't want to rewrite main parts of the parsing functions which could cause sideeffects. To mark a section as "to be translated" is not comfortable too. So I decided to break the syntax rules which allows LD/ADD/ADC/SUB/SBC/AND/OR/XOR/CP to be used with ZX set while writing a double comma ",," or use a "," in front of logical functions. This allows coding in following style:

Code: Select all

dbzx 'CREATED WITH ZX81-IDE' - is translated into zx charset
dbzx $39 - is translated into $25

LD A,,'?' - will put $0F instead of $3F in A
ADD A,,'0' will add $1C instead of $30
CP ,,'A' will compare with $26 instead of $41
So that looks a bit funny but it's not a must to do so - its just an option. ;)

What else is changed ?
I copied the code of the Fastloder ZX81FALD.p into file FASTLOAD.BIN which will prevent users to overwrite the ZX81FALD.p accidently by trying something with the delivered source which would effect the fastloader option directly. This file is hardcopied into the file to translate. So now it is more safe. Could be that somebody destroyed his fastloader code. And I found out that fast loader does not work with the 1k Games written by dr. beep becauses he uses the variables section in his games probably to use the last byte ever possible. :mrgreen:

I put a new option into the includes to choose the type of DFILE generated (COLLAPSED or EXPANDED) and changed the STKBOT/STKEND definitions which was not choosen carefully and get problem with expanded DFILE. And last but not least I added an option to write a startup message into the DFILE (work either for collapsed and expanded DFILE) which is centered on screen but maximum 32 chars. There could be a welcome message from your program created with this IDE.
You will find examples in ZX81DEMO.ASM

I think this is all, anyway not sure if I missed something to tell.
I will write a small manual but later, when this thread exceeds 3 or more pages.
Now I do all documentation here first.

Good luck 8-)
FASMWZ80.zip
(143.24 KiB) Downloaded 1920 times
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81-IDE Software Development Tool, IDE

Post by PokeMon »

Well, time for new *** UPDATE *** 8-)

What's changed ?

First a correction in one of the instruction tables which caused file directive to be not recognized, now it's there again.
Anyway if someone find something not working what should work (referring again to main flat assembler documentation http://flatassembler.net/docs.php ) just reply here or send me a message. I will find out why and probably repair.

Second I changed the fastloader code. The previous version took about 7 to 8 seconds minimum for the fastloader part transferred first in standard speed. I optimized the loader code and shorted some pause values during the transferred bits and during the low phase of the pulses as proposed from Zsolt. All in all the loader is shortened to about 2.3 seconds plus the code to transfer with about 1 kByte per additional second. So small programs can be transferred even in less than 3 seconds. Just by pressing F9 and activate Fastloader (in Run menu, default). I tried to adapt shorten of pause values carefully but maybe someone could have problems with transfer via PC soundcard. Please reply here. This affects standard speed as well - dont was engaged to divide my code here. :mrgreen: And I could increase the audio volume for the fastloader part double. This was something due to coding values, fastloader had only half output power as slow mode (standard speed).

Third I integrated the listing function. The main keys are:
F9 - run (transfer to ZX81)
CTRL-F9 - compile only (see if errors)
CTRL-F8 - create listing (which is opened automatically in a new window and updated when CTRL-F8 pressed again after changing)
To stop listing for some include files and to concentrate listing on the part you need, just use comments ;LISTOFF or ;LISTON at any time in source code, just have to be uppercase, start with ; and have to be at the very first beginning of a line. See ZX81DEMO.ASM for an example.

The BASIC routines are in experimental stadium and not to use now, wanted to post a useful version because SirMorris announced to maybe use this tool for development.

Any comments and requests are welcome.
FASMW.zip
(144.63 KiB) Downloaded 2170 times
User avatar
polomint
Posts: 16
Joined: Tue Jan 17, 2012 11:28 am
Location: Barrowford, Nelson, Lancashire
Contact:

Re: ZX81-IDE Software Development Tool, IDE

Post by polomint »

This is excellent, it's just the kick up the backside I need to continue with my ZX81 coding, thanks!!! :)
Bozxle81 - in progress.
Post Reply