Re: MC Interrupts

2007-05-17 Thread Calvin Allett
So the SAMs z80 really  is actually slowed down quite considerably, I hadn`t 
realised how much :(

Thanks for the details :)

Andrew Collier <[EMAIL PROTECTED]> wrote: On 17 May 2007, at 23:24, Calvin 
Allett wrote:
>> Andrew Collier  wrote:

>> Because of the Sam's memory timings, using JR is usually as fast (or
>> slightly faster than) using JP. That may change with Mayhem  
>> accelerator!

> Thanks :) I`ve been reading the 1995 posts to the mailing list these
> past few days, and it`s amazing how much I`m picking up from
> those old old posts, so I`ve seen it mentioned that they run at around
> the same speed on SAM, am I remembering right that it depends
> where in screen the raster is when the code is run?

Yes. The Sam's ASIC deals with memory in blocks of 4 cycles at a  
time, and also "steals" four cycles out of every eight while drawing  
the screen (and also in some parts of the border, in MODE 1). In  
general, this means that Sam cycle timings are usually the Z80's own  
timings rounded up to a multiple of four, and then doubled if the  
screen is on.

But a few instructions don't obey this rule, because they don't need  
to read memory at the time ASIC reads it. So when the screen is on,  
they "escape" part of the time doubling. JR is one of these  
instructions, but JP is not.

On a raw Z80, on in a Sam running from external memory, and probably  
in the Mayhem accelerator; JP takes 10 cycles, and JR takes 12 (or 7  
for a conditional jump not taken).

In a Sam during the border, or if the screen is off, JP takes 12  
cycles and also JR takes 12 cycles (a conditional jump which is not  
taken, only takes 8 cycles).

When the screen is on, JP takes 24 cycles, but JR only takes 16 (a  
conditional JR is 16 cycles whether taken or not).

HTH,
Andrew

-- 
  ---   Andrew Collier 
    http://www.intensity.org.uk/ ---
   --




   
-
 Yahoo! Answers - Got a question? Someone out there knows the answer. Tryit now.

Re: MC Interrupts

2007-05-17 Thread Andrew Collier

On 17 May 2007, at 23:24, Calvin Allett wrote:

Andrew Collier <[EMAIL PROTECTED]> wrote:



Because of the Sam's memory timings, using JR is usually as fast (or
slightly faster than) using JP. That may change with Mayhem  
accelerator!



Thanks :) I`ve been reading the 1995 posts to the mailing list these
past few days, and it`s amazing how much I`m picking up from
those old old posts, so I`ve seen it mentioned that they run at around
the same speed on SAM, am I remembering right that it depends
where in screen the raster is when the code is run?


Yes. The Sam's ASIC deals with memory in blocks of 4 cycles at a  
time, and also "steals" four cycles out of every eight while drawing  
the screen (and also in some parts of the border, in MODE 1). In  
general, this means that Sam cycle timings are usually the Z80's own  
timings rounded up to a multiple of four, and then doubled if the  
screen is on.


But a few instructions don't obey this rule, because they don't need  
to read memory at the time ASIC reads it. So when the screen is on,  
they "escape" part of the time doubling. JR is one of these  
instructions, but JP is not.


On a raw Z80, on in a Sam running from external memory, and probably  
in the Mayhem accelerator; JP takes 10 cycles, and JR takes 12 (or 7  
for a conditional jump not taken).


In a Sam during the border, or if the screen is off, JP takes 12  
cycles and also JR takes 12 cycles (a conditional jump which is not  
taken, only takes 8 cycles).


When the screen is on, JP takes 24 cycles, but JR only takes 16 (a  
conditional JR is 16 cycles whether taken or not).


HTH,
Andrew

--
 ---   Andrew Collier 
   http://www.intensity.org.uk/ ---
  --




Re: MC Interrupts

2007-05-17 Thread Calvin Allett
Thanks :) I`ve been reading the 1995 posts to the mailing list these
past few days, and it`s amazing how much I`m picking up from
those old old posts, so I`ve seen it mentioned that they run at around
the same speed on SAM, am I remembering right that it depends
where in screen the raster is when the code is run?



Andrew Collier <[EMAIL PROTECTED]> wrote: 
On 17 May 2007, at 22:17, Calvin Allett wrote:

> What`s the difference between a JP and a JR, I don`t even mean
> in T-States, but what varies between the way they work. If you`s
> don`t mind me asking ?

A JR takes less space, two bytes compared to a JP instruction which  
takes 3. In a JR, you take your current address and add a one-byte  
offset to it, so you can only jump approximately 128 bytes in either  
direction (generally, the assembler will do this calculation for  
you). In a JP instruction you specify an the whole two-byte  
destination address and you jump exactly there.

Because of the Sam's memory timings, using JR is usually as fast (or  
slightly faster than) using JP. That may change with Mayhem accelerator!

Andrew

-- 
  ---   Andrew Collier 
    http://www.intensity.org.uk/ ---
   --




   
-
 Yahoo! Answers - Got a question? Someone out there knows the answer. Tryit now.

RE: MC Interrupts

2007-05-17 Thread Calvin Allett
ly what you do is more 
like:
   
  Clear the grab buffers
  Loop:
  Set the display to page 1
  Update your game logic, move the cars etc
  Put the contents of grab buffer 2 back in the old position 
for each sprite
  Grab the area under each sprite into their grab buffer 2, 
remember the position for redrawing
  Use the MC sprite routine to draw the sprites on page 2 in 
the positions
  Set the display to page 2, showing the sprites in the new 
position
  Update your game logic, move cars etc
  Put the contents of grab buffer 1 back in the old position 
for each sprite
  Grab the area under each sprite into their grab buffer 1, 
remember the position for redrawing
  Use the MC sprite routine to draw the sprites on page 1 in 
the positions
   
  Repeat
   
  This is a little more tricky as you have to keep 2 copies of the grab buffer 
(one for each screen, apparently some people say you can do it with one buffer 
but ive not had much luck with that).  
   
  It depends on the MC  routine, some do know about the Screen/display 
commands, some don’t, its not always that hard to alter.  The grabbing is a 
similar MC routine.
   
  Adrian 
   
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Calvin Allett
 Sent: 16 May 2007 02:46
 To: Adrian
 Subject: RE: MC Interrupts
  
   
  `Did someone call? ;) Yes it was the early issues, it was issues 1-5 i think,
 ` i was only talking to colin this evening about that, now ive moved i
 ` really need to get on with finishing it, although i lost all my code
 ` when i lost the sam harddrive.  Ive now got a sam in a can and have
 ` some new flash cards on order so ill get back to it and finish the
 ` little game, maybe some articles on learning mc can be arranged.
 
 A S-I-A-Can Lucky Bas... erm... I mean sweet :D  I haven`t  got the 
