output [7:0] jaddr);
wire [7:0] iflag = {3'b0,buttons,serial,tovf,lcdc,vblank};
reg [7:0] imask = 16'hFFFF;
reg [7:0] ihold = 8'b0;
wire [7:0] imasked = ihold & imask;
output [7:0] jaddr);
wire [7:0] iflag = {3'b0,buttons,serial,tovf,lcdc,vblank};
reg [7:0] imask = 16'hFFFF;
reg [7:0] ihold = 8'b0;
wire [7:0] imasked = ihold & imask;
- assign data = rd ?
- (addr == `ADDR_IF) ? ihold :
- (addr == `ADDR_IE) ? imask :
+ assign data = rdlatch ?
+ (addrlatch == `ADDR_IF) ? ihold :
+ (addrlatch == `ADDR_IE) ? imask :
+ end else if (ack)
+ ihold <= ihold &
+ (imasked[0] ? 8'b11111110 :
+ imasked[1] ? 8'b11111101 :
+ imasked[2] ? 8'b11111011 :
+ imasked[3] ? 8'b11110111 :
+ imasked[4] ? 8'b11101111 :
+ 8'b11111111);