tokafondo wrote:
drogon wrote:
Here is something to think about... If your screen memory needs 120,000 bytes, then the fastest you can clear it in software would be to use the block move instruction (ie. MVN). This moves one byte every 7 cycles. 120,000 * 7 = 840000 cycles, at 8Mhz is about 1/10th of a second. So that's a baseline for clearing the screen or software scrolling. A slight thorn in the side is that 120KB of RAM will span 2 x 64KB banks in the '816/'265 address space, so drawing a line from one corner to the other will cross a bank - as will moving a sprite. I think at that point things would get complex enough for me to simply give-up and move to a plan B for video. (which I have done)
.
But that cross banking issue should not be a proble with a 16 bit addressing space, should it? The MCU just write bytes to an memory address and that is... "linear address space" should stand for that: no banking at all.
It's that, or I just don't have any clue of how the '816 memory model works?
You may need to do more reading about the '816.
The memory is 8 bits wide and the address bus is (effectively) 24 bits wide and it is linear however it's split from the CPU side into banks of 64KB each.
The index registers are 16 bits wide and there are separate data and program bank registers. There are instructions that let you do a direct 24-bit load/store and jump, but unless you use self-modifying code, you can't index with them. You might typically load the data bank register, then do the load/store, then more load/stores until you reach the next bank, then update the data bank register, reset the index register(s) and carry on. It's only "easy" when you stick to one bank.
Your video-generator side doesn't need to see this though - you can give it a 17-bit wide address register, it's just the '816 code that needs to be aware of it, but go back to the timings - you have a retro CPU in terms of ability and clock speed and you're trying to make it manipulate a quantity of memory that's far more than we ever dreamed of in the late 70's/early 80's. When we did progress to more colours and higher resolutions, we also had faster and more capable CPUs and hardware assist ('blitter' and the like) started to be a thing.
If you could keep to one bank, then your resolution or number of colours becomes reduced - 8 bits per pixel would limit you to about 320*200 pixel resolution which is usable - to give 40x25 characters. you could increase that to get to 320*240 if you went to 4 bits per pixel, but then your code needs to do read/modify/write for ever pixel written. It's always a compromise somewhere...
Cheers,
-Gordon
-Gordon
_________________
--
Gordon Henderson.
See my
Ruby 6502 and 65816 SBC projects here:
https://projects.drogon.net/ruby/