.ORIG x3000 START LEA R0, MSG PUTS IN LD R2, NEGZERO ADD R2, R0, R2 ; Check if R0 is invalid BRn PRINV LD R2, NEGNINE ADD R2, R0, R2 BRp PRINV LD R2, NEGZERO ADD R0, R0, R2 ; Convert to integer AND R2, R0, x01 ; Check even or odd BRp PRODD BRnzp PREVEN PRINV LEA R0, INVALID PUTS BRnzp START PREVEN LEA R0, EVEN BRnzp PRINT PRODD LEA R0, ODD BRnzp PRINT PRINT PUTS END HALT ZERO .FILL x0030 NEGZERO .FILL xFFD0 NEGNINE .FILL xFFC7 MSG .STRINGZ "Enter a number from 0 to 9: " EVEN .STRINGZ "Even\n" ODD .STRINGZ "Odd\n" INVALID .STRINGZ "Invalid input\n" .END