Giter Club home page Giter Club logo

Comments (2)

davidgiven avatar davidgiven commented on July 19, 2024

Very nice --- what's the performance like? (I'm guessing, not great...)

Regarding memory access: it'd be nice to have something cross-platform. Traditionally CP/M does extended memory access via a ramdisk. Reading and writing blocks is pretty cheap, although much slower than access via banking, of course. I wonder if some kind of virtual memory would be feasible?

Thinking out loud:

  • take the top byte of the address, and with 0xc0, shift right four times.
  • this is the offset into an array of 32 pointers in zero page, each of which points at a 2kB local block of memory.
  • if the pointer is non-zero, that block is mapped in. Get the pointer, add the address, dereference, return.
  • if it is zero, that block's not mapped in, so we follow a slow path to allocate a block and load it from a 64kB swapfile. This may involve evicting another block and writing it back to disk.

That would be something like...

lda vaddr+1
and #0xc0
lsr a
lsr a
tax
lda mappings+1
beq no_mapping
clc
lda vaddr+0
adc mappings+0, x
sta paddr+0
lda vaddr+1
and #0x3f
adc mappings+1, x
sta paddr+1
<derefence paddr here>

That's.. not that bad? It's more work than your current code but it's portable. Coming up with a cache eviction strategy would be tricky. LRU would require overhead for every memory access, but apparently some ARM chips would just evict a block at random and that was considered good enough...

from cpm65.

ivop avatar ivop commented on July 19, 2024

I'm afraid that will slow things down by at least a factor of two, not counting the load and save times to ramdisk. Most optimizations that I use can't be used, like the msb_to_bank and msb_to_adjusted tables, and checking for end of bank with the BIT instruction. Checks and adjustments that have to be done for almost each memory read or write (end-of-bank only during the optimized instruction fetcher).

But I see your point. It would be nice to have a cross-platform 8080.COM but IIUIC that would offload the bankswitching to a platform dependent ramdisk driver. IMHO it's better to keep the platform dependent code as close to the emulation as possible. It's slow enough as it is. Although it's faster than I had expected, I do not have a number yet. I need a proper benchmark program that I can run on a 2MHz or 4MHz 8080 and on the emulator to see how it performs. Do you know about such program?

I think I'll keep the bankswitching in for now. Later, if there's multiple drives and ramdisk support we can always change it or make it optional.

Regards,
Ivo

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.