Jump to content
IGNORED

ANTIC Mode 2 text rendering


robus

Recommended Posts

New to the forum and hoping someone might have an answer to this question. :)

 

As a hobby project I'm working on an Atari 400/800 emulator (the 400 was my first computer and I loved that thing!). Things are moving along well (I have a 6502 processor executing the OS ROM code which is nice to see) I'm now investigating ANTIC and GTIA to get something to show up on screen. I'm working on Mode 2 to start and I've got it processing a basic Display List (3 x 8 line blanks + 24 x mode 2 lines), decoding the characters and sending bits to GTIA for coloring as shown in the attachment (apologies for the color scheme!).

 

What I'm confused about is how Mode 2 handles the screen memory beyond my classic "Hello World!" text? The screen memory is zero'd out, but ANTIC can find a glyph for byte 0 which is, of course, the Heart image and proceeds to fill the rest of the screen with that. I don't think I should fill the text screen ram with "Space" characters to avoid drawing to screen, so how does ANTIC know not to render characters when there is no character data?

 

buffer_7.png

Edited by robus
  • Like 1
Link to comment
Share on other sites

ANTIC shouldn't be finding a heart for $00, it should be showing empty (space) characters:

  • CHBASE = $E0, so the font is stored at $E000-E3FF.
  • A character name byte of $00 references the character data at $E000-E007.
  • $E000-E007 is all $00, so no character is displayed.

That you have the heart showing up indicates a mixup between ATASCII and INTERNAL character sets, since $00 is the heart character in ATASCII. But that shouldn't be a factor at the hardware level, since ANTIC has no idea of character sets and the default font that it is given at $E000 is ordered in INTERNAL order. ATASCII is purely an OS-level concept from translation in the Display Handler when it reads/writes screen memory.

 

  • Like 1
Link to comment
Share on other sites

26 minutes ago, phaeron said:

ANTIC shouldn't be finding a heart for $00, it should be showing empty (space) characters:

  • CHBASE = $E0, so the font is stored at $E000-E3FF.
  • A character name byte of $00 references the character data at $E000-E007.
  • $E000-E007 is all $00, so no character is displayed.

That you have the heart showing up indicates a mixup between ATASCII and INTERNAL character sets, since $00 is the heart character in ATASCII. But that shouldn't be a factor at the hardware level, since ANTIC has no idea of character sets and the default font that it is given at $E000 is ordered in INTERNAL order. ATASCII is purely an OS-level concept from translation in the Display Handler when it reads/writes screen memory.

 

Thanks for the reply.

 

I'm converting from ATASCII to the internal format (which is why my Hello World! is drawing :) ) using this logic:

 

- (uint8)convertATASCIIToGlyph:(uint8)ch
{
    if (ch >= 32 && ch <= 95) {
        ch -= 32;
    } else if (ch < 32) {
        ch += 64;
    } else {
        // It's OK
    }
    return ch;
}

 

Link to comment
Share on other sites

Clearing the screen should set all bytes to $00. It's not clear where that Objective C code is being run -- if that's being used to stuff "hello world" onto the screen then that's fine, but if you have that in the ANTIC rendering path that's definitely wrong.

 

  • Like 1
Link to comment
Share on other sites

45 minutes ago, phaeron said:

Clearing the screen should set all bytes to $00. It's not clear where that Objective C code is being run -- if that's being used to stuff "hello world" onto the screen then that's fine, but if you have that in the ANTIC rendering path that's definitely wrong.

 

My emulator is written in ObjC. AFAIK the screen ram receives ATASCII chars which ANTIC translates into ROM glyphs?

 

There’s discussion of EOL codes when BASIC writes to the screen device, but I don’t think ANTIC deals with that?

Link to comment
Share on other sites

7 minutes ago, robus said:

AFAIK the screen ram receives ATASCII chars which ANTIC translates into ROM glyphs?

No, ANTIC translates INTERNAL chars, because that's the ordering of the characters in the font at $E000.

 

Here's what the OS-B memo pad screen looks like in memory:

 

image.thumb.png.da2d451e5610c1a72e3bc14c10fc85ca.png

 

...and here's the order of the characters in the font data:

 

image.thumb.png.1a02def5637d5f8ef0e0b22965faa144.png

Note the order of the blocks -- ATASCII $20-3F, $40-5F, $00-3F, $60-7F. This is why the screen buffer bytes are INTERNAL codes. If the font data had been ordered in ATASCII $00-7F order, then the screen buffer would take ATASCII codes instead.

7 minutes ago, robus said:

There’s discussion of EOL codes when BASIC writes to the screen device, but I don’t think ANTIC deals with that?

Correct, all control codes are handled by the E:/S: handler in the OS ROM.

  • Like 1
  • Thanks 1
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...