Jump to content

Photo

[AQUARIUS] BootLoader BASIC

Mattel Aqarius BASIC ROM

35 replies to this topic

#1 mvdsteenoven OFFLINE  

mvdsteenoven

    Chopper Commander

  • 181 posts
  • Location:Netherlands

Posted Sat Jan 4, 2014 12:49 PM

BootLoader Basic is the new version to create bootable BASIC programs on the Aquarius. Together with the Virtual Aquarius, BL Basic provides a complete environment to create, test and dump your BASIC programs. No more hussle with external scripts to create your ROM.

BL Basic adds the following commands and functions:

- CLS - Clear screen
  Syntax: CLS

- LOCATE - Position on screen
  Syntax: LOCATE col, row

- OUT - I/O Output data to port
  Syntax: OUT port, data

- PSG - Program PSG directly register, value
  Syntax: PSG register, value [, ...]

- IN() - I/O Input data from port
  Syntax: n = IN( port )

- JOY() - Read joystick
  Syntax: j = JOY( n )
                 n - 0 will read left or right
                   - 1 will read left joystick only
                   - 2 will read right joystick only


- LDUMP
  This command will export the BASIC program to ROM file using the printer interface of the Virtual Aquarius


All these commands (except LDUMP) can be used in your own ROM file as well.

To create your own BASIC ROM:

Load the BLBASIC.ROM in the Virtual Aquarius.
Next load your BASIC program by typing, quick type or load cassette.
Type the command LDUMP

IMPORTANT: Before pressing RETURN check the Virtual Aquarius printer settings!
Go to Configure -> Printer and configure the "Filename for Printer Output"
Make sure you send the output to a new file (!)

After checking the printer settings press RETURN at the LDUMP command

That's it!

Rename the output file extension from .txt to .rom or .bin and load the file into the Virtual Aquarius.

The zip file includes the following:

README.TXT - this text
BLBASIC.ROM - ROM to load into the Virtual Aquarius
SOURCE.ZIP - Z80 assembly code to create BLBASIC
 

Attached File  BLBasic.zip   9.53KB   148 downloads

 

Regs,

Martin



#2 Pset OFFLINE  

Pset

    Chopper Commander

  • 124 posts

Posted Sat Jan 4, 2014 3:02 PM

Super awesome.

 

What's a PSG register?

 

try this

cls: locate1,1: print("hello"): poke12288,255

doesn't it seem that the cursor is at 1,2 when it starts printing?

Well I guess that's the way Extended Basic did it as well.

 

You have some examples of those out and in commands in use?


Edited by Pset, Sat Jan 4, 2014 3:07 PM.


#3 mvdsteenoven OFFLINE  

mvdsteenoven

    Chopper Commander

  • Topic Starter
  • 181 posts
  • Location:Netherlands

Posted Sat Jan 4, 2014 3:50 PM

What's a PSG register?


PSG is the AY-3-8910 programmable sound generator, which is the 3-channel sound chip located in the mini-expander of the Aquarius. It also controls the handcontrollers.
You can read more about the PSG and its registers on my website here.

See the first example in Z80 on the page, "generate a tone on channel A"
This can be done with the PSG command as followed:
PSG 8,15,0,93,1,13,7,62
 

try this

cls: locate1,1: print("hello"): poke12288,255
doesn't it seem that the cursor is at 1,2 when it starts printing?
Well I guess that's the way Extended Basic did it as well.


That correct, the locate command works the same as Extended Basic. Try this:
locate14,11:?"Hello world!"
 

You have some examples of those out and in commands in use?


The JOY() function allows you to read the handcontrollers directly, but you can also read them by using the OUT and IN statements:
10 OUT 247,7:OUT 246,63
20 OUT 247,14:I=IN(246)
30 IF I=255 THEN 20
40 PRINT I;
50 GOTO20
Read here for more information about reading the handcontrollers.

Regs,
Martin

#4 Pset OFFLINE  

Pset

    Chopper Commander

  • 124 posts

Posted Sun Jan 5, 2014 4:43 AM

Ah PSG for sound hardware. I was just bopping around with SOUND the other day. 

 

I don't have any Aquarius hardware, too much arthritis to be patient enough with it but wow dreams do come true.

I tried to figure this stuff out for days, what peek or poke would get me the controller returns.

Press enter, change location, thumb all the buttons and the wheel, repeat. Until I had blisters.

Extended BASIC was supposed to be the answer and wasn't, but the disk drive gave me hope that

more programs to access faster would let me stumble on the answer, and that never showed up.

 

Are you testing your joysticks and ROMs on the real hardware?

 

Can we get joystick input from somewhere in the virtual software?

I just mashed all my keys, Virtual Aquarius didn't flinch. 



#5 mvdsteenoven OFFLINE  

mvdsteenoven

    Chopper Commander

  • Topic Starter
  • 181 posts
  • Location:Netherlands

Posted Sun Jan 5, 2014 6:23 AM

I do not test my ROM on real hardware, I do not have the equipment to create ROM's.

You can hook a joystick to your Windows system (as long as it Windows ActiveX compatible).

The Virtual Aquarius will emulate it as a handcontroller.



#6 Aquaman OFFLINE  

Aquaman

    Moonsweeper

  • 375 posts
  • Location:the Netherlands

Posted Sun Jan 5, 2014 10:05 AM

Thanks Martin, once again you did a great job of taking programming on the Aquarius one step further. As of 2014 this is the tool for every Basic developer!

#7 Pset OFFLINE  

Pset

    Chopper Commander

  • 124 posts

Posted Sun Jan 5, 2014 12:33 PM

Here's a program to draw with PSET through your game controller and

save the drawing to a BASIC file that will draw the drawing back to you using POKES.

 

This is just a test to see if I could PEEK where I was PSETting and of course doodle with the game controller.

First version does some printing using LOCATE that slows down the mouse draw.

Spoiler

Attached Files


Edited by Pset, Sun Jan 5, 2014 1:10 PM.


#8 mvdsteenoven OFFLINE  

mvdsteenoven

    Chopper Commander

  • Topic Starter
  • 181 posts
  • Location:Netherlands

Posted Sun Jan 5, 2014 2:50 PM

Thanks Martin, once again you did a great job of taking programming on the Aquarius one step further. As of 2014 this is the tool for every Basic developer!


Thanks for the compliment! But 2014 is still young and I'm looking forward to see Jay his mini expander project which looks very promissing as well.

#9 jaybird3rd OFFLINE  

jaybird3rd

    Quadrunner

  • 9,160 posts
  • "Excuse me, sir? I have a question ..."
  • Location:806.4616.0110

Posted Sun Jan 5, 2014 2:59 PM

Thanks for the compliment! But 2014 is still young and I'm looking forward to see Jay his mini expander project which looks very promissing as well.

Thanks!  I finally managed to burn that ROM that we had discussed, by the way; all I need to do now is finish building the glue logic and test it.  I should have time next week.



#10 mvdsteenoven OFFLINE  

mvdsteenoven

    Chopper Commander

  • Topic Starter
  • 181 posts
  • Location:Netherlands

Posted Sun Jan 5, 2014 3:07 PM

First version does some printing using LOCATE that slows down the mouse draw.

Screenupdates always require some time.
I also noticed that you used the OUT and IN commands to read the joystick. These commands require multiple translations between BASIC and the machinecode. The JOY() function does this all for you in lesser translations.

#11 Aquaman OFFLINE  

Aquaman

    Moonsweeper

  • 375 posts
  • Location:the Netherlands

Posted Sun Jan 5, 2014 3:35 PM

But 2014 is still young and I'm looking forward to see Jay his mini expander project which looks very promissing as well.

That's indeed a project which I am also looking forward to,especially the incorporated font feature would rise the Aquarius to a much higher level!!

#12 Pset OFFLINE  

Pset

    Chopper Commander

  • 124 posts

Posted Sun Jan 5, 2014 6:05 PM

Updated ROAD program, ie, drive your car down the road, don't hit the sides.

Use WASD keys or the joystick (still using the IN/OUT statements)  to move.

Program runs out of memory eventually. I'm not sure why.

Spoiler

Attached Files



#13 mvdsteenoven OFFLINE  

mvdsteenoven

    Chopper Commander

  • Topic Starter
  • 181 posts
  • Location:Netherlands

Posted Mon Jan 6, 2014 10:06 AM

 

Updated ROAD program, ie, drive your car down the road, don't hit the sides.

Use WASD keys or the joystick (still using the IN/OUT statements)  to move.

Program runs out of memory eventually. I'm not sure why.

 

You are calling your joystick input routine at line 1000 from line 400 using a GOSUB 1000.

