Jump to content
IGNORED

Atari BASIC questions


IndyJones1023

Recommended Posts

 

1 hour ago, IndyJones1023 said:

If I change the text to something longer, how do I change how far indented the text is?

 

160 SCRNX = 2.5 * ( 8 * SCALEX ) : SCRNY = 2.0 * ( 8 * SCALEY )

 

190 SCRNX = 2.5 * ( 8 * SCALEX ) : SCRNY = 3.0 * ( 8 * SCALEY )

 

Change the first numeric value defining SCRNX in these two lines. The values are in character spaces. So, in the above lines they're both inset 2.5 characters (of whatever size the characters currently are scaled to) from the left edge of the screen. So, if your text is longer than in the original program, you want to make the values smaller; if your text is shorter, you want to make the values bigger.

 

Link to comment
Share on other sites

I just noticed I had 2 lines (the ATASCII definitions) nested one level deeper than they needed to be. So, they were both being executed 7 more times than necessary (for each character).

 

Here's the edited code and updated ATR. I also updated the compiled version (BIGTEXT.CTB) on the ATR.

 

10 GRAPHICS 15 + 16
20 POKE 712 , $98 : POKE 708 , $56 : POKE 709 , $DA : POKE 710 , $0E 

30 CHBASE = PEEK ( 756 ) * 256
40 DIM MYTEXT$ ( 10 )
50 SCALEX = 2 : SCALEY = 4

100 ------------------------------

110 COLOR 3
120 TEXT 68 , 54 , "THE"

150 COLOR 1
160 SCRNX = 2.5 * ( 8 * SCALEX ) : SCRNY = 2.0 * ( 8 * SCALEY )
170 MYTEXT$ = "RETRO" : EXEC RENDTEXT

180 COLOR 2
190 SCRNX = 2.5 * ( 8 * SCALEX ) : SCRNY = 3.0 * ( 8 * SCALEY )
200 MYTEXT$ = "SCENE" : EXEC RENDTEXT

999 GOTO 999

1000 ------------------------------

1010 PROC RENDTEXT

1020   FOR CHAR = 1 TO LEN ( MYTEXT$ )

1030     ATASCII = ASC ( MYTEXT$ ( CHAR , CHAR ) )
1040     IF ATASCII < 96 THEN ATASCII = ATASCII - 32

1050     FOR BYTEROW = 0 TO 7

1060       BYTE = PEEK ( ATASCII * 8 + CHBASE + BYTEROW )

1070       FOR BIT = 7 TO 0 STEP -1

1080         IF BYTE & ( 2 ^ BIT )

1090           X = SCRNX + ( 7 - BIT ) * SCALEX + ( CHAR - 1 ) * 8 * SCALEX
1100           Y = SCRNY + BYTEROW * SCALEY

1110           FOR HEIGHT = 0 TO SCALEY - 1
1120             FOR WIDTH = 0 TO SCALEX - 1
1130               PLOT X + WIDTH , Y + HEIGHT
1140             NEXT WIDTH
1150           NEXT HEIGHT

1160         ENDIF

1170       NEXT BIT

1180     NEXT BYTEROW

1190   NEXT CHAR

1200 ENDPROC
 

Turbo-BASIC XL 1.5 (NTSC).atr

 

  • Like 3
Link to comment
Share on other sites

image.thumb.png.8619e0fceca561d9a3eb110a4fd3a6da.png

image.thumb.png.619be314f621a71945911f45ddcb5f67.png

You can also overlay as I have done, and you can overlay different text by changing mytext$ in between the overwrite. I also changed Case to show it works as well. Using the color registers you could also rotate color during the infinite loop.

Edited by _The Doctor__
  • Like 2
Link to comment
Share on other sites

Added ability to use an external font file.

 

I couldn't find any Namco font file for the Ataris; so, I whipped one up.

I combined a few characters from 2 different well-known Namco fonts,

and I made a few minor adjustments myself.

 

[Note: Only the alphanumeric characters in the Namco font have been added thus far. Everything else is still Atari default characters.]

 

I left the Atari font still active as the system font. So, it could still be used,

and will be used if the TBXL "TEXT" function is called to render any text.

 

I changed the "THE" at the top to use whatever custom font is loaded.

So, the SCALEX and SCALEY variables are changed appropriately before

rendering that text.

 

Theoretically, any number of fonts could be used here simultaneously. 

