Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user eightbitswide ! (Registered 2024-12-24) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > [gamedev] Reading level data problem
2005-10-03 18:43
Bastet

Registered: Jul 2005
Posts: 88
[gamedev] Reading level data problem

Hi Folks!

I try to code something in asm, and as i like them its going to be a simple RPG.
But now i have a little problem, how to read the map data?
I have this, hardcoded for now, testdungeon in my programm:
party: ;X first and then Y
!byte $01,$02

dungeon1: ;16x16 grid of map data
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$01,$01,$01,$00,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$01,$00,$01,$00,$01,$00,$01,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$01,$00,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00

As i am used to do high level programming, i cant figure out how to get something from there with the party coordinates.
I hope somebody can give at least a hint how to get an address out of x and y.

 
... 19 posts hidden. Click here to view all posts....
 
2005-10-09 07:30
Bastet

Registered: Jul 2005
Posts: 88
Hey, i am coding a game, not a demo ;)
Aaaand i got an idea of manipulating the charset. Ok, i have done it the cheapest way possible, made it with cuneinform, inserted it into the source at $2000 and told the VIC where to find it.

If you want to see.
--> http://fileanchor.com/5356-d (1683 byte -ZIP)

Dev is slow but steady.
Next stop is a messaging system using the last 5 lines on the screen or so.
After that i will include the PCs and then the first NPCs, with them a battle screen.

If anyone wants to give me some GFX, be my guest ^.^
2005-10-09 12:24
Ben
Account closed

Registered: Feb 2003
Posts: 163
Looks better already :)
What kind of game is this supposed to become?
2005-10-09 14:40
Laxity

Registered: Aug 2005
Posts: 459
"lda y"?... what compiler are you guys using? Shouldn't that be "tay"?
2005-10-09 15:14
Ben
Account closed

Registered: Feb 2003
Posts: 163
Quote: "lda y"?... what compiler are you guys using? Shouldn't that be "tay"?

Hehe :)

x and y are variables of some sort..
This pseudocode would obviously become

a)
"y lda #0"
with y the label, where you would need to "sta y+1".
This would compile to something like "sta $1001"

b)
"y .byte 0
[..]
lda y"
where you would need to "sta y", which would compile to something like
"1000 0
1001 lda $1001
"
and "sta $1000"

c)
"y = $d0
[..]
lda y"
where you would need to "sta y", which would compile to
"lda $d0" and "sta $d0"

et cetera.. et cetera..
2005-10-09 16:38
Bastet

Registered: Jul 2005
Posts: 88
Quote: Looks better already :)
What kind of game is this supposed to become?


A RPG of some sort
2005-10-09 17:04
Laxity

Registered: Aug 2005
Posts: 459
Quote: Hehe :)

x and y are variables of some sort..
This pseudocode would obviously become

a)
"y lda #0"
with y the label, where you would need to "sta y+1".
This would compile to something like "sta $1001"

b)
"y .byte 0
[..]
lda y"
where you would need to "sta y", which would compile to something like
"1000 0
1001 lda $1001
"
and "sta $1000"

c)
"y = $d0
[..]
lda y"
where you would need to "sta y", which would compile to
"lda $d0" and "sta $d0"

et cetera.. et cetera..


doh! Stupid me ;)
2005-10-10 13:20
White Flame

Registered: Sep 2002
Posts: 136
Using ORA instead of ADC lets you get rid of the CLC:

lda party+1 ;y
asl
asl
asl
asl
ora party ;x
tax
lda dungeon1,x

Then again, if your party 'x' and 'y' are guaranteed to be between 0 and 15, carry would be clear at that point regardless.
2005-10-10 14:08
Oswald

Registered: Apr 2002
Posts: 5094
gah, I shouldnt at first post into this topic, I knew all smartheads will show up and tell how it could be done 1 cycle faster or 1 byte shorter :)
2005-10-10 14:28
JackAsser

Registered: Jun 2002
Posts: 2014
@Oswald: Isn't that what C64 is all about? :D
2005-10-10 14:30
Bastet

Registered: Jul 2005
Posts: 88
@Oswald:
I find it funny, lets see when this cant be optimized any further.

@White Flame:
Cool, with this i can trow away the multiplication table for 16x16 maps.
BTW: In wich dimeonsions is that code working?
Can i easily switch to 32x32 with it?
Previous - 1 | 2 | 3 - Next
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
MWR/Visdom
SLC
Exploding Fi../Techn..
CA$H/TRiAD
Guests online: 101
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 The Demo Coder  (9.6)
6 Edge of Disgrace  (9.6)
7 What Is The Matrix 2  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Cubic Dream  (9.6)
3 Party Elk 2  (9.6)
4 Copper Booze  (9.6)
5 X-Mas Demo 2024  (9.5)
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 Censor Design  (9.3)
5 Triad  (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.037 sec.