But the routine at 1000 does not end with a RETURN statement, instead there are two GOTO 300 statements (at 1200 and 1400)

For every GOSUB statement the BASIC envorinment needs to "remember" where to return.

Replace the GOTO 300 statements at 1200 and 1400 with RETURN and you will have solved your memory leak.

 

Regs

Martin



#14 Pset OFFLINE  

Pset

    Chopper Commander

  • 124 posts

Posted Mon Jan 6, 2014 11:57 AM

Ok fixed up with a bit more curvey action to the road, preventing endless straightaways.

Wow it sure is super slow at 100% cpu speed. I was building it at 500%.

The program came from what I remember of the 50 BASIC Game Programs for Timex Sinclair book..

Now, I remember running that BASIC file on a Sinclair emulator years  back and it was heart crushingly slow.

 

But yay! Locate command scrolling and Joysticks. :D

Wish I could have been a fly on the wall while you made this BASIC.
 

Spoiler

Attached Files


Edited by Pset, Mon Jan 6, 2014 12:09 PM.


#15 Aquaman OFFLINE  

Aquaman

    Moonsweeper

  • 375 posts
  • Location:the Netherlands

Posted Mon Jan 6, 2014 2:42 PM

BootLoader Basic is the new version to create bootable BASIC programs on the Aquarius. Together with the Virtual Aquarius, BL Basic provides a complete environment to create, test and dump your BASIC programs. No more hussle with external scripts to create your ROM.

BL Basic adds the following commands and functions:

- CLS - Clear screen
  Syntax: CLS

- LOCATE - Position on screen
  Syntax: LOCATE col, row

- OUT - I/O Output data to port
  Syntax: OUT port, data

- PSG - Program PSG directly register, value
  Syntax: PSG register, value [, ...]

- IN() - I/O Input data from port
  Syntax: n = IN( port )

- JOY() - Read joystick
  Syntax: j = JOY( n )
                 n - 0 will read left or right
                   - 1 will read left joystick only
                   - 2 will read right joystick only


- LDUMP
  This command will export the BASIC program to ROM file using the printer interface of the Virtual Aquarius


All these commands (except LDUMP) can be used in your own ROM file as well.

To create your own BASIC ROM:

Load the BLBASIC.ROM in the Virtual Aquarius.
Next load your BASIC program by typing, quick type or load cassette.
Type the command LDUMP

IMPORTANT: Before pressing RETURN check the Virtual Aquarius printer settings!
Go to Configure -> Printer and configure the "Filename for Printer Output"
Make sure you send the output to a new file (!)

After checking the printer settings press RETURN at the LDUMP command

That's it!

Rename the output file extension from .txt to .rom or .bin and load the file into the Virtual Aquarius.

The zip file includes the following:

README.TXT - this text
BLBASIC.ROM - ROM to load into the Virtual Aquarius
SOURCE.ZIP - Z80 assembly code to create BLBASIC
 
attachicon.gifBLBasic.zip
 
Regs,
Martin

Hi Martin, I think you nailed all the most important commands of the 1541 rom in BL Basic, but why didn't you also incorporate the Scr command?

#16 mvdsteenoven OFFLINE  

mvdsteenoven

    Chopper Commander

  • Topic Starter
  • 181 posts
  • Location:Netherlands

Posted Tue Jan 7, 2014 11:46 AM

Hi Martin, I think you nailed all the most important commands of the 1541 rom in BL Basic, but why didn't you also incorporate the Scr command?

 

You gotta draw the line somewhere :-D

I can do an update and include the SCR command in version 1.1

Are there any other futures or nice to haves to include?

Perhaps a command AQUARIUS that will show a big Aquarius logo on screen?

or scrolling the screen vertical or horizontal, like VSCROLL and HSCROLL?

or............. ?

 

Regs,

Martin



#17 Gemintronic OFFLINE  

Gemintronic

    Jason S. - Lead Developer & CEO

  • 9,310 posts

Posted Tue Jan 7, 2014 11:54 AM

VSCROLL and HSCROLL would be very nice!  I think that's the only way I'll be able to compete with the latest MZ-700 titles

http://atariage.com/...s/#entry2209692



#18 Aquaman OFFLINE  

Aquaman

    Moonsweeper

  • 375 posts
  • Location:the Netherlands

Posted Tue Jan 7, 2014 2:59 PM

 

You gotta draw the line somewhere :-D