articles
 in question, but meaning to get those issue`s, so if you`ll be hopefully doing
 more then that`s brilliant.
  
  
 `To use something like that from basic, you could just do the following
 ` (this is off the top of my head after a bottle of wine, so it maybe
 ` wrong ;) )  But each frame you could do the following (its basically
 ` a double buffer system but from basic).  When i say page 1, page 2 –
 ` i don’t mean physical memory pages, but any particular page, again
 ` from memory it might have been the screen command that allowed you
 ` to open up and use different screens.  If you don’t know then ill
 ` try and dig up the info tomorrow.
 
 Yeah, your right, it`s the Screen command, with also the Display
 command for the flipping.. :) Would a MC routine, know which
 area in RAM to draw too, if Basic was flipping screens though, just thought. OR
 could a copy of a routine be used  to either draw to screen 1 or 2, so from
 Basic call the correct one? I`m never sure if you can have a small MC routine, 
and a copy, because if they both need to be paged in or whatever...
 
 
 `IN BASIC:
 `
 `Set the display to page 1`
 `
 `Update your game logic, move the cars etc`
 `
 `Use the MC sprite routine to draw the sprites on page 2 in 
the positions`
 `
 `Set the display to page 2, showing the sprites in the new 
position`
 `
 `   Update your game logic, move cars etc
 `
  `Use the MC sprite routine to draw the sprites on page 1 in 
