Jump to content
IGNORED

Display list Interrupts for beginners.


Grevle

Recommended Posts

I still not quite familiar on how a DLI is done..mostly because of the parsing. I understand the display list iself pretty good , So the easiest way for me  is to start with something simple. Just a single display list line with a differen color. Line 2 is better to start on since line 1 also involves the LMS instruction.

 

Here is the standard display list for gr2+16 (graphics mode 2 with no bottom text bar)

 

;GR 2+16

 

.Byte 112,112,112                ; three blank lines
.byte 71,64,156                    ; first is lms command INCLUDING FIRST MODE LINE two other is for screen adress low byte,highbyte = 40000
.byte 7,7,7,7,7,7,7,7,7,7,7    ;mode 2 lines
.byte 65,144,0                      ; first is jump on vertical blank instructions,2 other is the adress low byte first. the adress for the display list itself

 

If someone kan add the simple dli here to have line2  a different color and explain whats being done then it should be pretty fast for me and others who want to learn the basics of DLI.

 

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

To set a DLI and enable it you need something like this:-

Once color2 is changed, the new colour will persist from this line down until the next VB processing

when the original colour will be reset

 

setdli:
    LDA # <dli
    STA $0200
    LDA # >dli
    STA $0201
    LDA #$C0    ; ENABLE DLI
    STA NMIEN
    RTS

 

dli:    ; 2 DLI lines only
    pha ; MUST SAVE ANY REGISTERS YOU USE ON THE STACK
    sta Wsync    
    sta $d018 ; color2 change
    pla
    rti

    

Link to comment
Share on other sites

2 hours ago, TGB1718 said:

setdli:
    LDA # <dli
    STA $0200
    LDA # >dli
    STA $0201
    LDA #$C0    ; ENABLE DLI
    STA NMIEN
    RTS

 

Is this to set the adress for the DLI itself ? Lowbyte+Highbyte gives the adress ?  and is this code in the displaylist itself ? or can it be elsewhere ?

 

Nmien = 54286

Link to comment
Share on other sites

2 hours ago, Grevle said:

 

Is this to set the adress for the DLI itself ? Lowbyte+Highbyte gives the adress ?  and is this code in the displaylist itself ? or can it be elsewhere ?

 

Nmien = 54286

That tells the OS where to "look" to run the actual DLI code.  It is not part of the DLI itself, and yes, that code can live anywhere.

 

Something to keep in mind.  The OS only has one DLI vector (the 16-bit address pointed to by $0200 and $0201).  BUT - this does not mean you cannot run multiple DLIs.  If you want to do this, you have your 1st DLI end with code that sets the addresses (you can usually only set one byte), and continue this.  The final DLI will reset the address(es) back to the address of the 1st so that the process just repeats.  When doing this, steps have to be made to make sure the 1st DLI fires in the correct position.

Link to comment
Share on other sites

So i did try and to make this work. But i only get a one color screen. There's something missing. I did put the DLI flag + mode 2 Directly in the Display list (the number 135)

 

 

 

red.thumb.png.416a6bec97786bf57d53196dac1798bd.png

 

The full CODE for executable 

 


*=13200
      
SDMCTL = 559 ; Can turn on and off Antic (needed when creating display list)
SDLSTL = 560 ; Shadow display list pointer low - Antic må vite hvor den nye display listen er
SDLSTH = 561 ; Shadow display list pointer high 

     LDA #0
     STA SDMCTL ;TURN ANTIC OFF
     LDA #0 ; LOW BYTE
     STA SDLSTL ; store low byte of display list adress
     LDA #144 ; HIGHBYTE
     STA SDLSTH ;store high byte of display list adress
     LDA #34
     STA SDMCTL ; ... Turn on Antic again
    
    
  ;    SETUP VERTICAL BLANK ADRESS 
    LDX #121 ;Setup VBI Highbyte 121*256+Lowbyte 69 = adress for VBI = 31045
    LDY #69
    LDA #7
    JSR $E45C ; SetVB
         

; PUT SOME NUMBERS ON SCREEN
LDX #17 
STX 40009
LDX #18
STX 40229


    LDA #0
    STA 512
    LDA #150 ; DLI ADRESS 38400
    STA 513
    LDA #192 ; =192   ; ENABLE DLI
    STA 54286 ;NMIEN    

MAIN

JMP MAIN
     
     
     
 *=  31045 ; Vertical Blank interupt

JMP $E462 ; Exit DVI
     

; The Display list
*=36864

;GR 2+16

.Byte 112,112,112 ; three blank lines
.byte 71,64,156 ; first is lms command INCLUDING FIRST MODE LINE two other is for screen adress low byte,highbyte = 40000
.byte 7,7,7,135,7,7,7,7,7,7,7
.byte 65,144,0 ; first is jump on vertical blank instructions,2 other is the adress low byte first. the adress for the display list itself

 

 

; THE DLI

*=38400
PHA        ;   Save accumulator
LDX #32   ;   CHOOSE COLOR
STX $D40A ;WSYNC     Wait 
STX 712   ; Store color
PLA        ;   Restore registers
RTI         ;  Done
             ; always end DLI with RTI!

 

 

Edited by Grevle
Link to comment
Share on other sites

That was it. Finally i understand the basics of a DLI. Thanks for the Help.

 

 

red2.thumb.png.5ce65c71aa6c4ddeba7ca04324687679.png

 

Heres the changes i did:

 

Reversed the LSB and MSB in the last line of the Displaylist:

 

.byte 65,0,144 ; first is jump on vertical blank instructions,2 other is the adress low byte first. the adress for the display list itself

 

Then in the DLI routine write color to Hardware register and not shadowregister and USE Accu to store:

 

;DLI

*=38400
PHA        ;   Save accumulator
LDA #32   ;   CHOOSE COLOR
STA $D40A ;WSYNC     Wait 
STA $D01A   ; Store color
PLA        ;   Restore registers
RTI         ;  Done
             ; always end DLI with RTI!

 

 

So it's all about the Parsing. Reading on the net is Helpful but often Small things like parsing and different approaches can be confusing. Thank you. 👍

 

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