Jump to content
IGNORED

skunkboard hello sample next steps


toarnold

Recommended Posts

Hi friends,

 

Like many other Jaguar owners I got my Skunkboard last week. 'Cause I'm familar writing C and 68000 ASM code, I think the 'hello' sample is a good place to start.

After reviewing the source code I thought using the blitter is a good topic to dive into the jag.

Clearing the main screen was easy with the blitter, but after that I tried to copy the characters using the blitter. A char is 8x 8bit monochrome, but the screenbuffer isn't.

All my attemps results in an 8x8 pixel black hole :-(

Has anybody done this before?

Sorry I'm writing mobile. I can post my source code this afternoon if it makes sense.

 

toarnold

Link to comment
Share on other sites

Hi toarnold,

 

Like many other Jaguar owners I got my Skunkboard last week. 'Cause I'm familar writing C and 68000 ASM code, I think the 'hello' sample is a good place to start.
After reviewing the source code I thought using the blitter is a good topic to dive into the jag.
Clearing the main screen was easy with the blitter, but after that I tried to copy the characters using the blitter. A char is 8x 8bit monochrome, but the screenbuffer isn't.
All my attemps results in an 8x8 pixel black hole :-(
Has anybody done this before?

Text output was also the first software i made after i got my skunkboard. But i have reused some example code from Atari.

 

You can take a look at http://www.jagware.org, there is a thread about usefull tools and examples under "development" (http://www.jagware.org/index.php?s=e1b7f1f49a2b17d7e00ddeeadb1c5d9e&showtopic=836)

 

You should take a look at "jagfiles" (http://www.jagware.org/jag_uploads/dev/curt_vendel_jagfiles/) If you download jagfiles-1.zip, ... , jagfiles-12.zip you find in jagfile-9.zip the folder "Jag util sources" which contains text output with blitter. You will find also other usefull examples, many from Atari.

 

Best regards

Michael

  • Like 2
Link to comment
Share on other sites

Hi ST-Oldie,

 

thanks for the links. After study and a few trial and error I got it. But don't know why :). B_CMD is strange, and A2_PIXEL don't know why 1 ...

 

*A1_BASE = (uint32_t)jagscreen;
*A1_FLAGS = PIXEL8 | XADDPIX | WID320 | PITCH1;
*A1_PIXEL = (y << 16) | x;
*A1_STEP = 0x010000 | (uint16_t)-8;
*A2_BASE = (uint32_t)(textfont + (ch << 3));
*A2_FLAGS = PIXEL1 | XADDPIX | WID8 | PITCH1;
*A2_PIXEL = 1;
*A2_STEP = 0x010000 | (uint16_t)-1;
*B_COUNT = 0x080008;
*B_PATD = 1;
*B_DSTD = 0;
*B_CMD = SRCENX | UPDA1 | UPDA2 | PATDSEL | BCOMPEN | BKGWREN | DSTEN;
toarnold
Link to comment
Share on other sites

isnt there already a kind of font included in the jaguar bios/bootrom, that can be abused as source ??

 

the small "R" right to the Atari logo from the startup logo looks so fontish.. maybe there is the rest around.

 

anyone knows? :D ;-) :grin:

 

greets

Edited by Otto1980
Link to comment
Share on other sites

So much code, so little text. :)

 

Whole program has damn near been changed to one big pointer call.

 

Hi JagChris,

 

. In meantime you can put the code posted above into the DrawChar function.

 

 

toarnold

 

It's a little bit more complex than that.

Edited by JagChris
Link to comment
Share on other sites

Whole program has damn near been changed to one big pointer call.

What is a "pointer call"? There are no function pointers used in the example code.

 

@toarnold: I'd recommend that you add the volatile keyword to your pointer typecast in the function loopUntilBitIsSet32. A smart compiler will see that the contents of adr will never change and most likely optimise the busy-wait loop out. The volatile keyword prevents that from happening.

  • Like 3
Link to comment
Share on other sites

I'd recommend that you add the volatile keyword to your pointer typecast in the function loopUntilBitIsSet32.

You are absolutly right. I forgot about this.

There are a few mistakes in the jaguar.h some pointers are defined as long * but they are in real short *, like CLUT or JOYSTICK. This can cause side effects. And of course following your explanation about volatile, all pointers in jaguar.h aren't volatile, so e.g. polling JOYSTICK can lead you in the same trap.

 

Now I updated my sample to display all fonts TXG/MNX had ripped. I had to reorder them to be near ASCII order (ATARI calls this ATASCII a few years ago)

With the joystick you can flip through the fonts. With up/down you can select the inverted char mode (highBit enabled of the characters).

There are a few helper methods to dump values as hex and dec, print string and chars and treat your screen like an old ATARI Graphics 0 mode ;-)