the positions
 `
 ` 
 `
 `   Repeat ;)
 `
 ` 
 `
 `You still need to either A) handle storing what was under the sprites
 ` and putting it back, or B) just redraw the entire screen before you
 ` draw the sprites.  B) is the easiest to start with but can be slow,
 ` but the key is to get things working then speed them up. Doing this
 ` you are only actually updating when you want to, you don’t need interrupts,
 ` you don’t need anything clever in MC to do checking etc.
 
 I`ve tried drawing the complete (well 2/3rd`s of the screen) using double
 buffering in `Jimf `n Oobs` and it knocks it to about 4 fps, so been thinking
 of for a car game, defining area`s where cars may be, since the  tracks
 will only be about 24 pixels high or wide and drawing that if a car/s
 is in that region, this shouldn`t be much of a problem...
 
 I`ll try and knock up a demo of what I have in mind over the next few days,
 and you can hopefully see whether or not you think a MC routine would be
 possible/beneficial :)
  
 
 `I might be completely off track here, so let me know J
 `Adrian.
 
 Your not ;)  Oh, and `off track` very good, is that a pun :)
 
 Cal...
 
 


-
  
  The all-new Yahoo! Mail goes wherever you go - free your email address from 
your Internet  provider.
  
   
 
 
-
  APB Computer Services Ltd.
 Registered Address: 3 Springfield, Trevadlock, Congdons

Re: MC Interrupts

2007-05-17 Thread Calvin Allett
Ah sweet :) soz for delay, just spent 45 mins typing another reply !

Handy command then JR 

Colin Piggot <[EMAIL PROTECTED]> wrote: > What`s the difference between a JP 
and a JR, I don`t even mean
> in T-States, but what varies between the way they work. If you`s
> don`t mind me asking ?

JP reads in two bytes more to use as an address to jump to.

JR reads in only one more byte, to use as an offset from the current address
to jump to.

Colin
=
Quazar : Hardware, Software, Spares and Repairs for the Sam Coupe
1995-2007 - Celebrating 12 Years of developing for the Sam Coupe
Website: http://www.samcoupe.com/



   
-
 Yahoo! Answers - Got a question? Someone out there knows the answer. Tryit now.

RE: MC Interrupts

2007-05-17 Thread Calvin Allett
 the display to page 2, showing the sprites in the new 
position
  Update your game logic, move cars etc
  Put the contents of grab buffer 1 back in the old position 
for each sprite
  Grab the area under each sprite into their grab buffer 1, 
remember the position for redrawing
  Use the MC sprite routine to draw the sprites on page 1 in 
the positions
   
  Repeat
   
  This is a little more tricky as you have to keep 2 copies of the grab buffer 
(one for each screen, apparently some people say you can do it with one buffer 
but ive not had much luck with that).  
   
  It depends on the MC routine, some do know about the Screen/display commands, 
some don’t, its not always that hard to alter.  The grabbing is a similar MC 
routine.
   
  Adrian 
   
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Calvin Allett
 Sent: 16 May 2007 02:46
 To: Adrian
 Subject: RE: MC Interrupts
  
   
  `Did someone call? ;) Yes it was the early issues, it was issues 1-5 i think,
 ` i was only talking to colin this evening about that, now ive moved i
 ` really need to get on with finishing it, although i lost all my code
 ` when i lost the sam harddrive.  Ive now got a sam in a can and have
 ` some new flash cards on order so ill get back to it and finish the
 ` little game, maybe some articles on learning mc can be arranged.
 
 A S-I-A-Can Lucky Bas... erm... I mean sweet :D  I haven`t got the articles
 in question, but meaning to get those issue`s, so if you`ll be hopefully doing
 more then that`s brilliant.
  
  
 `To use something like that from basic, you could just do the following
 ` (this is off the top of my head after a bottle of wine, so it maybe
 ` wrong ;) )  But each frame you could do the following (its basically
 ` a double buffer system but from basic).  When i say page 1, page 2 –
 ` i don’t mean physical memory pages, but any particular page, again
 ` from memory it might have been the screen command that allowed you
 ` to open up and use different screens.  If you don’t know then ill
 ` try and dig up the info tomorrow.
 
 Yeah, your right, it`s the Screen command, with also the Display
 command for the flipping.. :) Would a MC routine, know which
 area in RAM to draw too, if Basic was flipping screens though, just thought. OR
 could a copy of a routine be used to either draw to screen 1 or 2, so from
 Basic call the correct one? I`m never sure if you can have a small MC routine, 
and a copy, because if they both need to be paged in or whatever...
 
 
 `IN BASIC:
 `
 `Set the display to page 1`
 `
 `Update your game logic, move the cars etc`
 `
 `Use the MC sprite routine to draw the sprites on page 2 in 
the positions`
 `
 `Set the display to page 2, showing the sprites in the new 
position`
 `
 `   Update your game logic, move cars etc
 `
 `Use the MC sprite routine to draw the sprites on page 1 in 
