Pcman is written in 100% pure assembly language.  I started working on it in the Fall of 1995, my Sophomore year in high school. At the time I was very much into the 'demo' scene; and this was my second entry into the 666 byte game contest; my first was pong.  I worked on this with Phil Lawton, a friend from one of the local BBSs.  We never actually managed to finish it (the ghosts don't move!), but, levels do work, and you *will* lose if you run into one of the ghosts. We still had a few bytes to work with, I think the program compiles into a 621 byte .com file.  



DrawErase PROC
  xor dl,dl
  mov ax,Xpos
  mov di,Ypos
  and dh,dh
  jz ErasePac
  mov dl,14 ; Pcman color

ErasePac:
  lea si,Pacman
  call Blit8x8 ; place Pcman (doesn't alter dx)
  mov cx,4 ; 4 ghosts

DrawGhosts:
  lea si,Xpos ; set X
  add si,cx
  add si,cx
  mov ax,[si]
  lea si,Ypos ; set Y
  add si,cx
  add si,cx
  mov di,[si]
  and dh,dh ; test draw/erase
  jz EraseGhosts
  lea si,Color ; set Color
  add si,cx
  mov dl,[si]

EraseGhosts:
  lea si,Ghost ; place ghost
  push cx
  call Blit8x8
  pop cx
  loop DrawGhosts
  ret

DrawErase ENDP




Isn't assembly language a beautiful thing?  I mean, I just love that you can do so much with just a few instructions and a consistent syntax.  Even better, you end up with a small, fast executable!  

In case you were curious about how the code is 'structured', take a look to the left.  This function is used to both draw and erase the pcman and the ghosts.  If the high bit of DX is set on entry to the function, this procedure will render all of the moveable entities, if it's 0, then it will erase them.

You can download the source here.

Have fun!