I can do an update and include the SCR command in version 1.1

Are there any other futures or nice to haves to include?

Perhaps a command AQUARIUS that will show a big Aquarius logo on screen?

or scrolling the screen vertical or horizontal, like VSCROLL and HSCROLL?

or............. ?

 

Regs,

Martin

I understand, and of course we have to keep in mind the limited memory! However when you offer we could see some more commands in version 1.1 ;-)  Something like Vscroll / Hscroll, the GET and PUT commands from Extended Basis and maybe a command like blanking the screen, to give the Aquarius a temporary speed boost would be very much appreciated. The screen blanking would be usefull for drawing a playfield quicker and not showing it building up slowly! These commands of course take up some memory space, but I think they are worth it, because in the end they would mean a shorter program to get things done. But after saying all of this I am still a very happy person at the moment whith the current BL basic you gave us :thumbsup:



#19 Pset OFFLINE  

Pset

    Chopper Commander

  • 124 posts

Posted Tue Jan 7, 2014 6:33 PM

Scrolling would be much appreciated.



#20 Pset OFFLINE  

Pset

    Chopper Commander

  • 124 posts

Posted Wed Jan 8, 2014 6:48 AM

Trying to replace your BASIC loader with a binary using LDUMP  returns and OD error at line 1010 when the binary is run from restart.

However typing run after the error runs the program as usual.

However typing new with the rom in the cartridge port returns OM memory at line 1000

Interesting.

Wooo typing 1000 and return scrambles the screen and reboots. 

Such fun!

Typing 1010 and return flips the margin 30 characters and locks the emulator.

All kinds of discoveries with this new BASIC. 

 

I think the Rom export needs to copy your BLbasic.rom and append the basic program as strings,

then feed the strings to BASIC as line feeds to put into memory on a specific init command

leaving RAM and the code to be manipulated by the user as usual.

What if you write batch files and scripts out of BitLoader Basic instead a straight cartridge dump.

Hmmm.

 

Anyway this is the code that I was breaking binary loader with

Your amazing Aquarius Man Holiday Assembler ;-D

Spoiler

Attached Files


Edited by Pset, Wed Jan 8, 2014 6:49 AM.


#21 mvdsteenoven OFFLINE  

mvdsteenoven

    Chopper Commander

  • Topic Starter
  • 181 posts
  • Location:Netherlands

Posted Wed Jan 8, 2014 2:23 PM

Trying to replace your BASIC loader with a binary using LDUMP  returns and OD error at line 1010 when the binary is run from restart.

However typing run after the error runs the program as usual.

 

Thanks for reporting these errors! :thumbsup:

You have discovered two bugs;

 

Apparently I did not set the start address for the DATA/READ command in the Boot Loader modus (after LDUMP). That is why it generates an OD Error.

The address at $38DC (14556) will now be set correctly so the DATA and READ commands are now functional too.

 

A program that is run in Boot Loader modus (after LDUMP) should never go into intermediate mode. If a program fails, or ends, or even is breaked by pressing CTRL+C, it should always restart the program.

You should never see the "Ok" prompt after the program has been LDUMP'ed.

This is to "protect" the code, but also because you cannot modify the program after LDUMP. It gives unexpected results.

In the standard Aquarius ROM the BASIC program is in memory before the memory variables. Rewriting a line of the BASIC program also requires some management of the memory variables.

But in Boot Loader modus (after LDUMP) the memory variables are before the BASIC program. After all, the program is in ROM memory while the memory variables are in lower RAM.

The Aquarius ROM wanted to do its memory management after removing the Basic line 1000 but failed to do so, which resulted in the scrambled screen.

This is a "known" issue that has been bypassed by not allowing the OK prompt.

Unfortunattely, the process that should trigger the OK prompt pointed to the wrong subprocess that is why you were able to get the OK prompt.

But this now been solved too.

 

 

Please find version 1.1 of BLBASIC attached which resolve the known bugs.

 

Attached File  BLBasic.zip   9.77KB   97 downloads

 

Regs,

Martin



#22 mvdsteenoven OFFLINE  

mvdsteenoven

    Chopper Commander

  • Topic Starter
  • 181 posts
  • Location:Netherlands

Posted Wed Jan 8, 2014 2:40 PM

