Jump to content

Photo

[AQUARIUS] Machine Language Programming on the Aquarius


109 replies to this topic

#1 jaybird3rd ONLINE  

jaybird3rd

    Quadrunner

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

Posted Tue Dec 21, 2010 4:55 PM

Because of the indirect relationship between the Intellivision and the Aquarius, the Intellivision Programming subforum seems to be as good a place as any for a discussion of Aquarius programming. I've begun this topic title with "[AQUARIUS]", a convention that I'd recommend for subsequent topics dedicated to the Aquarius, so they can be easily avoided by those who are interested only in Intellivision programming. This will also make it easier for these posts to be sorted into their own subforum in the future, if the need arises.

There are several possible approaches to development on the Aquarius. One is to use the built-in BASIC interpreter, or perhaps the Extended BASIC cartridge, to program for the Aquarius in BASIC. Personally, I much prefer to work in assembly language, or at least in another high-level language that compiles to machine language, such as C: the results are faster, more efficient, and more easily maintained and documented than old-fashioned line-numbered BASIC. Nevertheless, there are a great number of Aquarius programmers who still enjoy working in BASIC, and I'm sure that other topics will be created to serve their needs also.

This topic is intended as a place where Aquarius programmers working in machine language can post code snippets, tutorials, and other development resources of a more general nature. I'm sure that specific Aquarius development topics will be spun off into their own threads as circumstances warrant.

In the meantime, I'll get the ball rolling with a revised version of a post that I wrote in the "Aquarius Bitmap Graphics Tool" thread: a short tutorial for creating a simple Aquarius cartridge binary:

Here the source code for a simple program which fills the screen with character $C8 and color $31, creating a yellow-on-red "grid pattern":

	.org $E010

main

	ld	hl,$3400
	ld	b,$31
	call	fill

	ld	hl,$3000
	ld	b,$C8
	call	fill

	halt

fill

	ld	de,$03ff

loop

	ld	(hl),b
	inc	hl
	dec	de
	ld	a,d
	or	e
	jr	nz,loop

	ret

	.end
