ZX81-IDE Software Development Tool, IDE

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
User avatar
SafePit
Posts: 43
Joined: Mon Feb 20, 2012 7:06 pm
Location: Boise, ID
Contact:

Re: ZX81-IDE Software Development Tool, IDE

Post by SafePit »

First off, let say how great ZX81-IDE is. I'm "finally" learning z80 assembly and I really appreciate how easy to get up a going using this IDE. I did, however, run into an issue while entering in a program from "Mastering Machine Code on Your ZX81."

When using the "JR NC,$F8" or "JR NZ,$F8" op codes with literals, the assembler is interpreting these as "JR $F8". Fortunately, you can workaround this by using a label. Here is an example listing showing the problem (notice the op code 18 instead of 30 or 20):

Code: Select all

007C: [4085] 18 F8                      F8:     JR NC,$F8
007E: [4087] 30 FC                              JR NC,F8
0080: [4089] 18 F8                              JR NZ,$F8
0082: [408B] 20 F8                              JR NZ,F8
0084: [408D] 18 F6                              JR F8
0086: [408F] 18 F4                              JR F8 
Image
Image
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81-IDE Software Development Tool, IDE

Post by PokeMon »

Glad to hear, that you are using the ZX-IDE and that you find it helpful.
And thanks for that error report.
You are right, it is a bit different handled with labels or immediate values.

So I posted a bugfix release right now in the "Tutorial thread", first posting:
http://sinclairzxworld.com/viewtopic.php?f=6&t=1064
(Rev. 1.71.01f.Z80 10/2013)

Code: Select all

                                        format binary as 'p'
                                        
0000: [0000] 10 10                             DJNZ testlabel2
                                        
0002: [0002] 38 0E                             JR C,@f
0004: [0004] 38 FE                             JR C,$FE
0006: [0006] 30 0A                             JR NC,@f
0008: [0008] 30 FE                             JR NC,$FE
000A: [000A] 28 06                             JR Z,@f
000C: [000C] 28 FE                             JR Z,$FE
000E: [000E] 20 02                             JR NZ,@f
0010: [0010] 20 FE                             JR NZ,$FE
                                        
                                        testlabel2:
                                        
                                        @@:
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

ZX81-IDE Software Development Tool, IDE with graphic chars

Post by PokeMon »

So finally - here it is.
It was quite hard work, I will explain why.

The new release "1.71.01g.Z80 11/2013" of the ZX-IDE is the graphics release - thats why it is called revision g. :mrgreen:
No that was just a happy coincidence. ;)

The first big step was realizing support of graphics characters.
This has been done with modifying a truetype font to create the characters needed for ZX81, especially the graphic and inverted chars.
There has been an existing font named zx81.ttf but this is not very helpful for the IDE as both charsets are needed (Sinclair and ASCII) in one charset and with use of only 8 bit to avoid source files to be saved in multibyte (non-ascii) format. So this was a time consumpting project.

The graphic mode can be used with ALT+9 key, similar to SHIFT+9 on the ZX keyboard to activate graphics mode. It can be switched on for different editor windows in the IDE like needed and is automatically switched on if a file with graphic chars is loaded in the IDE. The use of the chars inside the IDE is very simple, a toolbar with graphic chars is displayed and a char can be inserted simply by clicking on the desired and visible char in top of window. They can be copied as well with CTRL-C and CTRL-V as needed.

To see the graphic chars you have to install the Sinclair.ttf font which is in the main directory. The font can be either copied to the windows/fonts directory or just installed from the main directory of the ZX-IDE by double clicking it and use the install button in the font viewer window.

Second the chapters 10,11,12,13 and used tokens are supported now which allow conditional BASIC programs (IF-THEN structures) and loops (FOR-NEXT statements). So this will offer a wider range to use BASIC with assembler in useful programs. Following additional statements are supported with this new version:

IF-THEN structure
comparison operators and logical expressions like <,>,=,<=,>=,<>,AND,OR,NOT
STOP statement
functions CODE, CHR$
FOR-NEXT loops with TO and STEP
SLOW and FAST (have been supported in earlier version 1.71.01e but not described in tutorial section)

There have been some more tricky action to modify the IDE to support the IF-THEN structure and logical expressions. This is used with the powerful macro language of FASM as well and so there are now two context to interprete IF statements or logical expressions. They can be used now either in BASIC or Assembler context. This was hard work, too (without renaming them).

So the version is uploaded in the IDE thread and available now, I will add some chapters in the tutorial in the next days.
I think next step is support of the of rest BASIC statements which are now not more too complicate.

So have fun with the new versions and hope to see some more programs using the IDE now. 8-)
Last edited by PokeMon on Tue Nov 26, 2013 10:20 pm, edited 1 time in total.
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: ZX81-IDE Software Development Tool, IDE

Post by sirmorris »

Wow, she's really coming on nicely Karl!

Thanks for all your hard work 8-)
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81-IDE Software Development Tool, IDE

Post by PokeMon »

So time for a new version, ZX-IDE 1.71.01h.Z80 (12/2013) - now with complete BASIC support for ZX81 (all statements).
The rest could be implemented more easy than thought.
I will describe a bit more in the tutorial thread.

New commands are:

