| |
Bizzmo Account closed
Registered: Mar 2005 Posts: 82 |
Video bank selection...
I'm in the process of re-learning to code! After 15 years or so I'm more than a little rusty so please excuse any silly questions!
I'm planning a little game, which is currently using the following memory configuration. (At the moment all this is stuffed at $C000. I want to use a bank without a ROM image so I can have as much memory available for graphics.
Data is currently at these offsets:
+$0000 - Screen Buffer 1
+$0400 - Screen Buffer 2
+$0800 - Character Set
+$1000 - Sprites Definitions...
Is this going to cause me a problem? Trying to load data to $D000 causes WinVice to do strange things! ;-)
Any tips would be appreciated!
Bizz.
|
|
| |
iopop
Registered: Dec 2001 Posts: 317 |
Use a cart like action replay to load files that are >202 blocks. Normal basic can not load files over $d000. Another solution would be to pack your file with pucrunch/exomizer or any packer of choice.
I can not see any problems with the mem layout. That is as long as you do not need to change the sprites in runtime. Then you have to swap $d000 to ram, change them, swap back to io. |
| |
Stryyker
Registered: Dec 2001 Posts: 468 |
I'm embarrassed to say I can't remember if you'll see sprites at $1000-$1fff but I know your own font will not be displayed from that section of memory. Probably just a character/bitmap issue |
| |
Raf
Registered: Nov 2003 Posts: 343 |
Quote: I'm embarrassed to say I can't remember if you'll see sprites at $1000-$1fff but I know your own font will not be displayed from that section of memory. Probably just a character/bitmap issue
I think it's not issue but the only way to use char-rom (think from where would vic take the char defs when it is not addresed in his space-range?) |
| |
iopop
Registered: Dec 2001 Posts: 317 |
@strykker: Sprites or any gfx will not be visible correctly if placed at $1000-$1fff or $9000-$9fff.
However, Bizzmo want to put his gfx in bank 0. ie. $c000-$ffff which is all good for gfx. |
| |
Scout
Registered: Dec 2002 Posts: 1570 |
Quote: @strykker: Sprites or any gfx will not be visible correctly if placed at $1000-$1fff or $9000-$9fff.
However, Bizzmo want to put his gfx in bank 0. ie. $c000-$ffff which is all good for gfx.
I have this nifty little program called "D018 Manager" which generates the correct settings for $DD00, $D018 and the spritepointers.
When I'm home tonight, I'll look it up and post it in CSDB.
R.
---
-= Silicon Ltd. =-
http://www.deco-design.com/scl |
| |
Bizzmo Account closed
Registered: Mar 2005 Posts: 82 |
Great, thanks for all the responses. It sounds as if the only thing causing me problems is loading the data from $D000...
Anyone suggest a way to do this using WinVice? I'm at work, so using a *real* 64 is out of the question! I've tried loading the sprite data in the WinVice monitor, but this doesn't work either. |
| |
Graham Account closed
Registered: Dec 2002 Posts: 990 |
You need to load the sprite data to another location and copy the data to $D000 after that. |
| |
Scout
Registered: Dec 2002 Posts: 1570 |
Quote: Great, thanks for all the responses. It sounds as if the only thing causing me problems is loading the data from $D000...
Anyone suggest a way to do this using WinVice? I'm at work, so using a *real* 64 is out of the question! I've tried loading the sprite data in the WinVice monitor, but this doesn't work either.
You have 3 options loading to $D000 with WinVice
Option 1:
Use a ROM image from the Action or Retro Replay cartridge to emulate the cart.
Option 2:
Load using the WinVice monitor.
When you're in the monitor enter "bank ram"
The RAM "under" $D000 (and up) will be visible.
You can now load stuff using the l-command
Option 3:
Load the data in low memory, set the $01 register to #$34 (afaik) and transfer it to $D000 by doing some coding.
R.
---
-= Silicon Ltd. =-
http://www.deco-design.com/scl |
| |
Bizzmo Account closed
Registered: Mar 2005 Posts: 82 |
Thanks very much! :-) |
| |
Scout
Registered: Dec 2002 Posts: 1570 |
Quote: Thanks very much! :-)
I've added that D018 Manager tool to CSDB
D018 Manager
R.
---
-= Silicon Ltd. =-
http://www.deco-design.com/scl |
| |
Majikeyric
Registered: Sep 2002 Posts: 83 |
Quote: I've added that D018 Manager tool to CSDB
D018 Manager
R.
---
-= Silicon Ltd. =-
http://www.deco-design.com/scl
Thanks! Very useful !
|
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
For people having problem with the bits in $01 (like myself) I can strongly recommend C= Hacking, issue 7. (http://www.canberra.edu.au/~scott/C=Hacking/C-Hacking7.html) under topic "Hiding kilobytes". There is a nice matrix there which I use when I get unsure.
/JackAsser |
| |
iopop
Registered: Dec 2001 Posts: 317 |
To calculate the value to put into $D018 I ususally use this formula:
lownibble = (char_mem-((3-gfx_bank)*$4000))/$0400
hignibble = (scr_mem-((3-gfx_bank)*$4000))/$0400
Where char_mem and scr_mem have to be at $0800 respectively $0400 boundaries and gfx_bank = {0 .. 3}. |
| |
Stryyker
Registered: Dec 2001 Posts: 468 |
I experienced $01 issues with loading and saving. I was patient at the time with no carts to freeze or reset. I would use the standard ROM routines then make a drink :)
I would read a byte, SEI, $01=$34, write data to memory, $01=$37, continue until end of file. |
| |
White Flame
Registered: Sep 2002 Posts: 136 |
Here's my $d018/$dd00 setup for use in cc65. Set CharBase and FontBase to their full addresses, and everything works out. Just make sure they're in the same 16k bank. :)
; Set char/font pointers
lda #((CharBase >> 6) & $f0) | ((FontBase >> 10) & $0e)
sta $d018
; Set VIC bank
lda # ((CharBase ^ $ffff) >> 14)
sta $dd00 |
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
Growing beards are we? =D |
| |
White Flame
Registered: Sep 2002 Posts: 136 |
Actually, I've kept them trimmed to the same length for years now. :)= |
| |
yago
Registered: May 2002 Posts: 333 |
My 0.02 regarding VIC-Memorysettings:
#include <macros/graphics.inc>
vicbnk=$C000
SETVICBANK(vicbnk)
lda#SCREENFONT($C000-vicbnk,$C800-vicbnk)
sta vic.mem
where graphics.inc has:
#ifdef DLOAD
#begindef SETVICBANK(address)
lda #0
sta cia2
lda #($3f^((address/16384)^3))
sta cia2|2
#enddef
#else
#begindef SETVICBANK(address)
lda #(address/16384)^3
sta cia2
#enddef
#endif
and
#define SCREENFONT(screen,font) ((screen)/64)|((font)/1024)| %?
and vic.mem is $D018
--
If everything is worth money
money is worth nothing |
| |
Frantic
Registered: Mar 2003 Posts: 1648 |
"lda #($3f^((address/16384)^3))"?
I have to ask: Do you actually think in decimal numbers when coding? ...or do you translate $4000 to 16384 when typing the code? :)
I hate it when people use decimal notation instead of hexadecimal ;) (no offence whatsoever, it's not YOU I hate, just this phenomenon.). I think I will never understand the reasons behind it.. I suspect it's ununderstandable in principle. ;) |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
autoboy: if you started doing sprites, replacing charsets and stuff in basic, you would be also used to decimal notation :) took me years to learn all the addys in hex.
btw, bank, screen and cset selection is way too simple. I simply use
lda %xxxxxxxx
sta whatever
needs 5 seconds of thinking instead of overcomplicated adress translations. |
| |
Frantic
Registered: Mar 2003 Posts: 1648 |
Oswald: Ok, so first you initialize a zeropage memory location with the correct $d018 value? (just kidding.. Nerd laughter: HIE HEHE HAHE HI HAHE HEAI HIE HEII HI I AEE HEEE ;)
Anyway.. I guess you hinted at a possible explanation for the decimal-phenomenon. Never thought of that. Probably because I never coded much BASIC. |
| |
yago
Registered: May 2002 Posts: 333 |
Yeah, Oswald is right. The partly-hexadecimal, partly-decimal scheme is due to historical reasons.
Although "only" one-liners, these beasts evolve over the years, sometimes having old basic-stuff in it.
As I read through this Thread, there are indeed much better (faster+shorter) ways then "/16384", especially ">>14" or ">>$e" in hexadecimal ;-)
And to answer your question, autoboy: When seeing the Number 16384, my Mind switches instantly to hexadecimal and thinks: Cool, thats $4000 !
|