1. sprites

Hi everybody,

Initially, when I was asked to explain what was going on under the bonnet of my
aliens!, I thought it was quite obvious. Then I thought a bit more about it
and prepared these notes. Line numbers, where given, refer to the attached
 little
demo. It is actually a sanitized copy of my first attempt, with a few comments
thrown in for a good measure.

All the usual disclaimers and customary lies apply here too: this is my first
venture into the sprite territory, and there is always a better/faster way of
doing anything, etc...

I shall concentrate on the mode 19, because it has such an easy, linear
arrangement of the video memory: a block of 64,000 bytes, one for every pixel on
the screen. It starts at #A0000 location, which corresponds to the top left hand
corner of your screen, and continues in left-to-right, line-by-line manner to
the bottom of your screen. I shall also assume, for simplicity, that in this
case the *whole* screen is our playfield.


The method consists of six basic steps:

   Step 1: Reserve two blocks of memory for your virtual screens, one as a
      working area, and the other as a permanent storage of the screen
      background. Lines 74 & 75.

   Step 2: Draw the background directly on the screen in any way you fancy.

   Step 3: Store the background in one of the virtual screens.
      Normally, it would be something like: mem_copy(s1,A,N)
      I short-circuited the step 2 and 3 in the demo, drawing the
      background directly into the storage memory: Lines 78 to 82.


The next three steps will be repeated over and over again in the main action
loop (lines 114 to 118), which usually contains some other things like timing,
checking of input, etc. Here they are gathered in the frame() routine, lines 23
to 54.

   Step 4: Prepare your working virtual screen first by copying the background
      into it, line 26: mem_copy(s2,s1,N)

   Step 5: The tricky bit: update your sprites and draw them into the virtual
      working screen, lines 28 to 52.

   Step 6: Display the updated working screen by copying it to the video memory,
      line 53: mem_copy(A,s2,N)


In real life, of course, you will need more than two virtual screens to store
temporary backgrounds for your Intro, Game Over screens,etc.

The step 5, especially its second part, drawing of sprites, is most critical in
terms of speed. Hollow and/or complicated sprites lead to short, broken poke
sequences and are expensive. A bit of care and effort with things like sprite
pre-processing, or taking advantage of symmetries (as in the following demo),
can make a huge difference!

That's it!  Jiri

-- snip ------------------------------------------------------------------------

-- sprite.ex : sprite experiments
-- jiri babor
-- j.babor at gns.cri.nz
-- version 1.00   97-03-29

include graphics.e
include machine.e
include get.e

constant
   A=#A0000,      -- start of video memory
   N=64000,       -- screen size
   ns=20,         -- number of sprites
   x=1,  y=2,     -- sprite labels
   xv=3, yv=4,    -- sprite labels
   h=5,           -- sprite half height
   w=15           -- sprite width

atom dt,s1,s2,t
integer count,junk
sequence c,sdata,pal,s,S,ss

procedure frame()
   sequence s
   integer m,n
   mem_copy(s2,s1,N)    -- fresh copy of background into working screen
   -- update sprites
   for i=1 to ns do
      if sdata[i][x]+sdata[i][xv]<1 or sdata[i][x]+sdata[i][xv]+w>320 then
         sdata[i][xv]=-sdata[i][xv]
      end if
      if sdata[i][y]+sdata[i][yv]<1 or sdata[i][y]+sdata[i][yv]+h+h>200 then
         sdata[i][yv]=-sdata[i][yv]
      end if
      sdata[i][x]=sdata[i][x]+sdata[i][xv]
      sdata[i][y]=sdata[i][y]+sdata[i][yv]
      -- write sprites to virtual screen
      for r=1 to h do
         m=1   n=1
         while m<w do
            if ss[i][r][m]  then exit
            else m=m+1 end if
         end while
         n=m
         while n<w do
            if ss[i][r][n+1]  then n=n+1
            else exit end if
         end while
         poke(s2+(sdata[i][y]+r-1)*320+sdata[i][x]+m-1, ss[i][r][m..n])
         poke(s2+(sdata[i][y]+10-r)*320+sdata[i][x]+m-1, ss[i][r][m..n])
      end for
   end for
   mem_copy(A,s2,N)     -- display: copy virtual screen s2 into video memory
