📄 zilogz80.tbl
字号:
/*************************************************************************** zilog_z80.tbl - Z80 assembler definition file ------------------- begin : Mon May 8 2000 copyright : (C) 2000 by Jan Nikit靚ko email : xnikit00@stud.fee.vutbr.cz ***************************************************************************//*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/Endian(LITTLE);NumberBase binbase(2);NumberBase octbase(8);NumberBase decbase(10);NumberBase hexbase(16);OperValue hexnum("*h", hexbase) { Return $0; };OperValue binnum("*b", binbase) { Return $0; };OperValue octnum("*o", octbase) { Return $0; };OperValue decnum("*d", decbase) { Return $0; };OperValue decnumd("*", decbase) { Return $0; };OperValOpt number( hexnum, binnum, octnum, decnum, decnumd ) { };InstFormat = { [prfidx] [prfopc] opcode [disp] [immd] };Enum reg8 { "B", "C", "D", "E", "H", "L", /*"(HL)",*/ "A"=7 };Enum hlmref { "(HL)"=6 };Enum regsixiy { "IX"=0xdd, "IY"=0xfd };OperValue ixiy("*", regsixiy) { SetB(prfidx, $0); Return 0x06; };OperValue idxmref("(*+*)", ixiy, number) { SetB(disp, $1); Return 0x06; };OperValOpt rm8( reg8, hlmref, idxmref ) { };Operand oc0rg8("*", reg8) { OrB(opcode, $0); };Operand oc3rg8("*", reg8) { OrB(opcode, $0<<3); };Operand oc0rm8("*", rm8) { OrB(opcode, $0); };Operand oc3rm8("*", rm8) { OrB(opcode, $0<<3); };Operand imd8("*", number) { SetB(immd, $0); };Enum bcde { "BC", "DE" };Operand oc4bdmref("(*)", bcde) { OrB(opcode, $0<<4); };Enum regsir { "I", "R" };Operand oc3ir("*", regsir) { SetB(prfopc, 0xed); OrB(opcode, $0<<3); };Operand absmref("(*)", number) { SetW(disp, $0); };Enum ld_id { "I"=0x00, "D"=0x08 };Operand ldildd("*", ld_id) { SetB(prfopc, 0xed); OrB(opcode, $0); };Operand imd16("*", number) { SetW(immd, $0); };Enum bcdehlsp { "BC", "DE", "HL", "SP" };Operand oc4r16("*", bcdehlsp) { OrB(opcode, $0<<4); };Enum hl { "HL" };OperOption hlixiy( hl, ixiy ) { };Enum bcdehlaf { "BC", "DE", "HL", "AF" };OperValOpt bcdehlafixiy(bcdehlaf, ixiy) { };Operand oc4str16("*", bcdehlafixiy) { OrB(opcode, $0<<4); };Instructions {/* zde vsude je vyhodne mit OrB, protoze neni nunte specifikovat cast operacniho *//* kodu, ktera se ma modifikovat, kdyz operandy jsou v ni jiz nastaveny */ ("LD *,*", oc3rg8, oc0rm8): { OrB(opcode, 0x40); } ("LD *,*", oc3rm8, oc0rg8): { OrB(opcode, 0x40); } ("LD *,*", oc3rm8, imd8): { OrB(opcode, 0x06); } ("LD A,*", oc4bdmref): { OrB(opcode, 0x0a); } ("LD *,A", oc4bdmref): { OrB(opcode, 0x02); } ("LD A,*", oc3ir): { OrB(opcode, 0x57); } ("LD *,A", oc3ir): { OrB(opcode, 0x47); } ("LD A,*", absmref): { SetB(opcode, 0x3a); } ("LD *,A", absmref): { SetB(opcode, 0x32); }/* zde je nutne mit operaci OrB, protoze operand ldildd nastavi cast opcode */ ("LD*", ldildd): { OrB(opcode, 0xa0); } ("LD*R", ldildd): { OrB(opcode, 0xb0); } ("LD *,*", oc4r16, imd16): { OrB(opcode, 0x01); } ("LD *,*", ixiy, imd16): { OrB(opcode, 0x21); } ("LD *,*", hlixiy, absmref): { SetB(opcode, 0x2a); } ("LD *,*", absmref, hlixiy): { SetB(opcode, 0x22); } ("LD *,*", oc4r16, absmref): { SetB(prfopc, 0xed); OrB(opcode, 0x4b); } ("LD *,*", absmref, oc4r16): { SetB(prfopc, 0xed); OrB(opcode, 0x43); } ("LD SP,*", hlixiy): { SetB(opcode, 0xf9); } ("PUSH *", oc4str16): { OrB(opcode, 0xc5); } ("POP *", oc4str16): { OrB(opcode, 0xc1); } ("EX DE , HL"): { SetB(opcode, 0xeb); } ("EX AF , AF'"): { SetB(opcode, 0x08); } ("EX (SP),*", hlixiy): { SetB(opcode, 0xe3); } ("EXX"): { SetB(opcode, 0xd9); }};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -