Jump to content
IGNORED

The Wanderers WIP


Link6415

Recommended Posts

Hello.

 

I am currently working on an RPG for the beloved Commodore 64.

 

I will share more, but I need to know how to put my charset at $E000 from a BASIC prg. A LISTing would be excellent, but an explanation would be okay too (although I will have a lot of questions.)

 

After I get this in, I'll have more to show and tell.

 

:)

Link to comment
Share on other sites

I will share more, but I need to know how to put my charset at $E000 from a BASIC prg. A LISTing would be excellent, but an explanation would be okay too (although I will have a lot of questions.)

The problem there is that you'll need to move the screen RAM as well, character sets and screens have to exist in the same 16K video bank... and BASIC will need to be told that the screen is no longer at 1024 as well if you're relying on PRINT commands.

 

To switch to video bank 3 ($c000 upwards):

poke56576,196

 

To select $c000 for screen memory and $e000 for character set:

poke53272,8

 

To get BASIC talking to the $c000 screen:

poke648,192

 

If you run/stop and restore the machine it won't revert to the standard $0400 screen, so poke648,4 is needed to get the cursor back to the right place.

  • Like 1
Link to comment
Share on other sites

post-43309-0-54990000-1443916193_thumb.pngpost-43309-0-67599300-1443916211_thumb.pngpost-43309-0-67169000-1443916219_thumb.pngpost-43309-0-89268900-1443916301_thumb.png

 

Sorry if this is not the conventional way of posting images on this forum. Things are a little different over on Lemon. I am a noob here.

 

Okay, the first pic is the listing of the program i used to put the charset in memory. The file used LOADed was exported from Charpad.

 

Is everything good here?

 

The second pic shows the tiles, sucessfully POKEd onto the screen. :D

 

The third pic shows the listing of the program i used to test out bitmap mode. This is where I think I messed myself over.

 

Is everything good here?

 

The fourth pic shows the result of my bitmap demo. Hm. Something seems to be amiss. I'm confused. Is the problem because I don't understand bitmap mode, or did I mess up the program that puts the charset in memory?!? :?

 

Ima confuzzled kid and i need helps plz. :P

Link to comment
Share on other sites

I may have forgotten 1 teensy weensy detail in my first post.

 

I'm using bitmap mode.

Bitmap mode... from BASIC? Is there any reason why you're going down that route rather than using faster, easier to manipulate character-based graphics?

Link to comment
Share on other sites

I'm only using BASIC to test out my charset and make sure I can still access the bitmap.

 

Although I may use a combination of ML and BASIC for the final.

 

But, I still need to get this bitmap thing figured out.

Okay, that sounds a bit more viable although i'd still advise using characters for speed and memory reasons personally. The BASIC program in that screenshot is using a base address of $2000 (bank 0) for the bitmap and putting the colour at $c000 (bank 3) - that won't work, both need to be in the same 16K bank. Bitmaps in bank 3 can be at $c000 or $e000 with the latter being easier to work with.

 

i'm not awake yet, but remove lines 6 and 7, replace them with the POKEs i gave you, set base to 57344 ($e000) in line 3 and try that?

Link to comment
Share on other sites

Wait, POKEs you gave me? POKE 56576,196 and POKE 53272? I put those in the program to load in the charset. It wouldn't work without them.

 

And won't putting the bitmap at $E000 overwrite the char data? I need it, to draw the tiles on the bitmap!

 

The bitmap works correctly. But I am getting the same result when stopping the program as before (see the fourth picture). I removed line 21 and the bitmap turned off, but the chars were random lines and dots!

 

:(

Edited by Link6415
Link to comment
Share on other sites

Wait, POKEs you gave me? POKE 56576,196 and POKE 53272? I put those in the program to load in the charset. It wouldn't work without them.

They also works for the bitmap. 53272 sets screen and character position but those become the colour RAM and bitmap pointer when using bitmap mode. 56576 sets the VIC-II bank, in this case bank 3 which is $c000 to $ffff.

 

And won't putting the bitmap at $E000 overwrite the char data? I need it, to draw the tiles on the bitmap!

Since you can't read from $e000 with BASIC (and need to disable the ROM there and BASIC's ROM to do so from assembly language) it'd be sensible to instead move the characters down to somewhere you can get at them like $c800 - you can then read from the characters and write to $e000 or switch to using character-based graphics with the screen at $c000 and the characters at $c800

 

The bitmap works correctly. But I am getting the same result when stopping the program as before (see the fourth picture). I removed line 21 and the bitmap turned off, but the chars were random lines and dots!

You've added changes i suggested to 648 amd 56576 at the start of your program so you'll need to restore the original values at the end as well (which are 4 and 199 respectively) otherwise it dumps out to a text-based display but still in bank 3 where there's no ROM character set.

  • Like 1
Link to comment
Share on other sites

Sounds good.

 

The original program that loaded the charest loaded it to $c800 so that will be easy - I'll just switch out the programs. Then I'll add your changes to the bitmap program and we'll see what happens.

 

I won't be able to get anything done till the evening, I'll try then.

 

Thanks!

Link to comment
Share on other sites

Yes! Everything is working! The bitmap turns on correctly, does what it's supposed to, and turns off correctly, bringing me back to text mode.

I played around with your pokes, is the listing okay?

post-43309-0-20918100-1444300998_thumb.png

Edited by Link6415
Link to comment
Share on other sites

I played around with your pokes, is the listing okay?

i can't see any references to 56576 to change video banks back and forth...? There's a little redundancy; line 4 sets BLOC to V+24 (where V is 53248) but that comes out as 53272 so you can either remove like 4 or change lines 7 and 20 to use BLOC instead of the direct value.

Link to comment
Share on other sites

Weird things are happening all over the place. SAVE "@:BITMAPDEMO",8,1 saves a program CALLED "@BITMAPDEMO"!!! WTF! Ugh.

 

There is one last option.

 

I think I can store the "char" data in an unused area in memory. It won't actually be for the chars, the real charset will be in the default area and remain unchanged. When I want to plot tiles or "chars" on the bitmap, I won't read the data from the character memory, I'll read it from the unused area in memory where I put the "charset".

 

Hmm. That sounds good, actually.

 

What do you think? Does that sound like a feasible solution?

Link to comment
Share on other sites

56576 was turning the chars into confetti when I turned off the bitmap, so I took it out. The program works though.

Like i said, you need to set it back when exiting as well or you leave the machine in the wrong video bank. If you don't set it at the start you're writing to the bitmap at $e000 in the program but the VIC-II is displaying the one at $2000.

 

I think I can store the "char" data in an unused area in memory. It won't actually be for the chars, the real charset will be in the default area and remain unchanged. When I want to plot tiles or "chars" on the bitmap, I won't read the data from the character memory, I'll read it from the unused area in memory where I put the "charset".

i'm not sure why you'd want to do that if the characters are already going to be in memory once at $c800?

 

And what would the best unused area in memory be? How do I put char data there?

BASIC programs run $0801 to $9fff, BASIC ROM is at $a000 to $bfff, $c000 to $cfff is free, I/O sits $d000 to $dfff and Kernel ROM is $e000 onwards - only the first and third of those spaces is available to read from with BASIC (you can write to all of them except the I/O space) and you lose space for your program with the first.

 

You can turn ROMs off to get at what's under them from assembly language.

Link to comment
Share on other sites

Remember the screen matrix really is just 1024 bytes, so $C000 - $C3FF. That would leave you with another 3K between $C400 - $CFFF to store character definitions, possibly an alternative bitmap colour screen and then have the actual bitmap data at $E000 that is writable, but not easily readable. Did I understand you correctly that you will plot characters in place in bitmap mode? In that case, remember the organization of graphics data is different, in such way in bitmap mode you plot one row of 8 pixels * 40 columns, then next row of 8 pixels * 40 columns, while character data obviously are 8 pixels * 8 rows (bytes) right away. A simple *40 will solve that though.

Link to comment
Share on other sites

PFFF!

 

Okay, I made a few assumptions.

 

The "strange things" were just me being tired because I was working on this at 4 AM.

 

If you look at my post, I put "@BITMAPDEMO". That is exactly how I typed it. (Is there a facepalm smiley?). If you didn't notice, it should have been "@:BITMAPDEMO".

 

The other thing that I found weird was the result of using caps in a REM. *sigh*

(Upon flipping through my C64 system guide, I realized my mistake.)

 

 

Anyway, I'm just going to proceed with the original plan. Thanks for the help, it may come in handy if I run into a REAL problem.

Link to comment
Share on other sites

Well I think this was the final straw. I can't PEEK the char data. There's too many problems with this, and nice scrolling isn't necessary for an rpg anyway. I think I'll just use char mode.

You can PEEK the character data if it's at $c800 but not when it's under the ROMs. But nice scrolling would usually mean character-based graphics anyway; trying to even double buffer shift a bitmap in assembly language isn't exactly something i'd recommend for a beginner.

Link to comment
Share on other sites

Horizontal scrolling is done through the VIC-II register at 53270, ideally by setting the display to 38 columns so you get one hidden column on each side of the screen.

 

FOR I=199 TO 192 STEP -1:POKE 53270,I:NEXT

 

Then you make a hard copy of the screen shifted one character to the left (possibly using double buffered screen matrix, so you shift between them with POKE 53272), copy the next content into the rightmost column and scroll again.

 

This means the VIC-II does the soft scrolling for you. It will work in hires mode too, but instead of copying up to 37*25 cells = 925 bytes + inserting another 25 bytes of new character data, you'd be copying the bitmap data of 37*8*25 = 7400 bytes + inserting another 25*8 = 200 bytes of new data.

 

If only a small portion of the bitmap needs to scroll, less data needs to be moved but then you also need to use raster interrupt to time it properly so you only change the value of 53270 during the desired raster lines. Of course this is the same if you work with character mode so it may already be part of the plan.

 

Anyway, wouldn't a RPG contain very much repeated graphics: walls, doors, objects, monsters anyway which are more handy to use in character mode than going through bitmap mode where you have to plot each pixel individually?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...