======000README --- README file for MAGIC =========================== 0) copy the magic.tar to your directory and then tar -xf magic.tar and then cd :magic 1) To generate the "magic", simply type make 2) To clear the obj files and the target file(magic), type make clobber 2b)To clear the obj files Only make clean 3) To make an listing of all files, type make print 1-2-3) To see what will happen if you type "make ...", type make -n make -n clean make -n print Wen-Nung Tsai, 1993/03/11 ==================================================================== ============ (MAGIC --- MAchine of Graham In China) ============ === The CPU has one ACcumulator, one indeX register, and a 12-bit IP === It also has a FLAG register of 2-bit: 00=LT, 01=EQ, 10=GT (For more detail, see Intr. to Computer Science,3rd ed,Chap 4, by Graham) == Instruction set is modified by Wen-Nung Tsai, NCTU. Mar-1993 ==-Instructions available: 0 NOP --- No OPeration 1 LDA addr --- Load Data in addr into Ac 2 STA addr --- STore Accumulator into addr 3 ADD addr --- ADD content in addr into AC 4 SUB addr --- AC= AC - [addr] 5 MUL addr --- AC= AC * [addr] 6 DIV addr --- AC= int(AC / [addr]) 7 MOD addr --- divide yielding remainder 8 CMP addr --- compare AC with [addr] 9 JMP addr --- unconditional JuMP A JLT addr --- Jump if Less Than B JEQ addr --- Jump if EQual to C JGT addr --- Jump if Greater Than D IN addr --- INput decimal value into addr E OUT addr --- OUTput value at addr in decimal F other instructions determined by next nibble: (in this case, the addr can not > 255 if any) F0 CLA --- CLear Accumulator (AC=0) F1 INS addr --- input string into addr till a "$" F2 OUTS addr --- output string at addr till a "$" F3 INC addr --- mem(addr)++ F4 DEC addr --- mem(addr)-- F5 INCA --- AC=AC+1 F6 DECA --- AC=AC-1 F7 MA2X --- X=AC (also known as TAX) F8 MX2A --- AC=X (also known as TXA) F9 LDAI const --- AC=const Fa LDAX offset --- AC=mem(X+offset) Fb STAX offset --- mem(X+offset)=AC Fc INCX --- X=X+1 Fd DECX --- X=X-1 Fe CLX --- X=0 FF HALT --- terminate execution ============ Directives for this Assembler: ORG n --- set starting address for next line DW n --- Define Word: reserve n words DC n --- Define Constant n in this word DB "string" --- Define Byte in STRING format END [start_addr] --- END of the program (set IP=start_addr if start_addr is present, default is 0) ======================================================================== Type "help" for help at the prompt "command?" if necessary when Running magic