So I have a usefull library to dump values for debug purpose.

 

Have fun!

 

toarnold

hello3.zip

  • Like 4
Link to comment
Share on other sites

*A1_PIXEL = (y << 16) | x;

*A2_PIXEL = 1;

 

If I remember correctly Ax_PIXEL is the Y<<16 + X<<0. So A1 is set to (1,16) and A2 to (0,1)

Now A2 points to the memory address of the font + 8 *character number (*A2_BASE = (uint32_t)(textfont + (ch << 3)) ;) that's why A2 y = 0

 

*B_CMD = SRCENX | UPDA1 | UPDA2 | PATDSEL | BCOMPEN | BKGWREN | DSTEN;

 

(info from http://www.hillsoftware.com/files/atari/jaguar/jag_v8.pdf)

 

UPDA1 Add the A1 step value to the A1 pointer between inner loop operations in the outer loop.

UPDA2 Add the A2 step value to the A2 pointer between inner loop operations in the outer loop.

SRCENX Enables an "extra" source data read at the start of an inner loop operation. This is necessary where data has to be re-aligned, and may also sometimes be of use in bit-to-pixel expansion.

DSTEN Enables a destination data read as part of inner loop operation. This must always be performed for pixels smaller than 8 bits, where part of the destination data write will need to restore the data that was previously there.

PATDSEL Select pattern data as the write data.

BCOMPEN Enable write inhibit on the output from the bit comparator. This works pixel by pixel in any size, but over whole phrases only on 8-bit pixels. When operating in pixel mode then the write does not occur unless BKGWREN is set, but in phrase mode

destination data is always written when the comparator determines that the pixel should not be written.

BKGWREN When a write inhibit occurs, this flag enables the Blitter to still perform the write, but to write back destination data. This only applies to pixel mode, in phrase mode destination data is always written.

 

 

In short each pixel is read from both the screen and the font. If the font passes a test ( lets say its a 1 ) then it will write out the data in pattern data ( e.g. red green yellow etc. ) else it will write out the colour which was there before

Edited by Seedy1812
  • Like 4
Link to comment
Share on other sites

The single pipe symbols. In C these are bitwise OR right? So the command is just going down the line checking for OR if this bit meets a critieria OR if that bit meets a critera? Pointer operaitons mixed with bit operations make my head spin a little.

Edited by JagChris
Link to comment
Share on other sites

Nope.

There nothing in rom, coding on Jaguar it's like coding demo on an Atari, everything must be done with hands, crafting is good for you ;)

 

Some peoples will be scared by this, no library, no real examples, etc... but you can do what you what you want, the only limit is your debugging skill (And the bandwidth speed ;) )

  • Like 3
Link to comment
Share on other sites

@Seedy1812

 

thank you for clearifing the blitter flags. Now I find out how to override the background color (prevent destination read [NOT DSTEN] and BKGWREN) and how to invert the image (exchanging B_PATD and B_DSTD).

I updated my sample, so it runs much faster.

 

It would be easier and quicker just to blit a single solid rectangle of colour behind the text instead of doing it per character. I don't think you can invert the pixel comparision

Link to comment
Share on other sites

not even a single font character in the 128kb of the jaguar bios ... epic fail :(

 

a complete 1 bit fontset just takes 2 kb :_(

 

but thanks god there is a image of an cat and a small 3d routine/objects and animation plus sound and soundroutine..

:thumbsup: :thumbsup: :thumbsup:

Why should it include a font its not a personal computer. Also some characters (eg French ) are not in the 0->255 byte range. What would the font have been used for? What it has is a signature boot up sequence so you know its turned on ok just like other consoles of its day. I guess it was designed as a games console that the end user would only play games and not be able to program it.

Edited by Seedy1812
  • Like 4
Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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