Jump to content
Harry Potter

CIOV access from cc65/AtariXL program?

Recommended Posts

Hi!  I am thinking about using the Atari XL's CIOV vector from a cc65 program and will soon need to call it.  Does it reside in ROM?  If so, how do I enable ROM to call it then disable ROM before returning?

Share this post


Link to post
Share on other sites

Answer to the same question you asked before:

 

 

Share this post


Link to post
Share on other sites

CC65 does not disable the ROM on the atarixl target. How do you think stdio works? It calls ROM.

  • Like 1

Share this post


Link to post
Share on other sites
29 minutes ago, Harry Potter said:

tgb1718: I am disabling ROM because cc65 disables ROM on the AtariXL target.

As @ivop says, none of the 8 bits disable the ROM, unless your code is using the RAM under the OS

which means your code will be disabling the ROM to do this, so you're in control, so you will know when

you can call OS routines

Share this post


Link to post
Share on other sites

The cc65 AtariXL configs mention RAM under the OS, so I assumed that it would disable the ROMs so it could access the RAM.  I also recall it being mentioned in the cc65 docs.  If not, how do I use this extra RAM?

Share this post


Link to post
Share on other sites

No, that is incorrect, PORTB in XL/XE machines is used to switch the OS in and out (in XE, also the banked RAM)

I believe bit 0 controls the OS/RAM switch in and out, bit 1 switches BASIC in and out

 

Share this post


Link to post
Share on other sites

Okay, so how does cc65 access the high memory?

 

BTW, I have some docs on the Atari's extra memory, but they only work on the 1200XL system.  :(  How do I do it on an Atari 150XL computer?

Share this post


Link to post
Share on other sites
34 minutes ago, Harry Potter said:

Okay, so how does cc65 access the high memory?

Same as any other language, cc65 does not use the memory under the OS, you need to switch it ROM out.

But it's not as simple as that, you will have to turn all interrupts off otherwise if an interrupt occurs

while the OS is switched out it will crash the machine.

 

something like this. 

 

char *portb=0xD301; // PORT B

char *NMIEN=0xD40E; 

char *IRQEN=0xD20E;

char *POKMSK=0x10;

 

char temp;

 

*NMIEN=0; // turn off interrupts

*IRQEN=0;  // ditto

*POKMSK=0; // ditto

temp=*portb;

temp=temp & 0xFE; // mask out ROM

*portb=temp;

 

// do your stuff here

 

temp=temp | 1;

*portb=temp; // OS back in

*POKMSK=0xc0; // turn interrupts back on

*IRQEN=0xc0; // ditto

*NMIEN=0x40; // ditto

 

  • Like 1

Share this post


Link to post
Share on other sites

Harry -

Again, this is all probably too hard for you. Try something smaller and easier.

TGB *just* explained exactly how it works. Read the code he wrote above. Look up each location in Mapping The Atari. Read as much as you can until you understand what the code is doing. Then you will know how any code in any language accesses the RAM under the ROM.

  • Like 1

Share this post


Link to post
Share on other sites

I can do it.  I can convert the code given here to assembler and use it to access Hidden RAM from a MemXAtari program.  Like I do with Hidden64 for the C64.  :)

 

BTW, my floppy drive broke, and I have much of my code on floppies.  :(  I'm waiting for my mother to bring to me a replacement floppy drive.  Unfortunately, it's being used on another laptop, so I will need to get more from eBay.

Share this post


Link to post
Share on other sites
4 hours ago, ivop said:

CC65 does not disable the ROM on the atarixl target. How do you think stdio works? It calls ROM.

You'e wrong, It _does_.

 

That's in fact the difference between the "atari" and "atarixl" targets.

 

For assembler programs the include file "atari.inc" defines a CIOV label which points to code to enable the ROM, call real CIOV, disable the ROM again. Since currently there is no such provision for C you'll need to write a small assembler stub which can be called by C and calls the CIOV label.

Edited by sanny

Share this post


Link to post
Share on other sites

Here is a tutorial how to temporarily switch on OS for making the system calls, read also the forum threads like this one. I agree with the others though - looking at the questions you ask it's beyond your current knowledge and skills. You are constantly asking for a code examples how to solve problems for you instead of trying to understand how stuff works. Try to finish something simpler first, read and understand a few books https://www.atariarchives.org/ like "De Re Atari" or "Mapping The Atari - Revised Edition".

  • Like 1

Share this post


Link to post
Share on other sites
16 hours ago, sanny said:

You'e wrong, It _does_.

 

That's in fact the difference between the "atari" and "atarixl" targets.

I see. Wasn't aware of that fact. Thanks!

Share this post


Link to post
Share on other sites

IIRC, the AtariXL version of the cc65 libraries disables the ROMs but keeps interrupts working.  Can I simply remove the code to disable the interrupts from the given?

Share this post


Link to post
Share on other sites
On 10/26/2021 at 10:13 PM, Harry Potter said:

IIRC, the AtariXL version of the cc65 libraries disables the ROMs but keeps interrupts working.  Can I simply remove the code to disable the interrupts from the given?

what about stop seeking attention and doing for a change what a programmers do, therefore first reading the documentation, source code, trying it yourself and debugging to find out what's and why not working? 

  • Like 3

Share this post


Link to post
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...