end procedure


-- main ------------------------------------------------------------------------

junk = graphics_mode(19)

-- set palette
pal=repeat({0,0,0},256)
for i=0 to 16 do
   pal[i+1]=palette(i,{0,0,0})
end for
for i=0 to 63 do
   pal[i+65]={32+floor(i/2),i,i}
   pal[i+129]={i,32+floor(i/2),i}
   pal[i+193]={i,i,32+floor(i/2)}
end for
all_palette(pal)

-- allocate memory for virtual screens
s1=allocate(N)
s2=allocate(N)

-- set background
for i=0 to 199 do
   for j=0 to 319 do
      poke(s1+i*320+j,255-floor(i*0.25))
   end for
end for

-- set sprite data
sdata=repeat(repeat(0,4),ns)
for i=1 to ns do
   sdata[i][x]=rand(319-w)
   sdata[i][y]=rand(199-h-h)
   sdata[i][xv]=6-rand(11)
   sdata[i][yv]=5-rand(9)
end for

-- generate sprite images
S={{0,0,0,0,1,1,1,1,1,1,1,0,0,0,0},
   {0,0,1,1,1,1,1,1,1,1,1,1,1,0,0},
   {0,1,1,1,2,2,2,2,2,2,2,1,1,1,0},
   {1,1,1,2,2,2,2,2,2,2,2,2,1,1,1},
   {1,1,1,2,2,2,2,2,2,2,2,2,1,1,1}}

ss={}
for i=1 to ns do
   s=S
   c={64*rand(3)+rand(40),64*rand(3)+rand(40)}   -- random color
   for j=1 to h do
      for k=1 to w do
         if s[j][k] then s[j][k]=c[s[j][k]]+k end if
      end for
   end for
   ss=append(ss,s)
end for

count=0
t=time()
while 1 do
   frame()
   if get_key()!=-1 then exit end if
   count=count+1
end while
dt=time()-t

junk = graphics_mode(-1)
printf(1,"%5.2f f.p.s.\n",count/dt)

new topic     » topic index » view message » categorize

2. Re: sprites

It's nice to see a Euphoria graphics demo that doesn't require a Pentium. :)

I did notice that there is flickering when the screen refreshes, so I dug up
this snippet of code in the VGA Trainer portion of the PC Game Programmer's
Encyclopedia. Since I'm no good at coding assembly, I thought I'd post it
here and see if anyone else is interested in it. It's written for Turbo
Pascal.

 -- David Cuny


 -- SNIP --------------------------------------------------------------------
procedure WaitRetrace; assembler;
  { This waits until you are in a Verticle Retrace ... this means that all
    screen manipulation you do only appears on screen in the next verticle
    retrace ... this removes most of the "fuzz" that you see on the screen
    when changing the pallette. It unfortunately slows down your program
    by "synching" your program with your monitor card ... it does mean
    that the program will run at almost the same speed on different
    speeds of computers which have similar monitors. In our SilkyDemo,
    we used a WaitRetrace, and it therefore runs at the same (fairly
    fast) speed when Turbo is on or off. }

label
  l1, l2;
asm
    mov dx,3DAh
l1:
    in al,dx
    and al,08h
    jnz l1
l2:
    in al,dx
    and al,08h
    jz  l2
end;

 -- SNIP
 ---------------------------------------------------------------------

new topic     » goto parent     » topic index » view message » categorize

3. Re: sprites

Cuny, David wrote:

> I did notice that there is flickering when the screen refreshes, so I dug up
> this snippet of code in the VGA Trainer portion of the PC Game Programmer's
> Encyclopedia. Since I'm no good at coding assembly, I thought I'd post it
> here and see if anyone else is interested in it. It's written for Turbo
> Pascal.