the positions
 `
 ` 
 `
 `   Repeat ;)
 `
 ` 
 `
 `You still need to either A) handle storing what was under the sprites
 ` and putting it back, or B) just redraw the entire screen before you
 ` draw the sprites.  B) is the easiest to start with but can be slow,
 ` but the key is to get things working then speed them up. Doing this
 ` you are only actually updating when you want to, you don’t need interrupts,
 ` you don’t need anything clever in MC to do checking etc.
 
 I`ve tried drawing the complete (well 2/3rd`s of the screen) using double
 buffering in `Jimf `n Oobs` and it knocks it to about 4 fps, so been thinking
 of for a car game, defining area`s where cars may be, since the tracks
 will only be about 24 pixels high or wide and drawing that if a car/s
 is in that region, this shouldn`t be much of a problem...
 
 I`ll try and knock up a demo of what I have in mind over the next few days,
 and you can hopefully see whether or not you think a MC routine would be
 possible/beneficial :)
  
 
 `I might be completely off track here, so let me know J
 `Adrian.
 
 Your not ;)  Oh, and `off track` very good, is that a pun :)
 
 Cal...
 
 


-
  
  The all-new Yahoo! Mail goes wherever you go - free your email address from 
your Internet provider.
  
   
 
 
-
  APB Computer Services Ltd.
 Registered Address: 3 Springfield, Trevadlock, Congdons Shop, Launceston, 
Cornwall, PL15 7PW.  
 Registration Number: 4942193.  V.A.T. No: 826 0005 70 
-
 This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. If 
you have received this email in error please notify the system manager. This 
message contains confidential information and is intended only for the 
individual named. If you are not the named addressee you s

Re: MC Interrupts

2007-05-17 Thread Andrew Collier


On 17 May 2007, at 22:17, Calvin Allett wrote:


What`s the difference between a JP and a JR, I don`t even mean
in T-States, but what varies between the way they work. If you`s
don`t mind me asking ?


A JR takes less space, two bytes compared to a JP instruction which  
takes 3. In a JR, you take your current address and add a one-byte  
offset to it, so you can only jump approximately 128 bytes in either  
direction (generally, the assembler will do this calculation for  
you). In a JP instruction you specify an the whole two-byte  
destination address and you jump exactly there.


Because of the Sam's memory timings, using JR is usually as fast (or  
slightly faster than) using JP. That may change with Mayhem accelerator!


Andrew

--
 ---   Andrew Collier 
   http://www.intensity.org.uk/ ---
  --




Re: MC Interrupts

2007-05-17 Thread Colin Piggot
> What`s the difference between a JP and a JR, I don`t even mean
> in T-States, but what varies between the way they work. If you`s
> don`t mind me asking ?

JP reads in two bytes more to use as an address to jump to.

JR reads in only one more byte, to use as an offset from the current address
to jump to.

Colin
=
Quazar : Hardware, Software, Spares and Repairs for the Sam Coupe
1995-2007 - Celebrating 12 Years of developing for the Sam Coupe
Website: http://www.samcoupe.com/



RE: MC Interrupts

2007-05-17 Thread Calvin Allett
What`s the difference between a JP and a JR, I don`t even mean
in T-States, but what varies between the way they work. If you`s
don`t mind me asking ?

Cal...
`Geoff Winkless <[EMAIL PROTECTED]> wrote:`Geoff Winkless wrote:
> Anyway, something like:

[snip]

Sorry, it's been a while and I was tired (!!), those local JP's should all
(of course) be JR's!

Geoff


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__



-
 New Yahoo! Mail is the ultimate force in competitive emailing. Find out more 
at the Yahoo! Mail Championships. Plus: play games and win prizes.

RE: MC Interrupts

2007-05-16 Thread Geoff Winkless
Geoff Winkless wrote:
> Anyway, something like:

[snip]

Sorry, it's been a while and I was tired (!!), those local JP's should all
(of course) be JR's!

Geoff


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__


RE: MC Interrupts

2007-05-16 Thread Adrian Brown
Dont worry about the speed, just order a mayhem accelerator ;)  But yes,
redrawing the entire screen can be very slow.  Ideally what you do is
more like:



Clear the grab buffers

Loop:

Set the display to page 1

Update your game logic, move the cars etc

Put the contents of grab buffer 2 back in the old
position for each sprite

Grab the area under each sprite into their grab buffer
2, remember the position for redrawing

Use the MC sprite routine to draw the sprites on page 2
in the positions

Set the display to page 2, showing the sprites in the
new position

Update your game logic, move cars etc

Put the contents of grab buffer 1 back in the old
position for each sprite

Grab the area under each sprite into their grab buffer
1, remember the position for redrawing

Use the MC sprite routine to draw the sprites on page 1
in the positions



Repeat



This is a little more tricky as you have to keep 2 copies of the grab
buffer (one for each screen, apparently some people say you can do it
with one buffer but ive not had much luck with that).



It depends on the MC routine, some do know about the Screen/display
commands, some don't, its not always that hard to alter.  The grabbing
is a similar MC routine.



Adrian



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Calvin Allett
Sent: 16 May 2007 02:46
To: Adrian
Subject: RE: MC Interrupts



`Did someone call? ;) Yes it was the early issues, it was issues 1-5 i
think,
` i was only talking to colin this evening about that, now ive moved i
` really need to get on with finishing it, although i lost all my code
` when i lost the sam harddrive.  Ive now got a sam in a can and have
` some new flash cards on order so ill get back to it and finish the
` little game, maybe some articles on learning mc can be arranged.

A S-I-A-Can Lucky Bas... erm... I mean sweet :D  I haven`t got the
articles
in question, but meaning to get those issue`s, so if you`ll be hopefully
doing
more then that`s brilliant.


`To use something like that from basic, you could just do the following
` (this is off the top of my head after a bottle of wine, so it maybe
` wrong ;) )  But each frame you could do the following (its basically
` a double buffer system but from basic).  When i say page 1, page 2 -
` i don't mean physical memory pages, but any particular page, again
` from memory it might have been the screen command that allowed you
` to open up and use different screens.  If you don't know then ill
` try and dig up the info tomorrow.

Yeah, your right, it`s the Screen command, with also the Display
command for the flipping.. :) Would a MC routine, know which
area in RAM to draw too, if Basic was flipping screens though, just
thought. OR
could a copy of a routine be used to either draw to screen 1 or 2, so
from
Basic call the correct one? I`m never sure if you can have a small MC
routine, and a copy, because if they both need to be paged in or
whatever...


`IN BASIC:
`
`Set the display to page 1`
`
`Update your game logic, move the cars etc`
`
`Use the MC sprite routine to draw the sprites on page 2
in the positions`
`
`Set the display to page 2, showing the sprites in the
new position`
`
`   Update your game logic, move cars etc
`
`Use the MC sprite routine to draw the sprites on page 1
in the positions
`
`
`
`   Repeat ;)
`
`
`
`You still need to either A) handle storing what was under the sprites
` and putting it back, or B) just redraw the entire screen before you
` draw the sprites.  B) is the easiest to start with but can be slow,
` but the key is to get things working then speed them up. Doing this
` you are only actually updating when you want to, you don't need
interrupts,
` you don't need anything clever in MC to do checking etc.

I`ve tried drawing the complete (well 2/3rd`s of the screen) using
double
buffering in `Jimf `n Oobs` and it knocks it to about 4 fps, so been
thinking
of for a car game, defining area`s where cars may be, since the tracks
will only be about 24 pixels high or wide and drawing that if a car/s
is in that region, this shouldn`t be much of a problem...

I`ll try and knock up a demo of what I have in mind over the next few
days,
and you can hopefully see whether or not you think a MC routine would be
possible/beneficial :)


`I might be completely off track here, so let me know J
`Adrian.

Your not ;)  Oh, and `off track` very good, is that a pun :)

Cal...







The all-new Yahoo! Mail
<http://us.rd.yahoo.com/mail/uk/taglines/default/nowyoucan/free_from_isp
/*http:/us.rd.yahoo.com/evt=40565/*http:/uk.docs.yahoo.com/nowyoucan.htm
l>  goes wherever you go - free your e

RE: MC Interrupts

2007-05-15 Thread Calvin Allett
`Did someone call? ;) Yes it was the early issues, it was issues 1-5 i think,
` i was only talking to colin this evening about that, now ive moved i
` really need to get on with finishing it, although i lost all my code
` when i lost the sam harddrive.  Ive now got a sam in a can and have
` some new flash cards on order so ill get back to it and finish the
` little game, maybe some articles on learning mc can be arranged.

A S-I-A-Can Lucky Bas... erm... I mean sweet :D  I haven`t got the articles
in question, but meaning to get those issue`s, so if you`ll be hopefully doing
more then that`s brilliant.
 
 
`To use something like that from basic, you could just do the following
` (this is off the top of my head after a bottle of wine, so it maybe
` wrong ;) )  But each frame you could do the following (its basically
` a double buffer system but from basic).  When i say page 1, page 2 –
` i don’t mean physical memory pages, but any particular page, again
` from memory it might have been the screen command that allowed you
` to open up and use different screens.  If you don’t know then ill
` try and dig up the info tomorrow.

Yeah, your right, it`s the Screen command, with also the Display
command for the flipping.. :) Would a MC routine, know which
area in RAM to draw too, if Basic was flipping screens though, just thought. OR
could a copy of a routine be used to either draw to screen 1 or 2, so from
Basic call the correct one? I`m never sure if you can have a small MC routine, 
and a copy, because if they both need to be paged in or whatever...


`IN BASIC:
`
`Set the display to page 1`
`
`Update your game logic, move the cars etc`
`
`Use the MC sprite routine to draw the sprites on page 2 in the 
positions`
`
`Set the display to page 2, showing the sprites in the new 
position`
`
`   Update your game logic, move cars etc
`
`Use the MC sprite routine to draw the sprites on page 1 in the 
positions
`
` 
`
`   Repeat ;)
`
` 
`
`You still need to either A) handle storing what was under the sprites
` and putting it back, or B) just redraw the entire screen before you
` draw the sprites.  B) is the easiest to start with but can be slow,
` but the key is to get things working then speed them up. Doing this
` you are only actually updating when you want to, you don’t need interrupts,
` you don’t need anything clever in MC to do checking etc.

I`ve tried drawing the complete (well 2/3rd`s of the screen) using double
buffering in `Jimf `n Oobs` and it knocks it to about 4 fps, so been thinking
of for a car game, defining area`s where cars may be, since the tracks
will only be about 24 pixels high or wide and drawing that if a car/s
is in that region, this shouldn`t be much of a problem...

I`ll try and knock up a demo of what I have in mind over the next few days,
and you can hopefully see whether or not you think a MC routine would be
possible/beneficial :)
 

`I might be completely off track here, so let me know J
`Adrian.

Your not ;)  Oh, and `off track` very good, is that a pun :)

Cal...




-
 The all-new Yahoo! Mail goes wherever you go - free your email address from 
your Internet provider.

RE: MC Interrupts

2007-05-15 Thread Adrian Brown
Did someone call? ;) Yes it was the early issues, it was issues 1-5 i
think, i was only talking to colin this evening about that, now ive
moved i really need to get on with finishing it, although i lost all my
code when i lost the sam harddrive.  Ive now got a sam in a can and have
some new flash cards on order so ill get back to it and finish the
little game, maybe some articles on learning mc can be arranged.



Compiled sprites are (if im not mistaken) the fastest way to draw things
on the sam.



To use something like that from basic, you could just do the following
(this is off the top of my head after a bottle of wine, so it maybe
wrong ;) )  But each frame you could do the following (its basically a
double buffer system but from basic).  When i say page 1, page 2 - i
don't mean physical memory pages, but any particular page, again from
memory it might have been the screen command that allowed you to open up
and use different screens.  If you don't know then ill try and dig up
the info tomorrow.



IN BASIC:

Set the display to page 1

Update your game logic, move the cars etc

Use the MC sprite routine to draw the sprites on page 2
in the positions

Set the display to page 2, showing the sprites in the
new position

Update your game logic, move cars etc

Use the MC sprite routine to draw the sprites on page 1
in the positions



Repeat ;)



You still need to either A) handle storing what was under the sprites
and putting it back, or B) just redraw the entire screen before you draw
the sprites.  B) is the easiest to start with but can be slow, but the
key is to get things working then speed them up. Doing this you are only
actually updating when you want to, you don't need interrupts, you don't
need anything clever in MC to do checking etc.



I might be completely off track here, so let me know J



Adrian.



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Calvin Allett
Sent: 15 May 2007 23:31
To: Adrian
Subject: Re: MC Interrupts



no probs mate, I`m not exactly gonna be able to do anything with any MC
code yet anyhow, and I know your  busy :) I do love looking through the
issue`s I have, it always eggs me on to do more coding, but I need to
get the early issue`s especially for the (sounding great) articles :D

