Post Reply 
'91 TDS 256KB RAM Card for the HP-48 SX
03-19-2015, 11:46 PM
Post: #7
RE: '91 TDS 256KB RAM Card for the HP-48 SX
I'm not familiar with this particular RAM card, but bankswitching under software control does not seem to be that difficult.

If the calculator can address only 128 KB, the card itself (and not the calculator, as in the 48GX) will have to contain the bankswitching logic. While bankswitching is typically accomplished through I/O ports, it can also be done through memory-mapped I/O.

At the minimum, all you need is a single latch to switch the RAM's A17 address line. If this is 0, the calculator will see the card's first 128 KB, if it's 1, the second 128 KB bank (and so on for larger cards). If you then add an address decoder to map this latch into the calculator's address room as bit 0 at address 1FFFFh (or something similar) overriding the actual RAM contents at this address, you can write a small program to set or clear this bit in order to switch RAM banks under software control.

Of course, it might be wise to add some "locking" logic to make it more difficult to flip RAM banks in order to avoid accidental bank switches in the case of a program running wild. This logic would disable the switching logic unless a specific 8-bit value is written to the address, or until a certain sequence of "magic" values is written to the same address, or a certain access pattern is recognized (for example, three successive reads of the same address).

If the RAM to be paged in or out is used for storage only (like a RAM disk), the bank-switching program should ensure that all files are closed on the corresponding volume, dirty data written out and all cached contents in the filesystem layer invalided before actually switching banks. Basically, the volume needs to be unmounted and remounted.

If, however, the RAM is part of the device's operational memory, the device would most certainly crash when switching banks. In this case, it might be possible to delay the requested page switch until the next power sequence or reboot. Alternatively, if a certain system state needs to be preserved through bank switches, the switching program might copy the vital data from one page to the other within a mutex. Or a more sophisticated switching logic would allow to map in and out sub-pages under software control. There are various ways how to accomplish this...



"Programs are poems for computers."
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: '91 TDS 256KB RAM Card for the HP-48 SX - matthiaspaul - 03-19-2015 11:46 PM

User(s) browsing this thread: 1 Guest(s)