Jump to content
  • 0

detecting I/O status in assembly?


desertfish
 Share

Question

Hi, when doing I/O via the kernel routines you can get a long way. However one thing that is missing (as far as I know) is a routine to check the I/O status. 
So I have some assembly code that works on the Commodore-64 where it checks  $90  directly which is the documented zero page location for the I/O status flag on the '64. 

I don't think that address is valid on the cx16.  How are you dealing with I/O errors on the Cx16?   

Link to comment
Share on other sites

Recommended Posts

  • 0

I'm confused by two lines in your cx16_LoadFileBanked().

byte bank = (byte)(((((word)<(>address)<<8)|>(<address))>>5)+((word)<(>address)<<3));
byte* addr = ((<address)&0x1FFF); // strip off the top 3 bits, which are representing the bank of the word!

What is the format of the

dword address

argument?  Whatever it is, loadtext must not be zero!!

Edited by Greg King
Link to comment
Share on other sites

  • 0
6 hours ago, Greg King said:

CLOSE doesn't call UNTALK; CLRCHN does call it.

I contend that it isn't wise to assume that a device can handle out-of-order function calls gracefully.  It's safer to build the habit of writing calls in the proper order.

True. But CLOSE first commands the device to be a listener, thereby stopping it to talk, if it was a talker. Issuing the UNTALK command should have no effect on the device after CLOSE, in my understanding.

I agree that it's safe to continue using CLRCHN. UNTALK and UNLISTEN ensure that all devices are in a passive (non-talking and non-listening) state.

Link to comment
Share on other sites

  • 0
11 hours ago, svenvandevelde said:

 

I found it ... I should not use bank 0 RAM A000. for some reason that interferes. bank 1 and beyond is ok. Note that the X16 by default uses bank 1 RAM!

Yep, that's a big no-no. Bank 0 has a bunch of stuff needed by the kernal, but it only needs the first few hundred bytes. You can safely write to $A800 and above, so that's another 6k at your disposal.

Link to comment
Share on other sites

  • 0
31 minutes ago, SlithyMatt said:

Yep, that's a big no-no. Bank 0 has a bunch of stuff needed by the kernal, but it only needs the first few hundred bytes.

Wonderful! So this means that when writing to A000 at the first few hundreds of bytes, i get all kind of strange side effects (lol). So bank 1 is the start of things for A000...

Thank you, it is a confirmation that I'm on the right path and help Jesper with some new CBM api that has been tested on the X16 loading a file from SD card :).

Time to pull off a pull request ... @Jesper Gravgaard 🙂

Edited by svenvandevelde
  • Like 1
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.

Guest
Answer this question...

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

 Share

×
×
  • Create New...

Important Information

Please review our Terms of Use