The map drawing routine is my target. If I put it in assembly then ... well it'll be superfast.
rem dx,dy is the top left corner of the map view
bb=0 :rem this prevents us from POKEing the bank every loop
for r = 0 to \rows-1
y = dy + r
y3 = int(y/32) :rem each RAM bank has 32 rows
ba = 10 + y3 :rem there's our bank number
if bb <> ba then bb=ba :poke $9f61,ba
yy = 32 * (y/32-y3) :rem y mod 32
for c = 0 to \cols-1
x = dx + c
la = peek($a000+yy*256+x) :rem tile value
bk=l1(la) :rem MSB for sprite block
ls=l2(la) :rem LSB for sprite block
s0=s0(r,c) :rem cached sprite address offset
vpoke $f, s0+0, %00000000 + ls
vpoke $f, s0+1, %10000000 + bk
next c
next r
return
First, the code is a mess. It's very busy, and seems to be inefficient for simply updating a map.
The data required to update any one tile is:
1. The correct bank and offset of the data.
2. The MSB value to poke.
3. The LSB value to poke.
4. The sprite's register offset.