To create a cartridge binary, just set the starting address to $E010 (as I've done here) and compile. You'll then need to add a valid sixteen-byte header to your binary before the Aquarius will load it as a cartridge image (it's a very weak form of "security").

First, compile the code (in this example, I will be using the Telemark Assembler):

TASM -80 -B FILL.ASM FILL.BIN

Then, prepend the cartridge header to your binary:

COPY /B CARTHEAD.BIN+FILL.BIN FILL2.BIN

Now you can load FILL2.BIN into Virtual Aquarius as a cartridge ("File | Load Game ROM ..."). I've attached copies of all four of these files in this archive:


Attached File  carttest.zip   764bytes   431 downloads

#2 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 9,821 posts
  • Busy bee!
  • Location:England

Posted Tue Dec 21, 2010 5:05 PM

+1

Glad to see this :D. Is this going to become a series of tutorials?

#3 jaybird3rd ONLINE  

jaybird3rd

    Quadrunner

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

Posted Tue Dec 21, 2010 5:11 PM

Glad to see this :D. Is this going to become a series of tutorials?

I hadn't intended on writing a series of tutorials, but I have toyed with the idea of sharing what I've learned about the Aquarius from my work on the Aquaricart project, and writing some tutorials would be a great way to do that. I also want to share some of the details about how to use the bankswitching capabilities of my new SuperCart I boards so that other programmers can use them for their own projects, if they'd like.

I'll have to sit down early next year and start organizing my notes!

#4 Chuck D. Head OFFLINE  

Chuck D. Head

    River Patroller

  • 3,504 posts
  • Facilitator of the Infinite
  • Location:Woodland, WA

Posted Tue Dec 21, 2010 5:12 PM

Great, let's see if I can learn something new....

#5 jaybird3rd ONLINE  

jaybird3rd

    Quadrunner

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

Posted Tue Dec 21, 2010 5:32 PM

Great, let's see if I can learn something new....

Well, I'll do my best. I'm getting all kinds of ideas for a series of tutorials on Aquarius programming, the more I think of the idea. I'm sure there are a lot of people who have wanted to try their hand at programming in assembly, but who have been scared away by the complexities of other machines. The Aquarius is a very simple machine with lots of untapped potential, and I think it would be a great learning platform for someone just starting out. After all, once you learn to program for the Z80 on the Aquarius, you can easily take that knowledge to other machines based on the Z80, a processor that is still being manufactured today.

#6 jaybird3rd ONLINE  

jaybird3rd

    Quadrunner

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

Posted Tue Dec 21, 2010 6:11 PM

It occurs to me that I should also post some tools that Aquarius programmers would find helpful. The first is the Virtual Aquarius emulator: it's a few years old and is Windows-only, but it's still the best and most fully-featured emulator for the Aquarius, and I'm told that it runs well under Linux and other platforms using Wine. This is version 0.72, which I believe is the most recent version. It also includes a number of cartridge and cassette images to get you started:

Attached File  VirtualAquarius.zip   1.29MB   774 downloads


Here is the Telemark cross-assembler, version 3.1. You'll also find this bundled with the Virtual Aquarius emulator, but I felt it deserved its own archive because it is the cross-assembler which I'll be using for the programming tutorials that I write. This is a shareware version, containing only a subset of the complete Telemark package, and I'd highly recommend registering it to get the full package, along with full documentation and support:

Attached File  TASM31.zip   69.96KB   375 downloads


Next is a complete disassembly of version S2 of the Aquarius Operating System ROM (the built-in BASIC interpreter). It's a fairly complete implementation of Microsoft BASIC in only 8K of ROM, and you can learn a lot about efficient Z80 programming from looking at this document. It is very well-commented and indicates the entry points of several valuable routines (such as the "PRINT" function used in BASIC), which can also be used by other programs. I am greatly indebted to Kenny Millar for all of his hard work in reverse-engineering the OS and documenting his findings so extensively:

Attached File  aqromdis.zip   39.16KB   389 downloads


Finally, here is a dump of the Aquarius Character Generator ROM, containing the default Aquarius character set. For a long time, this character set posed a problem for emulation authors: the contents of the original ROM are not directly accessible, so most emulators (including Virtual Aquarius) have used "approximations" of the original Aquarius characters. For complete character sets that were drawn by hand, they were remarkably close, but several of them included subtle but noticeable discrepancies. I desoldered the ROM from my Aquarius and dumped it earlier this year, and this is now the default character ROM that is used by the Aquarius driver in the MESS multi-system emulator:

Attached File  AquariusCharacterSet.zip   1.18KB   411 downloads

You can also use this with the Virtual Aquarius emulator, but the current version has a bug: it provides a "Browse" button to choose a different character set, but this button doesn't seem to do anything. Here is a workaround:

Once you have unzipped the Virtual Aquarius archive into its own folder, look for a subfolder inside it called "ROM". This contains several cartridge dumps, as well as a dump of the Aquarius operating system. Copy this character ROM into this folder and rename it to "CHARS.BIN". Then, open Virtual Aquarius, open the "Configure" menu, select "Memory ...", and toward the bottom of the dialog box, select the "Load 2K Character ROM from disk" radio button and click the "Browse" button. Click OK to reset the emulator.

You should now be using the correct character set. To check, press ENTER to start BASIC, type the following line of code, and press ENTER again:

PRINT CHR$(215)

If you are using the correct character set, the simulated Aquarius should have printed a character which looks like this:

chars_correct.png

You're still using the built-in character set if you see this instead:

chars_incorrect.png

(I've enlarged both of these so you can more clearly see the difference).

#7 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 9,821 posts
  • Busy bee!
  • Location:England

Posted Tue Dec 21, 2010 6:16 PM

Maybe a mod could sticky this too?

#8 chjmartin2 OFFLINE  

chjmartin2

    Moonsweeper

  • 322 posts
  • Location:Massachusetts

Posted Tue Dec 21, 2010 9:09 PM

I have never programmed in assembler before and I can tell you that the Aquarius has been a great "learning" machine for me. I am not anywhere near where I want to be, but with the help of Martin and Jay I can write a few usable lines of code. It is up, up and away for me.

#9 barnieg OFFLINE  

barnieg

    Moonsweeper

  • 388 posts
  • Location:Rugby, England

Posted Fri Dec 24, 2010 2:46 PM

I've tried to include the sample code in-line to compile with z88dk and get your test pattern but it won't return to the c code, if I remove the "ret" command my code will run with a red background and yellow foreground but no test pattern and ideas?


thanks
Barnie

#include "stdio.h"

#include "games.h"

#include <stdlib.h>

#include <graphics.h>

#define UP       'k'  /* arrow up     */

#define DOWN     'm' /* arrow down   */

#define LEFT     'z'  /* arrow left   */

#define RIGHT    'x'  /* arrow right  */



char bezman[] = { 10, 14, 0x00 , 0x00 , 0x0C , 0x00 , 0x0C , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x3F 

, 0x00 , 0x4C , 0x80 , 0x4C , 0x80 , 0x4C , 0x80 , 0x0C , 0x00 , 0x0C , 0x00 

, 0x0C , 0x00 , 0x0F , 0x00 , 0x00 , 0x00  };



char maskman[] = { 10, 14, 0x0C , 0x00 , 0x12 , 0x00 , 0x12 , 0x00 , 0x0C , 0x00 , 0x3F , 0x00 , 0x40 

, 0x80 , 0xB3 , 0x40 , 0xB3 , 0x40 , 0xB3 , 0x40 , 0x52 , 0x80 , 0x33 , 0x00 

, 0x13 , 0x00 , 0x10 , 0x80 , 0x0F , 0x00  };



char bezbot[] = { 10, 10, 0x00 , 0x00 , 0x1E , 0x00 , 0x33 , 0x00 , 0x7F , 0x80 , 0x5E , 0x80 , 0x5E 

, 0x80 , 0x12 , 0x00 , 0x12 , 0x00 , 0x33 , 0x00 , 0x00 , 0x00  };

	



char maskbot[] = { 10, 10, 0x1E , 0x00 , 0x21 , 0x00 , 0x4C , 0x80 , 0x80 , 0x40 , 0xA1 , 0x40 , 0xA1 

, 0x40 , 0x6D , 0x80 , 0x2D , 0x00 , 0x4C , 0x80 , 0x33 , 0x00  };

  
main()



{





int x,y,z;

int flag=1;

int speed=1;







  x=40;

  y=20;

  

#asm


main:

        ld      hl,$3400

        ld      b,$31

        call    fil



        ld      hl,$3000

        ld      b,$C8

        call    fil



        halt



fil:



        ld      de,$03ff



/* loop:



        ld      (hl),b

        inc     hl

        dec     de

        ld      a,d

        or      e

        jr	nz,loop */

loop:



        ld      (hl),b

        inc     hl

        dec     de

        ld      a,d

        or      e

        jr	nz,loop


ret

#endasm	



      



 

  

  while (flag!=2)

	{

	        switch( getk() ) {

	                case UP:

	                	y=y-speed;

	                	flag=1;

	                        break;

	                case DOWN:

	                	y=y+speed;

	                	flag=1;

	                        break;

	                case RIGHT:

	                	x++;

	                	flag=1;

	                        break;

	                case LEFT:

	                	x--;

	                	flag=1;

	                        break;

	                case 13:

	                        flag=2;

	                        break;

	                default:

	                	speed=1;

	        }

	        

	        if (flag==1)

	        {

	           if (speed<4) speed=speed+1;

		putsprite(spr_or,x,y,bezman);

	  	putsprite(spr_mask,x,y,maskman); 

		   flag=0;

	


}

	}



}



#10 mvdsteenoven OFFLINE  

mvdsteenoven

    Chopper Commander

  • 181 posts
  • Location:Netherlands

Posted Thu Dec 30, 2010 11:42 AM

I've tried to include the sample code in-line to compile with z88dk and get your test pattern but it won't return to the c code, if I remove the "ret" command my code will run with a red background and yellow foreground but no test pattern and ideas?


thanks
Barnie


main:

        ld      hl,$3400
        ld      b,$31
        call    fil

        ld      hl,$3000
        ld      b,$C8
        call    fil


        halt



Hi Barnie,
The last statement in your main procedure, HALT, stops the CPU.
Try replacing it with a RET statement. (but I have no experience with the z88dk compiler)

Regs
Martin

#11 mvdsteenoven OFFLINE  

mvdsteenoven

    Chopper Commander

  • 181 posts
  • Location:Netherlands

Posted Thu Dec 30, 2010 12:52 PM

It occurs to me that I should also post some tools that Aquarius programmers would find helpful.


Another great tool for programmers is the Mess Aquarius emulator.
It is not as enhanced as the Virtual Aquarius, but it has an integrated debugger:

mess-aquarius.jpg

You can find the Mess Aquarius emulator at http://www.mess.org/download.php
Download the latest Windows binaries from this page. I have not included the binaries, because the Mess emulator is under constant development. More information regarding the development of the Aquarius emulator is at http://mess.redump.n...ysinfo:aquarius

The Mess emulator does not include any ROM dumps, like the Virtual Aquarius. This is to avoid copyright issues. You will have to provide them yourselve.


HOW TO INSTALL MESS?

Create a folder called MESS and unpack the Windows binaries zip file in this folder.
Create subfolder ROMS, and within this folder a subfolder called Aquarius.

Your folder structure should now look like:

Mess
  +-- Artwork
  +-- hash
  +-- Roms
        +-- Aquarius

You need radofin.bin (available from virtual aquarius) and AquariusCharacterSet.zip (available from this forum). Copy radofin.bin and AquariusCharacterSet.bin to the folder Roms\Aquarius and rename radofin.bin to aq2.u2 and AquariusCharacterSet.bin into aq2.u5

Start the MessUI (Mess User Interface).
Scroll down the list of systems till you get to "Aquarius (NTSC)".

Right-click "Aquarius (NTSC)" and select Properties.
In the properties window go to the tab called "Display" and select "Run in a window", unselect "Start out maximized".
Go to the tab "Miscellaneous" and select "Use new UI".
In the tab "Configuration" select RAM size 20K.

Click the button "Ok" to save the new settings and close the dialog.

Double-click on the system "Aquarius (NTSC)" to start the emulator.
First it will give you a copyright warning, type OK to continue
Next it will complain about the ROMs, type OK to continue

The Mess emulator only supports cartridges and WAV files, no CAQ Virtual Aquarius format.
Luckily the Virtual Aquarius has a CAQ2WAV tool that enables you to convert the files.
You will notice that cartridges and cassette-files are called "Devices", which you first have to mount before you can use them (or before you can start playing).

After your first tour with the Mess Aquarius emulator you can close it, and return to the MessUI.


Now the cool stuff.....
Again, right-click on "Aquarius (NTSC)" and select properties.
Go to the tab "Debug" and select "Activate Integrated Debugger"
Click the "Ok" - button to save settings.

Start the Aquarius emulator!
Now you will see two screens; the Aquarius emulator and the debugger.
In the debugger you can go to Debug->Run to start the emulator.

Now you can monitor the CPU state, the memory, the Z80 flags and see your machinecoded program.

Enjoy!

Regs
Martin

Edited by mvdsteenoven, Thu Dec 30, 2010 12:55 PM.


#12 jaybird3rd ONLINE  

jaybird3rd

    Quadrunner

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

Posted Mon Jan 3, 2011 11:14 AM

Thanks very much for that write-up, Martin! I'll probably use MESS for many of the tutorials, both because of the debugger and because it's platform-independent, so this setup information will be very useful.

#13 chjmartin2 OFFLINE  

chjmartin2

    Moonsweeper

  • 322 posts
  • Location:Massachusetts

Posted Mon Jan 31, 2011 7:44 AM

Please help. I want to create an assembly program that displays an image, but I do not want to have to load that image into an array before displaying it. I tried a really stupid way of doing this by simply LD'ing the right bytes into the character ram and inc'ing hl as a memory pointer. This didn't work as the file got huge and was not efficient at all. A few questions:

1) What is the maximum rom size for an Aquarius cart?
2) How do I store a set of bytes that correspond to a character matrix, that is, what is the ASM equivalent of DATA statements in basic?
3) Can I store each line in a variable, like LineOne[]={255, 128, 111, 124, 38, 14, 56, 75, etc.}; or could I even store the entire 960 character set in a variable? Is there a more efficient way of doing it?
4) Can ROM memory be accessed like RAM? That is, can I use some type of structure in the ASM code that just has the data I want to store and the programatically pull from that memory location to the video ram?

