Adding the prefix bytes fools the assembler. The chip itself treats instructions that begin with 0FDh/0FFh as referring to IX/IY instead of HL. By replacing an instruction like: LD A,IXL=20 With: DB 0FDH LD A,L You are telling the assembler to store the same bytes that the disassembler treated as LD A,IXL. As far as the image being two bytes larger than the original file, you will _have_ to make sure your reassembly is creating a byte-for-byte copy of the original EPROM. A useful tool to do that is the DOS window command "FC /B originalromimagefile yourromimagefile". This will compare two binary files, showing where they are different. You would use the address of the first different byte to figure out what is different in your reassembled file. Only where FC/B runs without showing any differences should you consider your disassembly/reassembly complete. ~ Bob Ammerman RAm Systems -----Original Message----- From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf Of Justin Richards Sent: Saturday, August 16, 2014 10:49 AM To: Microcontroller discussion list - Public. Subject: Re: [EE] Z80 dis-assembly assembly - preferred tools Not exactly 100% sure what that does but it eliminates the errors. Thanks Now lastly the re-assembled file is 2 bytes larger than the original 4096 a= s compared with 4098. It needs to fit into a 4K EPROM. On 16 August 2014 20:43, Bob Ammerman wrote: > Er, it should be "prefix byte 0DDH or 0FDH", not "prefix byte 0DDH or=20 > 0FFH". > > Sorry, > > ~ Bob Ammerman > RAm Systems > > -----Original Message----- > From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On=20 > Behalf Of Bob Ammerman > Sent: Saturday, August 16, 2014 9:05 AM > To: 'Microcontroller discussion list - Public.' > Subject: RE: [EE] Z80 dis-assembly assembly - preferred tools > > It's pretty easy to deal with errors from IXL, IXH, IYL, IYH. All you=20 > have to do is use a prefix byte 0DDH or 0FFH in front of a normal=20 > instruction and the assembler will be happy: > > USEIX EQU 0DDH > USEIY EQU 0FDH > > Then replace something like: > > LD A,IXL > > With: > > DB USEIX > LD A,L > > ~ Bob Ammerman > RAm Systems > > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/chang= e your membership options at http://mailman.mit.edu/mailman/listinfo/piclist --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .