DFSFAR START ; Allocate Memory LD GR0,GR1 LD GR1,MEM PUSH 0,GR1 LD GR1,GR0 PUSH 0,GR1 XOR GR0,GR0 LAD GR1,7 CALL ALLOC ST GR0,MEM POP GR1 ; Argument maze LD GR7,MEM LAD GR7,0,GR7 ST GR1,0,GR7 ST GR2,1,GR7 ; Argument pos LD GR7,MEM LAD GR7,2,GR7 ST GR3,0,GR7 ; Argument depth LD GR7,MEM LAD GR7,3,GR7 ST GR4,0,GR7 ; Argument maxDepth LD GR7,MEM LAD GR7,4,GR7 ST GR5,0,GR7 ; Argument deepestPos LD GR7,MEM LAD GR7,5,GR7 ST GR6,0,GR7 ; maze( pos ) = "."c LD GR7,MEM LD GR7,2,GR7 LD GR1,GR7 LD GR2,MEM LD GR2,0,GR2 LD GR2,0,GR2 CALL C013 LD GR7,MEM LD GR7,1,GR7 ADDL GR7,GR0 LD GR6,='.' ST GR6,0,GR7 ; depth += 1 LAD GR7,1 LD GR6,MEM LAD GR6,3,GR6 ADDA GR7,0,GR6 ST GR7,0,GR6 ; If (depth > maxDepth) Then LD GR7,MEM LD GR7,3,GR7 LD GR6,MEM LD GR6,4,GR6 LD GR6,0,GR6 LAD GR0,#FFFF CPA GR7,GR6 JPL J005 XOR GR0,GR0 J005 LD GR7,GR0 AND GR7,GR7 JZE J004 ; maxDepth = depth LD GR7,MEM LD GR7,3,GR7 LD GR6,MEM LD GR6,4,GR6 ST GR7,0,GR6 ; deepestPos = pos LD GR7,MEM LD GR7,2,GR7 LD GR6,MEM LD GR6,5,GR6 ST GR7,0,GR6 ; End If J004 NOP ; x = (pos - 15) LD GR7,MEM LD GR7,2,GR7 LAD GR7,-15,GR7 LD GR6,MEM ST GR7,6,GR6 ; If (maze(x) = " "c) Then LD GR7,MEM LD GR7,6,GR7 LD GR1,GR7 LD GR2,MEM LD GR2,0,GR2 LD GR2,0,GR2 LD GR3,MEM LD GR3,1,GR3 CALL C011 LD GR7,GR0 LD GR6,=' ' SUBA GR7,GR6 JZE J008 LAD GR7,#FFFF J008 XOR GR7,=#FFFF AND GR7,GR7 JZE J006 ; Call DFSFAR ; ByRef maze As String [GR1,GR2] ; maze = maze ; ByVal pos As Integer [GR3] ; pos = x ; ByVal depth As Integer [GR4] ; depth = depth ; ByRef maxDepth As Integer [GR5] ; maxDepth = maxDepth ; ByRef deepestPos As Integer [GR6] ; deepestPos = deepestPos ; Set Arguments And Call DFSFAR LD GR1,MEM LD GR1,0,GR1 LD GR2,MEM LD GR2,1,GR2 LD GR3,MEM LD GR3,6,GR3 LD GR4,MEM LD GR4,3,GR4 LD GR5,MEM LD GR5,4,GR5 LD GR6,MEM LD GR6,5,GR6 CALL DFSFAR ; End If J006 NOP ; x = (pos + 1) LD GR7,MEM LD GR7,2,GR7 LAD GR7,1,GR7 LD GR6,MEM ST GR7,6,GR6 ; If (maze(x) = " "c) Then LD GR7,MEM LD GR7,6,GR7 LD GR1,GR7 LD GR2,MEM LD GR2,0,GR2 LD GR2,0,GR2 LD GR3,MEM LD GR3,1,GR3 CALL C011 LD GR7,GR0 LD GR6,=' ' SUBA GR7,GR6 JZE J010 LAD GR7,#FFFF J010 XOR GR7,=#FFFF AND GR7,GR7 JZE J009 ; Call DFSFAR ; ByRef maze As String [GR1,GR2] ; maze = maze ; ByVal pos As Integer [GR3] ; pos = x ; ByVal depth As Integer [GR4] ; depth = depth ; ByRef maxDepth As Integer [GR5] ; maxDepth = maxDepth ; ByRef deepestPos As Integer [GR6] ; deepestPos = deepestPos ; Set Arguments And Call DFSFAR LD GR1,MEM LD GR1,0,GR1 LD GR2,MEM LD GR2,1,GR2 LD GR3,MEM LD GR3,6,GR3 LD GR4,MEM LD GR4,3,GR4 LD GR5,MEM LD GR5,4,GR5 LD GR6,MEM LD GR6,5,GR6 CALL DFSFAR ; End If J009 NOP ; x = (pos + 15) LD GR7,MEM LD GR7,2,GR7 LAD GR7,15,GR7 LD GR6,MEM ST GR7,6,GR6 ; If (maze(x) = " "c) Then LD GR7,MEM LD GR7,6,GR7 LD GR1,GR7 LD GR2,MEM LD GR2,0,GR2 LD GR2,0,GR2 LD GR3,MEM LD GR3,1,GR3 CALL C011 LD GR7,GR0 LD GR6,=' ' SUBA GR7,GR6 JZE J012 LAD GR7,#FFFF J012 XOR GR7,=#FFFF AND GR7,GR7 JZE J011 ; Call DFSFAR ; ByRef maze As String [GR1,GR2] ; maze = maze ; ByVal pos As Integer [GR3] ; pos = x ; ByVal depth As Integer [GR4] ; depth = depth ; ByRef maxDepth As Integer [GR5] ; maxDepth = maxDepth ; ByRef deepestPos As Integer [GR6] ; deepestPos = deepestPos ; Set Arguments And Call DFSFAR LD GR1,MEM LD GR1,0,GR1 LD GR2,MEM LD GR2,1,GR2 LD GR3,MEM LD GR3,6,GR3 LD GR4,MEM LD GR4,3,GR4 LD GR5,MEM LD GR5,4,GR5 LD GR6,MEM LD GR6,5,GR6 CALL DFSFAR ; End If J011 NOP ; x = (pos - 1) LD GR7,MEM LD GR7,2,GR7 LAD GR7,-1,GR7 LD GR6,MEM ST GR7,6,GR6 ; If (maze(x) = " "c) Then LD GR7,MEM LD GR7,6,GR7 LD GR1,GR7 LD GR2,MEM LD GR2,0,GR2 LD GR2,0,GR2 LD GR3,MEM LD GR3,1,GR3 CALL C011 LD GR7,GR0 LD GR6,=' ' SUBA GR7,GR6 JZE J014 LAD GR7,#FFFF J014 XOR GR7,=#FFFF AND GR7,GR7 JZE J013 ; Call DFSFAR ; ByRef maze As String [GR1,GR2] ; maze = maze ; ByVal pos As Integer [GR3] ; pos = x ; ByVal depth As Integer [GR4] ; depth = depth ; ByRef maxDepth As Integer [GR5] ; maxDepth = maxDepth ; ByRef deepestPos As Integer [GR6] ; deepestPos = deepestPos ; Set Arguments And Call DFSFAR LD GR1,MEM LD GR1,0,GR1 LD GR2,MEM LD GR2,1,GR2 LD GR3,MEM LD GR3,6,GR3 LD GR4,MEM LD GR4,3,GR4 LD GR5,MEM LD GR5,4,GR5 LD GR6,MEM LD GR6,5,GR6 CALL DFSFAR ; End If J013 NOP ; maze( pos ) = " "c LD GR7,MEM LD GR7,2,GR7 LD GR1,GR7 LD GR2,MEM LD GR2,0,GR2 LD GR2,0,GR2 CALL C013 LD GR7,MEM LD GR7,1,GR7 ADDL GR7,GR0 LD GR6,=' ' ST GR6,0,GR7 EXIT NOP ; Release Memory LAD GR0,1 LD GR1,MEM CALL ALLOC POP GR1 ST GR1,MEM RET MEM DS 1 ; UtilAllocator ALLOC AND GR0,GR0 JNZ J017 LAD GR0,V003 ADDL GR0,V001 CPL GR0,V002 JZE J016 J015 ST GR1,V001 LAD GR0,V003 ADDL GR1,GR0 ST GR1,V002 RET J016 ADDL GR0,GR1 CPL GR0,V004 JPL J015 ST GR0,V002 SUBL GR0,GR1 ADDL GR1,V001 ST GR1,V001 RET J017 ST GR1,V002 LAD GR0,V003 SUBL GR1,GR0 ST GR1,V001 RET V001 DS 1 V002 DS 1 V003 DS 3000 V004 DC V004 ; UtilLoadElement C011 AND GR2,GR2 JNZ J007 XOR GR0,GR0 RET J007 CALL C013 PUSH 0,GR3 ADDL GR3,GR0 LD GR0,0,GR3 POP GR3 RET ; UtilSafeIndex C013 AND GR2,GR2 JNZ J001 XOR GR0,GR0 RET J001 LD GR0,GR1 JPL J002 XOR GR0,GR0 RET J002 CPL GR0,GR2 JMI J003 LAD GR0,-1 ADDL GR0,GR2 J003 RET END