6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 2:25 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed Oct 04, 2017 12:50 pm 
Offline
User avatar

Joined: Tue Oct 03, 2017 10:56 am
Posts: 13
Hey Guyz, I have another problem for which I need a bit of advice:

(1) I compiled with MADS a routine to display interlaced graphics for ATARI (multiplegraphicsmode).

(2) I then merged the MADS binaries with my main CC65 compiled program (using merge-xex.exe).

(3) The CC65 program autoruns, loads the image in memory, and then calls the MADS routine with __asm__("jsr $8000");

(4) The image gets displayed, BUT in the process the CC65 interrupts are killed (keyboard, timers...).

Could someone kindly advise me on how I can setup the interlace interrupt without killing the CC65 interrupts?

(see attached code and ATR file demo)

In the following code, the second cgetc() is never executed.
If I remove that line, I can see the program progress to the next line and black out the screen.

Code:
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <conio.h>
#include <unistd.h>


void LoadBitmap(char *filename)
{
   FILE* fp;
   
   // Open Map File
   fp = fopen(filename, "rb");   
   
    if (fp != 0) {
        printf("Loading...\n");
        fread((char*)(0x4100), 1, 0x1E00, fp);
        fclose(fp);
    } else {
        printf("File not found...\n");
    }
}

/*****************************************************************************/

int main (void)
{
    LoadBitmap("image.dat");
    printf("Ready to start MGM\n");
    cgetc ();
   
    // Start MGM
    __asm__("jsr $8000");
    cgetc ();
       
    // Black out the screen
    memset((char*)0x4100, 0, 0x1E00);
    cgetc ();
       
    // Done
    return EXIT_SUCCESS;
}


Attachments:
Atari-MGM.zip [181.19 KiB]
Downloaded 88 times

_________________
8bit-Slicks is coming out soon, register for the closed-beta!
Image
Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 04, 2017 2:22 pm 
Offline

Joined: Wed Oct 04, 2017 11:46 am
Posts: 4
I'm not sure from reading your code, coupled with my relative inexperience (what you are doing is more sophisticated than anything I've tried), but I think because you are exiting the VBI with RTI rather than jumping to the documented OS entry points, you are bypassing the OS routines to scan the keyboard.

From De Re Atari, Chapter 8.

Quote:
Once you have decided whether your VBI routine should be immediate or deferred, you must place the routine in memory (page six is a good place), link it to the proper VBI routine, and modify the appropriate OS RAM vector to point to it. Terminate an immediate VBI routine with a JMP to $E45F. Terminate a deferred VBI routine with a JMP to $E462. If you want to bypass the OS VBI routine entirely (and thereby gain processing time), terminate your immediate VBI routine with a JMP to $E462.


Jeremy

[Edit]

The response on AtariAge to your question is more accurate than mine.


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 05, 2017 12:45 pm 
Offline
User avatar

Joined: Tue Oct 03, 2017 10:56 am
Posts: 13
Thx for the extra info Jeremy!
I also saw the reply on Atariage, this community is great for supporting new devs!

_________________
8bit-Slicks is coming out soon, register for the closed-beta!
Image


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: