asm
  ld sp,$C7FF
  end asm

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

dim eee as uinteger at $C010
dim seed as uinteger at $C012
dim ee0 as uinteger at $C014
dim ee1 as uinteger at $C016
dim ee2 as uinteger at $C018
dim ee3 as uinteger at $C01A
dim eex as uinteger at $C01C
dim eey as uinteger at $C01E

sub parallelturnputchar(txp1 as uinteger, typ1 as uinteger,tch1 as ubyte)
  poke $E000+((txp1*32)+typ1) bxor %1111100000,tch1 bxor (((tch1 band 32)/32)*96) bxor (((tch1 band 64)/64)*96)
  end sub

sub parallelturnputsprite(tly2 as uinteger,txp2 as ubyte,typ2 as ubyte,tch2 as ubyte,tat2 as ubyte)
  poke $F000+(tly2*4),txp2
  poke $F001+(tly2*4),tch2
  poke $F002+(tly2*4),tat2
  poke $F003+(tly2*4),typ2
  end sub

seed=0

seed=smsrnd(seed)
poke $E400,seed

seed=smsrnd(seed)
poke $F801,seed

for ee0=0 to 31
  for ee1=0 to 31
    seed=smsrnd(seed)
    parallelturnputchar(ee1,ee0,96+(seed mod 9))
    'smsdelay(1000)
    next:next

'for eee=$F000 to $F0FF '-sprite
'  seed=smsrnd(seed)
'  poke eee,seed
'  'smsdelay(1000)
'  next

'for eee=0 to 255 '-sprite
'  parallelturnputchar(3,3,48+(eee mod 16) )
'  ee1=peek($F000+eee)
'  for ee0=0 to 255
'    poke $F000+eee,ee0
'    smsdelay(1000)
'    next
'  poke $F000+eee,ee1
'  parallelturnputsprite(0,eee,eee,eee,eee)
'  next

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


eee=0:eex=8:eey=8
do

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

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

eex=eex+((ee0 band 1)/1)-((ee0 band 2)/2)
eey=eey+((ee0 band 8)/8)-((ee0 band 4)/4)

ee1=peek($F801)
parallelturnputchar(5,4,48+(int(ee1/100) mod 10))
parallelturnputchar(6,4,48+(int(ee1/10) mod 10))
parallelturnputchar(7,4,48+(ee1 mod 10))

parallelturnputchar(eex,eey,32+(eee mod 64))


eee=eee+1
loop

do:loop

''for eee=$0000 to $FFFF
''  seed=smsrnd(seed)
''  poke eee,seed
''  next
'
'
'
''static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, pturn_state )
''	AM_RANGE(0x0000, 0x7fff) AM_ROM
''	AM_RANGE(0xc000, 0xc7ff) AM_RAM
''	AM_RANGE(0xc800, 0xcfff) AM_WRITENOP AM_READ(custom_r)
''	AM_RANGE(0xdfe0, 0xdfe0) AM_NOP
''	AM_RANGE(0xe000, 0xe3ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
''	AM_RANGE(0xe400, 0xe400) AM_WRITE(fgpalette_w)
''	AM_RANGE(0xe800, 0xe800) AM_WRITE(soundlatch_byte_w)
''	AM_RANGE(0xf000, 0xf0ff) AM_RAM AM_SHARE("spriteram")
''	AM_RANGE(0xf400, 0xf400) AM_WRITE(bg_scrollx_w)
''	AM_RANGE(0xf800, 0xf800) AM_READ_PORT("P1") AM_WRITENOP
''	AM_RANGE(0xf801, 0xf801) AM_READ_PORT("P2") AM_WRITE(bgcolor_w)
''	AM_RANGE(0xf802, 0xf802) AM_READ_PORT("SYSTEM")
''	AM_RANGE(0xf803, 0xf803) AM_WRITE(bg_scrolly_w)
''	AM_RANGE(0xf804, 0xf804) AM_READ_PORT("DSW2")
''	AM_RANGE(0xf805, 0xf805) AM_READ_PORT("DSW1")
''	AM_RANGE(0xf806, 0xf806) AM_READNOP /* Protection related, ((val&3)==2) -> jump to 0 */
''	AM_RANGE(0xfc00, 0xfc00) AM_WRITE(flip_w)
''	AM_RANGE(0xfc01, 0xfc01) AM_WRITE(nmi_main_enable_w)
''	AM_RANGE(0xfc02, 0xfc02) AM_WRITENOP /* Unknown */
''	AM_RANGE(0xfc03, 0xfc03) AM_WRITENOP /* Unknown */
''	AM_RANGE(0xfc04, 0xfc04) AM_WRITE(bgbank_w)
''	AM_RANGE(0xfc05, 0xfc05) AM_WRITE(fgbank_w)
''	AM_RANGE(0xfc06, 0xfc06) AM_WRITENOP /* Unknown */
''	AM_RANGE(0xfc07, 0xfc07) AM_WRITENOP /* Unknown */
''ADDRESS_MAP_END
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'sub putchar(txpos as uinteger,typos as uinteger,tch as uinteger, tadr as uinteger,txor as ubyte)
'  dim trt as uinteger at $A000
'  'for trt=0 to 7
'  '  poke $A200+(txpos band 31)+(trt*32)+((typos mod 28)*256),peek(tadr+(tch*8)+trt) bxor txor
'  '  next
'  'minivadersldir32b($A200+(txpos band 31)+(trt*32)+((typos mod 28)*256), tadr+(tch*8),8)
'  'minivadersfillramxor32b($A200+(txpos band 31)+(trt*32)+((typos mod 28)*256),txor,8)
'
'  minivadersldirxor32b($A200+(txpos band 31)+(trt*32)+((typos mod 28)*256), tadr+(tch*8),8,txor)
'  end sub
'
'sub writetext(txpos2 as uinteger,typos2 as uinteger,ttxt as uinteger, tleng as uinteger,tadr2 as uinteger, txor2 as uinteger)
'  dim trt2 as uinteger at $A002
'  for trt2=0 to tleng-1
'    putchar(txpos2+trt2,typos2,peek(ttxt+trt2),tadr2,txor2)
'    next
'  end sub
'
'for eey=0 to 27
'  for eex=0 to 31
'    seed=smsrnd(seed)
'    putchar(eex,eey,96+(seed mod 9),@charmap01-253,$FF)
'    next:next
'
'for eey=0 to 7
'  for eex=0 to 15
'    putchar(eex+15,eey+11,eex+(eey*16),@charmap01-253,$FF)
'    putchar(eex+15,eey+19,eex+(eey*16),@charmap01-253,$00)
'    next:next
'
'writetext(15,9,@text01,14,@charmap01-253,$FF)
'
'exps=16
'eee=0
'
'do
'  ejst=peek($E008) bxor 255
'  putchar(3,9,48+ (ejst mod 10)  ,@charmap01-253,$FF)
'  putchar(2,9,48+ ( int(ejst/10) mod 10)  ,@charmap01-253,$FF)
'  putchar(1,9,48+ ( int(ejst/100) mod 10)  ,@charmap01-253,$FF)
'  eee=eee+1
'  if (ejst band 1)<>0 then:exps=exps-1:end if
'  if (ejst band 2)<>0 then:exps=exps+1:end if
'  eqq=96+(eee mod 9)
'  if (ejst band 4)<>0 then:eqq=96+4:end if
'  putchar(exps,7,eqq,@charmap01-253,$FF)
'  pacmandelay(2000)
'  loop
'
'
'
'seed=0
'
'delay=100
'
''for eey2=0 to 27
''  for eex=0 to 31
''    for eey=0 to 7
''      for eee=1 to delay:next
''      seed=smsrnd(seed)
''      poke $A200+eex+(eey*32)+(eey2*256),seed
''      next:next:next
'
'
'do
'  seed=smsrnd(seed):eey2=seed mod 28
'  seed=smsrnd(seed):eex=seed band 31
'  for eey=0 to 7
'    poke $A200+eex+(eey*32)+(eey2*256),$00
'    next
'  seed=smsrnd(seed):eey2=seed mod 28
'  seed=smsrnd(seed):eex=seed band 31
'  for eey=0 to 7
'    poke $A200+eex+(eey*32)+(eey2*256),$FF
'    next
'  seed=smsrnd(seed):eey2=seed mod 28
'  seed=smsrnd(seed):eex=seed band 31
'  for eey=0 to 7
'    seed=smsrnd(seed)
'    poke $A200+eex+(eey*32)+(eey2*256),seed
'    next
'  loop
'
'
'delay=1000
'do
'  for eee=$A200 to $BDFF
'    seed=smsrnd(seed)
'    poke eee,seed
'    next
'  for eee=1 to delay:next
'  for eee=$A200 to $BDFF
'    poke eee,0
'    next
'  for eee=1 to delay:next
'  loop
'
'
'do
'  loop
'
'text01:
'asm
'  defb "HELLO WORLD!!!!!"
'  end asm
'
'
'
'
'
''-------------------------------------------------------------------------------
'
'
'
