Giter Site home page Giter Site logo

Comments (5)

davidgiven avatar davidgiven commented on June 27, 2024

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.

ivop avatar ivop commented on June 27, 2024

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.

davidgiven avatar davidgiven commented on June 27, 2024

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.

ivop avatar ivop commented on June 27, 2024

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.

davidgiven avatar davidgiven commented on June 27, 2024

Closing for cleanup.

from cpm65.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.