[EMAIL PROTECTED] wrote:

Quoting Calvin Allett :

> I still need to catch up on the later issue`s, and the earlier
> ones... I`d forgot there was such an article, but I`d heard, one of
> the early ones I think :)
>

I've got a site to work on tonight, otherwise I'd be dipping in my
issues to
look for you :(







To help you stay safe and secure online, we've developed the all new
Yahoo! Security Centre
<http://us.rd.yahoo.com/mail/uk/taglines/default/security_centre/*http:/
uk.security.yahoo.com/> .







APB Computer Services Ltd. Registered Address: 3 Springfield, Trevadlock, 
Congdons Shop, Launceston, Cornwall, PL15 7PW.  Registration Number: 4942193.  
V.A.T. No: 826 0005 70

This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. If 
you have received this email in error please notify the system manager. This 
message contains confidential information and is intended only for the 
individual named. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail. Please notify the sender 
immediately by e-mail if you have received this e-mail by mistake and delete 
this e-mail from your system. If you are not the intended recipient you are 
notified that disclosing, copying, distributing or taking any action in 
reliance on the contents of this information is strictly prohibited. 

Re: MC Interrupts

2007-05-15 Thread Calvin Allett
no probs mate, I`m not exactly gonna be able to do anything with any MC code 
yet anyhow, and I know your  busy :) I do love looking through the issue`s I 
have, it always eggs me on to do more coding, but I need to get the early 
issue`s especially for the (sounding great) articles :D