They would just be loaded into their own strings (as I've done) or some

other area of memory, and the CHBASE variable needs to point to

whatever font is desired, before rendering any text.

 

10 GRAPHICS 15 + 16
20 POKE 712 , $98 : POKE 708 , $56 : POKE 709 , $DA : POKE 710 , $0E 

40 DIM MYTEXT$ ( 10 ) , FONT$ ( 1024 )

60 CHBASE = ADR ( FONT$ )
70 OPEN #1 , 4 , %0 , "D:Namco.fnt"
80 BGET #1 , CHBASE , 1024
90 CLOSE #1

100 ------------------------------

110 SCALEX = 1 : SCALEY = 1
120 COLOR 3
130 SCRNX = 8.4 * ( 8 * SCALEX ) : SCRNY = 6.58 * ( 8 * SCALEY )
140 MYTEXT$ = "THE" : EXEC RENDTEXT

150 SCALEX = 2 : SCALEY = 4
160 COLOR 1
170 SCRNX = 2.5 * ( 8 * SCALEX ) : SCRNY = 2.0 * ( 8 * SCALEY )
180 MYTEXT$ = "RETRO" : EXEC RENDTEXT

190 COLOR 2
200 SCRNX = 2.5 * ( 8 * SCALEX ) : SCRNY = 3.0 * ( 8 * SCALEY )
210 MYTEXT$ = "SCENE" : EXEC RENDTEXT

999 GOTO 999

1000 ------------------------------

1010 PROC RENDTEXT

1020   FOR CHAR = 1 TO LEN ( MYTEXT$ )

1030     ATASCII = ASC ( MYTEXT$ ( CHAR , CHAR ) )
1040     IF ATASCII < 96 THEN ATASCII = ATASCII - 32

1050     FOR BYTEROW = 0 TO 7

1060       BYTE = PEEK ( ATASCII * 8 + CHBASE + BYTEROW )

1070       FOR BIT = 7 TO 0 STEP -1

1080         IF BYTE & ( 2 ^ BIT )

1090           X = SCRNX + ( 7 - BIT ) * SCALEX + ( CHAR - 1 ) * 8 * SCALEX
1100           Y = SCRNY + BYTEROW * SCALEY

1110           FOR HEIGHT = 0 TO SCALEY - 1
1120             FOR WIDTH = 0 TO SCALEX - 1
1130               PLOT X + WIDTH , Y + HEIGHT
1140             NEXT WIDTH
1150           NEXT HEIGHT

1160         ENDIF

1170       NEXT BIT

1180     NEXT BYTEROW

1190   NEXT CHAR

1200 ENDPROC

 

retroscenenamco.thumb.png.2932a064f999239a087c60617f0d64b3.png

 

Turbo-BASIC XL 1.5 (NTSC).atr

 

  • Like 3
Link to comment
Share on other sites

7 minutes ago, MrFish said:

Theoretically, any number of fonts could be used here simultaneously. 

They would just be loaded into their own strings (as I've done) or some

other area of memory, and the CHBASE variable needs to point to

whatever font is desired, before rendering any text.

2 minutes ago, _The Doctor__ said:

Since these are effectively plotted to the screen, fonts could be changed per render, allowing multiple fonts anywhere on the screen. Nice touch if added.

Yes, I mentioned that.

 

Link to comment
Share on other sites

1 hour ago, _The Doctor__ said:

For sure, I was posting at the same time as you, twice! I deleted /edited my post and changes with example as you've already done it.

Ah, I see.

 

1 hour ago, _The Doctor__ said:

Thank you for allowing me to play within your thread and program

No problem; have at it. The overlay text was a good idea. If you use 0.5 increments, you can get a more-subtle look too. If you use 4 underlays of the same color (offset in 4 different directions) with one overlay, you should be able to get something akin to outlining each letter. Will take a while to render, though.

 

I'll simplify the parameter editing part of the program, and maybe add some kind of interface, or at least some parameter input options.

 

Link to comment
Share on other sites

Added a machine language routine to plot the fat pixels. All the nested loops and calculations are still in TBXL, but the fat pixels aren't drawn by looping a PLOT statement anymore.

 

Everything's the same for changing parameters, except for picking a color. Instead of using the BASIC COLOR statement, a color is chosen by one of the following.

 

COLRNUM = COLR1

COLRNUM = COLR2

COLRNUM = COLR3

 

I haven't provided a way to choose the background color (COLOR 0) to draw in (yet), as it's not really needed; but I'll add it for completeness and the ability to use it for some special cases that can be devised.

 

At this point, render speed should be very close to the same for a given string at any scaling.

 

Turbo-BASIC XL 1.5 (NTSC).atr

 

 

  • Like 4
Link to comment
Share on other sites

I was able to coax some dither out of the new fat-pixel renderer. This effectively gives 9 colors (10 counting background). It's restricted to X-axis scaling of 2x at the moment. It will work with Y-axis scaling in any even multiples.

 

Effective use of it depends on color selections, of course.

 

unite1.thumb.png.0311d0abd71bf2f5ccd7d95149d265d9.png

 

unite2.thumb.png.7188913d2bbfe31b2c9fbfa821a1b942.png

 

 

 

  • Like 4
Link to comment
Share on other sites

24 minutes ago, _The Doctor__ said:

Our     T     is about 1 unit off to the right on all of our renders, if adjusted in the font itself will it help or hurt?  Or some special case adjust in the render? Single letter kern so to speak?

It doesn't have anything to do with the renderer. It has to do with Namco choosing to define their characters in an uneven number of pixels (7). The Atari sys font doesn't exibit this with the "T" character, because its characters are defined in an even number of pixels (6). Certain characters can't fill the character space completely and look right; the "T" is one of them in the Namco font. This is also partly a symptom of working with monospaced fonts. Character geometries can't always adhere to dimensions where other characters work fine.

 

The pixel difference becomes more noticeable as the font gets scaled up.

 

Link to comment
Share on other sites

57 minutes ago, _The Doctor__ said:

That I understand but maybe we can adjust it is what I was getting at. We could do RE then TRO ourselves and adjust the start point but that's a bit of fun most won't want to do. For now that's what I'll check and see.

Good luck. You'll end up throwing something else off when you do that. The upper case "I" in the Namco font (and the "Y") also exhibits the same issue; but it probably ends up being a little-less noticeable because it has two horizontal bars to fill up the overall space better. In the case above (where I'm demonstrating dithers), it's also at the end of the word ATARI, so there's no spacing to compare it with on the right side.

 

Here are the Namco and Atari fonts. You can see that the Atari font ends up with spacing problems to the right of both its "M" and "W" (one pixel to the right of all the other characters), whereas these are no problem in the Namco font. You trade one problem for another with mono-spaced fonts. The Namco font is kinda nice, because there's more space to define each characters.

 

Namco Font

namco.thumb.png.4827e0ecf8ee51a4fd3b9eb0395ee7b4.png

 

Atari System Font

atari.thumb.png.aa54797b9365ca2e3d985d43faf9c186.png

  • Like 1
Link to comment
Share on other sites

1 hour ago, _The Doctor__ said:

That I understand but maybe we can adjust it is what I was getting at. We could do RE then TRO ourselves and adjust the start point but that's a bit of fun most won't want to do. For now that's what I'll check and see.

Sorry, it's late here. So, I didn't think through what you were asking; I was just focused on what you were saying about moving the two halves of the word separately. Actually, if you want to render the "T" in a string by itself, you can accomplish something here; because a font pixel is bigger than a screen pixel, in this case. So, you would render the word "RE RO", as a string, then you would render the "T" offset to the left by "0.05" of a scaled character. So, since the word "RETRO" starts getting rendered at 2.5, the "T" would be at 4.5 - 0.05 = 4.45.

 

So, you'd end up with this, which is what I think you're trying to accomplish. I didn't fix all the other occurrences (of "T"s and "I"s), just the "T" in RETRO, but it'd be the same process for them all. And, yeah, it actually looks pretty decent like that.

 

fixT.thumb.png.12ec33503985b0f49d229d61e0df56df.png 

 

 

 

  • Like 1
Link to comment
Share on other sites

Exactly, that's what I was about to post with example. Now that I think on this, it could actually be automated with a flag or code in the render parser since we don't use all the char codes, we could assign one for adjust right and one for adjust left.

 

I think we're beyond the original ask on this one, and it's nice and simple right now. I have to download the next version and put in my edits again :)

 

