Expandable RAM

Chat about anything CX16 related that doesn't fit elsewhere
User avatar
Jestin
Posts: 85
Joined: Sat Jun 27, 2020 10:14 pm
Contact:

Expandable RAM

Post by Jestin »



11 hours ago, Johan Kårlin said:




what program would need 2 MB ram on an 8-bit computer?



This is actually what I find the most exiting about a project such as the Commander X16.  What would devs have come up with in the 8-bit era had memory restrictions not been an issue?  I'm curious to find out.

Johan Kårlin
Posts: 292
Joined: Wed Jun 03, 2020 11:33 am
Location: Kalmar, Sweden

Expandable RAM

Post by Johan Kårlin »

But again, for the 256x256 tilemap case, you have to store at least some of the data in himem, and at that point you might as well limit the contents in VRAM to a 128x64 window into the data (actually, you could probably go as low as an 81x41 window in 640x480 resolution with 8x8 tiles, and if you're using 320x240 and 16x16 tiles, you could go as low as 21x11... but powers of two make certain maths easier; and since they conveniently fit into the VERA's tilemap sizes, you could just scroll the layers and not have to worry about moving quantities of VRAM around to constantly re-align the tilemap.


This is actually what I am doing in my ongoing project. I use a window of 21x11 tiles while the tilemap is 32x32 and the logical map (or what to call it) is 256x256! It’s absolutely doable even if I struggled with it quite a bit before it worked. It would be easier if there were more VRAM, talking about the benefits of more memory...
BruceMcF
Posts: 1336
Joined: Fri Jul 03, 2020 4:27 am

Expandable RAM

Post by BruceMcF »



20 hours ago, StephenHorn said:




Well, it's much faster to have the assets in himem because you can retrieve them more quickly than SDCard data. The SDCard requires banging away at the protocol for data transfer, which might be assisted somewhat with hardware but might also involve literally byte-banging single bytes through what effectively amounts to a serial port on an I/O address with commands and replies to retrieve blocks of data... or worse, bit-banging a similar interface to the same job but 8X slower. However the kernal ends up implementing it, it will be way slower than accessing himem.



We do know that if it's coming from the built in SD card port, Vera is reading the data in from the SD card, which is an SPI interface with a 12.5MHz serial clock, so in the middle of a block read, the process of writing the output byte to $9F3E, reading $9F3F until bit7 is clear, then reading the input put from $9F3E is going to be about half the speed of a memory to memory copy, if it is properly interleaved. Add the file system overhead to set up which block is being read, perhaps a third of the speed of a memory to memory copy.

That seems likely to be part of why Vera was redesigned to bring out the registers which were previously accessed through the data ports ... direct copy from the SD drive to the VRAM works much faster if the SPI port can be accessed directly and then written to the data port where the auto-increment writes it to the correct location.



; Block read ready, VRAM port A destination & increment already set up

; Y is the byte countdown, X holds the dummy value to write to trigger the SPI transfer

    LDX #0

    TXY

    STX SPI_DATA

-    LDA SPI_CTRL

    BMI -

    LDA SPI_DATA

    STX SPI_DATA

    STA DATA0

    DEY

    BNE -

; (Next I assumed a 'DEC N' on a memory register is going to test whether more pages need transferring)

... note that would certainly busy wait in the first byte, because a maximum byte transfer frequency of 1.5625MHz can't keep up with a 4-clock instruction which has an effective instruction frequency of 2MHz plus, but storing the dummy to start the next SPI cycle immediately after reading the previous SPI data received means that normally the busy will be cleared by the time the loop restarts at SPI_CTRL ... a 13 clock 65C02 sequence has an effective frequency of 615kHz, so the SPI port is plenty fast to keep up with that.

But this is a block transfer that has already been set up. One choice that is likely going to be needed in a number of games is whether to load video assets straight into VRAM from SD card in a double buffered arrangement and feed audio from assets stored in High RAM, or to load, in particular, PCM assets straight into Vera's PCM ports, and load video assets stored in High RAM.

rje
Posts: 1263
Joined: Mon Apr 27, 2020 10:00 pm
Location: Dallas Area

Expandable RAM

Post by rje »



On 8/1/2020 at 4:04 AM, Johan Kårlin said:




Maybe a stupid question, but what program would need 2 MB ram on an 8-bit computer? You could fill the memory banks with sound samples, I suppose. A game could fill them with images or other graphic resources, but you would have to copy them to VRAM in order to display them and if they belong to different parts of the game you might just as well load them from an SD-card?



I. THEORETICAL

Taking cues from the 8 Bit Guy's video on his "Dream Computer" (part 2).

1. I assume that "Planet X16" will be distributed via diskette.

2. I assume that the 8 Bit Guy will load the game map and data into banked RAM.

3. Ultima VI is one of his favorite 8 bit games.  On the C64, it came in six diskettes, roughly taking 1MB of RAM.

Given those three assumptions, the Law of Resource Estimation suggests you take your requirements and double them.  If you think you need 1MB, then make sure you have 2MB.

* * *

II. PRACTICAL

The "full load" option is a good one.  You could load everything, instead of swapping files in and out, if you wanted to.

You could load whole diskettes from IEC drives, if you wanted to.

This could make *diskette* distribution "more" viable as an option -- again, if you wanted to.

Doable options that fit well with the overall design.

Johan Kårlin
Posts: 292
Joined: Wed Jun 03, 2020 11:33 am
Location: Kalmar, Sweden

Expandable RAM

Post by Johan Kårlin »

I really got some good answers to that question, both from you and several others! When working on my own game I can still dream of more than 128 KB VRAM though. Now I manage to have a tilemap of 256x256 tiles by adding a software solution to what the hardware can offer. It is by far the most complicated and time consuming part of the game so more memory would have made a great difference. On the other hand it has been a fun and satisfying challenge! And sometimes I can’t make up my mind if I want more or less resources... As a whole I think the CX16 already has become my dream computer too.
stargeizer
Posts: 1
Joined: Sat Aug 22, 2020 7:47 pm

Expandable RAM

Post by stargeizer »


Hmmm. For games memory issues can be workarounded. I mean, in the good old times (tm) of 8-bit, many developers did crunched their games to 32-40 kb of RAM, and some of them were quite large.  I remember impossible mission, draconus, for the c64... for the Ataris, Black Lamp, Mission (or misja), both of them featured 100+ rooms, digitalized music and animations crunched into 38-40 kb of RAM. Of course these were action games. Or rpg for the nes, and we're talking  2 KB of RAM, 2 kb of videoram and 24? (can't remember the exact value, less than 250 tho.) of ram for sprites... Final Fantasy was around 140 kb of rom, i think.