[EMAIL PROTECTED] wrote: Quoting Calvin Allett :

> I still need to catch up on the later issue`s, and the earlier 
> ones... I`d forgot there was such an article, but I`d heard, one of 
> the early ones I think :)
>

I've got a site to work on tonight, otherwise I'd be dipping in my issues to
look for you :(




-
 To help you stay safe and secure online, we've developed the all new Yahoo! 
Security Centre.

Re: MC Interrupts

2007-05-15 Thread david

Quoting Calvin Allett <[EMAIL PROTECTED]>:

I still need to catch up on the later issue`s, and the earlier 
ones... I`d forgot there was such an article, but I`d heard, one of 
the early ones I think :)




I've got a site to work on tonight, otherwise I'd be dipping in my issues to
look for you :(



Re: MC Interrupts

2007-05-15 Thread Calvin Allett
I still need to catch up on the later issue`s, and the earlier ones... I`d 
forgot there was such an article, but I`d heard, one of the early ones I think 
:)

[EMAIL PROTECTED] wrote: Quoting Calvin Allett :

> I`ve come across a little routine on an old disk magazine that 
> provides four 8*8 pixel masked `sprites` via a MC interrupt routine, 
> it seems pretty fast, and am wondering about trying to use it, 
> however I`m wondering if it`s possible to alter an interrupt routine 
> so that it only runs the code every 2nd or third frame?

I also seem to recall a pretty decent Sprite article in SAM Revival... can't
recall the issue - but it was from that clever chap Adrian (Brown, I think?)




   
-
 Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for 
your freeaccount today.

Re: MC Interrupts

2007-05-15 Thread david

Quoting Calvin Allett <[EMAIL PROTECTED]>:

I`ve come across a little routine on an old disk magazine that 
provides four 8*8 pixel masked `sprites` via a MC interrupt routine, 
it seems pretty fast, and am wondering about trying to use it, 
however I`m wondering if it`s possible to alter an interrupt routine 
so that it only runs the code every 2nd or third frame?


I also seem to recall a pretty decent Sprite article in SAM Revival... can't
recall the issue - but it was from that clever chap Adrian (Brown, I think?)




Re: MC Interrupts

2007-05-15 Thread david

Quoting Calvin Allett <[EMAIL PROTECTED]>:


I used to love these demo`s, and the converted games, as I still
usually prefer AY music over The Sound Machine, or E-tracker, although
some SAM tunes blow the AY away :) I was thinking it might be easier
to get someone to do a tune or two for games, if I needed an AY tune
over an SAA as the scenes bigger.