um, I don't see the last multi color dither version file, or the one with the re ro t trick

  • Like 1
Link to comment
Share on other sites

33 minutes ago, MrFish said:

then you would render the "T" offset to the left by "0.05" of a scaled character. So, since the word "RETRO" starts getting rendered at 2.5, the "T" would be at 4.5 - 0.05 = 4.45.

Actually, this isn't exactly right -- but apparently it's close enough to work. I was trying to get to half a scaled pixel (hence the 0.05); but scaled pixels aren't 0.1 here, because a pixel is 1/8th of a character, not 1/10th. So, 1/8th is 0.125, which equals one scaled pixel; then half of that would be 0.0625 (rather than 0.05). So, the adjusted value would be 4.5 - 0.0625 = 4.4375. Might not matter at this scaling, but at a higher scaling (where there's more precision in pixels) it could matter.

 

18 minutes ago, _The Doctor__ said:

um, I don't see the last multi color dither version file, or the one with the re ro t trick

I'll have to upload it tomorrow; it's really late here.

 

  • Like 1
Link to comment
Share on other sites

Here's the version that allows dithering for text with 2x scaling on the X-Axis (combined with any even number scaling on the Y-Axis).

 

Dithers are assigned in the same way colors are.

 

COLRNUM = DITHER1

COLRNUM = DITHER2

etc...

 

The dithers are defined as follows.

 

DITHER1: Colors 1 & 2

DITHER2: Colors 2 & 3

DITHER3: Colors 1 & 3

DITHER4: Colors 1 & 0

DITHER5: Colors 2 & 0

DITHER6: Colors 3 & 0

 

There's a copy of the program that includes an example of the adjusted letter spacing as discussed above.

The name of the program using adjusted spacing is BGTXTADJ.TTB. The program without adjusted spacing is BIGTEXT.TTB.

 

Compiled versions of both programs are included. They use the same filenames as above, but with the extension CTB.

 

Spacing Adjusted

adjusted.thumb.png.9ff3ba67ef036a2ab3c01f0f4d109786.png

 

Normal Spacing

normal.thumb.png.31f7271ee958e236870134e4763bf782.png

 

Turbo-BASIC XL 1.5 (NTSC).atr

 

  • Like 2
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...