Thanks in advance for the help.

Chris

#14 mvdsteenoven OFFLINE  

mvdsteenoven

    Chopper Commander

  • 181 posts
  • Location:Netherlands

Posted Mon Jan 31, 2011 12:08 PM

Hi Chris,

1) What is the maximum rom size for an Aquarius cart?

16K upper memory is reserved for cartridge ROM.
You could make a cart with 32K or 48K ROM, that is technically possible. But it could overwrite the RAM memory, so you should advise the user about this.
Also, Jay has used bankswitching for his multicard. You could use this technique if you need more memory.

2) How do I store a set of bytes that correspond to a character matrix, that is, what is the ASM equivalent of DATA statements in basic?
3) Can I store each line in a variable, like LineOne[]={255, 128, 111, 124, 38, 14, 56, 75, etc.}; or could I even store the entire 960 character set in a variable? Is there a more efficient way of doing it?

2,3 can have the same answer. This is the solution that I should choose:
You could use the pseudo command defb (defbyte or .db in tasm) for data sets

	ld	de, 12328
	ld	hl, LineOne
	ld	bc, 8		; 8 bytes of data
	ldir			; write 8 bytes from
				; LineOne to screen

	halt

LineOne:
	.db 255, 128, 111, 124, 38, 14, 56, 75

