CMD START ; Argument cmd ST GR1,ARG1 ; cmd = -1 LAD GR7,-1 LD GR6,ARG1 ST GR7,0,GR6 ; Do J001 NOP ; Print "command? (up,right,down,left,end)" OUT LB001,LL001 ; Input s IN SB001,SL001 XOR GR0,GR0 ST GR0,EOF LD GR0,SL001 JPL J004 JZE J004 ST GR0,EOF XOR GR0,GR0 ST GR0,SL001 J004 NOP ; Call LOWER ; ByRef s As String [GR1,GR2] ; s = s ; Set Arguments And Call LOWER LAD GR1,SL001 LAD GR2,SB001 CALL LOWER ; Select Case s LAD GR1,SB001 LD GR2,SL001 LAD GR3,='end' LAD GR4,3 CALL C004 AND GR0,GR0 JZE J006 LAD GR3,='up' LAD GR4,2 CALL C004 AND GR0,GR0 JZE J007 LAD GR3,='u' LAD GR4,1 CALL C004 AND GR0,GR0 JZE J007 LAD GR3,='right' LAD GR4,5 CALL C004 AND GR0,GR0 JZE J008 LAD GR3,='r' LAD GR4,1 CALL C004 AND GR0,GR0 JZE J008 LAD GR3,='down' LAD GR4,4 CALL C004 AND GR0,GR0 JZE J009 LAD GR3,='d' LAD GR4,1 CALL C004 AND GR0,GR0 JZE J009 LAD GR3,='left' LAD GR4,4 CALL C004 AND GR0,GR0 JZE J010 LAD GR3,='l' LAD GR4,1 CALL C004 AND GR0,GR0 JZE J010 JUMP J005 ; Case "end" J006 NOP ; Exit Do JUMP J003 JUMP J005 ; Case "up", "u" J007 NOP ; cmd = 0 XOR GR7,GR7 LD GR6,ARG1 ST GR7,0,GR6 ; Exit Do JUMP J003 JUMP J005 ; Case "right", "r" J008 NOP ; cmd = 1 LAD GR7,1 LD GR6,ARG1 ST GR7,0,GR6 ; Exit Do JUMP J003 JUMP J005 ; Case "down", "d" J009 NOP ; cmd = 2 LAD GR7,2 LD GR6,ARG1 ST GR7,0,GR6 ; Exit Do JUMP J003 JUMP J005 ; Case "left", "l" J010 NOP ; cmd = 3 LAD GR7,3 LD GR6,ARG1 ST GR7,0,GR6 ; Exit Do JUMP J003 ; End Select J005 NOP ; Loop Until Eof() J002 NOP LD GR7,EOF AND GR7,GR7 JZE J001 J003 NOP EXIT NOP RET ; ByRef cmd As Integer [GR1] ARG1 DS 1 ; Dim s As String SL001 DS 1 SB001 DS 256 EOF DS 1 LL001 DC 33 LB001 DC 'command? (up,right,down,left,end)' ; UtilCompareStr C004 PUSH 0,GR1 PUSH 0,GR2 PUSH 0,GR3 PUSH 0,GR4 PUSH 0,GR5 XOR GR0,GR0 J011 AND GR2,GR2 JPL J012 CPL GR2,GR4 JNZ J013 JUMP J015 J012 AND GR4,GR4 JZE J014 LD GR5,0,GR1 CPL GR5,0,GR3 JMI J013 JPL J014 LAD GR1,1,GR1 LAD GR2,-1,GR2 LAD GR3,1,GR3 LAD GR4,-1,GR4 JUMP J011 J013 LAD GR0,-1 J014 OR GR0,=1 J015 POP GR5 POP GR4 POP GR3 POP GR2 POP GR1 RET END