Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Hires bitmap RAM arrangement
2014-02-15 14:05
TSM

Registered: Jan 2007
Posts: 42
Hires bitmap RAM arrangement

I wanted to make a little program to display the "Doodle" picture file from this page:

http://www.editorix.org/congo/html/c64_image_formats__part_i.ht..

It loads at $1C00, so you have screen data at $1C00 and bitmap data at $2000. I set everything up very carefully (screen mode, base VIC address, screen RAM and bitmap RAM addresses) and the bitmap is correct but the colors are all messed up. If I move the screen data to $0C00 and change the address accordingly in $D018, then it works.
I wanted to display the picture without moving any data around; is this possible at all?
Strangely, if I save a snapshot with Vice at the messed-up screen and feed the file to "vicegrab", it will spit up a perfectly working .prg file (although with screen RAM @ $0C00)!
2014-02-15 14:17
Mixer

Registered: Apr 2008
Posts: 452
Please, take a minute to familiarize yourself with c-64 memory arrangement using common sources. (codebase,mapping c-64) etc.

Using $1000-$2000 for graphic data the way you wish is not doable. VIC sees system fonts there. Thus you need to relocate screen/color data.
2014-02-15 14:18
tlr

Registered: Sep 2003
Posts: 1790
The VIC always sees the char rom at $1000-$1fff and $9000-$9fff so if you point screen fetch to $1c00 you'll get the screen memory fetched from the inverted lower case charset.

You could just load the data to a different load address, say $5c00 and it'll be fine.
2014-02-15 14:22
TSM

Registered: Jan 2007
Posts: 42
Whoops, I overlooked that! Thank you!
2014-02-15 14:25
Krill

Registered: Apr 2002
Posts: 2980
Just for the record, VIC can see RAM at $1000-$1fff in the Ultimax memory configuration, which can be enabled using a cartridge.
(Mixer, tlr: I'm sure you know this and just didn't mention it for the sake of simplicity, but your absolute qualifiers seemed a bit too strict.)
2014-02-17 03:26
Graham
Account closed

Registered: Dec 2002
Posts: 990
If you don't want to move memory around, load the image to address $5C00. The VIC-bank $4000-$7FFF doesn't have any restrictions due to character ROM mapping.
2014-02-17 13:17
TSM

Registered: Jan 2007
Posts: 42
Thanks Graham, I did just that. Then, just the base address for the VIC had to be updated.
2014-02-17 16:43
Cruzer

Registered: Dec 2001
Posts: 1048
Krill: But doesn't the VIC just see the RAM at $0000-$0fff when looking at $1000-$1fff in the Ultimax memory configuration, since there is only 4K of RAM available? Thanks for pointing out this very important and relevant fact, btw. :)
2014-02-17 17:40
Oswald

Registered: Apr 2002
Posts: 5094
more cool facts: VICII will also display the contents of $0000 and $0001 instead of the CPU port. ;) there were also some wild speculations in a c= hacking (iirc) on how to write there. (have VICII read the data to be written while cpu sets bus to write)
2014-02-17 17:51
chatGPZ

Registered: Dec 2001
Posts: 11386
nothing to speculate there... i have written a little test program recently that does just that, check this :)
2014-02-17 19:59
Oswald

Registered: Apr 2002
Posts: 5094
its hard to see what it does (counts upwards, screen is at $0000?) so you have prooved this writing method works? and vice even emulates it? weird it does, the perequisites sound like they are only needed for this scenario.
2014-02-17 22:12
chatGPZ

Registered: Dec 2001
Posts: 11386
vice emulates it for quite some time :) its not very hard to do either, the VIC fetches from $3fff in border area. so all you need to do is wait for border, write the value you want to go to $00 to $3fff, and write (whatever) value to $00. same for $01 respectively. check readme and source here
2014-02-18 09:19
Krill

Registered: Apr 2002
Posts: 2980
Quote: Krill: But doesn't the VIC just see the RAM at $0000-$0fff when looking at $1000-$1fff in the Ultimax memory configuration, since there is only 4K of RAM available? Thanks for pointing out this very important and relevant fact, btw. :)

In Ultimax mode, the CPU can only access the lowmost 4 kB of internal RAM, but VIC sees internal RAM beyond that, including the $1000..$1fff and $9000..$9fff ranges.
(However, it reads external memory at $3000..$3fff of each 16 kB VIC bank, and can even be forced to only see external memory, but that is another story.)

You can confirm this by putting graphics in the usually non-displayable memory range as the OP did, and then freeze using a freezer cartridge. When freezing, it will briefly switch into Ultimax mode, revealing the graphics normally hidden underneath the character generator ROM.

Action Replay and similar cartridges allow you to programmatically enable the Ultimax mode. With some code below $1000, disable interrupts and write #$03 to $de00, and the graphics are revealed permanently.

Sources:
http://skoe.de/docs/c64-dissected/pla/c64_pla_dissected_a4ss.pdf
http://codebase64.org/doku.php?id=base:memory_management
http://ar.c64.org/wiki/Hiding_kilobytes_C%3DHacking_Issue_7.txt
http://www.floodgap.com/retrobits/ckb/secret/ultimax.html
http://ar.c64.org/wiki/Action_Replay
2014-02-18 11:23
Oswald

Registered: Apr 2002
Posts: 5094
Quote: vice emulates it for quite some time :) its not very hard to do either, the VIC fetches from $3fff in border area. so all you need to do is wait for border, write the value you want to go to $00 to $3fff, and write (whatever) value to $00. same for $01 respectively. check readme and source here