LineTwo:
	.db 1, 2, 3, 4
	.db 5, 6, 7, 8

	.end

You must make sure that the program pointer does not execute the .db commands; jump over it or stop the program before the .db pseudo commands.

If there is a more efficient way? I do not know what you want to do. If you have the 960 characters available in another binary file then you could write some as below and concatenate the two files together:

	ld	de, 12328
	ld	hl, DATA
	ld	bc, 960
	ldir		

	halt
DATA:
	.end

In the above example the DATA starts where the program ends, and you can concatenate the file together like
COPY /b prog.obj + data.bin output.obj

4) Can ROM memory be accessed like RAM? That is, can I use some type of structure in the ASM code that just has the data I want to store and the programatically pull from that memory location to the video ram?

Yes, but ROM is only readonly. You cannot write to it.

Regs
Martin

#15 chjmartin2 OFFLINE  

chjmartin2

    Moonsweeper

  • 322 posts
  • Location:Massachusetts

Posted Mon Jan 31, 2011 3:41 PM

Hi Chris,

1) What is the maximum rom size for an Aquarius cart?

16K upper memory is reserved for cartridge ROM.
You could make a cart with 32K or 48K ROM, that is technically possible. But it could overwrite the RAM memory, so you should advise the user about this.
Also, Jay has used bankswitching for his multicard. You could use this technique if you need more memory.

