News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Space Invaders

Started by _japheth, July 17, 2024, 08:45:34 PM

Previous topic - Next topic

_japheth


Hello Friends,

I played with Paul S. Reid's "Space Invaders" source code a bit. It's a clone of the famous Arcade game of the 1980s, written with TASM, using VGA mode 0x13 ( 320x200x8 ). The first step was to convert it to Masm syntax. Then, just for fun, I made protected-mode variants, for DPMI 16-/32-bit and Win32.

The Win32 variant uses the (now "legacy") DirectDraw API, and runs in 640x480x8 mode; this seems to be supported by all Windows versions. It might run too fast on new machines - that probably can be fixed rather easily by switching to DirectDraw7 and then select a vertical refresh rate of 60 or 70.

The DOS versions run fine in true DOS and in DosBox. However, with Qemu and VBox there's a problem - they don't support "vertical retrace" synchronisation ( an interesting discussion about this is here: https://forum.osdev.org/viewtopic.php?t=31917 ) - so the game runs way too fast there.

Btw, the game is copyright Paul S. Reid, but distribution of binary and source is ok....


Dummheit, gepaart mit Dreistigkeit - eine furchtbare Macht.

Vortex

Hi Japheth,

Nice work :thumbsup:

For those who would like to try the game, here is how to use the keyboard : left and right arrow keys to move the cannon and SPACE to fire.

FORTRANS

Hi,

   The Windows version works well with my Win2k system.

Regards,

Steve

daydreamer

nice work japhet  :thumbsup:
its design is old dos game run ASAP=run As fast as possible,it makes my cpu go full speed with turbo and cooler fan goes full speed(windows version)

but I already have a different energy setting for lower cpu speed to switch to when run old win95 games for that to solve that kinda problem
 
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

FORTRANS

Hi,

   I tried INVADERS.COM, INVADERS.EXE, and INVADE32.EXE in a
Windows NTVDM, and all ran normally.  INVADERS.COM and
INVADERS.EXE had an odd long pause after dying until I could
quit.

   Trying in an OS/2 VDM, all ran too fast.  Same odd Pauses.

Regards,

Steve N.

_japheth

Quote from: daydreamer on July 18, 2024, 10:15:13 PMits design is old dos game run ASAP=run As fast as possible,it makes my cpu go full speed with turbo and cooler fan goes full speed(windows version)

Yes, the program uses PeekMessage() in the message loop, thus returning instantly if no message is available. IIRC inserting a Sleep(1) call in the message loop - probably just before the WaitForVerticalBlank() call - should reduce cpu load significantly.
Dummheit, gepaart mit Dreistigkeit - eine furchtbare Macht.

_japheth


A little update

  • - sound added to the Win32 version - just using the simple Beep(), no need for SFX.
  • - duration of sound in DOS versions no longer depends on cpu speed.

Dummheit, gepaart mit Dreistigkeit - eine furchtbare Macht.