PacMan hardware
Re: PacMan hardware
In my information such examples do not exist.
https://www.walkofmind.com/programming/pie/hardware.htm
To refer to variable locations you might, in example, use our sccz80 slang:
char spr0_x @0x5060;
or, you could define a structure
Remember that the graphics are in a ROM chip, you'll display PACMAN characters unless you won't encode a new rom
https://www.walkofmind.com/programming/pie/hardware.htm
To refer to variable locations you might, in example, use our sccz80 slang:
char spr0_x @0x5060;
or, you could define a structure
Remember that the graphics are in a ROM chip, you'll display PACMAN characters unless you won't encode a new rom
-
- Member
- Posts: 22
- Joined: Tue Oct 04, 2022 4:25 am
Re: PacMan hardware
I declared spr0_x as a global variable:stefano wrote: ↑Fri Oct 14, 2022 10:54 pm In my information such examples do not exist.
https://www.walkofmind.com/programming/pie/hardware.htm
To refer to variable locations you might, in example, use our sccz80 slang:
char spr0_x @0x5060;
or, you could define a structure
Remember that the graphics are in a ROM chip, you'll display PACMAN characters unless you won't encode a new rom
Code: Select all
char spr0_x @0x5060;
void main()
{
int i;
SetupLevel(); /* Display the first level */
spr0_x=112;
/* Loop keyhandler till you finished the game */
while (CheckNotFinished())
Gamekeys();
}
Re: PacMan hardware
I'm not sure those value can be read back
https://github.com/mamedev/mame/blob/ab ... .cpp#L1027
MAME sources include interesting comments, too
https://github.com/mamedev/mame/blob/ab ... an.cpp#L45
https://github.com/mamedev/mame/blob/ab ... .cpp#L1027
MAME sources include interesting comments, too
https://github.com/mamedev/mame/blob/ab ... an.cpp#L45
-
- Member
- Posts: 22
- Joined: Tue Oct 04, 2022 4:25 am
Re: PacMan hardware
What is the best way to set the sprite ID bits in the 4FF0h register?
Re: PacMan hardware
Just guessing, because I never did sprite stuff with pacman: what about #defining constants for the bits and using the | OR operator ?
https://stackoverflow.com/questions/293 ... -constants
https://stackoverflow.com/questions/293 ... -constants
-
- Member
- Posts: 22
- Joined: Tue Oct 04, 2022 4:25 am
Re: PacMan hardware
That's how the main function looks now:
But every time I try to build a new code, compiler gives me such error:
The most funny thing here is that symbols of 71st line before fifth is occupied with an indent.
Code: Select all
#define spr0 @0x4FF0|0xFC
char spr0_x @0x5060;
void main()
{
int i;
SetupLevel(); /* Display the first level */
spr0=0x2c;
spr0_x=112;
/* Loop keyhandler till you finished the game */
while (CheckNotFinished())
Gamekeys();
}
Code: Select all
C:\Users\user\Downloads\z88dk\examples\pacman>make
zcc +pacman -vn -c dstar.c
dstar.c:71:3: error: Invalid expression
dstar.c:71:4: fatal error: Expected ';'
Compilation aborted
make: *** [Makefile:37: dstar.o] Error 1
Re: PacMan hardware
It must be the '@' hack.
Please try compiling it with a normal 'char' declaration, if it works, please try by inserting it back with the address in decimal.
Please try compiling it with a normal 'char' declaration, if it works, please try by inserting it back with the address in decimal.
-
- Member
- Posts: 22
- Joined: Tue Oct 04, 2022 4:25 am
Re: PacMan hardware
Code: Select all
char spr0 @0x4FF0|0xFC;
char spr0_x @0x5060;
void main()
{
int i;
SetupLevel(); /* Display the first level */
spr0=0x2c;
spr0_x=112;
/* Loop keyhandler till you finished the game */
while (CheckNotFinished())
Gamekeys();
}
Re: PacMan hardware
so, I suppose you solved the compile error.
That bitwise expression seems strange to me:
char spr0 @0x4FF0|0xFC;
what are you willing to do?
That bitwise expression seems strange to me:
char spr0 @0x4FF0|0xFC;
what are you willing to do?
-
- Member
- Posts: 22
- Joined: Tue Oct 04, 2022 4:25 am
Re: PacMan hardware
char spr0 @0x4FF0;
spr0=0x2c|0x...
You have no way to touch only some bit.
spr0=0x2c|0x...
You have no way to touch only some bit.
-
- Member
- Posts: 22
- Joined: Tue Oct 04, 2022 4:25 am
Re: PacMan hardware
Shouldn't that be this?
char spr0 @0x4FF0;
spr0 |= 0x2c;
char spr0 @0x4FF0;
spr0 |= 0x2c;
Re: PacMan hardware
You can't do that, because it is not a memory address but a write only mapped port. You can't predict the value you will get, so you'll just add dirt to your values.
-
- Member
- Posts: 22
- Joined: Tue Oct 04, 2022 4:25 am
Re: PacMan hardware
I think the only way is to always write all the bits.
If you wish to keep the previous value, you could store a copy in a variable.
unsigned char spr0 @0x4FF0;
unsigned char spr0_save=0;
spr0_save|=0x02c;
spr0=spr0_save;
spr0=0x2c|0x...
If you wish to keep the previous value, you could store a copy in a variable.
unsigned char spr0 @0x4FF0;
unsigned char spr0_save=0;
spr0_save|=0x02c;
spr0=spr0_save;
spr0=0x2c|0x...
-
- Member
- Posts: 22
- Joined: Tue Oct 04, 2022 4:25 am
Re: PacMan hardware
Code: Select all
unsigned char spr0 @0x4FF0;
unsigned char spr0_save=0;
char spr0_x @0x5060;
void main()
{
int i;
SetupLevel(); /* Display the first level */
spr0_save|=0x02c;
spr0=spr0_save;
spr0=0x2c|0xfc;
spr0_x=112;
/* Loop keyhandler till you finished the game */
while (CheckNotFinished())
Gamekeys();
}
Code: Select all
spr0_save|=0x02c;
spr0=spr0_save;