2) How do I store a set of bytes that correspond to a character matrix, that is, what is the ASM equivalent of DATA statements in basic?
3) Can I store each line in a variable, like LineOne[]={255, 128, 111, 124, 38, 14, 56, 75, etc.}; or could I even store the entire 960 character set in a variable? Is there a more efficient way of doing it?

2,3 can have the same answer. This is the solution that I should choose:
You could use the pseudo command defb (defbyte or .db in tasm) for data sets

	ld	de, 12328
	ld	hl, LineOne
	ld	bc, 8		; 8 bytes of data
	ldir			; write 8 bytes from
				; LineOne to screen

	halt

LineOne:
	.db 255, 128, 111, 124, 38, 14, 56, 75

LineTwo:
	.db 1, 2, 3, 4
	.db 5, 6, 7, 8

	.end

You must make sure that the program pointer does not execute the .db commands; jump over it or stop the program before the .db pseudo commands.

If there is a more efficient way? I do not know what you want to do. If you have the 960 characters available in another binary file then you could write some as below and concatenate the two files together:

	ld	de, 12328
	ld	hl, DATA
	ld	bc, 960
	ldir		

	halt
DATA:
	.end

In the above example the DATA starts where the program ends, and you can concatenate the file together like
COPY /b prog.obj + data.bin output.obj

