histcomp:8080

This is an old revision of the document!


Intel 8080

8080.lark
%import common.HEXDIGIT
%import common.ESCAPED_STRING
%import common.WS
 
IDENT: /[a-zA-Z_]+/
 
COMMENT: /;[^\n]*/
 
A16: HEXDIGIT ~ 4 "h" | IDENT
D16: HEXDIGIT ~ 4 "h"
D8: HEXDIGIT ~ 2 "h"
 
REG16: "A" | "AF" | "PSW"
     | "B" | "BC"
     | "D" | "DE"
     | "H"
     | "SP"
 
REG8: "A"
    | "B"
    | "C"
    | "D"
    | "H"
    | "L"
    | "M"
 
start: (label|directive|instruction)*
 
label: IDENT ":"
 
directive: "ORG"i A16
         | "DB"i (D8+ | ESCAPED_STRING)
 
instruction: CONTROL
           | JUMP
           | CALL
           | RESET
           | MOVE16
           | ARITH16
           | MOVE8
           | ARITH8
           | RET
 
CONTROL: "EI"i
       | "DI"i
       | "NOP"i
       | "HLT"i
       | "IN"i D8
       | "OUT"i D8
 
JUMP: ("JNZ"i|"JNC"i|"JPO"i|"JP"i|"JZ"i|"JC"i|"JPE"i|"JM"i|"JMP"i) A16
    | "PCHL"i
 
CALL: ("CNZ"i|"CNC"i|"CPO"i|"CP"i|"CZ"i|"CC"i|"CPE"i|"CM"i|"CALL"i) A16
 
RET: "RNZ"i
   | "RNC"i
   | "RPO"i
   | "RP"i
   | "RZ"i
   | "RC"i
   | "RPE"i
   | "RM"i
   | "RET"i
 
RESET: "RST"i "0".."7"
 
MOVE16: ("POP"i|"PUSH"i) REG16
      | "XCHG"i
      | "SPHL"i
      | "LXI"i REG16 D16
      | ("SHLD"i|"LHLD"i) A16
 
ARITH16: ("INX"i|"DAD"i|"DCX"i) REG16
 
MOVE8: "MOV"i REG8 "," REG8
     | ("STAX"i|"LDAX"i) REG16
     | "MVI"i REG8 "," D8
     | ("LDA"i|"STA"i) A16
 
ARITH8: ("ADD"i|"ADC"i) REG8 | ("ADI"i|"ACI"i) D8
      | ("SUB"i|"SBB"i) REG8 | ("SUI"i|"SBI"i) D8
      | "ANA"i REG8 | "ANI"i D8
      | "XRA"i REG8 | "XRI"i D8
      | "ORA"i REG8 | "ORI"i D8
      | "CMP"i REG8 | "CPI"i D8
      | ("INR"i|"DCR"i) REG8
      | "RLC"i
      | "RAL"i
      | "DAA"i
      | "STC"i
      | "RRC"i
      | "RAR"i
      | "CMA"i
      | "CMC"i
 
%ignore COMMENT
%ignore WS
  • histcomp/8080.1673139374.txt.gz
  • Last modified: 2023-01-08 00:56
  • by asdf