There's always the SID player as well :-) (Although you do need a SID chip for
this... ;))



Re: MC Interrupts

2007-05-15 Thread david

Quoting Colin Piggot <[EMAIL PROTECTED]>:


Interrupts aren't affected by the speed of the machine.

The ASIC generates the frame interrupt every 50th of a second, it's all tied
right into the video timings. So things like music players, or any frame
interrupt (or line interrupt) routines don't need to be changed at all.


I guess you could do much more in between the interrupts however :-)



Re: MC Interrupts

2007-05-15 Thread Calvin Allett
Calvin Allett wrote:
> I`ve been wondering this before, in relation to the Mayhem
> accelerator, as if wanting to write a game to run at 20Mhz
> (about four times normal speed with uncontended RAM?)
> then if I`d be able to run an intterupt music player, but have
> the player altered to only play the music every 4th frame,
> to keep tune at correct speed approx?

`Interrupts aren't affected by the speed of the machine.
`
`The ASIC generates the frame interrupt every 50th of a second, it's all 
`tied
`right into the video timings. So things like music players, or any 
`frame
`interrupt (or line interrupt) routines don't need to be changed at all.

I knew that I was possibly talking crap :D I should have realised actually,
so that`s really cool, so you still get your 50 interrupts, but
just more you can do between them.


> Oh, and while I`m rambling, does anybody know if there exists
> an interrupt player for AY music, or just players to incorporate
> into MC?

`I don't recall seeing any standalone interrupt players to play AY 
`music,
`although Cookie and Stefan have in the past written patches into the 
`various
`128K demos they both converted to play the music through the SAA1099 so
`they've done the main bit of work of converting AY register data into 
`the
`nearest equivalent for the SAA.
`
I used to love these demo`s, and the converted games, as I still
usually prefer AY music over The Sound Machine, or E-tracker, although
some SAM tunes blow the AY away :) I was thinking it might be easier
to get someone to do a tune or two for games, if I needed an AY tune
over an SAA as the scenes bigger.

---
`
`Could be a bit more tricky if you are meaning to play .AY files, which 
`are
`essentially the speccy machine code player and the data that would 
`need
`the machine code part (which I guess is specific to the tune and the
`programmer who wrote the player) to be patched to play through the SAA 
`etc.

Damn, really didn`t know this, I thought that the .AY files
were just data for the soundchip, although having heard 48K beeper
and 128K AY in the format, I should have realised it included the player :(

Thanks for info Colin, I`d misunderstood both things, erm ;)

Cal...


-
 What kind of emailer are you? Find out today - get a free analysis of your 
email personality. Take the quiz at the Yahoo! Mail Championship.

RE: MC Interrupts

2007-05-15 Thread Calvin Allett

Calvin Allett wrote:
> so would it seem feasable to be able to alter the routine 
> with a flag, so that it jumps straight back every other frame 
> and only draws the other frames?

"`Assuming you don't need to worry about redrawing them if they haven't 
`moved
`you could simply add your own interrupt handler to check whether the
`positions are the same and don't call the sprite routine if they are.
`
`If your BASIC program _is_ changing the display then you will have to 
`call
`them every frame anyway, since the masks will go horribly wrong 
`otherwise
`(in fact, won't they anyway?)"

The game I`m thinking is a simplistic Super Sprint type game, and
they`d be travelling over road graphics that wouldn`t be changing,
so that`s not a problem, but I see what you mean.

i hadn`t thought of actually adding in anything to the routine, apart
from wondering if it could be slowed down to not run as often, and give
more speed to Basic, but your idea sounds even better, checking the coords
and only changing/drawing if they change :) that sounds to be the best.

--
 
`I'm confused why you'd want to fake hardware sprites with interrupts 
`anyway,
`why not just write some MC to blat the sprite and call it from your 
`BASIC
`routine? That gives much more fine-grained control.

I don`t know :D I`m loving the extra speed of the Put command
in MasterBasic, and just wanting/needing more speed than the generic
routine offers, and coming across this little 4 `sprite` routine
just got me excited (even if it`s only 8*8 graphics)... It would
actually be better to use a routine that I could Call when required,
and not waste time though... never been a fan of interrupts in Basic,
as they slow it down terribly :)