4) Can ROM memory be accessed like RAM? That is, can I use some type of structure in the ASM code that just has the data I want to store and the programatically pull from that memory location to the video ram?

Yes, but ROM is only readonly. You cannot write to it.

Regs
Martin


This is very helpful. I want to store an image in the program ROM rather than loading it into an array. The 960 bytes are simply the bytes that correspond to an image. All I really want to do is to have the bytes available to my program. I see that .db does that for me - I assume that the LineOne: tag actually will be compiled to a memory location and that is what you are loading into HL? Then you go ahead and set BC to 8 bytes as the length of the data - what does the LDIR do? Lastly, what is the max number of bytes I could do that with as a group, meaning, could I do this:


	ld	de, 12328
	ld	hl, ImageData
	ld	bc, 960		; 960 bytes of data
	ldir			; write 960 bytes from
				; ImageData to screen

	halt

ImageData
	.db 255, 128, 111, 124, 38, 14, 56, 75,...,40
        .db 255, 15, 127, 124, 206, 248, 53, 37,...,40
        .db .........



#16 mvdsteenoven OFFLINE  

mvdsteenoven

    Chopper Commander

  • 181 posts
  • Location:Netherlands

Posted Tue Feb 1, 2011 12:16 PM

Hi Chris,

This is very helpful. I want to store an image in the program ROM rather than loading it into an array. The 960 bytes are simply the bytes that correspond to an image. All I really want to do is to have the bytes available to my program. I see that .db does that for me - I assume that the LineOne: tag actually will be compiled to a memory location and that is what you are loading into HL? Then you go ahead and set BC to 8 bytes as the length of the data - what does the LDIR do? Lastly, what is the max number of bytes I could do that with as a group, meaning, could I do this:


Yes, you are right with all your assumptions. The tag is compiled to a memory location which I use in HL.
The max number of bytes is 65535. BC is a 16-bit register, and that is the highest number that it can handle. (of course 65535 is also 64K minus 1, and 64K is the highest memory location that the Z80 can address, so you wouldn't have anywhere to move)

LDIR does (DE) <- (HL), HL+1, DE+1, BC-1 and repeats until BC hits 0.
In other words it reads the content of the memory location at HL and copies it into the memory location at DE. Then it increases the registers HL and DE, decreases register BC and repeats until BC hits 0.
So when LDIR is finished HL will point to the memory location after your data-block (as in my example after processing LineOne HL will point at LineTwo). The same goes for DE.

But I guess that you have figured this out by now.
BTW do remember to put a colon ( : ) behind your tag ImageData

Regs,
Martin

#17 chjmartin2 OFFLINE  

chjmartin2

    Moonsweeper

  • 322 posts
  • Location:Massachusetts

Posted Tue Feb 1, 2011 6:53 PM

Hi Chris,

This is very helpful. I want to store an image in the program ROM rather than loading it into an array. The 960 bytes are simply the bytes that correspond to an image. All I really want to do is to have the bytes available to my program. I see that .db does that for me - I assume that the LineOne: tag actually will be compiled to a memory location and that is what you are loading into HL? Then you go ahead and set BC to 8 bytes as the length of the data - what does the LDIR do? Lastly, what is the max number of bytes I could do that with as a group, meaning, could I do this:


Yes, you are right with all your assumptions. The tag is compiled to a memory location which I use in HL.
The max number of bytes is 65535. BC is a 16-bit register, and that is the highest number that it can handle. (of course 65535 is also 64K minus 1, and 64K is the highest memory location that the Z80 can address, so you wouldn't have anywhere to move)

LDIR does (DE) <- (HL), HL+1, DE+1, BC-1 and repeats until BC hits 0.
In other words it reads the content of the memory location at HL and copies it into the memory location at DE. Then it increases the registers HL and DE, decreases register BC and repeats until BC hits 0.
So when LDIR is finished HL will point to the memory location after your data-block (as in my example after processing LineOne HL will point at LineTwo). The same goes for DE.

But I guess that you have figured this out by now.
BTW do remember to put a colon ( : ) behind your tag ImageData

Regs,
Martin


Thanks for your help - it was critical in getting my new program to work, which I posted as a new topic. Thanks again!

#18 mvdsteenoven OFFLINE  

mvdsteenoven

    Chopper Commander

  • 181 posts
  • Location:Netherlands

Posted Tue Mar 1, 2011 12:55 PM

I have added a page to my website for the programmers who would like to create their own ROM header. You can follow this link: ROM Recognization.
Please note that Jay has provided his own ROM headers for the SuperCart. You can find them here.

Regs,
Martin

#19 jaybird3rd ONLINE  

jaybird3rd

    Quadrunner

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

Posted Tue Mar 1, 2011 7:32 PM

I have added a page to my website for the programmers who would like to create their own ROM header. You can follow this link: ROM Recognization.
Please note that Jay has provided his own ROM headers for the SuperCart. You can find them here.

Regs,
Martin

That's amazing ... a web-based Aquarius cartridge header generator!

Thank you, Martin.

#20 chjmartin2 OFFLINE  

chjmartin2

    Moonsweeper

  • 322 posts
  • Location:Massachusetts

Posted Sat Mar 19, 2011 9:38 PM

So I need some help. I have made multiple versions of my flicker program to run on an actual Aquarius. I am so frustrated. I read the VSYNC bit, wait for it to go high, then wait for it to go low, then load. It works perfectly in the emulator and the code is very simple:

; Displays an Image Using 136 Flicker Colors and 65,536 Flicker Blocks
; Use tasm to compile
;
.org $E000			; Start Program at Memloc $E010

.db $b6, $b7, $24, $2a, $8d, $9c, $42, $b0
.db $53, $6c, $90, $64, $89, $a8, $f9, $70


main:

      call waittof
      call ViewFr1
      call waittof
      call ViewFr2
      jp main                 ; Repeat


waittof:

high:
	in a, (253)		; Read VSYNC Signal Flag
	bit 0,a			; Test bit 1 of VSYNC signal
	jr nz, high		; Loop and wait for the sync
low:	in a, (253)		; Read VSYNC Signal Flag
	bit 0,a		; Test bit 1 of VSYNC Signal
	jr z, low

	ret

ViewFr1:
	ld  de, 12328		; Set Memory Location to Character Video
	ld hl, FrameOneChar		; Set HL to FrameOneChar Memory Location
	ld bc, 960			; 960 Bytes of Data
	ldir			; write 960 bytes from FrameOneChar to screen
	ld de, 13352		; Set Memory Location to Color Video
	ld hl, FrameOneCol		; Set HL to FrameOneCol Memory Location
	ld bc, 960			; 960 Bytes of Data
	ldir			; write 960 bytes from FrameOneCol to screen
	ret			; return to main program

ViewFr2:
	ld  de, 12328		; Set Memory Location to Character Video
	ld hl, FrameTwoChar		; Set HL to FrameTwoChar Memory Location
	ld bc, 960			; 960 Bytes of Data
	ldir			; write 960 bytes from FrameTwoChar to screen
	ld de, 13352		; Set Memory Location to Color Video
	ld hl, FrameTwoCol		; Set HL to FrameTwoCol Memory Location
	ld bc, 960			; 960 Bytes of Data
	ldir			; write 960 bytes from FrameTwoCol to screen
	ret			; return to main program
#include cleave.FR1
#include cleave.FR2

.END

On the actual Aquarius, it looks like I am changing the screen during the retrace, or somehow otherwise setting the wrong characters or colors. It is like it doesn't even care about the code waiting for the retrace, but if that were the case, it would look like a screen where I didn't even try to wait for the retrace or do anything - which creates weird repeat lines and junk.

I am been fighting it for quite some time and it is frustrating that I can make it work on the emulator, but the real thing just will not cooperate. I want to throw the damn thing out the window after I smash it with a hammer. I now know for a fact that there has to be a bug in the emulator, but the emulator works the way that the documentation sounds. It could make you insane!

I want to move on to the next thing, but I can't leave this unsolved. What do I do next?!

#21 MattelAquarius OFFLINE  

MattelAquarius

    Moonsweeper

  • 479 posts
  • Location:Washington D.C.

Posted Sun Mar 20, 2011 3:26 PM

I wonder if it's somehow a matter of which Aquarius you are using. There are at least two different versions. The emulator is based off the later version. You can identify it on the BASIC boot screen. After the copyright message, it says "S2".



#22 jaybird3rd ONLINE  

jaybird3rd

    Quadrunner

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

Posted Sun Mar 20, 2011 3:33 PM

I wonder if it's somehow a matter of which Aquarius you are using. There are at least two different versions. The emulator is based of the later version. You can identify it on the BASIC boot screen. After the copyright message, it says "S2".

That's a possibility. One of the holdups on the Aquaricart project, in fact, is an issue that I've discovered which affects the way the SuperCart I works (in its "16K mode") with the older Aquarius computers. Of the seven that I own, only two have this particular problem, and both happen to be the older, non-"S2" models. This suggests that there are some differences in the hardware, in addition to the revisions to the OS. I should really crack open one of each, to see if I can identify what was changed.

#23 chjmartin2 OFFLINE  

chjmartin2

    Moonsweeper

  • 322 posts
  • Location:Massachusetts

Posted Sun Mar 20, 2011 8:18 PM

I have two different Aquarius... I will check.

#24 mvdsteenoven OFFLINE  

mvdsteenoven

    Chopper Commander

  • 181 posts
  • Location:Netherlands

Posted Mon Mar 21, 2011 12:40 PM

I want to move on to the next thing, but I can't leave this unsolved. What do I do next?!


Hi Chris,
You have travelled way beyond anyone has ever gone with the Aquarius.
But have you tried switching the wait sequence? Like first wait for VSYNC to get low, and then wait for high.
How about the suggestion on Yahoo groups; create your own loop instead of using LDIR (because of the undocumented waitstate to clear the registers, although I do believe that I have read somewhere that a common LD also needs a moment to clear the registers - but I could be mistaken)
Perhaps you could try only upper half of the screen instead of the full screen, in case the emulator works faster then the real Aquarius.

Regs,
Martin

#25 mvdsteenoven OFFLINE  

mvdsteenoven

    Chopper Commander

  • 181 posts
  • Location:Netherlands

Posted Mon Mar 21, 2011 12:49 PM

Of the seven that I own, only two have this particular problem, and both happen to be the older, non-"S2" models. This suggests that there are some differences in the hardware, in addition to the revisions to the OS. I should really crack open one of each, to see if I can identify what was changed.

I have two different Aquarius... I will check.


Am I the only one that still doesn't own a non-"S2" model?! :( :? :(

@Jay,
The non-"S2" ROM is still not available for the Virtual Aquarius. Could you please dump it and upload it?

Regs,
Martin




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users