The X16 surpases anything built in the 80-90's era, so better can be done, although probably it won't be exactly easy tho. But then again... "640Kb should be enough for anyone (??)....." ?

 

rje
Posts: 1263
Joined: Mon Apr 27, 2020 10:00 pm
Location: Dallas Area

Expandable RAM

Post by rje »



On 8/21/2020 at 12:06 PM, Johan Kårlin said:




And sometimes I can’t make up my mind if I want more or less resources... As a whole I think the CX16 already has become my dream computer too.



I completely agree with that sentiment, Johan!  At what point does retro become absurd?  Why can’t I be satisfied with the limitations of an 80s architecture?  It’s those limitations that allow me to create, in the first place!  And the VERA chip is by far the most complex thing to work with (that I know of) in the X16.  It’s a bit frustrating when you have to manipulate bits with BASIC.

i imagine the power of VERA, and the sound generators, will be robust for the sake of courting the Commodore demo scene.  OK, I grok that - it’s a vibrant community and worth the serenade.  As for my end, i will be thinking about ways to alleviate my pain...  BASIC extensions to perform sprite ops sounds like a place to start.  And sound commands.

 

 

rje
Posts: 1263
Joined: Mon Apr 27, 2020 10:00 pm
Location: Dallas Area

Expandable RAM

Post by rje »



17 hours ago, stargeizer said:




The X16 surpases anything built in the 80-90's era, so better can be done, although probably it won't be exactly easy tho. But then again... "640Kb should be enough for anyone (??)....." ?



 



Thank you for this!   The X16 is clearly overpowered.... but your post gave me one insight as to WHY that’s a good thing.

i already noted the demo scene, which I hope will be attracted to the X16.  But I’m talking about us programmers who, let’s face it, are used to the sloppy bigger languages.  We’re used to having ooodles of memory and probably will only enjoy a certain amount of data limitations.

in other words, there’s a bell curve here.  Offer 32K of RAM.... and that’s it.... and you could cause undue pain for developers.  Offer too much memory, on the other hand, and you’ve passed beyond into the absurd, or even beyond the 6502’s ability to handle memory reasonably.

 

 Note the 8 Bit Guy’s second video on his Dream Computer.  When he talks about performance, he is roughly aiming for the Intel 286...  in speed, video, and memory.

A 6502 architecture with 80286 specs is the upper end of the chip’s reasonable reach... it’s a good upper end, with enough “slop” to spare for us programmers to enjoy an 8 bit retro experience.

And that feels about right to me.

Post Reply