David, it's inline assembly, just take the part from label: and apply the
ASM2EU program to make it in euphoria. After poking it into memory and
calling it, it will return exactly when an fresh screen has been displayed,
so if you poke to VGAmem the results will not flicker. This works fine in
compiled languages.. but don't know in Euphoria because speed is required
for syncronicity.

Bye,
--

            ************************************
            This message sent by Daniel Berstein
            ************************************
     email: architek at geocities.com
 homepages: http://www.geocities.com/SiliconValley/Heights/9316
            http://www.cybercity.hko.net/silicon_valley/architek

new topic     » goto parent     » topic index » view message » categorize

4. Re: sprites

--------------FDF6AC23EBC

David,
This is what i made with the source code you sent.
For some strange reason the program just crash, and i
don't have any idea why. Perhaps Robert Craig can explain
this. I send the code and the CW.ERR file produced by
Causeway. I guess the problem is just of Causeway, because
there's no ex.err file generated (well, causeway didn't let
the asm routine to finish).
Rob, are you sure i can PUSH and POP?

--

            ************************************
            This message sent by Daniel Berstein
            ************************************
     email: architek at geocities.com
 homepages: http://www.geocities.com/SiliconValley/Heights/9316
            http://www.cybercity.hko.net/silicon_valley/architek

--------------FDF6AC23EBC
Content-Disposition: inline; filename="wait.ex"

include machine.e

sequence code
atom code_space

code =  {
    #50,                   --     push    ax
    #52,                   --     push    dx
    #BA,#DA,#03,           --     mov     dx, #3da
                           -- l1:
    #EC,                   --     in      al, dx
    #24,#08,               --     and     al, #8
    #75,#FB,               --     jnz     l1
                           -- l2:
    #EC,                   --     in      al, dx
    #24,#08,               --     and     al, #8
    #74,#FB,               --     jz      l2
    #5A,                   --     pop     dx
    #58,                   --     pop     ax
    #C3}                   --     ret

code_space = allocate_low(length(code))
poke(code_space, code)


puts(1, "\n  calling machine code routine for waiting retrace...\n ")


call(code_space)

free_low(code_space)

puts(1, "All done!\n")


--------------FDF6AC23EBC
Content-Disposition: inline; filename="Cw.err"

CauseWay DOS Extender v3.14 Copyright 1992-96 Michael Devore.
All rights reserved.

Exception: 0E, Error code: 0004

EAX=0000D950 EBX=00000000 ECX=00000000 EDX=24EC03DA ESI=82425038
EDI=8241C5D8 EBP=FFFFFC19 ESP=8241C560 EIP=0000D957 EFL=00010213

CS=018F-7DC15000 DS=0197-7DC15000 ES=0197-7DC15000
FS=0000-xxxxxxxx GS=019F-xxxxxxxx SS=0197-7DC15000

CR0=00000000 CR2=00000000 CR3=00000000 TR=0000

Info flags=00008018

$         07 80 74 1C 2E 8B 47 12 2E A3 75 19 2E 8B 47 10
         2E A3 73 19 5A 5B 58 2E FF 4D 00 00 8B 14 00 00
         2E 80 0F 80 8B DC 36 8B 47 0A 25 D5 0C 83 C8 02
         2E A3 93 1B 5A 5B 58 2E 89 26 73 19 2E 8C 16 75
         19 2E 8E 16 68 0A 66 2E 8B 26 64 0A 66 2E 81 2E
         64 0A 00 02 00 00 66 2E FF 36 73 19 66 50 66 53
         66 51 66 52 66 56 66 57 66 55 1E 06 0F A0 0F A8
         B8 01 0C 8E D8 89 26 73 19 8C 16 75 19 B9 6B 00
         66 33 D2 8B D4 FF 16 9C 04 8B 1E 97 1B 8A 5F 01
         50 66 53 1E B8 63 00 8E D8 66 0F B6 C3 66 8B D8
         66 D1 E3 66 8B C3 66 D1 E3 66 03 D8 66 81 C3 64
         23 00 00 1E B8 D3 00 8E D8 67 66 8B 13 67 8B 4B
         04 1F 1F 66 5B 58 F7 06 A2 05 01 00 74 0A 89 0E
         89 1B 89 16 87 1B EB 09 89 0E 8B 1B 66 89 16 87
         1B B8 73 00 8E E0 66 0F B7 36 75 19 66 C1 E6 04


SS:ESP > 01 00 00 00 50 D9 00 00 27 E1 3E 82 D8 C5 41 82
         01 00 80 00 D0 C5 41 82 44 D6 41 82 F4 37 42 82
         D0 C5 41 82 00 00 00 00 50 D9 00 00 D3 2A 3F 82
         00 00 00 00 00 00 00 00 21 00 00 00 F3 27 3F 82
         D8 C5 41 82 80 00 00 00 19 FC FF FF D8 C5 41 82
         19 00 00 00 00 00 00 00 00 00 00 00 D8 B0 3E 82
         01 00 00 00 D7 A6 3F 82 00 00 00 00 7B A9 3F 82
         19 00 00 00 44 D6 41 82 04 C6 41 82 F2 60 41 82
         15 86 41 82 78 00 00 00 0F 00 00 00 F1 60 41 82
         20 1D 3F 82 80 6F 41 82 00 00 00 00 10 C6 41 82
         8F 41 40 82 00 00 00 00 00 01 41 82 07 DE 3F 82
         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00



--------------FDF6AC23EBC--

new topic     » goto parent     » topic index » view message » categorize

5. sprites

Hello,
        Can anyone show me an example of a bitmap passing over another
bitmap(a background) w/o disturbing the background bitmap?
Thanx,
/ViC./
 ______________________________________________________________________
|     http://www.geocities.com/SiliconValley/Heights/8858/home.htm     |
|                     Veni vidi, vici. Fiat lux.                       |
|______________________________________________________________________|

new topic     » goto parent     » topic index » view message » categorize

6. Re: sprites

At 08:06 PM 2/15/97 -0500, you wrote:

>        Can anyone show me an example of a bitmap passing over another
>bitmap(a background) w/o disturbing the background bitmap?

Do you mean being able to see the background through the sprite or having the
background restored after the sprite moves over it.

If it's the second, use a call to save_image() to keep the part of the
background the sprite is moving over.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The Reaper  (J. Lays)
reaper at auracom.com  ........................
               . .. -||..........__......  "There are no miracles,
                . /  ||......../-- \\.::::  Just dreams that come true,
             . ..|   ||...... / o o| |.:::  By the actions of someone
               .|  _-||.......|| ^ / /.:::: Who didn't waste time dreaming."
              ..| |..||...... -\_- \ |\-.:::
               .| |.[< \ .../            \.::
                .||.|||\|\ |  -REAPER- .  \.::::
               ...|.\|| |  \  |        |   |.:::.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

new topic     » goto parent     » topic index » view message » categorize

7. Re: sprites

>Do you mean being able to see the background through the sprite or having the
>background restored after the sprite moves over it.
>
>If it's the second, use a call to save_image() to keep the part of the
>background the sprite is moving over.
>
>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>The Reaper  (J. Lays)

I meant the second, and I wanted some sort of example. Thanx, I will
try save_image().
/ViC./
 ______________________________________________________________________
|     http://www.geocities.com/SiliconValley/Heights/8858/home.htm     |
|                     Veni vidi, vici. Fiat lux.                       |
|______________________________________________________________________|

new topic     » goto parent     » topic index » view message » categorize

8. Re: sprites

On Sat, 15 Feb 1997, Vic wrote:
> Hello,
>         Can anyone show me an example of a bitmap passing over another
> bitmap(a background) w/o disturbing the background bitmap?
> Thanx,
> /ViC./

play OidZone.

Michael Packard
Lord Generic Productions
lgp at exo.com http://exo.com/~lgp
A Crash Course in Game Design and Production
http://exo.com/~lgp/euphoria

new topic     » goto parent     » topic index » view message » categorize

9. Re: sprites

> Hello,
>         Can anyone show me an example of a bitmap passing over another
> bitmap(a background) w/o disturbing the background bitmap?
> Thanx,
> /ViC./
Here's an example of how I write sprites when there is a background.
Hope it helps.

DeWayne Culbertson

new topic     » goto parent     » topic index » view message » categorize

10. Re: sprites

At 03:02 PM 2/16/97 -0800, you wrote:

>
>play OidZone.
>

Um, he wants a example that he can read, not some binded shareware game like
OidZone. Seriously, though, you have to cut down your plugging of that game.
We all know about it now. (good job on the game, however. It's really cool,
though I'm not buying...) Anyways, when I said PC speaker, I meant through
the "PC" speaker, not a sound blaster, like you use in OidZone. Though
Jacques' code is
nice, it is rather bulky and it's SOMEONE ELSE's code, which I don't like using.
However, in a game like Snakers!, I didn't have much choice. If you seen the
example Vic sent me, then you should know what speaker I am talking about...

P.S.  Play SNAKERS!!!! Version 1.5 should be on the official homepage soon, that
      is if Robert Craig decides to put it up. Two-Player simultaneous!
      (hey, if Packard can do it, why can't I?)

Man, I should have kept that long signature...


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The Reaper  (J. Lays)
reaper at auracom.com  ........................
               . .. -||..........__......  "There are no miracles,
                . /  ||......../-- \\.::::  Just dreams that come true,
             . ..|   ||...... / o o| |.:::  By the actions of someone
               .|  _-||.......|| ^ / /.:::: Who didn't waste time dreaming."
              ..| |..||...... -\_- \ |\-.:::
               .| |.[< \ .../            \.::
                .||.|||\|\ |  -REAPER- .  \.::::
               ...|.\|| |  \  |        |   |.:::.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

new topic     » goto parent     » topic index » view message » categorize

11. Re: sprites

On Sun, 16 Feb 1997, The Reaper wrote:
> Jacques' code is nice, it is rather bulky and it's SOMEONE ELSE's code,
> which I don't like using. However, in a game like Snakers!, I didn't
> have much choice...

I cannot disagree with you more on all points.

1) The interface code to use Jacques routines is TINY, like 5 lines to
load all your sounds, and one include file. Then it's
PlaySoundEffect(SoundEffects[3]) to play sound 3, say.
I don't see bulky.  I see elegant and painless to add to your code.  I
asked Jacques how to make it work and he gave me the 5 line snippet I cut
and pasted into OZ and it worked the first time.

2) So it's someone else's code!  As far as anyone is concerned, Jacques'
code was a STANDARD include from the day he released it. Why reinvent the
wheel, when we have something that works great?  If you know a BETTER way
to do something, that's a different thing, but just because someone else
wrote it doesn't justify boycotting it.

On a similar note, I consider the sound code as developed FOR OidZone as
much as anything else.   When OZ began production there was NOTHING for
soundblaster.  I asked (the world) for Sound Blaster support and a couple
weeks later I got alphas of the code from Jacques. As far as I know I was
the first aside from him to use the code in anything anyone on here saw.
OZ's first alpha had soundblaster support.  Peter Blue beat me to the
punch getting his Space Invaders out first. (dang! =)

It is IMPORTANT FOR THE EXPANSION OF EUPHORIA that people build routines
that others can use in their code.  I've been writing like mad all week
getting the OidZone Programmer's Reference sufficiently detailed in the
code explanation.  My own goal in all I do is to get us all working
together as we explore what Euphoria can do.  If you want to do the things
I've done, I'll show you, as long as you show me how you took it to the
next level.  When you get source code from me, you also get a complete
license to use it any way you want royalty free. (you can pay me
royalties if you want!)

Michael Packard
Lord Generic Productions
lgp at exo.com http://exo.com/~lgp
A Crash Course in Game Design and Production
http://exo.com/~lgp/euphoria

new topic     » goto parent     » topic index » view message » categorize

12. Re: sprites

>play OidZone.
>
>Michael Packard
>Lord Generic Productions
>lgp at exo.com http://exo.com/~lgp
>A Crash Course in Game Design and Production
>http://exo.com/~lgp/euphoria

Thanks for your help! :)
/ViC./
 ______________________________________________________________________
|     http://www.geocities.com/SiliconValley/Heights/8858/home.htm     |
|                     Veni vidi, vici. Fiat lux.                       |
|______________________________________________________________________|

new topic     » goto parent     » topic index » view message » categorize

13. Re: sprites

>Here's an example of how I write sprites when there is a background.
>Hope it helps.
>
>DeWayne Culbertson
>
>Attachment Converted: c:\eudora\attach\sptites.zip


Thanks for the code...it's works good.
/ViC./
 ______________________________________________________________________
|     http://www.geocities.com/SiliconValley/Heights/8858/home.htm     |
|                     Veni vidi, vici. Fiat lux.                       |
|______________________________________________________________________|

new topic     » goto parent     » topic index » view message » categorize

14. Re: sprites

At 09:49 PM 2/16/97 -0800, you wrote:
>
>I cannot disagree with you more on all points.
>

You all hate me, don't you :)  *sigh*   Anyways, what I meant by bulky is
that you have about six include files with it. And I didn't mean we should
boycott the code (good lord!), but I meant that "I" feel better writing my
own. However, I can't, so I'll be using Jacques Deschene's code.

Oh yeah, expansion must be real IMPORTANT if you're charging $45 for it.
(just kidding, Packard, I had to put that in. No offense.)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The Reaper  (J. Lays)
reaper at auracom.com  ........................
               . .. -||..........__......  "There are no miracles,
                . /  ||......../-- \\.::::  Just dreams that come true,
             . ..|   ||...... / o o| |.:::  By the actions of someone
               .|  _-||.......|| ^ / /.:::: Who didn't waste time dreaming."
              ..| |..||...... -\_- \ |\-.:::
               .| |.[< \ .../            \.::
                .||.|||\|\ |  -REAPER- .  \.::::
               ...|.\|| |  \  |        |   |.:::.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

new topic     » goto parent     » topic index » view message » categorize

15. Re: sprites

>You all hate me, don't you :)  *sigh*   Anyways, what I meant by bulky is
>that you have about six include files with it. And I didn't mean we should
>boycott the code (good lord!), but I meant that "I" feel better writing my
>own. However, I can't, so I'll be using Jacques Deschene's code.

Well, if you wish to distribute your files to non-Euphoria people you can
use the handy little file called bind.ex.  It takes all the include files
and the main program and makes one .exe file out of them.
You should read the doc's that come with Euphoria!


We don't hate you, we just like picking on you.  :)


-Matt Stancliff

new topic     » goto parent     » topic index » view message » categorize

16. Re: sprites

On Mon, 17 Feb 1997, The Reaper wrote:
>
> Oh yeah, expansion must be real IMPORTANT if you're charging $45 for it.
> (just kidding, Packard, I had to put that in. No offense.)

If you saw it, you'd agree.  I know, you'd rather I give away the 120 page
book I'm writing on how to create a simultaneous-event driven game like
OidZone, but I ain't. =)  You can wait until we get that far in crash
course, that's fine.  It shouldn't be much after june.

Michael Packard
Lord Generic Productions
lgp at exo.com http://exo.com/~lgp
A Crash Course in Game Design and Production
http://exo.com/~lgp/euphoria

new topic     » goto parent     » topic index » view message » categorize

17. Re: sprites

At 05:52 PM 2/17/97 -0500, you wrote:

>Well, if you wish to distribute your files to non-Euphoria people you can
>use the handy little file called bind.ex.  It takes all the include files
>and the main program and makes one .exe file out of them.
>You should read the doc's that come with Euphoria!
>
>We don't hate you, we just like picking on you.  :)

Um, I think you got lost there. I know about bind.ex (it's a bit hard to
program without the .DOCs!!!), and I was talking about something different.

P.S. Don't you start picking on me. It's bad enough having the font-meister
and      Mr. Cash raining down on me! :)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The Reaper  (J. Lays)
reaper at auracom.com  ........................
               . .. -||..........__......  "There are no miracles,
                . /  ||......../-- \\.::::  Just dreams that come true,
             . ..|   ||...... / o o| |.:::  By the actions of someone
               .|  _-||.......|| ^ / /.:::: Who didn't waste time dreaming."
              ..| |..||...... -\_- \ |\-.:::
               .| |.[< \ .../            \.::
                .||.|||\|\ |  -REAPER- .  \.::::
               ...|.\|| |  \  |        |   |.:::.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

new topic     » goto parent     » topic index » view message » categorize

18. Re: sprites

> Oh yeah, expansion must be real IMPORTANT if you're charging $45 for it.
> (just kidding, Packard, I had to put that in. No offense

I guess I must think it is, as I put in an order for the $40 edition (and
will pay more than American customers because I am in Canada). We
shouldn't fault Michael for making a profit on something that will benefit
the Euphoria community. What he is doing is a good thing.

David Gay
http://www.interlog.com/~moggie/Euphoria
"A Beginner's Guide To Euphoria"

new topic     » goto parent     » topic index » view message » categorize

19. Re: sprites

On Mon, 17 Feb 1997, The Reaper wrote:
> P.S. Don't you start picking on me. It's bad enough having the font-meister
> and      Mr. Cash raining down on me! :)

Mr Cash?  I'd like to meet him! (and sell him a few hundred copies of...)

Michael Packard
Lord Generic Productions
lgp at exo.com http://exo.com/~lgp
A Crash Course in Game Design and Production
http://exo.com/~lgp/euphoria

new topic     » goto parent     » topic index » view message » categorize

20. Re: sprites

At 10:49 PM 2/17/97 -0500, you wrote:

>I guess I must think it is, as I put in an order for the $40 edition (and
>will pay more than American customers because I am in Canada).

Sucker :)    Seriously, though, you seem like a valid programmer, I don't
see why you need the source code... it's really for the beginners (and
people who won't admit their beginners) that use YOUR tutorial. Oh well, if
you got the cash to spend...

>We shouldn't fault Michael for making a profit on something that will benefit
>the Euphoria community. What he is doing is a good thing.

You guys take me WAY too seriously...
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The Reaper  (J. Lays)
reaper at auracom.com  ........................
               . .. -||..........__......  "There are no miracles,
                . /  ||......../-- \\.::::  Just dreams that come true,
             . ..|   ||...... / o o| |.:::  By the actions of someone
               .|  _-||.......|| ^ / /.:::: Who didn't waste time dreaming."
              ..| |..||...... -\_- \ |\-.:::
               .| |.[< \ .../            \.::
                .||.|||\|\ |  -REAPER- .  \.::::
               ...|.\|| |  \  |        |   |.:::.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

new topic     » goto parent     » topic index » view message » categorize

21. Re: sprites

On Tue, 18 Feb 1997, The Reaper wrote:
> >I guess I must think it is, as I put in an order for the $40 edition (and
> >will pay more than American customers because I am in Canada).
>
> Sucker :)    Seriously, though, you seem like a valid programmer, I don't
> see why you need the source code... it's really for the beginners (and
> people who won't admit their beginners) that use YOUR tutorial. Oh well, if
> you got the cash to spend...

That is too funny to even make a snide comment at...

Michael Packard
Lord Generic Productions
lgp at exo.com http://exo.com/~lgp
A Crash Course in Game Design and Production
http://exo.com/~lgp/euphoria

new topic     » goto parent     » topic index » view message » categorize

22. Re: sprites

> Sucker :)    Seriously, though, you seem like a valid programmer, I don't
> see why you need the source code... it's really for the beginners (and
> people who won't admit their beginners) that use YOUR tutorial. Oh well, if
> you got the cash to spend...
C
I am a valid programmer :)...however, we are all beginners at
things we never tried before. Professional graphics programming...the
stuff Michael does...is one of those things. That's why I attend his Crash
Course regularly and also why I wanted the source of his game.

