Jump to content
IGNORED

8-Bit DLI Routine with DMACLT


Cybergoth

Recommended Posts

Hi there!

 

Here's a snippet straight from Gateway to Apshai:

 

; DLI Routine

        PHA

        LDA VCOUNT

        STA WSYNC

        CMP #$40

        BCS LB3BC

        LDA #$0C

        STA CHBASE; Set custom charset

        LDA #$3E

        STA DMACLT

        LDA #$03

        STA GRACTL; Enable Players & Missiles

        PLA

        RTI



LB3BC    LDA #$E0

        STA CHBASE; Set default uppercase charset

        LDA #$22

        STA DMACLT

        LDA #$00

        STA GRACTL; Disable Players & Missiles

        STA GRAFP0

        STA GRAFP1

        STA GRAFP2

        STA GRAFP3

        STA GRAFM

        PLA

        RTI

 

Well, I think I ~ understand what it does. Except a few little details:

 

- What do the writes to DMACLT? Googling that only gets me 4 totally useless hits...

 

- So VCOUNT is the vertical line count, but what is the visible range of the screen? Top to bottom = 0-191?

 

- From my understanding of how a DLI works so far, it should already be executed at a precise line. So why does it check VCOUNT at all?

 

- I'm not sure if the DLI code is executed at all, at the *moment* I'm examining. To all my best knowledge, the display-list looks like this:

 

; Display List



L819A    .BYTE AEMPTY8     ; 8 empty lines

        .BYTE AEMPTY8     ; 8 empty lines

        .BYTE AEMPTY8     ; 8 empty lines

        .BYTE AEMPTY8     ; 8 empty lines

        .BYTE AEMPTY8     ; 8 empty lines

        .BYTE ALMS+$06    ; Load Memory for Antic mode 6

        .WORD L80FD

        .BYTE AEMPTY8     ; 8 empty lines

        .BYTE AEMPTY8     ; 8 empty lines

        .BYTE AEMPTY8     ; 8 empty lines

        .BYTE AEMPTY8     ; 8 empty lines

        .BYTE AEMPTY8     ; 8 empty lines

        .BYTE AEMPTY8     ; 8 empty lines

        .BYTE AEMPTY8     ; 8 empty lines

        .BYTE ALMS+$07    ; Load Memory for Antic mode 7

        .WORD L8111

        .BYTE AEMPTY8     ; 8 empty lines

        .BYTE AEMPTY8     ; 8 empty lines

        .BYTE AEMPTY8     ; 8 empty lines

        .BYTE AEMPTY8     ; 8 empty lines

        .BYTE AEMPTY8     ; 8 empty lines

        .BYTE AEMPTY8     ; 8 empty lines

        .BYTE AEMPTY8     ; 8 empty lines

        .BYTE ALMS+$02    ; Load Memory for Antic mode 2

        .WORD L8125

        .BYTE ALMS+$02    ; Load Memory for Antic mode 2

        .WORD L814D

        .BYTE AEMPTY8     ; 8 empty lines

        .BYTE AEMPTY8     ; 8 empty lines

        .BYTE ALMS+$06

        .WORD L3C28

        .BYTE AVB+AJMP

        .WORD L819A

 

So, would this list execute the DLI routine?

 

Greetings,

Manuel

Link to comment
Share on other sites

Hi there!

 

You are probably having difficulty finding it because the register is called DMACTL not DMACLT.  :)

 

Maybe someone should tell the programmer of DIS6502 :ponder:

 

DMACTL controls the player/missile configuration. I'll scan the page from the book I have and post it.  :)

 

I see. So basically it supports the write to GRACTL.

 

Thanks. Now there's only 3 questions left :)

 

Greetings,

Manuel

Link to comment
Share on other sites

If the L81XX .WORD references are what I think they are, the DLI is executed multiple times in that list.

 

The VCOUNT store into WSYNC causes ANTIC to halt the CPU until 4.47µs before the next scan line. (That's 7 machine cycles, or 14 color clocks.)

 

VCOUNT returns half the value of the vertical line counter. The range of values is from 0 through 130.

Link to comment
Share on other sites

Hi there!

 

If the L81XX .WORD references are what I think they are, the DLI is executed multiple times in that list.

 

Most of them are pointers to plain text like "copyright © 1983 Epyx" or "hit trigger to continue".

 

So, if these trigger the DLI multiple times, it makes sense to verify VCOUNT.

 

VCOUNT returns half the value of the vertical line counter. The range of values is from 0 through 130.

 

Hm... a-hm... so VCOUNT covers the whole TV frame of 262 lines? Now, what is the range of the *visible* VCOUNT values?

 

Greetings,

Manuel

Link to comment
Share on other sites

:!: You are looking at the wrong display list. There are a few of them in Gateway (the one you listed is actually for the title screen...GR.1 at the top and bottom, with one line of GR.2 in the middle followed by two lines of GR.0, with blank filler in between). The DLI is called from the actual ingame display list (at $0a56, I think). What it does is change to a custom character set and enable P/M in the center of the screen, while keeping the standard character set at the top and bottom.
Link to comment
Share on other sites

Hi there!

 

:!: You are looking at the wrong display list.  There are a few of them in Gateway (the one you listed is actually for the title screen...GR.1 at the top and bottom, with one line of GR.2 in the middle followed by two lines of GR.0, with blank filler in between).  The DLI is called from the actual ingame display list (at $0a56, I think).  What it does is change to a custom character set and enable P/M in the center of the screen, while keeping the standard character set at the top and bottom.

 

Aha! It's starting to make sense!

 

A theory: When the second intro screen is still displayed and the "hit trigger..." is blinking, the DLI vector is already set.

 

But it is only executed *after* the display list is changed to the one copied to $0a56 and $C0 is written to NMIEN, right?

 

Greetings,

Manuel

Link to comment
Share on other sites

That is correct. It has to be done in that order so the processor knows where to go when interrupts are enabled and begins to be called from the ingame D/L. Miss setting the vector in time and the program will crash. In the Atari 8-bit's, you have about 18 machine cycles within a DLI following Wsync. This may be a little less if you have additional open SIO channels IIRC (?).

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