Comments (5)
It is doable without relocation, but it's ugly. The bottom of your binary contains the font, plus 1kB of padding. The actual code starts above this. On startup, you move the font data so it's aligned; the padding allows this without interfering with the code. Before exiting you adjust the TPA to discard the code.
The downside is that you're wasting up to a kilobyte of memory for the padding.
from cpm65.
I see. As in my case the font is to be loaded from disk and not part of the COM file, it means I have to pad with 7 pages to be prepared for the worst case of non-alignment with 1kB boundaries. That's 14 sectors on disk, which is quite substantial as setfnt.com now is only 4 sectors. Reloading itself and relocating and copying over the fcb might be an option. The second copy needs to check TPA lowmem with its own lowmem to know it has been called before.
I was also thinking of creating a small wrapper that has setfnt.com included as an array or block of bytes. The wrapper copies that array to the top of the memory (perhaps minus one extra page in case the fcb would spillover), calls relocate, copies over the fcb to its pblock (offset is in the header) and then jumps to it. That might need less sectors read from disk and could be reused for other programs that need to allocate memory at the bottom of the TPA. Would that be acceptable?
from cpm65.
Anything's acceptable!
How big is the ROM? Could you split the memory map into MAIN and EXTRA, with the boundary at the bottom of the ROM, with the BIOS loading right at the top of memory and the CCP and BDOS under the ROM? That way setfnt could claim an aligned block from the top of TPA, and (assuming I've understood the Atari memory map) because the BIOS isn't in low memory any more you should even get some TPA back?
from cpm65.
I chose to implement no hack. On a <= 48kB machine, it loads the font at the top of the TPA. On a 64+kB machine, the first run reserves memory, and after that you can change fonts at will.
The ROM is 16kB (c000-ffff). I have split the memory into MAIN and EXTRA already. MAIN is from 0500-cfff (where c000-cffff is under the ROM). d000-d7ff are the hardware registers, d800-dfff is the BIOS, e000-e3ff is a copy of the ROM font for when the ROM is disabled (same location as in the ROM), e400-ffff is the EXTRA bank that contains BDOS, CCP and some free memory. BIOS is basically not in any bank :) And MAIN only contains two small interrupt routines for when the ROM is disabled and two wrappers to call CIO (keyboard) and SIO (serial or PBI disk access). By using SIO you get PBI devices like flashcarts, IDE interfaces, etc., for free. Or alternate OS's with high speed SIO code, up to 127k baud serial.
from cpm65.
Closing for cleanup.
from cpm65.
Related Issues (20)
- VT52 waiting for valid escape sequence HOT 1
- Reusing a static FCB for several file operations HOT 3
- "REN"-like command for changing user ID HOT 2
- Multiple drive support HOT 6
- Older Apple ][ support HOT 5
- Arrow-key constants HOT 2
- cpm.h header file needed HOT 2
- munmap_chunk(): invalid pointer HOT 4
- Suggestion: have the CCP zero out the bss for transient commands
- Thoughts on sound, timer, and joystick drivers HOT 1
- No Binary for Nano6502? HOT 2
- Cursor behaviour HOT 3
- Writing a new driver in assembly HOT 7
- Dependency on a certain version of llvm-mos HOT 1
- Failing to assemble .COMs on macOS (13.6) HOT 2
- Listing multiple lines in BEdit does not work
- ccp internal "ren" does not work HOT 2
- Build for Apple II 3.5" as well HOT 5
- Saving files with BEDIT on the Atari doesn't work HOT 3
- Updates to lib6502 breaks objdump HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpm65.