Jump to content
IGNORED

Value read from bankswitching location?


eshu

Recommended Posts

Hi,

 

When I read from a bankswitching location eg LDA $1FF8 in $F8 bankswitching it reads #$FF into the accumulator, does anyone know if this behaviour is the same on real hardware, on both the harmony/melody and normal cartridge boards?

 

Thanks

 

You are reading the value from $1FF8. If the bankswitching is very slow, then you read from the old bank, if it is quick you read from the new bank.

To always get $FF, you should put $FF at location $1FF8 in both banks. If you need a different value, just put that value at $1FF8 in both banks.

Link to comment
Share on other sites

Hi,

 

When I read from a bankswitching location eg LDA $1FF8 in $F8 bankswitching it reads #$FF into the accumulator, does anyone know if this behaviour is the same on real hardware, on both the harmony/melody and normal cartridge boards?

 

Thanks

 

You are reading the value from $1FF8. If the bankswitching is very slow, then you read from the old bank, if it is quick you read from the new bank.

To always get $FF, you should put $FF at location $1FF8 in both banks. If you need a different value, just put that value at $1FF8 in both banks.

 

Thanks, makes sense - I think dasm fills unused bytes with #$ff - I had a bit of a mental block because the address obvioussly serves the function of bankswitching, but i guess that's handled by a different part of the circuit and the memory is still there to read....

Link to comment
Share on other sites

In general, I think it's a bad practice to rely on values read at hotspot locations.

 

Putting the same value in all banks at hotspot locations will usually work, but if the hardware happens to be changing addresses during the time the value is read, this is undefined behavior and there is no guarantee the data will be valid.

 

What's worse, some hardware may not drive the bus at all when a hotspot is hit leading to unpredictable values.

Link to comment
Share on other sites

I think dasm fills unused bytes with #$ff

By default. You can instruct it to fill memory with any byte (or group of bytes) that you choose though.

 

ex:

ORG $FF00,0 fills memory below the address specified with zeros. I believe that it's been said it's better/quicker to fill unused portions with $FF for binaries you intend to burn to eprom.

Link to comment
Share on other sites

What's worse, some hardware may not drive the bus at all when a hotspot is hit leading to unpredictable values.

 

I think you can rely on the value if it is the same on both banks. The original F8 devices do drive the bus

and I guess if new boards want to be compatible they should do this as well. Do you know of any boards/devices

that do not drive the bus when A12 is '1' ? That would be interesting ...

Link to comment
Share on other sites

What's worse, some hardware may not drive the bus at all when a hotspot is hit leading to unpredictable values.

 

I think you can rely on the value if it is the same on both banks. The original F8 devices do drive the bus

and I guess if new boards want to be compatible they should do this as well. Do you know of any boards/devices

that do not drive the bus when A12 is '1' ? That would be interesting ...

Usually that is true, but recently I was working on an 8k board running a 4k game, and A12 was (mistakenly) floating. Even though both 4k banks had the same data, the game did not work until I connected the line high or low. This suggests that address lines must be at proper logic levels during the read. If reading an EPROM at the same time the address is changing, this might result in incorrect data. Even if this occurs one in a thousand reads, that is enough.

 

Devices with RAM do not drive the bus in some addresses with A12=1. There are some new schemes for Harmony/Melody that currently don't bother driving the bus during hotspots.

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