Jump to content
nitrofurano

Aquarius stuff from Boriel's ZX-Basic Compiler - first attempt

Recommended Posts

here is my first attempt on creating Aquarius .rom files from Boriel's ZX-Basic Compiler - i think i'm struggling on the "scramble code" ( http://www.vdsteenov...s/romcheck.html ) or something else? the resulting .rom, the ZX-Basic sources i used, the .asm temporary file (for helping the debug process) and the .sh (bash script on Linux) for the compiling process are all there! :)

 

the idea was, for now, to do a "cls" with the character 0x41 ("A") and the colour attribute 0x35 (i can't remember now which colours are), and the resulting behaviour looks weird... :S

aquarius_borielszxbasiccompiler_experimentalsnippets_201306291704.zip

Edited by nitrofurano
  • Like 2

Share this post


Link to post
Share on other sites

working! \o/

 

Interesting.

But the BASIC dialect is not using line numbers, like the original Aquarius Basic?

Can you also do commands like SOUND or INKEY$?

 

Regs,

Martin

Share this post


Link to post
Share on other sites

Sweet! I see potential for the Aquarius. What will be your next step to see how good it will convert some of the more complex Basic Aquarius programs including sound and graphics?

Share this post


Link to post
Share on other sites

my idea is try to do for Aquarius (and other hardware like ColecoVision and many others, starting on the z80 ones) the same approach that i did for http://nitrofurano.altervista.org/retrocoding/mc1000 , http://nitrofurano.altervista.org/retrocoding/msx and http://nitrofurano.altervista.org/retrocoding/zxspectrum - the syntax is not exactly like Aquarius Basic, it's more close to ZX-Spectrum Basic, and you can also code like FreeBasic - the only care we should have is to avoid the default ZX-Spectrum commands, and create and/or use libraries that are more specific to each hardware (in the attachments from the weblinks i'm posting in the start of this message you can see these differences clearly ) - for now, i'm struggling on creating Aquarius libraries in Basic (maybe because stack issues on the limited 2kb default ram size?) that i imagine these libraries can work better using some inline assembly (you can code in assembly there, between "asm" and "end asm") - the idea is to be able to draw even bezier curves if needed - and i hope the limit, besides the hardware limitations, is only on the creativity of each coder! :)

  • Like 1

Share this post


Link to post
Share on other sites

my idea is try to do for Aquarius (and other hardware like ColecoVision and many others, starting on the z80 ones) the same approach that i did for http://nitrofurano.a...rocoding/mc1000 , http://nitrofurano.a...retrocoding/msx and http://nitrofurano.a...ding/zxspectrum - the syntax is not exactly like Aquarius Basic, it's more close to ZX-Spectrum Basic, and you can also code like FreeBasic - the only care we should have is to avoid the default ZX-Spectrum commands, and create and/or use libraries that are more specific to each hardware (in the attachments from the weblinks i'm posting in the start of this message you can see these differences clearly ) - for now, i'm struggling on creating Aquarius libraries in Basic (maybe because stack issues on the limited 2kb default ram size?) that i imagine these libraries can work better using some inline assembly (you can code in assembly there, between "asm" and "end asm") - the idea is to be able to draw even bezier curves if needed - and i hope the limit, besides the hardware limitations, is only on the creativity of each coder! :)

Do you suggest that with these libraries it would also be possible to exceed the Aquarius basic limitations like programming the Mini-expander sound chip and controllers?

Share this post


Link to post
Share on other sites

about inkey$, i think we can use the Aquarius "Bios" somehow? i think that we can also use the keyboard i/o port, also as a library, and be able to check multiple simultaneously pressed keys, like this game also coded on Boriel's ZX-Basic Compiler ( http://nitrofurano.altervista.org/retrocoding/zxspectrum/misc/bacaball.html - sources found at http://www.mojontwins.com/csscgc2011/nitrofurano-bacaball/ - among other stuff coded on ZX-Basic for ZX-Spectrum can be find at http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Released_Programs#Bacaball )

Share this post


Link to post
Share on other sites

Do you suggest that with these libraries it would also be possible to exceed the Aquarius basic limitations like programming the Mini-expander sound chip and controllers?

 

just for you having some idea, you can code in 100% assembly there, in 100% basic, or something between them - for example, if you can do all you are asking in assembly, you surely will do in ZX-Basic Compiler as well - the "strategy" will be on coding in Basic what you struggle to do in Assembly (like complex calculations), and coding in Assembly what you struggle to do in Basic (like specific stuff like accessing bios, i/o access with disable interruptions, optimized code for better performance, and so on), and the flexibility of the custom libraries you might create and/or use are very helpful there

Edited by nitrofurano

Share this post


Link to post
Share on other sites

that is why i'm sharing the temporary .asm files on all MSX and Aquarius codes - there you can see how the compiler works, and where it is being more or less efficient (normally it is far above my expectations! :) )

Share this post


Link to post
Share on other sites

updating a bit:

http://img708.imageshack.us/img708/407/17n1.png

i'm using aquariusdelay instead of aquariuswaitvbl (because i'm still struggling on how to get vbl working), and started to try to find out how the keyboard i/o port works (no idea how to use it yet, i only know it is in the port $FF) - the idea is, for now, trying to move that "sprite" with the keyboard...

aquarius_borielszxbasiccompiler_example01e_delay_keymap_201307011817.zip

  • Like 1

Share this post


Link to post
Share on other sites

yes.. YES!! Soon ZX Basic will rule over the Aquarius with a light-grey fist! I say you incorporate the Aquarius font into EVERY port of ZX basic from the Coleco to the SG-1000 so every 8 bit system can bask in the one true bitmapped font!

  • Like 3

Share this post


Link to post
Share on other sites

another update: fixed the "sprite" and added some code - the keymap and waitvbl library is still about to be fixed (for now, "wsad" keys are the same as "tgfh" and "ikjl"; waitvbl i still have no idea how to work, specially in assembly - sometimes; the cls library have some kind of 1-byte offset weird behaviour that i think is caused by some interrupt noise, but if i add some "di" or "ei" between "asm" and "end asm", the code doesn't compile... :S )

aquarius_borielszxbasiccompiler_example01g_delay_keymap_201307021005.zip

  • Like 2

Share this post


Link to post
Share on other sites

Seven months later here's a windows batch file to get the example compiled.

The batch file included in previous downloads pointed to a py file that didn't exist on my install.

I pointed to the .exe's in this script.

 

I also added the ZX BASIC COMPILER folder to my PATH

 

Need to install the dd program you see running in the script.

I did an 8 our GetGnuWin install for that tiny app (and trying to figure out why lua won't build rrrrrhg!)

. Maybe you just get the app.

 

 

I removed the end part that launches MESS because mess, messUI, and mame all complains

to me about not finding the aquarius roms that are installed when launched on command line.

It also hangs if you are not actually build your rom in the Roms folder.

REM Windows Batch to compile Boriel's ZX BASIC
REM To Aquarius Computer System Rom
 
REM remove old build
rm example01.asm example01.rom
 
REM ZXB is the main SDK executable. It can act both as a compiler or as a translator:
zxb library/aquariusromheader.bas --org=0x0000
 
REM copy header into temp file
dd ibs=1 count=16 skip=0 if=aquariusromheader.bin of=example01.tmr
 
REM rm removes objects
rm aquariusromheader.bin
 
REM compiling the basic program to cartridge memory
zxb example01.bas --asm --org=0xE010
zxb example01.bas --org=0xE010
cat example01.bin >> example01.tmr
 
REM create an 8K empty file
dd if=Null of=_dummybytes.bin bs=8192 count=1 seek=8192
 
REM fill the empty with the temp
cat _dummybytes.bin >> example01.tmr
 
REM clean up old build files
rm _dummybytes.bin example01.bin
 
REM write 8k of temp file to ROM file
dd ibs=1 count=8192 skip=0 if=example01.tmr of=example01.rom
rm example01.tmr
Edited by Pset

Share this post


Link to post
Share on other sites

Probably not but the software works on Aquarius emulator and that's a huge leap.

No sense in waiting on one man to do any job.

 

Running man keeps on running!

Which reminds me I got post my C code running man.

Soon as I recompile and test it a dozen times.

 

Ok looks like that batch doesn't do enough, the 8K rom it made doesn't load.

 

Edited by Pset
  • Like 2

Share this post


Link to post
Share on other sites

EUREKA!

Build Boriels ZXBASIC for the Aquarius Computer on Windows
Add the BASIC ZX COMPILER directory to your PATH Environment Variable.
Apparently there's some scripts to run in the setup I didn't read about,
and I did added my path manually.
Open up a Command Line program.
CD to the directory of the .bas file you want to compile (this project)
run example01.bs on unix
or
run example01.bat on Windows.
The result should be a new 8K example01.rom
And a bunch of other build files I left in there, for now, in case things go wrong.
Load Virtual Aquarius or Mess
Load the example01.rom into the catridge port
Restart the emulated computer
Behold the glory.
Example02 is a sprite demo,
WASD and IJKL keys run sprites around,
think a third set of keys to.
Enjoy programming on your Aquarius Home Computer System.
The Original ROMs are included for testing, again, if things go wrong.

6ZPnmxE.gif

REM Windows Batch to compile Boriel's ZX BASIC
REM To Aquarius Computer System Rom
REM cleanup disabled, build files left behind 
REM Edit this batch file to work cleaner
REM Enjoy your time compiling Boriel's ZX BASIC.
 
@ECHO OFF
 
REM Write Null file
ECHO NULL > Null
 
REM remove old build
rm example01.asm example01.rom
 
REM ZXB is the main SDK executable. It can act both as a compiler or as a translator:
zxb library/aquariusromheader.bas --org=0x0000
 
REM copy 16 BYTES header   into temp files
dd ibs=1 count=16 skip=16 if=aquariusromheader.bin of=example01.tmr
 
REM the line below is the for linux? what the line above does.
REM dd ibs=1 count=$((0x0010)) skip=$((0x0010)) if=aquariusromheader.bin of=example01.tmr
 
REM remove build temp file
REM rm aquariusromheader.bin
 
REM compiling the basic program to cartridge memory
zxb example01.bas --asm --org=0xE010
zxb example01.bas --org=0xE010
cat example01.bin >> example01.tmr
 
REM create an 8K empty file my settings may be wrong.
dd if=Null of=_dummybytes.bin bs=8192 count=1 seek=1024
 
REM here's the unix version
REM dd bs=8192 count=1 if=/dev/zero of=_dummybytes.bin
 
REM fill the empty with the TMR file
cat _dummybytes.bin >> example01.tmr
 
REM cleaning  up old build files  
REM rm _dummybytes.bin example01.bin
 
ECHO Writing 8k of TMR file to ROM file
dd ibs=1 count=8192 skip=0 if=example01.tmr of=example01.rom
 
REM remove TMR
REM rm example01.tmr
 
REM remove Null
REM rm Null
 
REM Launch emulator disabled for now
REM mess aquarius -skip_gameinfo -resolution1 640x400 -aspect0 8:6 -cart1 example01.rom

 

 

BuildBorielsZXBASIC.zip

Edited by Pset
  • Like 1

Share this post


Link to post
Share on other sites

Looks like I need some other things besides dd to make this work.

 

The batch file calls:

 

rm

cat

zxb

 

The first two sound like unix commands

I'm guessing the last one is zx basic but I can't find where I download the Aquarius version :|

 

UPDATE: I think I've tracked down rm and cat for Windows. Whatever version of dd I try gives various errors in Windows 8. I think it's more related to each revision supports different options. Is there is link to the specific dd that worked?

  • Like 1

Share this post


Link to post
Share on other sites

now that 8 hour GnuWin install shows what it did.

 

rm statements just do clean up of files you wont need when its done.

But since stuff dont work perfect yet, lets see what does get done.

 

The one I left in the script is supposed to be commented out with REM for now.

 

I'd like to say Cygwin should have the commands you need.

But nope doesn't have cat, and i'm having a hell of a time making copy do what cat did.

 

I'm getting an extra two bytes of data at the start of my ROM.

And I don't know where they come from.

oh Nope, I'm losing the bytes, lets see.

Edited by Pset

Share this post


Link to post
Share on other sites

I made one step forward and one step back :)

 

I installed the setup-x86_64.exe from cygwin and went for the base packages.

I installed the zxbasix-1.2.9.msi from Boriels site.

I unpacked BuildBorielsZXBASIC.zip to its own dire3ctory on the root of my hard drive.

This is the result when I attempt to run the batch files:

 

C:\BuildBorielsZXBASIC>WinBuildBorielsZXBasic01.bat

C:\BuildBorielsZXBASIC>REM Windows Batch to compile Boriel's ZX BASIC

C:\BuildBorielsZXBASIC>REM To Aquarius Computer System Rom

C:\BuildBorielsZXBASIC>REM cleanup disabled, build files left behind

C:\BuildBorielsZXBASIC>REM Edit this batch file to work cleaner

C:\BuildBorielsZXBASIC>REM Enjoy your time compiling Boriel's ZX BASIC.
rm: cannot remove `example01.rom': No such file or directory
Writing 8k of TMR file to ROM file

C:\BuildBorielsZXBASIC>WinBuildBorielsZXBasic02.bat

C:\BuildBorielsZXBASIC>REM Windows Batch to compile Boriel's ZX BASIC

C:\BuildBorielsZXBASIC>REM To Aquarius Computer System Rom

C:\BuildBorielsZXBASIC>REM cleanup disabled, build files left behind

C:\BuildBorielsZXBASIC>REM Edit this batch file to work cleaner

C:\BuildBorielsZXBASIC>REM Enjoy your time compiling Boriel's ZX BASIC.
rm: cannot remove `example01.rom': No such file or directory
Writing 8k of TMR file to ROM file

 

Share this post


Link to post
Share on other sites

now that 8 hour GnuWin install shows what it did.

 

rm statements just do clean up of files you wont need when its done.

But since stuff dont work perfect yet, lets see what does get done.

 

The one I left in the script is supposed to be commented out with REM for now.

 

I'd like to say Cygwin should have the commands you need.

But nope doesn't have cat, and i'm having a hell of a time making copy do what cat did.

 

I'm getting an extra two bytes of data at the start of my ROM.

And I don't know where they come from.

 

This seems to have cat

http://gnuwin32.sourceforge.net/packages/coreutils.htm

 

AS a side note dd seemed to work better if I went into compatibility mode and set it to run as administrator.

Share this post


Link to post
Share on other sites

Amazing what getting up and taking a break will do.

 

Here's the skinny CAT free version using Windows COPY.

I'd call it clean, but it leaves your drive with like six files every build.

We'll have to figure out a good clean up method next time on Aquarius Guide To Home Computing.

 

Update attached.

 

Your console output only shows the little header information.

ECHO is off, after that. change it to ON to see what really happens.

The Boriel install instructions have some mention of getting the path to the app right.

I'd start there (but I didn't lol, woops).

Else

add a semi-colon and any path to your PATH, in this case its starting fresh with z88dk

I ended up having to add \bin to that path, watch those folders.

Shift+right click a folder that contains exe's and "Copy as path"

then paste into your PATH variable input, clean up the quotes and

make sure your PATH looks something like

 

C:\DEV\ZXBasicCompiler;C:\Users\Pset\AQUARIUS2014;C:\AnotherFolder\etc

 

 

aNU93Zo.png

 

 

 

 

REM Windows Batch Compiler Script
REM For Boriel's ZX BASIC to Aquarius Computer Catridge ROM
REM No RM version 1.0 January 13 2014 
 
REM Write Null file, very important
ECHO NULL > Null
 
REM ZXB is the main SDK executable. It can act both as a compiler or as a translator:
REM http://www.boriel.com/en/software/the-zx-basic-compiler/
 
REM this command creates a binary machine code compilation of the 8k catridge header
REM see library/aquarisromheader16kb.bas for bigger cart.
zxb library/aquariusromheader.bas --org=0x0000
 
REM copy 16 BYTES header   into temp files
dd ibs=1 count=16 skip=16 if=aquariusromheader.bin of=example01.tmr
 
REM compiling the basic program to cartridge memory
zxb example01.bas --asm --org=0xE010
zxb example01.bas --org=0xE010
 
REM append rom header binary to assembly code binary
copy example01.tmr /b + example01.bin /b example01.tmr 
 
REM create an 8K empty file my settings may be wrong.
dd if=Null of=_dummybytes.bin bs=8192 count=1 seek=1
 
REM append the temp binary data with space to fill the 8k rom
copy example01.tmr /b + /b _dummybytes.bin example01.tmr /b
 
REM cleaning  up old build files  
REM rm _dummybytes.bin example01.bin
 
ECHO Writing only 8k of TMR binary to ROM file
dd ibs=1 count=8192 skip=0 if=example01.tmr of=example01.rom

 

 

BuildBorielsZXBASIC_Post23.zip

Edited by Pset

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.

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...