----------------------------------------
-- dZ80 configuration file
----------------------------------------

----------------------------------------
-- Disassembly control
----------------------------------------

cpu="z80"
inputfile="mz2000_ipl.rom"
outputfile="mz2000_ipl.asm"
--fileheadersize=27
filebaseaddr=0
disstart=0
disend=1606
--quiet=0
labelledoutput=1

----------------------------------------
-- Layout
----------------------------------------

labelreference=1
addresscolumn=1
opcodecolumn=1
relativejumpcomment=1
uppercase=1
autoblanklines=1
db="db"
comment="; "
radix=16
numprefix="0"
numsuffix="H"

----------------------------------------
-- Scripts
----------------------------------------

--script="scripts\\spectrum.lua"

----------------------------------------
-- References
----------------------------------------

referencefile="mz2000_ipl.ref"
inportreference=1
outportreference=1
addressreference=1
indirectaddressreference=1
limitreferences=1

----------------------------------------
-- Opcode mapfile and code/data areas
----------------------------------------

--opmapfile="mayhem.map"

-- Code Region isnt required as v2.x sets the entire region to code unless a data region overrides it.
d_SetCodeRegion(0, 1606)

-- Set the known data regions, either as a data region (byte), word or string. The type affects the assembly output definitions and word
-- regions will attempt to map to an address, ie. jump tables will be setup with labels rather than constants.
d_SetDataRegion(    hex("0289"),      218)

d_SetStringRegion(  hex("0289"),       13)
d_SetStringRegion(  hex("0297"),       27)
d_SetStringRegion(  hex("02B3"),       13)
d_SetStringRegion(  hex("02C1"),       12)
d_SetStringRegion(  hex("02CE"),       12)
d_SetStringRegion(  hex("02DB"),       11)
d_SetStringRegion(  hex("02E7"),       31)
d_SetStringRegion(  hex("0307"),       14)
d_SetStringRegion(  hex("0316"),       22)
d_SetStringRegion(  hex("032D"),        3)
d_SetStringRegion(  hex("0331"),       28)
d_SetStringRegion(  hex("034E"),       14)
d_SetStringRegion(  hex("035D"),       7)

-- Create a mapping table of known Sharp I/O ports and 8 bit constants.
--
-- Format           Addr      IsAddr   Label            : IsAddr = 0, value is a constant, = 1, value is an address.
--d_SetByteEquate(hex("FE")   ,   1,     "PRTC"       )
--d_SetByteEquate(hex("FF")   ,   1,     "PRTD"       )

-- Create a mapping table of known Sharp MZ BIOS/Memory Mapped Hardware addresses which dz80 
-- can use to replace an address with the label. The EQU list will also be output at the start
-- of the disassembly file so it can compile.
-- Format           Addr      IsAddr   Label            : IsAddr = 0, value is a constant, = 1, value is an address.
d_SetWordEquate(hex("0002"),    1,     "NST"       )
d_SetWordEquate(hex("0006"),    1,     "START"     )