So VICII will leave the data on the bus it has read, and the CPU will drive the R/W line to write, but not change bus contents since it pushes the data internally, correct ?

what other stuff may have required VICE to emulate what happens to the memory on such a low level ?
2014-02-18 12:42
JackAsser

Registered: Jun 2002
Posts: 2014
Quote: So VICII will leave the data on the bus it has read, and the CPU will drive the R/W line to write, but not change bus contents since it pushes the data internally, correct ?

what other stuff may have required VICE to emulate what happens to the memory on such a low level ?


A similar "feature" is the last OP-code read will become d8xx-color in the FLI-bug area etc. You simply need to emulate the memory bus behavior correctly and not just set a byte in some array.
2014-02-18 12:55
Oswald

Registered: Apr 2002
Posts: 5094
thanks, that explains.
2014-02-18 16:54
chatGPZ

Registered: Dec 2001
Posts: 11386
another thing is the "garbage" that you can read from open i/o space
2014-02-22 10:50
Copyfault

Registered: Dec 2001
Posts:
Quoting Krill
...
Action Replay and similar cartridges allow you to programmatically enable the Ultimax mode. With some code below $1000, disable interrupts and write #$03 to $de00, and the graphics are revealed permanently.


Wondering if there are demos already that utilize this? Since years (if not decades) every compo-machine comes equipped with an AR, so it should be rather probable...
2014-02-22 23:52
chatGPZ

Registered: Dec 2001
Posts: 11386
i doubt it, as ultimax mode also means that only the first 4k of memory are available as RAM - so you could display gfx from the non existing memory at $1000 =D (you could abuse it in cartridge memory at $9000 - not very useful though)
2014-02-23 11:56
Copyfault

Registered: Dec 2001
Posts:
Groepaz, it's correct that in ultimax there's only 4k of RAM ($0000-$0fff), but this ofcourse only applies for the cpu! The VIC sees all of'em 64k.

By switching to ultimax at the beginning of the display area and swichting back to full RAM/IO access e.g. at the beginning of the lower border, I guess some "nice things" might be possible.

Hmm, somehow cries for a 4K AR Compo ;)
2014-02-23 15:50
chatGPZ

Registered: Dec 2001
Posts: 11386
Quote:
but this ofcourse only applies for the cpu!

yes. forgot about that /o\
2014-02-24 13:32
Krill

Registered: Apr 2002
Posts: 2980
Quoting Copyfault
By switching to ultimax at the beginning of the display area and swichting back to full RAM/IO access e.g. at the beginning of the lower border, I guess some "nice things" might be possible.

Hmm, somehow cries for a 4K AR Compo ;)
Hmm, while there might be some things not possible otherwise (display RAM under chargen ROM, use AR extra RAM), i think the gain in possibilities will be quite subtle and not as striking as, e.g., using REU DMA transfers to hammer a single register with a new value every cycle.

I always thought of Ultimax mode as a means to have VIC display external memory contents without the need to hog the bus or CPU with memory transfers. Something like piping a preprocessed full-framerate video stream from a PC into a cartridge and let VIC display it just like that, while the CPU is free to replay high-res samples which also come in through the cartridge.
Of course, that'd just be a toy not giving much more than the novelty of watching TV or Youtube through a VIC+SID filter :) (Could Chameleon be used for such a hack?)
2014-02-24 16:43
ChristopherJam

Registered: Aug 2004
Posts: 1409
An ultimax mode demo might open the door for many more lines of char based FPP - you'd get 16*8=128 lines in *every* bank, not just the 'clean' one.

Of course, fitting your display list code and the update code around a memory map that has data in the first 40 bytes of every 1k, and most of every 2k corrupted every 8 bytes.. it would not be a trivial undertaking.
2014-02-24 17:52
chatGPZ

Registered: Dec 2001
Posts: 11386
Quote:
Could Chameleon be used for such a hack?

much of how the chameleon works is based on that ultimax idea you described, so yes :)
2014-02-25 15:18
AmiDog

Registered: Mar 2003
Posts: 97
I've tried to understand the Ultimax mode, but I always get confused. My idea was to use the Ultimax mode to be able to quickly switch between lots of charsets (since the VIC can read from the cartridge in Ultimax mode). Also, since the VIC can access all of the 64k of RAM even in Ultimax mode, one should be able to put sprites there as normal.

The plan was to have a cartridge with lots of RAM, using the IO area to write to it using paging, and run the code from the cartridge RAM using the two ROM areas that are available in Ultimax mode. Unless it's actually possible to write to the ROM areas in Ultimax mode, in which case one don't have to resort to the IO area, but I don't think the ROM areas are writable.

The main problem is to actually find a cartridge which has some 512KB or more of RAM and which can be told to put the C64 into Ultimax mode at will... Perhaps modding the 1541U firmware could work.
2014-02-25 15:48
chatGPZ

Registered: Dec 2001
Posts: 11386
thats another property of ultimax: write signal is generated for the whole memory area - the ultimax was designed so cartridges could bring whatever additional memory they need.
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Guests online: 120
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Original Suppliers
1 Derbyshire Ram  (9.7)
2 Fungus  (9.3)
3 Black Beard  (9.2)
4 Baracuda  (9.2)
5 hedning  (9.1)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.086 sec.