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 (addr == `ADDR_IF) ? ihold :
25 (addr == `ADDR_IE) ? imask :
29 assign master = (imasked) != 0;
31 assign jaddr = imasked[0] ? 8'h40 :
35 imasked[4] ? 8'h60 : 8'h00;
39 if (wr && (addr == `ADDR_IF || addr == `ADDR_IE)) begin
41 `ADDR_IF : ihold <= iflag | data;
42 `ADDR_IE : begin imask <= data; ihold <= ihold | iflag; end
47 ihold <= ihold | iflag;