> You guys take me WAY too seriously...

My prior comment to you was not an admonishment. It was just my opinion
that if a commercial venture helps enhance Euphoria's visibility, I don't
have a problem with any profits made out of it :)

David Gay
http://www.interlog.com/~moggie/Euphoria
"A Beginner's Guide To Euphoria"

new topic     » goto parent     » topic index » view message » categorize

23. Re: sprites

On Tue, 18 Feb 1997, David Gay wrote:
> I am a valid programmer :)...however, we are all beginners at

What the heck is a "valid programmer?"


Michael Packard
Lord Generic Productions
lgp at exo.com http://exo.com/~lgp
A Crash Course in Game Design and Production
http://exo.com/~lgp/euphoria

new topic     » goto parent     » topic index » view message » categorize

24. Re: sprites

> What the heck is a "valid programmer?"
>
I assumed The Reaper's use of "valid" was an American slangword for
"acceptable" or "recognized", so a "valid programmer" would mean
"acceptable programmer" :)

But enough of this. How's the Games Crash Course going? :)

new topic     » goto parent     » topic index » view message » categorize

25. Re: sprites

On Thu, 20 Feb 1997, David Alan Gay wrote:
> > What the heck is a "valid programmer?"
> >
> I assumed The Reaper's use of "valid" was an American slangword for
> "acceptable" or "recognized", so a "valid programmer" would mean
> "acceptable programmer" :)
>
> But enough of this. How's the Games Crash Course going? :)
>
Going well.  I was planning to cover the AI spec this time, but I've been
thinking about taking a detour into PC speaker sound FX, since somebody
asked about them earlier, and it would be best as an addendum to the sound
lesson we just did.  While being no expert on speaker tweaking, I did some
interesting ones for OZ and I could introduce Simultaneous Event Driven
Programming concepts that we'll need later with such a lesson. Our
PC speaker sound FX need to be time-sliced to work in our gaming
environment, so we need to plan effects around changing sound(XXX) at
discrete intervals...

