Tandy 200 RAM
This page captures some useful information for programming with T200 RAM.
T200 RAM is always 24k blocks, from A000 to FFFF. There can be any number of banks from 1 to 3.
In the T200 memory map, there are 6 defined blocks - 3 ROM and 3 RAM. Bank selection is accomplished by writing to IO port D8 (216). The current setting of the bank selection may be read back from D8 also.
Bit 1,0 --> selection of ROM bank (0000-9FFF or 0000-7FFF) 00 = main ROM (40k) 01 = multiplan (32k) 10 = option ROM (if installed) Bit 3,2 --> selection of RAM bank (A000-FFFF) 00 = bank 1 01 = bank 2 (if installed) 10 = bank 3 (if installed)
Register D8 can be written at any time, with catastrophic results if not done correctly!
Bank To Bank Copy
The T200 ROM provides a routine to perform a bank-to-bank memory copy.
To accomplish this, the T200 uses spare memory in the Tandy 200 Timer to store the source and destination ram banks.
Then there are a set of rom routines that do the bank to bank copies.
So, you can imagine then how this works - you store the critical data somewhere accessible always, then bank switch getting all the info you need about the directories, then do the byte copies.
There is a routine at 2FC5 that copies BC bytes from (HL) in source to (DE) in target-- you could use that to copy things to ALTLCD in the ram banks-- then you have your environment prepped for doing the bank to bank copy from RAM.
Remote block copy code at 2FC5
; this routine copies BC bytes from (HL) in source to (DE) in target ; enter with source RAM visible
2FC5H (C5H) PUSH B 2FC6H (46H) MOV B,M ; load B with (HL) 2FC7H (DBH) IN 91H ; get target data 2FC9H (D3H) OUT D8H ; switch to target 2FCBH (78H) MOV A,B ; 2FCCH (12H) STAX D ; store (HL) in (DE) 2FCDH (DBH) IN 90H 2FCFH (D3H) OUT D8H ; switch to source 2FD1H (C1H) POP B 2FD2H (23H) INX H 2FD3H (13H) INX D 2FD4H (0BH) DCX B ; decrement BC 2FD5H (79H) MOV A,C ; 2FD6H (B0H) ORA B 2FD7H (C2H) JNZ 2FC5H ; loop back until B copies are performed.... 2FDAH (C9H) RET
ALTLCD exists in all 3 RAM banks, and is 640 bytes long, running from F7B0 (63408) to FA2F (64047).