I understand, and of course we have to keep in mind the limited memory! However when you offer we could see some more commands in version 1.1 ;-)  Something like Vscroll / Hscroll, the GET and PUT commands from Extended Basis and maybe a command like blanking the screen, to give the Aquarius a temporary speed boost would be very much appreciated. The screen blanking would be usefull for drawing a playfield quicker and not showing it building up slowly!

 

Please note: The version 1.1 which has just been released is only a bugfix. It does not contains any enhancements - yet.

 

I was already thinking about some kind of MEMCOPY command; this would allow you to POKE and prepare a part in memory and when you are finished copy the memory to the screen so everything is shown in once.

But perhaps we can extend the GET and PUT commands; like, first GET a part of the screen ( or the whole screen if you like ) - the contents is moved into an array - you modify the array as if it was the screen - and PUT the array back on screen.

 

In Extended Basic the GET syntax is: GET (x1, y1)-(x2,y2), array

The PUT syntax: PUT (x1,y2), array [, action ]

 

We could do something like MOD array, (x,y), character, color

(MOD as in Modify but truncated to 3 three letters, just as GET and PUT)

 

Add a function which returns the address of the array in memory so you can POKE directly into the content?

e.g. N=ADDR( array )

 

Ideas, suggestions?

 

 

Regs,

Martin



#23 Aquaman OFFLINE  

Aquaman

    Moonsweeper

  • 375 posts
  • Location:the Netherlands

Posted Wed Jan 8, 2014 3:34 PM

Please note: The version 1.1 which has just been released is only a bugfix. It does not contains any enhancements - yet.
 
I was already thinking about some kind of MEMCOPY command; this would allow you to POKE and prepare a part in memory and when you are finished copy the memory to the screen so everything is shown in once.
But perhaps we can extend the GET and PUT commands; like, first GET a part of the screen ( or the whole screen if you like ) - the contents is moved into an array - you modify the array as if it was the screen - and PUT the array back on screen.
 
In Extended Basic the GET syntax is: GET (x1, y1)-(x2,y2), array
The PUT syntax: PUT (x1,y2), array [, action ]
 
We could do something like MOD array, (x,y), character, color
(MOD as in Modify but truncated to 3 three letters, just as GET and PUT)
 
Add a function which returns the address of the array in memory so you can POKE directly into the content?
e.g. N=ADDR( array )
 
Ideas, suggestions?
 
 
Regs,
Martin

These all sound equally interesting and I leave it up to you, what would be the quickest and easiest way to get some kind of screen flipping done (preferably possible to create a full screen presentation)? Also the commands should make some kind of speedier "sprite" movements possible, keeping in mind the upcoming Font upgrade by Jay!

Edited by Aquaman, Wed Jan 8, 2014 3:42 PM.


#24 Aquaman OFFLINE  

Aquaman

    Moonsweeper

  • 375 posts
  • Location:the Netherlands

Posted Wed Jan 8, 2014 3:39 PM

Any command to help creating a more professional programming within the limitations of Basic is very much appreciated.

Edited by Aquaman, Wed Jan 8, 2014 3:42 PM.


#25 Pset OFFLINE  

Pset

    Chopper Commander

  • 124 posts

Posted Thu Jan 9, 2014 12:14 PM

How do we make this a bootable a ROM for the emulator?

can we loose the load screen and go straight to BASIC?

 

I can't even get Virtual Aquarius to open the file browser for boot or character  roms,

It dies if ROM/RADOFIN.BIN or the built in S2 is not the boot rom.

 

Even if it has files in the cartridge slot it doesn't boot with them, at application start, its

always a trip to the file menu, scroll down to blbasic.rom, open it , restart, press return...

 

Probably want to set up some kind of batch file with build options for Tniasm for future changes?

waystobreakBasic.bat?

 

In theory wouldn't it be possible to patch the Virtual Aquarius.exe's default
rom and re-release the VirtualAquarius2014 edition here in a few months with the patcher inside the download?
Isn't that how hackers hack software? Where are those meddling kids?

 

I've been breaking my brain every day since November trying to get different z80 emulators and projects to do something Aquarius.

 

Here's a thought.

We don't want to be forever stuck in a loop of developing for the the Aquarius

and the work lying dead there, what if your BASIC can take in the standard 

Simple Aquarius basic, and output C or Lua or Browser Basic

 

They used to have programs for that sort of thing all over.

 

By the way on RetroBattleStations  it's Z80 week, go show off your gear.







Also tagged with one or more of these keywords: Mattel, Aqarius, BASIC, ROM

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users