which locations are safe to use in zero page besides $fa - $ff?
and btw: i don't quite understand the concept of relocating zeropage:
$d507 holds the P0L Register and $d508 the P0H according to the c128's manual
but $d507 needs the Hi-BYte (Page) location of the desired Page. What is the P0H good for.
And: To which RAM Bank does all this apply. Always to the currennt visible?!
Unfortunately, the cassette tape buffer on the C128 is in page one, not page zero like it is on the C64, so that's out.
Are you using BASIC? If so, you're kind of screwed. If not, that opens up several possibilities. There are pointer locations in page zero for tape and RS-232 operations that you could use if you're not using those. The two floating point accumulator locations should be free for M/L. There are also work areas for string functions, etc. that are available if you're not using them. The best thing to do is buy or download a copy of Mapping the C128 and go through byte by byte and try to figure out what you can hijack. Be VERY careful with locations that are used by the Kernal, as opposed to those that are just used by BASIC. Sometimes 'Mapping' only lists the PRIMARY function of a zero page location, but it's also used for other things by other routines.
Good luck!
thanks :)
$D507 is the page number (high byte) zero page accesses will be redirected to. Bit 0 of $D508 is used to select which RAM bank zero page will go to. Bits 0-3 are actually reserved here, which may suggest that if you have an internal RAM expansion you could also direct zero page to one of the extra banks, but I'm not sure if that really works in practice. I don't personally know anyone who has an internally expanded 128.
There are some things to be mindful of when redirecting zero page:
- Locations 0 and 1 are not redirected, they always access the Data Direction Register and Data Register
- If you're going to change the block pointer at $D508, write your page pointer to $D507 immediately afterwards. Changes to the block pointer only take effect after writing the page pointer.
- Accesses to zero page are redirected to the page specified in $D507, but likewise, accesses to the page specified in $D507 will be redirected to page 0, except in one circumstance. See next item.
- If you've set up a shared area of RAM via $D506, zero page will always be in block 0 RAM regardless of the block pointer setting. But if you do set the block pointer to a non-zero RAM bank, there's a side effect: zero page and the page pointed to by the page pointer will be at the same location. So, if you read or write the page specified in $D507, it will *not* be redirected to page zero, but if you read or write zero page it *will* be redirected to the page in $D507.
- Be sure to switch back to the original configuration before calling Kernal or Screen Editor routines. Alternately, you can call RAMTAS (and CINT if needed) after you first set up your new page, and the page will be cleared and necessary values stored there. (But in that case, there's hardly any benefit of relocating zero page.)
ok, these are precious information; thanks a lot, this will help me a lot
And, if all else fails, RTFM. Mapping the Commodore 128 contains a detailed explanation of what every ZP location does. In fact, read the entire book. :-) That's how I learned the machine. Geesh!
Quote from: airship on January 14, 2008, 01:52 AM
Unfortunately, the cassette tape buffer on the C128 is in page one, not page zero like it is on the C64, so that's out.
Are you using BASIC? If so, you're kind of screwed. If not, that opens up several possibilities. There are pointer locations in page zero for tape and RS-232 operations that you could use if you're not using those. The two floating point accumulator locations should be free for M/L. There are also work areas for string functions, etc. that are available if you're not using them. The best thing to do is buy or download a copy of Mapping the C128 and go through byte by byte and try to figure out what you can hijack. Be VERY careful with locations that are used by the Kernal, as opposed to those that are just used by BASIC. Sometimes 'Mapping' only lists the PRIMARY function of a zero page location, but it's also used for other things by other routines.
Good luck!
The 128's cassette buffer is at $0B00, which is page 11. The stack is in page 1. Are you confusing pages with RAM banks?
Unless changed. common low RAM extends from $0000 to $03FF. Therefore, the 128's cassette buffer is in RAM bank 0. It is possible to point logical zero page to the casette buffer if tape is not going to be used. The fake RS-232 buffers at $0C00 and $0D00 are also possible. In fact, any page between $0B00 and $1000 is theoretically okay for relocated ZPs and stacks, as long as the functions that normally use these areas are not invoked. Also, if BASIC is not to be used, its runtime stack at $0800 is fair game. If only 80 column display is to be used, you can steal any of the four pages that encompass VIC character RAM ($0400-$07FF).
Just a temporary brain glitch on the cassette buffer location. Page 11 it is.
Quote from: BigDumbDinosaur on January 14, 2008, 12:39 PM
[...] Unless changed. common low RAM extends from $0000 to $03FF. Therefore, the 128's cassette buffer is in RAM bank 0. It is possible to point logical zero page to the casette buffer if tape is not going to be used. [...]
Using the tape buffer is not a good idea if you are using BOOT and may be some other BASIC 7.0 DOS commands.
BOOT destroys the buffer and some other DOS commands are using the first 2 or 3 bytes as temporary storage.
Only if you don't use BOOT and don't need the first bytes the tape buffer is a good place for ML or data.
WTE
thanks for all your replies, but i am not interested in the tape buffer at all - i asked for ZEROpage locations ;) and tape buffer isn't located in the zeropage neither on c128 nor on the c64 (it is at $33c - $3xx on c64).
Quote from: wte on January 15, 2008, 06:58 AM
Quote from: BigDumbDinosaur on January 14, 2008, 12:39 PM
[...] Unless changed. common low RAM extends from $0000 to $03FF. Therefore, the 128's cassette buffer is in RAM bank 0. It is possible to point logical zero page to the casette buffer if tape is not going to be used. [...]
Using the tape buffer is not a good idea if you are using BOOT and may be some other BASIC 7.0 DOS commands.
BOOT destroys the buffer and some other DOS commands are using the first 2 or 3 bytes as temporary storage.
Only if you don't use BOOT and don't need the first bytes the tape buffer is a good place for ML or data.
WTE
Most people don't manually use
boot, and the kernal call to
boot_call (
$FF53) at boot-time will be working with the standard map. In any case, the application using a relocated ZP or stack is going to be custom, by definition, and therefore it will be the programmer's responsibility to analyze memory usage. That's what makes M/L so fun! :-)
Quote from: hannenz on January 15, 2008, 08:16 AM
thanks for all your replies, but i am not interested in the tape buffer at all - i asked for ZEROpage locations ;) and tape buffer isn't located in the zeropage neither on c128 nor on the c64 (it is at $33c - $3xx on c64).
Yes, but you did ask about relocating ZP and the buffer is one of several possible places for that sort of activity.
oops - you're right - sorry ::)