toarnold Posted September 29, 2014 Share Posted September 29, 2014 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 Quote Link to comment Share on other sites More sharing options...
ST-Oldie Posted September 29, 2014 Share Posted September 29, 2014 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 2 Quote Link to comment Share on other sites More sharing options...
toarnold Posted September 29, 2014 Author Share Posted September 29, 2014 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 Quote Link to comment Share on other sites More sharing options...
JagChris Posted September 29, 2014 Share Posted September 29, 2014 Can you post the entire modified hello jag users? Quote Link to comment Share on other sites More sharing options...
toarnold Posted September 30, 2014 Author Share Posted September 30, 2014 Hi JagChris, I'm on a business trip until thursday. In meantime you can put the code posted above into the DrawChar function. I will post my code later. toarnold Quote Link to comment Share on other sites More sharing options...
toarnold Posted September 30, 2014 Author Share Posted September 30, 2014 Found a little bit spare time This is my modified source. I extracted the ATARI 8-Bit font, made a blue background, and printed a white READY on the screen Next step is to display a white block beneath the READY toarnold hello.zip 1 Quote Link to comment Share on other sites More sharing options...
JagChris Posted October 1, 2014 Share Posted October 1, 2014 Thank you for sharing this. Quote Link to comment Share on other sites More sharing options...
TXG/MNX Posted October 2, 2014 Share Posted October 2, 2014 (edited) Hi, I did convert some extra fonts for your example but didn't change the code, maybe you can change the code a little so people can select in the main code which font to use when compiling. I am digging up more fonts but got 1 disk 5.25" that refuses to read ... hello_2.zip Edited October 2, 2014 by TXG/MNX Quote Link to comment Share on other sites More sharing options...
Clint Thompson Posted October 4, 2014 Share Posted October 4, 2014 So much code, so little text. 2 Quote Link to comment Share on other sites More sharing options...
Otto1980 Posted October 4, 2014 Share Posted October 4, 2014 (edited) 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? greets Edited October 4, 2014 by Otto1980 Quote Link to comment Share on other sites More sharing options...
JagChris Posted October 4, 2014 Share Posted October 4, 2014 (edited) 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 October 4, 2014 by JagChris Quote Link to comment Share on other sites More sharing options...
GroovyBee Posted October 4, 2014 Share Posted October 4, 2014 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. 3 Quote Link to comment Share on other sites More sharing options...
toarnold Posted October 4, 2014 Author Share Posted October 4, 2014 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 4 Quote Link to comment Share on other sites More sharing options...
Zerosquare Posted October 4, 2014 Share Posted October 4, 2014 isnt there already a kind of font included in the jaguar bios/bootrom, that can be abused as source ??Nope. Quote Link to comment Share on other sites More sharing options...
JagChris Posted October 5, 2014 Share Posted October 5, 2014 What is a "pointer call"? There are no function pointers used in the example code. Whoops my bad. My wording wasn't perfectly precise. Quote Link to comment Share on other sites More sharing options...
Seedy1812 Posted October 9, 2014 Share Posted October 9, 2014 (edited) *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 October 9, 2014 by Seedy1812 4 Quote Link to comment Share on other sites More sharing options...
JagChris Posted October 10, 2014 Share Posted October 10, 2014 Thank you very much for that Seedy. Quote Link to comment Share on other sites More sharing options...
JagChris Posted October 10, 2014 Share Posted October 10, 2014 (edited) 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 October 10, 2014 by JagChris Quote Link to comment Share on other sites More sharing options...
JagChris Posted October 10, 2014 Share Posted October 10, 2014 OK a lot. Quote Link to comment Share on other sites More sharing options...
Seedy1812 Posted October 10, 2014 Share Posted October 10, 2014 For both | (OR) and &(AND) if there is only 1 (eg &) then the result is bitwise maths (http://www.cprogramming.com/tutorial/bitwise_operators.html) and when there is 2 (&& || ) then its a pure binary value ( each side is considered to be FALSE (0) or TRUE ( not 0) ) 1 Quote Link to comment Share on other sites More sharing options...
toarnold Posted October 15, 2014 Author Share Posted October 15, 2014 @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. hello4.zip Quote Link to comment Share on other sites More sharing options...
GT Turbo Posted October 15, 2014 Share Posted October 15, 2014 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 ) 3 Quote Link to comment Share on other sites More sharing options...
Seedy1812 Posted October 15, 2014 Share Posted October 15, 2014 @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 Quote Link to comment Share on other sites More sharing options...
Otto1980 Posted October 15, 2014 Share Posted October 15, 2014 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: Quote Link to comment Share on other sites More sharing options...
Seedy1812 Posted October 15, 2014 Share Posted October 15, 2014 (edited) 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: 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 October 15, 2014 by Seedy1812 4 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.