SLOW & FAST (FAST is supported actually since version 1.71.01e)
GOSUB & RETURN
LOAD & SAVE
PRINT AT and PRINT TAB, CLS, SCROLL
PLOT & UNPLOT
PAUSE & INKEY$
LLIST, LPRINT & COPY
substrings "ABCDEF" (2 TO 4)
DIM
PEEK & POKE

Next step is complete support of ZX80BASIC.
After I will revise the fastloader and implement the SAVE into the ZX-IDE (receiving data from ZX81/ZX80).

This will offer new possibilities.
Most of you will think, this is not needed nor helpful as there is nothing to save on ZX81.
But this is more than just support of save, when implemented we have a backward channel and can initiate communication between ZX81 and windows applications in the background (if a small client is loaded).

So you can look forward to this version next year. 8-)
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81-IDE Software Development Tool, IDE

Post by PokeMon »

So the time did come - the ZX80 BASIC support is finished and now releases in ZX-IDE 1.71.01k.Z80 (02/2014).
Now you can program with just one tool:

Z80 Assembly in general
ZX80 BASIC+Assembly
ZX81 BASIC+Assembly

For next release I will try to integrate the support of programming in C as well with the help of z88dk tools, but with slightly changed concept. So it would be possible to use C-functions in BASIC or Assembly context - but C functions may be called from BASIC (or Assembly) and not vice versa. So this would be maybe a help for people not very firm with assembly programming. We will see - I will give it a chance and hope the implementation would be not too complicate.

Next step then would be implementation of a new highspeed LOAD/SAVE interface (audio) for both types (ZX80 and ZX81).

So as every time the newest version of the ZX-IDE can be found in the first posting of this thread:
viewtopic.php?f=6&t=1064
User avatar
peterz
Posts: 10
Joined: Sat Apr 13, 2013 11:23 am

Re: ZX81-IDE Software Development Tool, IDE

Post by peterz »

Many thanks for this excellent tool. I'm primarily using it as an assembler, but it really is all I need for my ZX81 software projects.

I noticed that ZX-IDE lets me use a few instructions that don't exist. One example is LD HL, (DE), but I think there are others. These can be hard to find back later, when things don't work. No big deal whatsoever, but if it is something you can easily prevent in a future release, I would be grateful. If you want, I can keep track of the ones I find.
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81-IDE Software Development Tool, IDE

Post by PokeMon »

Thanks, those hints are very welcome and I will fix this for the next release.
So feel free to post errors or missbehaviours just here. ;)
User avatar
stefano
Posts: 542
Joined: Tue Dec 11, 2012 9:24 am
Contact:

Re: ZX81-IDE Software Development Tool, IDE

Post by stefano »

I now understand why you were asking about the z88dk relocating capabilities :)
In theory this can be achieved with z80asm and worked on the Spectrum (to include subroutines in REM basic lines) but some work should be done for the zx81. First of all I should figure out how the final program will be built.. a composition of external modules into different REM lines ?
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81-IDE Software Development Tool, IDE

Post by PokeMon »

No - there is a sample application ZX81DEMO.ASM (which maybe is now more than a simple sample) which shows the include files to load.
In fact you can do what you want, there is no start loader.
If you want to execute assembler code this can be simple done with RAND USR or PRINT USR or LET USR (or any other statement accepting an integer number as argument) at any BASIC line.

There is an AUTORUN label defined, which can be placed at any BASIC line (or prior) and executes the program automatically after loading.
Here is a smaller sample:

Code: Select all

format zx81
;labelusenumeric
;LISTOFF

        // hardware options to be set and change defaults in ZX81DEF.INC
        MEMAVL     =       MEM_1K         // can be MEM_1K, MEM_2K, MEM_4K, MEM_8K, MEM_16K, MEM_32K, MEM_48K
                                           // default value is MEM_16K
        STARTMODE  EQU     SLOW_MODE       // SLOW or FAST
        DFILETYPE  EQU     AUTO            // COLLAPSED or EXPANDED or AUTO
        STARTUPMSG EQU    'CREATED WITH ZX81-IDE' // any message will be shown on screen after loading, max. 32 chars

        include 'SINCL-ZX\ZX81.INC'        // definitions of constants and memory start area
;LISTON

        AUTOLINE 10

        REM SIMPLE PROGRAM

30      REM _asm
        LD BC,label1
        RET
        END _asm

        PRINT USR #30#

        REM _asm
label1:
        LD A,,'X'
        RST $10
        RET
        END _asm
        RAND USR #label1

AUTORUN:
        RAND USR USR #30#

        include 'SINCL-ZX\ZX81POST.INC'          ; include D_FILE and needed memory areas

assert ($-MEMST)<MEMAVL
// end of program
Take notice of the USR USR usage in above example - this is not a typo.
The functions can be cascaded as well.

RAND USR USR #30#

Means execute the assembly code at line 30, which give the address of label1 which is the code to execute by the first (outer) USR function. ;)
This allows to place code at any position in memory without knowing the effective start address.
There is no reason to place the code always in the first line of the program or to start with RAND USR 16514.

As for relocation - this is not needed in general for own programs but to use drivers in different memory areas without recompilation.
Something which is not very common now to ZX81 development - many programs are compiled for a special environment with drivers at fixed locations.
This would also allow to move a driver in a variable (D$ for example) and let the OS move it somewhere depending on other variable to place easy temporarily code which can be throwed away easy with a CLEAR or RUN statement after work.
Post Reply