INIT START RPUSH ; Argument maze ST GR1,ARG1 ST GR2,ARG2 ; Init Variables LAD GR1,I001 XOR GR2,GR2 LAD GR3,2 CALL C010 ; Print "Seed? (1 - 999)" OUT LB001,LL001 ; Input x IN TB001,TL001 XOR GR0,GR0 ST GR0,EOF LAD GR1,TB001 LD GR2,TL001 JPL J004 JZE J004 ST GR2,EOF XOR GR2,GR2 J004 CALL C000 ST GR0,I002 ; Call RAND ; ByVal init As Boolean [GR1] ; init = True LAD GR7,#FFFF ST GR7,T001 ; ByRef value As Integer [GR2] ; value = Max(101, Min(1099, (x + 100))) LAD GR7,101 LAD GR6,1099 LD GR5,I002 LAD GR5,100,GR5 CPA GR6,GR5 JMI J005 LD GR6,GR5 J005 NOP CPA GR7,GR6 JPL J006 LD GR7,GR6 J006 NOP ST GR7,T002 ; Set Arguments And Call RAND LD GR1,T001 LAD GR2,T002 CALL RAND ; maze = Space(225) LAD GR7,225 LD GR3,GR7 LAD GR1,TB001 LAD GR2,TL001 CALL C003 LD GR1,ARG2 LD GR2,ARG1 LAD GR3,TB001 LD GR4,TL001 CALL C007 ; Mid( maze, 0, 15 ) = String(15, "#"c) LAD GR7,15 LD GR6,='#' LD GR3,GR6 LD GR1,GR7 LAD GR2,257 CALL C013 ST GR0,TL001 LAD GR1,TB001 LD GR2,GR3 LD GR3,GR0 CALL C010 XOR GR7,GR7 LAD GR6,15 LD GR1,GR7 LD GR5,ARG2 LD GR2,ARG1 LD GR2,0,GR2 LAD GR3,TB001 LD GR4,TL001 CALL C008 ; Mid( maze, 210, 15 ) = String(15, "#"c) LAD GR7,15 LD GR6,='#' LD GR3,GR6 LD GR1,GR7 LAD GR2,257 CALL C013 ST GR0,TL001 LAD GR1,TB001 LD GR2,GR3 LD GR3,GR0 CALL C010 LAD GR7,210 LAD GR6,15 LD GR1,GR7 LD GR5,ARG2 LD GR2,ARG1 LD GR2,0,GR2 LAD GR3,TB001 LD GR4,TL001 CALL C008 ; For i = 15 To 210 Step 15 LAD GR7,15 ST GR7,I001 J019 NOP LD GR1,I001 CPA GR1,=210 JPL J021 ; maze( i ) = "#"c LD GR7,I001 LD GR1,GR7 LD GR2,ARG1 LD GR2,0,GR2 CALL C013 LD GR7,ARG2 ADDL GR7,GR0 LD GR6,='#' ST GR6,0,GR7 ; maze( (i + 14) ) = "#"c LD GR7,I001 LAD GR7,14,GR7 LD GR1,GR7 LD GR2,ARG1 LD GR2,0,GR2 CALL C013 LD GR7,ARG2 ADDL GR7,GR0 LD GR6,='#' ST GR6,0,GR7 ; Next i J020 NOP LAD GR1,I001 LD GR2,0,GR1 LAD GR2,15,GR2 ST GR2,0,GR1 JUMP J019 J021 NOP EXIT NOP RPOP RET ; ByRef maze As String [GR1,GR2] ARG1 DS 1 ARG2 DS 1 ; Dim i As Integer I001 DS 1 ; Dim x As Integer I002 DS 1 EOF DS 1 T001 DS 1 T002 DS 1 TL001 DS 1 TB001 DS 256 LL001 DC 15 LB001 DC 'Seed? (1 - 999)' ; FuncCInt C000 PUSH 0,GR1 PUSH 0,GR2 PUSH 0,GR3 PUSH 0,GR4 PUSH 0,GR5 ADDL GR2,GR1 XOR GR0,GR0 XOR GR4,GR4 CPL GR1,GR2 JZE J001 LD GR3,0,GR1 CPL GR3,='+' JNZ J003 LAD GR1,1,GR1 JUMP J002 J003 CPL GR3,='-' JNZ J002 LAD GR4,-1 LAD GR1,1,GR1 J002 CPL GR1,GR2 JZE J001 LD GR3,0,GR1 SUBL GR3,='0' JMI J001 CPL GR3,=9 JPL J001 LD GR5,GR0 SLL GR0,3 ADDL GR0,GR5 ADDL GR0,GR5 ADDL GR0,GR3 LAD GR1,1,GR1 JUMP J002 J001 XOR GR0,GR4 SUBL GR0,GR4 POP GR5 POP GR4 POP GR3 POP GR2 POP GR1 RET ; FuncSpace C003 PUSH 0,GR1 PUSH 0,GR2 PUSH 0,GR3 XOR GR1,GR3 XOR GR3,GR1 XOR GR1,GR3 LAD GR2,257 CALL C013 LD GR1,GR3 LD GR3,GR0 LD GR2,=' ' CALL C010 LD GR0,GR3 POP GR3 POP GR2 POP GR1 ST GR0,0,GR2 RET ; UtilCopyStr C007 PUSH 0,GR1 PUSH 0,GR2 PUSH 0,GR3 PUSH 0,GR4 ST GR4,0,GR2 AND GR4,GR4 JZE J013 J012 LD GR2,0,GR3 ST GR2,0,GR1 LAD GR3,1,GR3 LAD GR1,1,GR1 SUBL GR4,=1 JPL J012 J013 POP GR4 POP GR3 POP GR2 POP GR1 RET ; UtilCopyToOffsetStr C008 PUSH 0,GR1 PUSH 0,GR2 PUSH 0,GR3 PUSH 0,GR4 PUSH 0,GR5 PUSH 0,GR6 CALL C013 LD GR1,GR6 LD GR6,GR0 CPL GR1,GR2 JMI J014 LD GR1,GR2 J014 ADDL GR1,GR6 LD GR0,GR1 CPL GR0,GR2 JMI J015 LD GR0,GR2 J015 SUBL GR0,GR6 CPL GR0,GR4 JMI J016 LD GR0,GR4 J016 ADDL GR5,GR6 LD GR6,GR5 ADDL GR5,GR0 ADDL GR3,GR0 J017 CPL GR5,GR6 JZE J018 LAD GR3,-1,GR3 LAD GR5,-1,GR5 LD GR1,0,GR3 ST GR1,0,GR5 JUMP J017 J018 POP GR6 POP GR5 POP GR4 POP GR3 POP GR2 POP GR1 RET ; UtilFill C010 PUSH 0,GR1 PUSH 0,GR2 PUSH 0,GR3 ADDL GR3,GR1 J010 CPL GR1,GR3 JZE J011 ST GR2,0,GR1 LAD GR1,1,GR1 JUMP J010 J011 POP GR3 POP GR2 POP GR1 RET ; UtilSafeIndex C013 AND GR2,GR2 JNZ J007 XOR GR0,GR0 RET J007 LD GR0,GR1 JPL J008 XOR GR0,GR0 RET J008 CPL GR0,GR2 JMI J009 LAD GR0,-1 ADDL GR0,GR2 J009 RET END