SHOW START ; Argument steps ST GR1,ARG1 ; Argument field ST GR2,ARG2 ; hline = String(21, "-"c) LAD GR7,21 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 GR1,SB006 LAD GR2,SL006 LAD GR3,TB001 LD GR4,TL001 CALL C007 ; index = 0 XOR GR7,GR7 ST GR7,I003 ; Print ((" " & CStr(steps)) & " steps") LD GR7,ARG1 LD GR3,GR7 LAD GR1,TB001 LAD GR2,TL001 CALL C002 LAD GR1,TB002 LAD GR2,TL002 LAD GR3,=' ' LAD GR4,1 CALL C007 LAD GR1,TB002 LAD GR2,TL002 LAD GR3,TB001 LD GR4,TL001 CALL C005 LAD GR1,TB002 LAD GR2,TL002 LAD GR3,=' steps' LAD GR4,6 CALL C005 OUT TB002,TL002 ; For row = 0 To 3 Step 1 XOR GR7,GR7 ST GR7,I001 J030 NOP LD GR1,I001 CPA GR1,=3 JPL J032 ; Print hline OUT SB006,SL006 ; s = "|" LAD GR1,SB005 LAD GR2,SL005 LAD GR3,='|' LAD GR4,1 CALL C007 ; For col = 0 To 3 Step 1 XOR GR7,GR7 ST GR7,I002 J033 NOP LD GR1,I002 CPA GR1,=3 JPL J035 ; f = field(index) LD GR7,I003 LD GR1,GR7 LAD GR2,16 CALL C013 LD GR7,ARG2 ADDL GR7,GR0 LD GR7,0,GR7 ST GR7,I004 ; If (f = 0) Then LD GR7,I004 XOR GR6,GR6 SUBA GR7,GR6 JZE J039 LAD GR7,#FFFF J039 XOR GR7,=#FFFF AND GR7,GR7 JZE J037 ; s = (s & " * |") LAD GR1,TB001 LAD GR2,TL001 LAD GR3,SB005 LD GR4,SL005 CALL C007 LAD GR1,TB001 LAD GR2,TL001 LAD GR3,=' * |' LAD GR4,5 CALL C005 LAD GR1,SB005 LAD GR2,SL005 LAD GR3,TB001 LD GR4,TL001 CALL C007 JUMP J036 ; ElseIf (f < 10) Then J037 NOP LD GR7,I004 LAD GR6,10 LAD GR0,#FFFF CPA GR7,GR6 JMI J040 XOR GR0,GR0 J040 LD GR7,GR0 AND GR7,GR7 JZE J038 ; s = (((s & " ") & CStr(f)) & " |") LAD GR1,TB001 LAD GR2,TL001 LAD GR3,SB005 LD GR4,SL005 CALL C007 LAD GR1,TB001 LAD GR2,TL001 LAD GR3,=' ' LAD GR4,2 CALL C005 LD GR7,I004 LD GR3,GR7 LAD GR1,TB002 LAD GR2,TL002 CALL C002 LAD GR1,TB001 LAD GR2,TL001 LAD GR3,TB002 LD GR4,TL002 CALL C005 LAD GR1,TB001 LAD GR2,TL001 LAD GR3,=' |' LAD GR4,2 CALL C005 LAD GR1,SB005 LAD GR2,SL005 LAD GR3,TB001 LD GR4,TL001 CALL C007 JUMP J036 ; Else J038 NOP ; s = (((s & " ") & CStr(f)) & " |") LAD GR1,TB001 LAD GR2,TL001 LAD GR3,SB005 LD GR4,SL005 CALL C007 LAD GR1,TB001 LAD GR2,TL001 LAD GR3,=' ' LAD GR4,1 CALL C005 LD GR7,I004 LD GR3,GR7 LAD GR1,TB002 LAD GR2,TL002 CALL C002 LAD GR1,TB001 LAD GR2,TL001 LAD GR3,TB002 LD GR4,TL002 CALL C005 LAD GR1,TB001 LAD GR2,TL001 LAD GR3,=' |' LAD GR4,2 CALL C005 LAD GR1,SB005 LAD GR2,SL005 LAD GR3,TB001 LD GR4,TL001 CALL C007 ; End If J036 NOP ; index += 1 LAD GR7,1 LAD GR6,I003 ADDA GR7,0,GR6 ST GR7,0,GR6 ; Next col J034 NOP LAD GR1,I002 LD GR2,0,GR1 LAD GR2,1,GR2 ST GR2,0,GR1 JUMP J033 J035 NOP ; Print s OUT SB005,SL005 ; Next row J031 NOP LAD GR1,I001 LD GR2,0,GR1 LAD GR2,1,GR2 ST GR2,0,GR1 JUMP J030 J032 NOP ; Print hline OUT SB006,SL006 EXIT NOP RET ; ByVal steps As Integer [GR1] ARG1 DS 1 ; ByRef field(15) As Integer [GR2] ARG2 DS 1 ; Dim row As Integer I001 DS 1 ; Dim col As Integer I002 DS 1 ; Dim index As Integer I003 DS 1 ; Dim f As Integer I004 DS 1 ; Dim s As String SL005 DS 1 SB005 DS 256 ; Dim hline As String SL006 DS 1 SB006 DS 256 TL001 DS 1 TB001 DS 256 TL002 DS 1 TB002 DS 256 ; FuncCStrArgInt C002 CPL GR3,=#8000 JNZ J008 PUSH 0,GR3 PUSH 0,GR4 LAD GR3,='-32768' LAD GR4,6 CALL C007 POP GR4 POP GR3 RET J008 AND GR3,GR3 JNZ J009 LAD GR3,1 ST GR3,0,GR2 LD GR3,='0' ST GR3,0,GR1 XOR GR3,GR3 RET J009 PUSH 0,GR1 PUSH 0,GR2 PUSH 0,GR3 PUSH 0,GR4 PUSH 0,GR5 JPL J010 LD GR4,='-' ST GR4,0,GR1 LAD GR1,1,GR1 XOR GR3,=#FFFF LAD GR3,1,GR3 J010 LAD GR4,V001 LD GR5,GR1 LD GR2,GR3 LAD GR3,10 J011 CALL C009 ADDL GR1,='0' ST GR1,0,GR4 LAD GR4,1,GR4 LD GR2,GR0 JPL J011 LAD GR2,V001 LAD GR4,-1,GR4 J012 LD GR1,0,GR4 ST GR1,0,GR5 LAD GR5,1,GR5 LAD GR4,-1,GR4 CPL GR4,GR2 JPL J012 JZE J012 LD GR0,GR5 POP GR5 POP GR4 POP GR3 POP GR2 POP GR1 SUBL GR0,GR1 ST GR0,0,GR2 RET V001 DS 6 ; UtilConcatStr C005 PUSH 0,GR1 PUSH 0,GR2 PUSH 0,GR3 PUSH 0,GR4 LD GR0,0,GR2 LD GR2,GR1 ADDL GR1,GR0 LAD GR2,256,GR2 ADDL GR4,GR3 J028 CPL GR1,GR2 JZE J029 CPL GR3,GR4 JZE J029 LD GR0,0,GR3 ST GR0,0,GR1 LAD GR1,1,GR1 LAD GR3,1,GR3 JUMP J028 J029 LD GR0,GR1 POP GR4 POP GR3 POP GR2 POP GR1 SUBL GR0,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 J007 J006 LD GR2,0,GR3 ST GR2,0,GR1 LAD GR3,1,GR3 LAD GR1,1,GR1 SUBL GR4,=1 JPL J006 J007 POP GR4 POP GR3 POP GR2 POP GR1 RET ; UtilDivMod C009 AND GR3,GR3 JNZ J015 XOR GR0,GR0 LAD GR1,-1 RET J015 PUSH 0,GR2 PUSH 0,GR3 PUSH 0,GR4 PUSH 0,GR5 LD GR4,GR2 LD GR5,GR2 JPL J013 XOR GR5,GR5 SUBA GR5,GR2 J013 LD GR1,GR3 JPL J014 XOR GR1,GR1 SUBA GR1,GR3 J014 LAD GR0,1 J016 ADDL GR1,GR1 JOV J017 ADDL GR0,GR0 JUMP J016 J017 SRL GR1,1 LAD GR1,#8000,GR1 XOR GR2,GR2 J018 CPL GR5,GR1 JMI J019 SUBL GR5,GR1 ADDL GR2,GR0 J019 SRL GR0,1 JZE J020 SRL GR1,1 JUMP J018 J020 LD GR5,GR4 XOR GR5,GR3 SRA GR5,15 XOR GR2,GR5 SUBA GR2,GR5 CALL C012 LD GR1,GR4 SUBA GR1,GR0 LD GR0,GR2 POP GR5 POP GR4 POP GR3 POP GR2 RET ; UtilFill C010 PUSH 0,GR1 PUSH 0,GR2 PUSH 0,GR3 ADDL GR3,GR1 J004 CPL GR1,GR3 JZE J005 ST GR2,0,GR1 LAD GR1,1,GR1 JUMP J004 J005 POP GR3 POP GR2 POP GR1 RET ; UtilMul C012 PUSH 0,GR2 PUSH 0,GR3 PUSH 0,GR4 PUSH 0,GR5 XOR GR0,GR0 XOR GR1,GR1 LD GR4,GR2 LD GR5,GR3 J021 SRL GR2,1 JOV J022 JNZ J024 JUMP J025 J022 ADDL GR0,GR3 JOV J023 JUMP J024 J023 LAD GR1,1,GR1 J024 SLL GR3,1 JUMP J021 J025 SRL GR5,1 SLL GR4,1 JOV J026 JNZ J025 JUMP J027 J026 ADDL GR1,GR5 JUMP J025 J027 POP GR5 POP GR4 POP GR3 POP GR2 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