d_SetWordEquate(hex("0036"),    1,     "CLEAR"     )
d_SetWordEquate(hex("0060"),    1,     "KEYIN"     )
d_SetWordEquate(hex("008C"),    1,     "KEYS1"     )
d_SetWordEquate(hex("008E"),    1,     "KEYS"      )
d_SetWordEquate(hex("0098"),    1,     "NKIN"      )
d_SetWordEquate(hex("00A0"),    1,     "FDCC"      )
d_SetWordEquate(hex("0364"),    1,     "FD"        )
d_SetWordEquate(hex("00AC"),    1,     "CMT"       )
d_SetWordEquate(hex("00CE"),    1,     "ST1"       )
d_SetWordEquate(hex("00D9"),    1,     "MISMCH"    )
d_SetWordEquate(hex("026D"),    1,     "DISP"      )
d_SetWordEquate(hex("01F6"),    1,     "MSTOP"     )
d_SetWordEquate(hex("00E9"),    1,     "RDINF"     )
d_SetWordEquate(hex("00F8"),    1,     "RD1"       )
d_SetWordEquate(hex("01C7"),    1,     "MOTOR"     )
d_SetWordEquate(hex("0193"),    1,     "TMARK"     )
d_SetWordEquate(hex("010B"),    1,     "STPEIR"    )
d_SetWordEquate(hex("010E"),    1,     "EIRTN"     )
d_SetWordEquate(hex("0110"),    1,     "RDDAT"     )
d_SetWordEquate(hex("011C"),    1,     "RTAPE"     )
d_SetWordEquate(hex("0121"),    1,     "RTP2"     )
d_SetWordEquate(hex("01BB"),    1,     "SPDIN"     )
d_SetWordEquate(hex("015E"),    1,     "TRTN1"     )
d_SetWordEquate(hex("0121"),    1,     "RTP2"     )
d_SetWordEquate(hex("0133"),    1,     "RTP3"     )
d_SetWordEquate(hex("0173"),    1,     "RBYTE"     )
d_SetWordEquate(hex("0154"),    1,     "RTP5"     )
d_SetWordEquate(hex("015A"),    1,     "RTP6"     )
d_SetWordEquate(hex("0266"),    1,     "BOOTER"     )
d_SetWordEquate(hex("0162"),    1,     "EDGE"     )
d_SetWordEquate(hex("0177"),    1,     "RBY1"     )
d_SetWordEquate(hex("0188"),    1,     "RBY2"     )
d_SetWordEquate(hex("0191"),    1,     "RBY3"     )
d_SetWordEquate(hex("019C"),    1,     "TM0"     )
d_SetWordEquate(hex("019F"),    1,     "TM1"     )
d_SetWordEquate(hex("01A2"),    1,     "TM2"     )
d_SetWordEquate(hex("01AC"),    1,     "TM3"     )
d_SetWordEquate(hex("01DD"),    1,     "MOT1"     )
d_SetWordEquate(hex("01EF"),    1,     "MOTRD"     )
d_SetWordEquate(hex("01F2"),    1,     "MOTR"     )
d_SetWordEquate(hex("0202"),    1,     "OPEN"     )
d_SetWordEquate(hex("020E"),    1,     "KYEMES"     )
d_SetWordEquate(hex("0219"),    1,     "PLAY"     )
d_SetWordEquate(hex("0237"),    1,     "DM1"     )
d_SetWordEquate(hex("0238"),    1,     "DM1A"     )
d_SetWordEquate(hex("0239"),    1,     "DM1B"     )
d_SetWordEquate(hex("0244"),    1,     "DEL6"     )
d_SetWordEquate(hex("024A"),    1,     "DEL1M"     )
d_SetWordEquate(hex("0250"),    1,     "DLY2"     )
d_SetWordEquate(hex("0252"),    1,     "DLY2A"     )
d_SetWordEquate(hex("0257"),    1,     "LDMSG"     )
d_SetWordEquate(hex("027E"),    1,     "DISP1"     )
d_SetWordEquate(hex("0260"),    1,     "DISP2"     )
d_SetWordEquate(hex("0277"),    1,     "DISP3"     )
d_SetWordEquate(hex("0289"),    1,     "MES1"     )
d_SetWordEquate(hex("0297"),    1,     "MES3"     )
d_SetWordEquate(hex("02B3"),    1,     "MES6"     )
d_SetWordEquate(hex("02C1"),    1,     "MES8"     )
d_SetWordEquate(hex("02CE"),    1,     "MES9"     )
d_SetWordEquate(hex("02DB"),    1,     "MES10"     )
d_SetWordEquate(hex("0307"),    1,     "MES13"     )
d_SetWordEquate(hex("0316"),    1,     "MES14"     )
d_SetWordEquate(hex("034E"),    1,     "MES16"     )
d_SetWordEquate(hex("035D"),    1,     "IPLMC"     )
d_SetWordEquate(hex("0387"),    1,     "MCHECK"     )
d_SetWordEquate(hex("03B4"),    1,     "NODISK"     )
d_SetWordEquate(hex("03C1"),    1,     "READY"     )
d_SetWordEquate(hex("03D6"),    1,     "REDY0"     )
d_SetWordEquate(hex("03F4"),    1,     "MTON"     )
d_SetWordEquate(hex("03FA"),    1,     "MTD1"     )
d_SetWordEquate(hex("03FD"),    1,     "MTD2"     )
d_SetWordEquate(hex("040A"),    1,     "SEEK"     )
d_SetWordEquate(hex("041B"),    1,     "MOFF"     )
d_SetWordEquate(hex("0431"),    1,     "RCLB"     )
d_SetWordEquate(hex("0449"),    1,     "BUSY"     )
d_SetWordEquate(hex("0450"),    1,     "BUSY2"     )
d_SetWordEquate(hex("0453"),    1,     "BUSY0"     )
d_SetWordEquate(hex("0461"),    1,     "BUSY1"     )
d_SetWordEquate(hex("0467"),    1,     "CONVRT"     )
d_SetWordEquate(hex("0470"),    1,     "TRANS"     )
d_SetWordEquate(hex("0477"),    1,     "TRANS1"     )
d_SetWordEquate(hex("0480"),    1,     "DCHK"     )
d_SetWordEquate(hex("049F"),    1,     "DTCK1"     )
d_SetWordEquate(hex("04A2"),    1,     "BREAD"     )
d_SetWordEquate(hex("04AB"),    1,     "READ1"     )
d_SetWordEquate(hex("04B8"),    1,     "RE0"     )
d_SetWordEquate(hex("04C7"),    1,     "RE8"     )
d_SetWordEquate(hex("04D2"),    1,     "RE1"     )
d_SetWordEquate(hex("04D4"),    1,     "RE2"     )
d_SetWordEquate(hex("04FA"),    1,     "RE6"     )
d_SetWordEquate(hex("04FC"),    1,     "RE4"     )
d_SetWordEquate(hex("0516"),    1,     "RETS"     )
d_SetWordEquate(hex("0517"),    1,     "RE5"     )
d_SetWordEquate(hex("051F"),    1,     "RE3"     )
d_SetWordEquate(hex("0538"),    1,     "REX"     )
d_SetWordEquate(hex("0541"),    1,     "RE7"     )
d_SetWordEquate(hex("0546"),    1,     "REE"     )
d_SetWordEquate(hex("0555"),    1,     "WAIT"     )
d_SetWordEquate(hex("055C"),    1,     "WAIT2"     )
d_SetWordEquate(hex("055F"),    1,     "WAIT0"     )
d_SetWordEquate(hex("056D"),    1,     "WAIT1"     )
d_SetWordEquate(hex("0572"),    1,     "NMASTE"     )
d_SetWordEquate(hex("057E"),    1,     "ERR"     )
d_SetWordEquate(hex("0581"),    1,     "ERR1"     )
d_SetWordEquate(hex("0583"),    1,     "TRYAG2"     )
d_SetWordEquate(hex("0587"),    1,     "TRYAG"     )
d_SetWordEquate(hex("05A4"),    1,     "TRYAG1"     )
d_SetWordEquate(hex("05B2"),    1,     "DNO"     )
d_SetWordEquate(hex("05BC"),    1,     "DNO10"     )
d_SetWordEquate(hex("05CC"),    1,     "DNO3"     )
d_SetWordEquate(hex("05D3"),    1,     "TRYAG3"     )
d_SetWordEquate(hex("05DD"),    1,     "TRYAG4"     )
d_SetWordEquate(hex("05DF"),    1,     "TRYAG5"     )
d_SetWordEquate(hex("0331"),    1,     "MES15"     )
d_SetWordEquate(hex("05E9"),    1,     "DNO0"     )
d_SetWordEquate(hex("05F7"),    1,     "DNO1"     )
d_SetWordEquate(hex("05FE"),    1,     "DLY80U"     )
d_SetWordEquate(hex("0605"),    1,     "DLY1M"     )
d_SetWordEquate(hex("060C"),    1,     "DLY60M"     )
d_SetWordEquate(hex("0610"),    1,     "DLYT"     )
d_SetWordEquate(hex("0617"),    1,     "EXROMT"     )
d_SetWordEquate(hex("0620"),    1,     "EROM1"     )
d_SetWordEquate(hex("062B"),    1,     "ERMT1"     )
d_SetWordEquate(hex("062D"),    1,     "EROM2"     )
d_SetWordEquate(hex("063A"),    1,     "SEROMA"     )
d_SetWordEquate(hex("0642"),    1,     "SEROMD"     )

