The OP maze generator is awesome!
For a different machine code implementation, see the October 1983 Compute!:
http://archive.org/stream/1983-10-compu ... 3/mode/2up
There's a VIC-20 implementation
And here it is:
Code: Select all
10 rem maze (vic)
20 rem maze generator in machine language
50 rem for the vic-20 (any memory size)
100 y=peek(55)+256*peek(56)-202: x=int(y/256): y=y-256*x
110 poke 55,y: poke 56,x: poke 51,y: poke 52,x
120 clr: poke 36879,27: print chr$(142);: x=rnd(-ti)
130 s=peek(55)+256*peek(56): a=s
140 print "{clr}{2 down}loading..."
150 read x$: if x$="xxx" then 200
160 r=asc(x$): q=val(mid$(x$,1-(r<48)))
170 if r<>43 then x=q: goto 190
180 y=s+q: x=int(y/256): y=y-256*x: poke a,y: a=a+1
190 poke a,x: a=a+1: goto 150
200 print "{home}": if peek(210)<>16 then 220
210 poke s+17,16: poke s+45,148: poke s+48,149
220 print "{down}activate with"
230 print " {rvon}sys"; s+8
240 print "{2 down}press any key for"
250 print "demonstration mazes."
260 print "{2 down}press 'q' when you"
270 print "want to quit.": goto 290
280 sys s+8: print "{home}press key..."
290 get x$: if x$="" then 290
300 if x$<>"q" then 280
310 print "{clr}": poke 36879,27
320 data 1, 0, 234, 255, 255, 255, 22, 0, 169, 45
330 data 133, 87, 169, 22, 133, 89, 169, 30, 133, 88
340 data 133, 90, 169, 25, 141, 15, 144, 32, 95, 229
350 data 32, 148, 224, 165, 143, 41, 7, 201, 2, 48
360 data 245, 160, 0, 153, 0, 150, 153, 0, 151, 200
370 data 208, 247, 162, 0, 160, 0, 169, 160, 145, 89
380 data 200, 192, 21, 208, 249, 24, 165, 89, 105, 22
390 data 133, 89, 144, 2, 230, 90, 232, 224, 21, 208
400 data 229, 160, 0, 169, 4, 145, 87, 32, 148, 224
410 data 165, 143, 41, 3, 133, 1, 170, 10, 168, 24
420 data 185, +0, 101, 87, 133, 91, 185, +1, 101, 88
430 data 133, 92, 24, 185, +0, 101, 91, 133, 89, 185
440 data +1, 101, 92, 133, 90, 160, 0, 177, 89, 201
450 data 160, 208, 18, 138, 145, 89, 169, 32, 145, 91
460 data 165, 89, 133, 87, 165, 90, 133, 88, 76, +87
470 data 232, 138, 41, 3, 197, 1, 208, 189, 177, 87
480 data 170, 169, 32, 145, 87, 224, 4, 240, 26, 138
490 data 10, 168, 162, 2, 56, 165, 87, 249, +0, 133
500 data 87, 165, 88, 249, +1, 133, 88, 202, 208, 238
510 data 76, +87, 96, xxx
http://www.kweepa.com/step/vic20/mazer.prg
It's a weak bit of code, since it relocates it from basic rather than just using relative jumps, but it's fast enough
I updated it to not have to be relocated (so it installs faster), and put it in the cassette buffer (by moving the random maze color from asm to basic):
Code: Select all
10 p=828:fori=0to182:reada:pokep+i,a:next
20 data 169, 45, 133, 87, 169, 22, 133, 89, 169, 30
30 data 133, 88, 133, 90, 169, 5, 160, 0, 153, 0
40 data 150, 153, 0, 151, 200, 208, 247, 162, 0, 160
50 data 0, 169, 160, 145, 89, 200, 192, 21, 208, 249
60 data 24, 165, 89, 105, 22, 133, 89, 144, 2, 230
70 data 90, 232, 224, 21, 208, 229, 160, 0, 169, 4
80 data 145, 87, 32, 148, 224, 165, 143, 41, 3, 133
90 data 1, 170, 10, 168, 24, 185, 235, 3, 101, 87
100 data 133, 91, 185, 236, 3, 101, 88, 133, 92, 24
110 data 185, 235, 3, 101, 91, 133, 89, 185, 236, 3
120 data 101, 92, 133, 90, 160, 0, 177, 89, 201, 160
130 data 208, 18, 138, 145, 89, 169, 32, 145, 91, 165
140 data 89, 133, 87, 165, 90, 133, 88, 24, 144, 188
150 data 232, 138, 41, 3, 197, 1, 208, 189, 177, 87
160 data 170, 169, 32, 145, 87, 224, 4, 240, 25, 138
170 data 10, 168, 162, 2, 56, 165, 87, 249, 235, 3
180 data 133, 87, 165, 88, 249, 236, 3, 133, 88, 202
190 data 208, 238, 240, 144, 96, 1, 0, 234, 255, 255
200 data 255, 22, 0
210 print"{clr}":pokep+15,2+6*rnd(1):sysp:print"{home}press key..."
220 k=peek(197):ifk<>48thenon1-(k=64)goto210,220
230 poke198,0
http://www.kweepa.com/step/vic20/mazer2.prg