asm
  ld sp,$5FFF
  end asm

#include "./library/pacmandelay.bas"
#include "./library/smsrnd.bas"

dim i as uinteger at $5810
dim eee as uinteger at $5812
dim seed as uinteger at $5814
dim ee0 as uinteger at $5816
dim ee1 as uinteger at $5818
dim ee2 as uinteger at $582A
dim ee3 as uinteger at $582C
dim ee4 as ubyte at $581A
dim ecsp as ubyte at $581C
dim ecsq as ubyte at $581E
dim ex0 as uinteger at $5820
dim ey0 as uinteger at $5822
dim ej0 as uinteger at $5824
dim ej1 as uinteger at $5826
dim delay as uinteger at $5828

sub zodiackputchar(txp1 as uinteger,typ1 as uinteger,tch1 as uinteger):
  poke $B000+txp1*32+(31-typ1),tch1
  end sub

sub zodiackputattr(typ2 as uinteger,tat2 as uinteger):
  poke $9000+(63-typ2),tat2
  end sub

for ee0=0 to 31
  for ee1=0 to 31
    seed=smsrnd(seed)
    zodiackputchar(ee1,ee0,$60+(seed mod 9))
    for delay=0 to 100:next
    next:next

for eee=0 to 63
  seed=smsrnd(seed)
  zodiackputattr(eee,seed)
  for delay=0 to 400:next
  next

for ee0=0 to 15
  for ee1=0 to 15
    zodiackputchar(ee1+13,ee0+15,ee0*16+ee1)
    next:next

eee=0:ex0=8:ey0=8
do

zodiackputchar(3,1,48+int(eee/10000) mod 10)
zodiackputchar(4,1,48+int(eee/1000) mod 10)
zodiackputchar(5,1,48+int(eee/100) mod 10)
zodiackputchar(6,1,48+int(eee/10) mod 10)
zodiackputchar(7,1,48+eee mod 10)

ee0=peek($6083)
zodiackputchar(5,3,48+int(ee0/100) mod 10)
zodiackputchar(6,3,48+int(ee0/10) mod 10)
zodiackputchar(7,3,48+ee0 mod 10)

ey0=ey0+((ee0 band 32)/32)

ee0=peek($6084)
zodiackputchar(5,4,48+int(ee0/100) mod 10)
zodiackputchar(6,4,48+int(ee0/10) mod 10)
zodiackputchar(7,4,48+ee0 mod 10)

ex0=ex0+((ee0 band 8)/8)-((ee0 band 128)/128)
ey0=ey0-((ee0 band 16)/16)

zodiackputchar(ex0,ey0,eee band 127)

eee=eee+1
loop








do

loop


do

for eee=$9000 to $903F
  seed=smsrnd(seed)
  poke eee,seed
  next
for eee=$9040 to $905F
  seed=smsrnd(seed)
  poke eee,seed
  next
for eee=$9060 to $907F
  seed=smsrnd(seed)
  poke eee,seed
  next
for eee=$A000 to $A3FF
  seed=smsrnd(seed)
  poke eee,seed
  next
for eee=$B000 to $B3FF
  seed=smsrnd(seed)
  poke eee,seed
  next

loop

'	AM_RANGE(0x9000, 0x903f) AM_RAM_WRITE(attributes_w) AM_SHARE("attributeram")
'	AM_RANGE(0x9040, 0x905f) AM_RAM AM_SHARE("spriteram")
'	AM_RANGE(0x9060, 0x907f) AM_RAM AM_SHARE("bulletsram")
'	AM_RANGE(0xa000, 0xa3ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
'	AM_RANGE(0xb000, 0xb3ff) AM_RAM_WRITE(videoram2_w) AM_SHARE("videoram_2")


do:loop

