|
|
1.1 ! root 1: .TH REDCODE 6 5/20/84 ! 2: .CM 3 ! 3: .SH NAME ! 4: redcode \- assembler for mars game ! 5: .SH SYNOPSIS ! 6: .I redcode ! 7: .I file ... ! 8: .SH DESCRIPTION ! 9: .I Redcode ! 10: is an assembler for the ! 11: assembly language given by Kee Dewdney in the ! 12: `Computer Recreations', ! 13: .I Scientific American, ! 14: May, 1984. ! 15: The command line lists of source file names ending in ! 16: .LR .red . ! 17: They are assembled into corresponding ! 18: object files with names ending in ! 19: .LR .obj . ! 20: .PP ! 21: A source file consists of a ! 22: .L name ! 23: directive giving the program's name, ! 24: then any number of program and data statements, ! 25: then an ! 26: .L end ! 27: directive that gives the starting location of the program. ! 28: Statements have the following syntax: ! 29: .IP ! 30: [label] opcode arg1 [arg2] [; comment] ! 31: .PP ! 32: There are three addressing modes; ! 33: all address calculations are done modulo 8000. ! 34: .LP ! 35: .nf ! 36: .I ! 37: Syntax Meaning ! 38: #[0-9]+ immediate ! 39: [0-9]+ relative ! 40: @[0-9]+ indirect, relative ! 41: .PP ! 42: The following opcodes are implemented, along with the corresponding ! 43: semantics specified in pseudo-C: ! 44: .PP ! 45: .nf ! 46: .I ! 47: Instruction Mnem Opcode Args Explanation ! 48: Move mov 1 A B B=A ! 49: Add add 2 A B B+=A ! 50: Subtract sub 3 A B B-=A ! 51: Jump jmp 4 A PC=A ! 52: Jump if zero jmz 5 A B PC=(B==0)?A:PC+1 ! 53: Jump if greater jmg 6 A B PC=(B<4000)?A:PC+1 ! 54: Dec, Jmp if 0 djz 7 A B PC=(--B==0)?A:PC+1 ! 55: Compare cmp 8 A B PC=(A==B)?PC+1:PC+2 ! 56: .PP ! 57: The following non-executable directives may be used ! 58: to reserve and initialize data space: ! 59: .PP ! 60: .I ! 61: Directive Mnem Arg Explanation ! 62: Buffer space bss n Reserve n words ! 63: Data data A Initialize 1 word ! 64: Name name 't' Name of program ! 65: End end start Specify starting location ! 66: .PP ! 67: The program was written by Paul Milazzo at Rice. ! 68: For documentation on the object code format, see ! 69: .IR mars (6). ! 70: .SH EXAMPLES ! 71: .EX ! 72: name 'dwarf' ! 73: site data -1 ; address of last 0 'bomb' ! 74: start add #5 site ; move site forward ! 75: mov #0 @site ; write 0 'bomb' ! 76: jmp start ; loop ! 77: end start ! 78: .EE ! 79: .SH SEE ALSO ! 80: .IR mars (6)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.