DFSFILL START ; Allocate Memory LD GR0,GR1 LD GR1,MEM PUSH 0,GR1 LD GR1,GR0 PUSH 0,GR1 XOR GR0,GR0 LAD GR1,4 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 ; 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 ; x = (pos - 15) LD GR7,MEM LD GR7,2,GR7 LAD GR7,-15,GR7 LD GR6,MEM ST GR7,3,GR6 ; Select Case maze(x) LD GR7,MEM LD GR7,3,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 CPA GR7,=' ' JZE J004 CPA GR7,='U' JZE J005 CPA GR7,='L' JZE J005 CPA GR7,='R' JZE J005 JUMP J007 ; Case " "c J004 NOP ; maze( pos ) = "U"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,='U' ST GR6,0,GR7 ; Call DFSFILL ; ByRef maze As String [GR1,GR2] ; maze = maze ; ByVal pos As Integer [GR3] ; pos = x ; Set Arguments And Call DFSFILL LD GR1,MEM LD GR1,0,GR1 LD GR2,MEM LD GR2,1,GR2 LD GR3,MEM LD GR3,3,GR3 CALL DFSFILL JUMP J007 ; Case "U"c, "L"c, "R"c J005 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 Sub JUMP EXIT ; End Select J007 NOP ; x = (pos + 1) LD GR7,MEM LD GR7,2,GR7 LAD GR7,1,GR7 LD GR6,MEM ST GR7,3,GR6 ; Select Case maze(x) LD GR7,MEM LD GR7,3,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 CPA GR7,=' ' JZE J008 CPA GR7,='U' JZE J009 CPA GR7,='R' JZE J009 CPA GR7,='D' JZE J009 JUMP J010 ; Case " "c J008 NOP ; maze( pos ) = "R"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,='R' ST GR6,0,GR7 ; Call DFSFILL ; ByRef maze As String [GR1,GR2] ; maze = maze ; ByVal pos As Integer [GR3] ; pos = x ; Set Arguments And Call DFSFILL LD GR1,MEM LD GR1,0,GR1 LD GR2,MEM LD GR2,1,GR2 LD GR3,MEM LD GR3,3,GR3 CALL DFSFILL JUMP J010 ; Case "U"c, "R"c, "D"c J009 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 Sub JUMP EXIT ; End Select J010 NOP ; x = (pos + 15) LD GR7,MEM LD GR7,2,GR7 LAD GR7,15,GR7 LD GR6,MEM ST GR7,3,GR6 ; Select Case maze(x) LD GR7,MEM LD GR7,3,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 CPA GR7,=' ' JZE J011 CPA GR7,='R' JZE J012 CPA GR7,='L' JZE J012 CPA GR7,='D' JZE J012 JUMP J013 ; Case " "c J011 NOP ; maze( pos ) = "D"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,='D' ST GR6,0,GR7 ; Call DFSFILL ; ByRef maze As String [GR1,GR2] ; maze = maze ; ByVal pos As Integer [GR3] ; pos = x ; Set Arguments And Call DFSFILL LD GR1,MEM LD GR1,0,GR1 LD GR2,MEM LD GR2,1,GR2 LD GR3,MEM LD GR3,3,GR3 CALL DFSFILL JUMP J013 ; Case "R"c, "L"c, "D"c J012 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 Sub JUMP EXIT ; End Select J013 NOP ; x = (pos - 1) LD GR7,MEM LD GR7,2,GR7 LAD GR7,-1,GR7 LD GR6,MEM ST GR7,3,GR6 ; Select Case maze(x) LD GR7,MEM LD GR7,3,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 CPA GR7,=' ' JZE J014 CPA GR7,='L' JZE J015 CPA GR7,='U' JZE J015 CPA GR7,='D' JZE J015 JUMP J016 ; Case " "c J014 NOP ; maze( pos ) = "L"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,='L' ST GR6,0,GR7 ; Call DFSFILL ; ByRef maze As String [GR1,GR2] ; maze = maze ; ByVal pos As Integer [GR3] ; pos = x ; Set Arguments And Call DFSFILL LD GR1,MEM LD GR1,0,GR1 LD GR2,MEM LD GR2,1,GR2 LD GR3,MEM LD GR3,3,GR3 CALL DFSFILL JUMP J016 ; Case "L"c, "U"c, "D"c J015 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 Sub JUMP EXIT ; End Select J016 NOP 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 J019 LAD GR0,V003 ADDL GR0,V001 CPL GR0,V002 JZE J018 J017 ST GR1,V001 LAD GR0,V003 ADDL GR1,GR0 ST GR1,V002 RET J018 ADDL GR0,GR1 CPL GR0,V004 JPL J017 ST GR0,V002 SUBL GR0,GR1 ADDL GR1,V001 ST GR1,V001 RET J019 ST GR1,V002 LAD GR0,V003 SUBL GR1,GR0 ST GR1,V001 RET V001 DS 1 V002 DS 1 V003 DS 2000 V004 DC V004 ; UtilLoadElement C011 AND GR2,GR2 JNZ J006 XOR GR0,GR0 RET J006 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