Jump to content
IGNORED

Mad Pascal and display list interrupts


Gury

Recommended Posts

Display list interrupt example:

 

post-7301-0-23856300-1445173056_thumb.png

{
  Display list interrupt example
}
uses crt, graph;

var
  dlist : word;

procedure DLI_routine;
begin
  asm
  {  
  stx @sp
    
  lda #<dli  ; Set up our display list interrupt vector
  sta $200
  lda #>dli
  sta $201
  lda #$c0   ; Enable DLI + Vertical blank routines
  sta nmien
  };
  
  gotoxy(8, 16); writeln('Some more text...');  
  
  asm
  {
loop
  jmp loop    ; Wait forever     
        
dli
  pha         ; Save registers
  lda #0      ; New text color
  ldx #36     ; New background color
  stx WSYNC   ; Wait 
  sta COLPF1  ; Store color
  stx COLPF2  ; Store color
  pla         ; Restore registers
  rti         ; Done

  ldx @sp
  };  
end;
  
begin
  InitGraph(0); CursorOff;
  dlist := DPeek($230);
  Poke(dlist+16, 130);
  gotoxy(6, 5); writeln('Display list interrupt example');
  DLI_routine;
  gotoxy(8, 20); writeln('Is this text shown?');    
  repeat until 1;
end.

dli1.xex

  • Like 2
Link to comment
Share on other sites

hmm - reads as if this one never leaves the DLI_routine:

loop
     jmp loop

so this will never occur:

gotoxy(8, 20); writeln('Is this text shown?');
repeat until 1;

or am I missing something?

 

... I did some small changes and now it works as it should:

 

replace the loop jmp loop with a simple rts

 

and add =0 to have an endless loop behind: repeat until 1

gury_dli.obx -> compiled programme

guri_dli.zip -> .pas file

Edited by pps
Link to comment
Share on other sites

Display list interrupt example 2 - Multicolor graphics 0 screen
post-7301-0-23155300-1445508172_thumb.png
{
  Display list interrupt example 2
  Multicolor graphics 0 screen
}
uses crt, graph;

var
  i : Byte;
  dlist : word;

procedure DLI_routine;
begin
  asm {
  stx @sp  

  lda #<dli  ; Set up our display list interrupt vector
  sta $200
  lda #>dli
  sta $201
  lda #$c0   ; Enable DLI + Vertical blank routines
  sta nmien

  ldx @sp
  rts

dli
  pha         ; Save accumulator
  lda VCOUNT  ; Load accumulator with Vertical line counter value
  sta WSYNC   ; Wait for horizontal sync 
  sta COLPF2  ; Color and luminance of playfield 2
  sta COLBAK  ; Color and luminance of the background
  pla         ; Restore accumulator
  rti         ; Done with display list interrupt
  };
end;

begin
  InitGraph(0); CursorOff;
  dlist := DPeek($230);
  // Set colors for 8 lines at the top
  fillchar(pointer(dlist+10), 8, 130);
  // Set colors for bottom lines
  fillchar(pointer(dlist+21), 4, 130);
  // Some text
  gotoxy(5, 3); writeln('Display list interrupt example 2');
  gotoxy(5, 4); writeln('Multicolor graphics 0 screen');
  // Display list interrupt routine
  DLI_routine;
  // More text
  for i := 0 to 7 do begin  
    gotoxy(8, 16+i); writeln('Some more text on line ', 16+i);
  end;
  // Endless loop
  repeat until 1=0;
end.

 

dli2.xex

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