1 `define ADDR_IF 16'hFF0F
2 `define ADDR_IE 16'hFFFF
18 wire [7:0] iflag = {3'b0,buttons,serial,tovf,lcdc,vblank};
19 reg [7:0] imask = 16'hFFFF;
20 reg [7:0] ihold = 8'b0;
21 wire [7:0] imasked = ihold & imask;
24 reg [15:0] addrlatch = 0;
26 assign data = rdlatch ?
27 (addrlatch == `ADDR_IF) ? ihold :
28 (addrlatch == `ADDR_IE) ? imask :
32 assign master = (imasked) != 0;
34 assign jaddr = imasked[0] ? 8'h40 :
38 imasked[4] ? 8'h60 : 8'h00;
42 if (wr && (addr == `ADDR_IF || addr == `ADDR_IE)) begin
44 `ADDR_IF : ihold <= iflag | data;
45 `ADDR_IE : begin imask <= data; ihold <= ihold | iflag; end
50 ihold <= ihold | iflag;