d_SetWordEquate(hex("CF00"),    1,     "IBUFE"     )
d_SetWordEquate(hex("CF00"),    1,     "ATRB"      )
d_SetWordEquate(hex("CF01"),    1,     "NAME"      )
d_SetWordEquate(hex("CF12"),    1,     "SIZE"      )
d_SetWordEquate(hex("CF14"),    1,     "DTADR"     )
d_SetWordEquate(hex("FFE0"),    1,     "SUMDT"     )
d_SetWordEquate(hex("FFE2"),    1,     "TMCNT"     )
d_SetWordEquate(hex("CF00"),    1,     "IBADR1"    )
d_SetWordEquate(hex("8000"),    1,     "IBADR2"    )
d_SetWordEquate(hex("FFE0"),    1,     "NTRACK"    )
d_SetWordEquate(hex("FFE1"),    1,     "NSECT"     )
d_SetWordEquate(hex("FFE2"),    1,     "BSIZE"     )
d_SetWordEquate(hex("FFE4"),    1,     "STTR"      )
d_SetWordEquate(hex("FFE5"),    1,     "STSE"      )
d_SetWordEquate(hex("FFE6"),    1,     "MTFG"      )
d_SetWordEquate(hex("FFE7"),    1,     "CLBF0"     )
d_SetWordEquate(hex("FFE8"),    1,     "CLBF1"     )
d_SetWordEquate(hex("FFE9"),    1,     "CLBF2"     )
d_SetWordEquate(hex("FFEA"),    1,     "CLBF3"     )
d_SetWordEquate(hex("FFEB"),    1,     "RETRY"     )
d_SetWordEquate(hex("FFEC"),    1,     "DRINO"     )
d_SetByteEquate(hex("D8"),      1,     "CR"        )
d_SetByteEquate(hex("D9"),      1,     "TR"        )
d_SetByteEquate(hex("DA"),      1,     "SCR"       )
d_SetByteEquate(hex("DB"),      1,     "DR"        )
d_SetByteEquate(hex("DC"),      1,     "DM"        )
d_SetByteEquate(hex("DD"),      1,     "HS"        )
d_SetByteEquate(hex("E0"),      1,     "PPIA"      )
d_SetByteEquate(hex("E1"),      1,     "PPIB"      )
d_SetByteEquate(hex("E2"),      1,     "PPIC"      )
d_SetByteEquate(hex("E3"),      1,     "PPICTL"    )
d_SetByteEquate(hex("E8"),      1,     "PIOA"      )
d_SetByteEquate(hex("E9"),      1,     "PIOCTLA"   )
d_SetByteEquate(hex("EA"),      1,     "PIOB"      )
d_SetByteEquate(hex("EB"),      1,     "PIOCTLB"   )
d_SetByteEquate(hex("F4"),      1,     "GRPHCTL"   )

-- Comments to be added at fixed addresses.
d_SetComment(   hex("1250"),    "Sharp defined BASIC restart location from Monitor." )
d_SetComment(   hex("5B55"),    "Relocated to 0x3302 for 0x5B bytes." )
d_SetComment(   hex("5BB0"),    "Relocated to 0x4806 for 0xF8 bytes." )
d_SetComment(   hex("5CA8"),    "End of Relocated code." )

----------------------------------------
-- End of configuration file
----------------------------------------