But I may change my mind again...

Michael Packard
Lord Generic Productions
lgp at exo.com http://exo.com/~lgp
A Crash Course in Game Design and Production
http://exo.com/~lgp/euphoria

new topic     » goto parent     » topic index » view message » categorize

26. Re: sprites

> David,
> This is what i made with the source code you sent.
> For some strange reason the program just crash, and i
> don't have any idea why. Perhaps Robert Craig can explain
> this. I send the code and the CW.ERR file produced by
> Causeway. I guess the problem is just of Causeway, because
> there's no ex.err file generated (well, causeway didn't let
> the asm routine to finish).
> Rob, are you sure i can PUSH and POP?

Your problem is that Euphoria is running in 32-bit protected mode,
not real mode, and machine code instructions are processed
differently in this mode.

For example, the code #50 for which your comment shows :  -- push ax
is actually executing the instruction: -- push eax!

The instruction to load the DX register is actually loading the EAX
register, which takes four bytes, so you will need some extra zeros.
Also, you want a TEST instruction, not an AND.
Lastly, there's no reason to waste precious DOS memory, when you can
use extended memory. Just use allocate() instead of allocate_low().

Like this:

include machine.e

sequence code
atom code_space

code = {
               #50,                                         -- push eax
               #52,                                         -- push edx
               #BA, #DA, #03, #00,#00,      -- mov edx,#3DA
               #EC,                                        -- loop: in al,edx
               #A8, #08,                                -- test al,#8
               #75, #FB,                                -- jnz loop
               #EC,                                        -- finish: in al,edx
               #A8, #08,                                -- test al,#8
               #74, #FB,                                -- jz finish
               #5A,                                        -- pop edx
               #58,                                         -- pop eax
               #C3}                                        -- ret

code_space = allocate(length(code))
poke(code_space,code)

puts(1,"\n Calling machine code routine for waiting retrace... \n ")

call(code_space)

free(code_space)

puts(1,"All done!\n")

Regards,
              Michael Bolin

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu