MAKE START RPUSH ; Argument maze ST GR1,ARG1 ST GR2,ARG2 ; Argument sPos ST GR3,ARG3 ; Argument best ST GR4,ARG4 ; Init Variables LAD GR1,I001 XOR GR2,GR2 LAD GR3,4 CALL C010 ; For k = 30 To 195 Step 30 LAD GR7,30 ST GR7,I002 J001 NOP LD GR1,I002 CPA GR1,=195 JPL J003 ; For i = 2 To 12 Step 2 LAD GR7,2 ST GR7,I001 J004 NOP LD GR1,I001 CPA GR1,=12 JPL J006 ; maze( (k + i) ) = "#"c LD GR7,I002 LD GR6,I001 ADDA GR7,GR6 LD GR1,GR7 LD GR2,ARG1 LD GR2,0,GR2 CALL C013 LD GR7,ARG2 ADDL GR7,GR0 LD GR6,='#' ST GR6,0,GR7 ; Call RAND ; ByVal init As Boolean [GR1] ; init = False XOR GR7,GR7 ST GR7,T001 ; ByRef value As Integer [GR2] ; value = x ; Set Arguments And Call RAND LD GR1,T001 LAD GR2,I003 CALL RAND ; Select Case x LD GR7,I003 CPA GR7,=0 JZE J010 CPA GR7,=1 JZE J011 CPA GR7,=2 JZE J012 CPA GR7,=3 JZE J013 JUMP J014 ; Case 0 J010 NOP ; x = ((k + i) - 15) LD GR7,I002 LD GR6,I001 ADDA GR7,GR6 LAD GR7,-15,GR7 ST GR7,I003 JUMP J014 ; Case 1 J011 NOP ; x = ((k + i) + 1) LD GR7,I002 LD GR6,I001 ADDA GR7,GR6 LAD GR7,1,GR7 ST GR7,I003 JUMP J014 ; Case 2 J012 NOP ; x = ((k + i) + 15) LD GR7,I002 LD GR6,I001 ADDA GR7,GR6 LAD GR7,15,GR7 ST GR7,I003 JUMP J014 ; Case 3 J013 NOP ; x = ((k + i) - 1) LD GR7,I002 LD GR6,I001 ADDA GR7,GR6 LAD GR7,-1,GR7 ST GR7,I003 ; End Select J014 NOP ; maze( x ) = "#"c LD GR7,I003 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 J005 NOP LAD GR1,I001 LD GR2,0,GR1 LAD GR2,2,GR2 ST GR2,0,GR1 JUMP J004 J006 NOP ; Next k J002 NOP LAD GR1,I002 LD GR2,0,GR1 LAD GR2,30,GR2 ST GR2,0,GR1 JUMP J001 J003 NOP ; For i = 73 To 223 Step 15 LAD GR7,73 ST GR7,I001 J015 NOP LD GR1,I001 CPA GR1,=223 JPL J017 ; If (maze(i) = " "c) Then LD GR7,I001 LD GR1,GR7 LD GR2,ARG1 LD GR2,0,GR2 LD GR3,ARG2 CALL C011 LD GR7,GR0 LD GR6,=' ' SUBA GR7,GR6 JZE J020 LAD GR7,#FFFF J020 XOR GR7,=#FFFF AND GR7,GR7 JZE J018 ; Call DFSFILL ; ByRef s As String [GR1,GR2] ; s = maze ; ByVal pos As Integer [GR3] ; pos = i ; Set Arguments And Call DFSFILL LD GR1,ARG1 LD GR2,ARG2 LD GR3,I001 CALL DFSFILL ; gPos = i LD GR7,I001 ST GR7,I004 ; Exit For JUMP J017 ; End If J018 NOP ; Next i J016 NOP LAD GR1,I001 LD GR2,0,GR1 LAD GR2,15,GR2 ST GR2,0,GR1 JUMP J015 J017 NOP ; For i = 0 To 224 Step 1 XOR GR7,GR7 ST GR7,I001 J021 NOP LD GR1,I001 CPA GR1,=224 JPL J023 ; If (maze(i) <> "#"c) Then LD GR7,I001 LD GR1,GR7 LD GR2,ARG1 LD GR2,0,GR2 LD GR3,ARG2 CALL C011 LD GR7,GR0 LD GR6,='#' SUBA GR7,GR6 JZE J025 LAD GR7,#FFFF J025 NOP AND GR7,GR7 JZE J024 ; 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 ; End If J024 NOP ; Next i J022 NOP LAD GR1,I001 LD GR2,0,GR1 LAD GR2,1,GR2 ST GR2,0,GR1 JUMP J021 J023 NOP ; Call DFSFAR ; ByRef maze As String [GR1,GR2] ; maze = maze ; ByVal pos As Integer [GR3] ; pos = gPos ; ByVal depth As Integer [GR4] ; depth = 0 XOR GR7,GR7 ST GR7,T001 ; ByRef maxDepth As Integer [GR5] ; maxDepth = 0 XOR GR7,GR7 ST GR7,T002 ; ByRef deepestPos As Integer [GR6] ; deepestPos = sPos ; Set Arguments And Call DFSFAR LD GR1,ARG1 LD GR2,ARG2 LD GR3,I004 LD GR4,T001 LAD GR5,T002 LD GR6,ARG3 CALL DFSFAR ; best = 0 XOR GR7,GR7 LD GR6,ARG4 ST GR7,0,GR6 ; Call DFSFAR ; ByRef maze As String [GR1,GR2] ; maze = maze ; ByVal pos As Integer [GR3] ; pos = sPos ; ByVal depth As Integer [GR4] ; depth = 0 XOR GR7,GR7 ST GR7,T001 ; ByRef maxDepth As Integer [GR5] ; maxDepth = best ; ByRef deepestPos As Integer [GR6] ; deepestPos = gPos ; Set Arguments And Call DFSFAR LD GR1,ARG1 LD GR2,ARG2 LD GR3,ARG3 LD GR3,0,GR3 LD GR4,T001 LD GR5,ARG4 LAD GR6,I004 CALL DFSFAR ; maze( sPos ) = "S"c LD GR7,ARG3 LD GR7,0,GR7 LD GR1,GR7 LD GR2,ARG1 LD GR2,0,GR2 CALL C013 LD GR7,ARG2 ADDL GR7,GR0 LD GR6,='S' ST GR6,0,GR7 ; maze( gPos ) = "G"c LD GR7,I004 LD GR1,GR7 LD GR2,ARG1 LD GR2,0,GR2 CALL C013 LD GR7,ARG2 ADDL GR7,GR0 LD GR6,='G' ST GR6,0,GR7 EXIT NOP RPOP RET ; ByRef maze As String [GR1,GR2] ARG1 DS 1 ARG2 DS 1 ; ByRef sPos As Integer [GR3] ARG3 DS 1 ; ByRef best As Integer [GR4] ARG4 DS 1 ; Dim i As Integer I001 DS 1 ; Dim k As Integer I002 DS 1 ; Dim x As Integer I003 DS 1 ; Dim gPos As Integer I004 DS 1 T001 DS 1 T002 DS 1 ; UtilFill C010 PUSH 0,GR1 PUSH 0,GR2 PUSH 0,GR3 ADDL GR3,GR1 J026 CPL GR1,GR3 JZE J027 ST GR2,0,GR1 LAD GR1,1,GR1 JUMP J026 J027 POP GR3 POP GR2 POP GR1 RET ; UtilLoadElement C011 AND GR2,GR2 JNZ J019 XOR GR0,GR0 RET J019 CALL C013 PUSH 0,GR3 ADDL GR3,GR0 LD GR0,0,GR3 POP GR3 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