Jump to content

Photo

The Wanderers WIP

C64 RPG new game WIP

85 replies to this topic

#1 Link6415 OFFLINE  

Link6415

    Chopper Commander

  • 131 posts
  • balls-deep in the 6502
  • Location:Ohio

Posted Sat Oct 3, 2015 2:01 PM

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.

:)

#2 TMR OFFLINE  

TMR

    River Patroller

  • 3,473 posts
  • Beeping the horn on the data bus
  • Location:Leeds, U.K.

Posted Sat Oct 3, 2015 4:07 PM

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.

#3 Link6415 OFFLINE  

Link6415

    Chopper Commander

  • Topic Starter
  • 131 posts
  • balls-deep in the 6502
  • Location:Ohio

Posted Sat Oct 3, 2015 5:40 PM

Ok.

Good news:
Got the tiles at $E000 :)

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

I'm using bitmap mode.

#4 7800fan OFFLINE  

7800fan

    Quadrunner

  • 5,606 posts
  • Location:MI

Posted Sat Oct 3, 2015 6:03 PM

it has been a while since I've dabbled into BASIC bitmapped screen but when you're in bitmap, memory location 1024-2023 is still used for setting colors.

 

I've become too dependent on Super Expander for ez graphics on my 64.



#5 Link6415 OFFLINE  

Link6415

    Chopper Commander

  • Topic Starter
  • 131 posts
  • balls-deep in the 6502
  • Location:Ohio

Posted Sat Oct 3, 2015 6:03 PM

Attached File  Charload Listing.png   2.46KB   2 downloadsAttached File  YAY!!! Tiles!.png   2.14KB   2 downloadsAttached File  Bitmap Listing.png   5.25KB   2 downloadsAttached File  Bitmap Garbage.png   1.03KB   3 downloads

 

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



#6 Link6415 OFFLINE  

Link6415

    Chopper Commander

  • Topic Starter
  • 131 posts
  • balls-deep in the 6502
  • Location:Ohio

Posted Sun Oct 4, 2015 6:51 AM

Aha! There was a mistake!
Line 7 should be

7 POKE BSET,PEEK(BSET)OR32

Okay, the bitmap works, but isn't turning off correctly... Hmm.

I'm going to eat breakfast and then maybe I can figure this out...

#7 TMR OFFLINE  

TMR

    River Patroller

  • 3,473 posts
  • Beeping the horn on the data bus
  • Location:Leeds, U.K.

Posted Mon Oct 5, 2015 3:24 AM

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?

#8 Link6415 OFFLINE  

Link6415

    Chopper Commander

  • Topic Starter
  • 131 posts
  • balls-deep in the 6502
  • Location:Ohio

Posted Mon Oct 5, 2015 4:57 AM

Nonononono no.

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.

#9 TMR OFFLINE  

TMR

    River Patroller

  • 3,473 posts
  • Beeping the horn on the data bus
  • Location:Leeds, U.K.

Posted Tue Oct 6, 2015 1:19 AM

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?

#10 Link6415 OFFLINE  

Link6415

    Chopper Commander

  • Topic Starter
  • 131 posts
  • balls-deep in the 6502
  • Location:Ohio

Posted Tue Oct 6, 2015 3:57 AM

Thanks!

#11 Link6415 OFFLINE  

Link6415

    Chopper Commander

  • Topic Starter
  • 131 posts
  • balls-deep in the 6502
  • Location:Ohio

Posted Tue Oct 6, 2015 4:01 PM

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, Tue Oct 6, 2015 4:04 PM.


#12 TMR OFFLINE  

TMR

    River Patroller

  • 3,473 posts
  • Beeping the horn on the data bus
  • Location:Leeds, U.K.

Posted Wed Oct 7, 2015 2:58 AM

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.

#13 Link6415 OFFLINE  

Link6415

    Chopper Commander

  • Topic Starter
  • 131 posts
  • balls-deep in the 6502
  • Location:Ohio

Posted Wed Oct 7, 2015 3:54 AM

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!

#14 Link6415 OFFLINE  

Link6415

    Chopper Commander

  • Topic Starter
  • 131 posts
  • balls-deep in the 6502
  • Location:Ohio

Posted Thu Oct 8, 2015 4:40 AM

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?

Attached Files


Edited by Link6415, Thu Oct 8, 2015 4:43 AM.


#15 TMR OFFLINE  

TMR

    River Patroller

  • 3,473 posts
  • Beeping the horn on the data bus
  • Location:Leeds, U.K.

Posted Thu Oct 8, 2015 4:54 AM

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.

#16 Link6415 OFFLINE  

Link6415

    Chopper Commander

  • Topic Starter
  • 131 posts
  • balls-deep in the 6502
  • Location:Ohio

Posted Thu Oct 8, 2015 4:59 AM

I just woke up and didn't notice a couple of those things.

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

#17 Link6415 OFFLINE  

Link6415

    Chopper Commander

  • Topic Starter
  • 131 posts
  • balls-deep in the 6502
  • Location:Ohio

Posted Thu Oct 8, 2015 3:28 PM

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?

#18 Link6415 OFFLINE  

Link6415

    Chopper Commander

  • Topic Starter
  • 131 posts
  • balls-deep in the 6502
  • Location:Ohio

Posted Thu Oct 8, 2015 3:38 PM

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

#19 TMR OFFLINE  

TMR

    River Patroller

  • 3,473 posts
  • Beeping the horn on the data bus
  • Location:Leeds, U.K.

Posted Fri Oct 9, 2015 2:26 AM

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.

#20 carlsson OFFLINE  

carlsson

    Metagalactic Mule

  • 8,049 posts
  • Location:Västerås, Sweden

Posted Fri Oct 9, 2015 7:36 AM

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.



#21 Link6415 OFFLINE  

Link6415

    Chopper Commander

  • Topic Starter
  • 131 posts
  • balls-deep in the 6502
  • Location:Ohio

Posted Fri Oct 9, 2015 3:03 PM

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.

#22 Link6415 OFFLINE  

Link6415

    Chopper Commander

  • Topic Starter
  • 131 posts
  • balls-deep in the 6502
  • Location:Ohio

Posted Sun Oct 11, 2015 4:08 AM

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.

#23 TMR OFFLINE  

TMR

    River Patroller

  • 3,473 posts
  • Beeping the horn on the data bus
  • Location:Leeds, U.K.

Posted Mon Oct 12, 2015 8:39 AM

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.

#24 Link6415 OFFLINE  

Link6415

    Chopper Commander

  • Topic Starter
  • 131 posts
  • balls-deep in the 6502
  • Location:Ohio

Posted Mon Oct 12, 2015 8:03 PM

How does character scrolling work exactly?

#25 carlsson OFFLINE  

carlsson

    Metagalactic Mule

  • 8,049 posts
  • Location:Västerås, Sweden

Posted Tue Oct 13, 2015 1:50 AM

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?







Also tagged with one or more of these keywords: C64, RPG, new game, WIP

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users