here is a very old maze generator I used to use, can't remember where I dug it up. It may have come from the ABC(All Basic Code) archives.
xz- the X size of generated maze
yz- the Y size of generated maze
C- color of maze
S- room size
offx- X offset to place map on screen
offy- Y offset to place map on screen
SCREEN _NEWIMAGE(640, 480, 32)
Temp& = _NEWIMAGE(320, 200, 13)
_DEST Temp&
map 319, 141, 1, 2, 0, 0
_PUTIMAGE (0, 0)-STEP(639, 399), Temp&, _DISPLAY, (0, 0)-STEP(319, 199)
SUB map (xz, yz, C, S, offx, offy)
DIM xv(50), yv(50)
OFX = offx
OFY = offy
LINE (OFX + 0, OFY + 0)-(OFX + xz - 1, OFY + yz - 1), 2, B
120: KEY OFF:: ZZC = C
130 DEF SEG = &HF000: a = PEEK(&HC05D): DEF SEG: IF a = &H4C THEN ZZC = 3
140 YD = S: XD = YD: YN = INT(yz \ YD): XN = INT(xz \ XD)
150 DIM p1(XN + 2, YN + 2), q(XN, YN), a%(9)
160 a%(0) = &H10: a%(1) = &H8: a%(2) = &HF003: a%(3) = &HF003: a%(4) = &HC000
170 a%(5) = &HFF3F: a%(6) = &HC000: a%(7) = &H3003: a%(8) = &HC0C: a%(9) = &H330
180 xv(0) = 1: xv(1) = 0: xv(2) = -1: xv(3) = 0
190 yv(0) = 0: yv(1) = 1: yv(2) = 0: yv(3) = -1
200 GOSUB 290: FOR OKL = 1 TO 5000: NEXT
210 GOTO 200
270 'CLS : SCREEN 0, , 0, 0: WIDTH 80: COLOR 7, 0, 0: LOCATE , , 1: RUN "demo"'op
280 END
290 '
300 'RANDOMIZE TIMER
310 FOR x = 0 TO XN + 2: p1(x, 0) = 1: p1(x, 1) = 1: p1(x, YN + 1) = 1: p1(x, YN + 2) = 1: NEXT
320 FOR y = y TO YN + 2: p1(0, y) = 1: p1(1, y) = 1: p1(XN + 1, y) = 1: p1(XN + 2, y) = 1: NEXT
330 FOR x = 2 TO XN: FOR y = 2 TO YN: p1(x, y) = 0: NEXT: NEXT
340 FOR x = 0 TO XN: FOR y = 0 TO YN: q(x, y) = 0: NEXT: NEXT
350 'CLS
360 LINE (OFX + XD * 0, OFY + YD * 0)-(OFX + XD * XN, OFY + YD * 0), ZZC, B
370 LINE -(OFX + XD * XN, OFY + YD * (YN - 1)), ZZC, B
380 LINE (OFX + XD * 0, OFY + YD * 1)-(OFX + XD * 0, OFY + YD * YN), ZZC, B
390 LINE -(OFX + XD * XN, OFY + YD * YN), ZZC, B
400 C = ZZC: GOSUB 440: C = 2
410 IF ZZC = 3 THEN C = 3
420 GOSUB 630
430 RETURN
440 '
450 XMIN = 0: XMAX = XN: YMIN = 0: YMAX = YN
460 WHILE (XMIN < XMAX AND YMIN < YMAX)
470 FOR XO = XMIN TO XMAX: x = XO: y = YMIN: GOSUB 530: NEXT: YMIN = YMIN + 1
480 FOR YO = YMIN TO YMAX: y = YO: x = XMAX: GOSUB 530: NEXT: XMAX = XMAX - 1
490 FOR XO = XMIN TO XMAX: x = XO: y = YMAX: GOSUB 530: NEXT: YMAX = YMAX - 1
500 FOR YO = YMIN TO YMAX: y = YO: x = XMIN: GOSUB 530: NEXT: XMIN = XMIN + 1
510 WEND
520 RETURN
530 '
540 S = INT(RND(1) * 4)
550 FOR N = S TO 3 + S: V = N MOD 4
560 IF p1(x + xv(V) + 1, y + yv(V) + 1) GOTO 610
570 p1(x + xv(V) + 1, y + yv(V) + 1) = 1
580 LINE (OFX + x * XD, OFY + y * YD)-((x + xv(V)) * XD + OFX, (y + yv(V)) * YD + OFY), C, B
590 x = x + xv(V): y = y + yv(V)
600 GOTO 540
610 NEXT
620 RETURN
630 '
LINE (OFX + 0, OFY + 0)-(OFX + 0, OFY + 10), 1
END SUB