MIXAL
MIXAL is the assembly language of the fictitious MIX computer .
The MIX computer is a hypothetical computer from Donald Knuth's The Art of Computer Programming , which can be programmed using MIXAL. An emulation of this computer can be found on the web links under Dan's MIX Simulator and MIXAL Compiler .
Sample programs
hello world
TERM EQU 19 console device no. (19 = typewriter)
ORIG 1000 start address
START OUT MSG(TERM) output data at address MSG
HLT halt execution
MSG ALF "HELLO"
ALF " WORL"
ALF "D "
END START end of program
Formation of the faculty function
Eingabe CON 10 Variable "Eingabe" wird auf "10" gesetzt
Zaehler CON 0 Variable "Zaehler" wird auf "0" gesetzt
Produkt CON 1 Variable "Produkt" wird auf "1" gesetzt
Start Start des Programms (Label für den nächsten Befehl)
LDA Eingabe "Load A-Register" Lädt den Inhalt der Variablen in das A-Register
STA Zaehler "Store A-Register" Speichert Inhalt des A-Registers in Variable "Zaehler"
Schleife LDA Produkt "Load A-Register" Lädt den Inhalt der Variablen "Produkt" in das A-Register
MUL Zaehler Multipliziert A-Registerinhalt mit Variable "Zaehler". Ergebnis wird in A- und X-Register geschrieben
STX Produkt "Store X-Register" Speichert Inhalt des X-Registers in Variable "Produkt"
LDA Zaehler "Load A-Register" Lädt den Inhalt der Variable "Zaehler" in das A-Register
DECA 1 "Decrement at 1" Inhalt des A-Registers wird um 1 verringert
STA Zaehler "Store A-Register" Speichert Inhalt des A-Registers in Variable "Zaehler"
JAP Schleife "Jump if A Positive" Wenn A>0, springe zurück nach "Schleife"
HLT "Halt"
END Start Ende des Programmes, welches bei Start beginnt. Das Resultat steht in Variable "Produkt"
description
In order to understand this description, practice in dealing with assembly language is helpful.
Flags
The MIX computer has some processor flags that are used to control the program flow.
E flag
Set if the content of the A register is the same as the content of the address in the CMPA command (CMPA is always executed first).
L flag
Set if the content of the A register is less than the content of the address for the CMPA command (CMPA is always executed first).
G flag
Set if the content of the A register is greater than the content of the address for the CMPA command (CMPA is always executed first).
Web links