`Anyway, something like:
` 
`MyInt:
`  PUSH HL
`  PUSH BC
`Sprite1:
`LD BC, 
`LD HL, (SpritePos1)
`SBC HL, BC
`JP Z, GoSprites
`Sprite2:
`LD BC, 
`LD HL, (SpritePos2)
`SBC HL, BC
`JP NZ, GoSprites
`Sprite3:
`LD BC, 
`LD HL, (SpritePos3)
`SBC HL, BC
`JP NZ, GoSprites
`Sprite4:
`LD BC, 
`LD HL, (SpritePos4)
`SBC HL, BC
`JP NZ, GoSprites
`  POP BC
`  POP HL
`reti
`GoSprites:
`LD HL, (SpritePos1)
`LD (Sprite1+1), HL
`LD HL, (SpritePos2)
`LD (Sprite2+1), HL
`LD HL, (SpritePos3)
`LD (Sprite3+1), HL
`LD HL, (SpritePos4)
`LD (Sprite4+1), HL
`  POP BC
`  POP HL
`JP OldHandler
`
`It's not exactly optimal but it's fairly obvious what it does.
`

hehe, cheers for the example Geoff, but I`m afraid I`m still
to learn MC, I can understand the LD commands, and i think I`ve
got the general idea of what POPs and JP`s do, but as soon
as I start to think about having to have graphics in special formats
etc it puts me off learning MC... I have dl`d some MC books from
WoSpec recently though *_+

thanks again :)

Cal...


   
-
 Yahoo! Answers - Got a question? Someone out there knows the answer. Tryit now.

Re: MC Interrupts

2007-05-15 Thread Colin Piggot
Calvin Allett wrote:
> I`ve been wondering this before, in relation to the Mayhem
> accelerator, as if wanting to write a game to run at 20Mhz
> (about four times normal speed with uncontended RAM?)
> then if I`d be able to run an intterupt music player, but have
> the player altered to only play the music every 4th frame,
> to keep tune at correct speed approx?

Interrupts aren't affected by the speed of the machine.

The ASIC generates the frame interrupt every 50th of a second, it's all tied
right into the video timings. So things like music players, or any frame
interrupt (or line interrupt) routines don't need to be changed at all.


> Oh, and while I`m rambling, does anybody know if there exists
> an interrupt player for AY music, or just players to incorporate
> into MC?

I don't recall seeing any standalone interrupt players to play AY music,
although Cookie and Stefan have in the past written patches into the various
128K demos they both converted to play the music through the SAA1099 so
they've done the main bit of work of converting AY register data into the
nearest equivalent for the SAA.

Could be a bit more tricky if you are meaning to play .AY files, which are
essentially the speccy machine code player and the data that would need
the machine code part (which I guess is specific to the tune and the
programmer who wrote the player) to be patched to play through the SAA etc.

Colin
=
Quazar : Hardware, Software, Spares and Repairs for the Sam Coupe
1995-2007 - Celebrating 12 Years of developing for the Sam Coupe
Website: http://www.samcoupe.com/



RE: MC Interrupts

2007-05-15 Thread Geoff Winkless
Calvin Allett wrote:
> so would it seem feasable to be able to alter the routine 
> with a flag, so that it jumps straight back every other frame 
> and only draws the other frames?

Assuming you don't need to worry about redrawing them if they haven't moved
you could simply add your own interrupt handler to check whether the
positions are the same and don't call the sprite routine if they are.

If your BASIC program _is_ changing the display then you will have to call
them every frame anyway, since the masks will go horribly wrong otherwise
(in fact, won't they anyway?)
 
I'm confused why you'd want to fake hardware sprites with interrupts anyway,
why not just write some MC to blat the sprite and call it from your BASIC
routine? That gives much more fine-grained control.

Anyway, something like:
 
MyInt:
 PUSH HL
 PUSH BC
Sprite1:
LD BC, 
LD HL, (SpritePos1)
SBC HL, BC
JP Z, GoSprites
Sprite2:
LD BC, 
LD HL, (SpritePos2)
SBC HL, BC
JP NZ, GoSprites
Sprite3:
LD BC, 
LD HL, (SpritePos3)
SBC HL, BC
JP NZ, GoSprites
Sprite4:
LD BC, 
LD HL, (SpritePos4)
SBC HL, BC
JP NZ, GoSprites
 POP BC
 POP HL
reti
GoSprites:
LD HL, (SpritePos1)
LD (Sprite1+1), HL
LD HL, (SpritePos2)
LD (Sprite2+1), HL
LD HL, (SpritePos3)
LD (Sprite3+1), HL
LD HL, (SpritePos4)
LD (Sprite4+1), HL
 POP BC
 POP HL
JP OldHandler

It's not exactly optimal but it's fairly obvious what it does.

Geoff


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__