structure of game file

Page 1/4
| 2 | 3 | 4

By norakomi

Paragon (1137)

norakomi's picture

09-06-2005, 13:03

Hi there !

I need some advice concerning the use of the interrupt.

globaly my game looks like this:

org $4000

call playmusic ;plays music made in scc-musixx

ld a,$c3
ld ($fd9f),a ;to make the game jump to stars
ld hl,stars ;every interrupt....
ld ($fda0),hl

scroll:
call backgrscr ;scroll background 1 pix left
jp scroll ;this part is infinitely looped

stars:
call putsprites ;paste 32 sprites in screen
call game ;here the enemy/player movement/interaction is done
ei

I end this stars routine with an ei (but NO ret)
(if I end this routine with an ret the music (scc-musixx) does not play)

And now I have problems (with the interrupt??):
the music does not play fluently when there is a lot
going on in screen .....
If I disable the music everything works fine,
if I enable the music some sprites are affected at some times....

Is the global overview given above a good way to make a game?
Thanx

Login or register to post comments

By ARTRAG

Enlighted (6932)

ARTRAG's picture

09-06-2005, 13:51

Change
ld a,$c3
ld ($fd9f),a ;to make the game jump to stars
ld hl,stars ;every interrupt....
ld ($fda0),hl

in

ld hl,stars
ld ($fda0),hl
ld a,$c3
ld ($fd9f),a

or you get a random jump (at $c9c9 probably)
if an interrupt occur between the two instructions

By norakomi

Paragon (1137)

norakomi's picture

09-06-2005, 14:48

in a konami shooter game, what is put on the interrupt and what is not?

-background scroll?
-music?
-sfx?
-plotting sprites?
-movement enemys/player?

By ARTRAG

Enlighted (6932)

ARTRAG's picture

09-06-2005, 14:53

Actually it depends.

If you want a fluid game you should be able to
process all the functions in one single interrupt.

This only guarantees full framerate.

By norakomi

Paragon (1137)

norakomi's picture

09-06-2005, 14:57

I started my game with the plotting of 32 sprites and the movement of characters/player and the interaction between characters/player/bullets all on the interrupt.

then I made background scrolling but i had to place this outside of the interrupt.
putting the background scrolling on the interrupt didnt work????

how could this be??

And I ended this interrupt allways with a RET instruction.
But now I have put music in my game and I cannot end the interrupt with an END anymore....

I dont know why this is????

By GhostwriterP

Paladin (683)

GhostwriterP's picture

09-06-2005, 19:01


Is the global overview given above a good way to make a game?

I don't think it is...

A nice way to do things is putting only music and soundfx (and screensplits) on the interrupt.

Then do something like:

ld a,1
ld (flag),a

in the interrupt routine. And sync your other routines the following way:

mainlus
xor a
ld (flag),a
wait
ld a,(flag)
or a
jr nz,wait

call move
call scroll
call whatever ; you want to do Smile

jp mainlus

Btw shouldn't there be a call to the music player in your interuptroutine?
And please do end with a RET!!! That your program is actualy working is a
complete mystery to me.

By norakomi

Paragon (1137)

norakomi's picture

09-06-2005, 19:05

haha, its getting more and more a mistery to me !!!

I just expanded bit by bit....

first starting with the sprites, then the movement of characters,
then the background, then the music, and no everything isnt working that
fine anymore,

Ill start working on your tips.......

2Bcontinued........

By ARTRAG

Enlighted (6932)

ARTRAG's picture

09-06-2005, 19:14

norakomi

Do you really know what EI means?

Usually you cannot have EI in an interrupt routine (!!!)

Actually nor in a main unless it is cupled with DI
and should be used only to protect a SHORT segment
of instructions (usually I/O) from interrupts (in case they
could interfere with the external device with which you are
doing I/O in your main)

GhostP

Probability says that, provided that you wait very long, a monkey, typing random at a keyboard, will compose Shakespeare.

By norakomi

Paragon (1137)

norakomi's picture

09-06-2005, 23:11

Is there usually only 1 interrupt (the vdp interrupt) used in most shooter games?

And what if using this interrupt stop my music.....
Does this mean that the music uses the same interrupt and that I'm cancelling out
the music by using another interrupt......

By norakomi

Paragon (1137)

norakomi's picture

09-06-2005, 23:15


Then do something like:

ld a,1
ld (flag),a

in the interrupt routine. And sync your other routines the following way:

mainlus
xor a
ld (flag),a
wait
ld a,(flag)
or a
jr nz,wait

call move
call scroll
call whatever ; you want to do Smile

jp mainlus

Btw shouldn't there be a call to the music player in your interuptroutine?Yeah, there is a call to a music player........

so, what you are saying is, put music, SFX and screensplit on the interrupt,
and make the mainlus start as soon as the interrupt starts....., right???
what is the benefit of sync-ing the mainlus to the interrupt??????

By GhostwriterP

Paladin (683)

GhostwriterP's picture

10-06-2005, 00:12

Sync-ing the mainlus is done for the same reason you call your game and putsprite routine in the interrupt routine.
You want to have a fixed frame rate and smooth movement!
Your background scroll must be synced too, right? Otherwise you probably would have some wave going through,
and irregular moving scroll.
With this 'flag' way you dont need a HALT (wich i presume you are usingSmile).

Page 1/4
| 2 | 3 | 4