diff --git a/libgambatte/src/memory.cpp b/libgambatte/src/memory.cpp index 7929050d..3cc8b115 100644 --- a/libgambatte/src/memory.cpp +++ b/libgambatte/src/memory.cpp @@ -219,7 +219,6 @@ unsigned long Memory::event(unsigned long cc) { unsigned dmaDest = dmaDestination_; unsigned dmaLength = ((ioamhram_[0x155] & 0x7F) + 1) * 0x10; unsigned length = hdmaReqFlagged(intreq_) ? 0x10 : dmaLength; - ackDmaReq(intreq_); if ((static_cast(dmaDest) + length) & 0x10000) { @@ -289,9 +288,16 @@ unsigned long Memory::event(unsigned long cc) { case intevent_interrupts: if (halted()) { cc += 4 * (isCgb() || cc - intreq_.eventTime(intevent_interrupts) < 2); + if (cc > lastOamDmaUpdate_) + updateOamDma(cc); + intreq_.unhalt(); intreq_.setEventTime(disabled_time); } + if (cc >= intreq_.eventTime(intevent_video)) + lcd_.update(cc); + if (cc >= intreq_.eventTime(intevent_dma)) + break; if (ime()) { di(); diff --git a/test/hwtests/irq_precedence/hdma_vs_m0_scx1_cgb04c_out1234.asm b/test/hwtests/irq_precedence/hdma_vs_m0_scx1_cgb04c_out1234.asm new file mode 100644 index 00000000..83d5162e --- /dev/null +++ b/test/hwtests/irq_precedence/hdma_vs_m0_scx1_cgb04c_out1234.asm @@ -0,0 +1,141 @@ +.size 8000 + +.text@48 + jp lprint_8000 + +.text@100 + jp lbegin + +.data@143 + c0 + +.text@150 +lbegin: + ld a, 01 + ldff(43), a + ld a, cf + ldff(51), a + ld a, f0 + ldff(52), a + xor a, a + ldff(53), a + ldff(54), a + ld sp, cff2 + ld hl, 1234 + push hl + pop hl + ld b, 02 + ld c, 41 +lbegin_waitm2: + ldff a, (c) + and a, 03 + cmp a, b + jrnz lbegin_waitm2 + ld a, 08 + ldff(41), a + ld a, 80 + ldff(55), a + ld a, 02 + ldff(ff), a + xor a, a + ldff(0f), a + ei +lbegin_wait_int: + jr lbegin_wait_int + +.text@7000 +lprint_8000: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, (8001) + ld b, a + swap a + and a, 0f + ld(9800), a + ld a, b + and a, 0f + ld(9801), a + ld a, (8000) + ld b, a + swap a + and a, 0f + ld(9802), a + ld a, b + and a, 0f + ld(9803), a + ld bc, 7a00 + ld hl, 8000 + ld d, 00 +lprint_copytiles: + ld a, (bc) + inc bc + ld(hl++), a + dec d + jrnz lprint_copytiles + ld a, c0 + ldff(47), a + ld a, 80 + ldff(68), a + ld a, ff + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + xor a, a + ldff(69), a + ldff(69), a + xor a, a + ldff(42), a + ldff(43), a + ld a, 91 + ldff(40), a +lprint_limbo: + jr lprint_limbo + +.text@7400 +lwaitly_b: + ld c, 44 +lwaitly_b_loop: + ldff a, (c) + cmp a, b + jrnz lwaitly_b_loop + ret + +.data@7a00 + 00 00 7f 7f 41 41 41 41 + 41 41 41 41 41 41 7f 7f + 00 00 08 08 08 08 08 08 + 08 08 08 08 08 08 08 08 + 00 00 7f 7f 01 01 01 01 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 01 01 01 01 + 3f 3f 01 01 01 01 7f 7f + 00 00 41 41 41 41 41 41 + 7f 7f 01 01 01 01 01 01 + 00 00 7f 7f 40 40 40 40 + 7e 7e 01 01 01 01 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 41 41 41 41 7f 7f + 00 00 7f 7f 01 01 02 02 + 04 04 08 08 10 10 10 10 + 00 00 3e 3e 41 41 41 41 + 3e 3e 41 41 41 41 3e 3e + 00 00 7f 7f 41 41 41 41 + 7f 7f 01 01 01 01 7f 7f + 00 00 08 08 22 22 41 41 + 7f 7f 41 41 41 41 41 41 + 00 00 7e 7e 41 41 41 41 + 7e 7e 41 41 41 41 7e 7e + 00 00 3e 3e 41 41 40 40 + 40 40 40 40 41 41 3e 3e + 00 00 7e 7e 41 41 41 41 + 41 41 41 41 41 41 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 40 40 + diff --git a/test/hwtests/irq_precedence/hdma_vs_m0_scx2_cgb04c_out0183.asm b/test/hwtests/irq_precedence/hdma_vs_m0_scx2_cgb04c_out0183.asm new file mode 100644 index 00000000..6f6eec1e --- /dev/null +++ b/test/hwtests/irq_precedence/hdma_vs_m0_scx2_cgb04c_out0183.asm @@ -0,0 +1,141 @@ +.size 8000 + +.text@48 + jp lprint_8000 + +.text@100 + jp lbegin + +.data@143 + c0 + +.text@150 +lbegin: + ld a, 02 + ldff(43), a + ld a, cf + ldff(51), a + ld a, f0 + ldff(52), a + xor a, a + ldff(53), a + ldff(54), a + ld sp, cff2 + ld hl, 1234 + push hl + pop hl + ld b, 02 + ld c, 41 +lbegin_waitm2: + ldff a, (c) + and a, 03 + cmp a, b + jrnz lbegin_waitm2 + ld a, 08 + ldff(41), a + ld a, 80 + ldff(55), a + ld a, 02 + ldff(ff), a + xor a, a + ldff(0f), a + ei +lbegin_wait_int: + jr lbegin_wait_int + +.text@7000 +lprint_8000: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, (8001) + ld b, a + swap a + and a, 0f + ld(9800), a + ld a, b + and a, 0f + ld(9801), a + ld a, (8000) + ld b, a + swap a + and a, 0f + ld(9802), a + ld a, b + and a, 0f + ld(9803), a + ld bc, 7a00 + ld hl, 8000 + ld d, 00 +lprint_copytiles: + ld a, (bc) + inc bc + ld(hl++), a + dec d + jrnz lprint_copytiles + ld a, c0 + ldff(47), a + ld a, 80 + ldff(68), a + ld a, ff + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + xor a, a + ldff(69), a + ldff(69), a + xor a, a + ldff(42), a + ldff(43), a + ld a, 91 + ldff(40), a +lprint_limbo: + jr lprint_limbo + +.text@7400 +lwaitly_b: + ld c, 44 +lwaitly_b_loop: + ldff a, (c) + cmp a, b + jrnz lwaitly_b_loop + ret + +.data@7a00 + 00 00 7f 7f 41 41 41 41 + 41 41 41 41 41 41 7f 7f + 00 00 08 08 08 08 08 08 + 08 08 08 08 08 08 08 08 + 00 00 7f 7f 01 01 01 01 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 01 01 01 01 + 3f 3f 01 01 01 01 7f 7f + 00 00 41 41 41 41 41 41 + 7f 7f 01 01 01 01 01 01 + 00 00 7f 7f 40 40 40 40 + 7e 7e 01 01 01 01 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 41 41 41 41 7f 7f + 00 00 7f 7f 01 01 02 02 + 04 04 08 08 10 10 10 10 + 00 00 3e 3e 41 41 41 41 + 3e 3e 41 41 41 41 3e 3e + 00 00 7f 7f 41 41 41 41 + 7f 7f 01 01 01 01 7f 7f + 00 00 08 08 22 22 41 41 + 7f 7f 41 41 41 41 41 41 + 00 00 7e 7e 41 41 41 41 + 7e 7e 41 41 41 41 7e 7e + 00 00 3e 3e 41 41 40 40 + 40 40 40 40 41 41 3e 3e + 00 00 7e 7e 41 41 41 41 + 41 41 41 41 41 41 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 40 40 + diff --git a/test/hwtests/irq_precedence/hdma_vs_m0_scx2_halt_cgb04c_out1234.asm b/test/hwtests/irq_precedence/hdma_vs_m0_scx2_halt_cgb04c_out1234.asm new file mode 100644 index 00000000..60d5dfe6 --- /dev/null +++ b/test/hwtests/irq_precedence/hdma_vs_m0_scx2_halt_cgb04c_out1234.asm @@ -0,0 +1,140 @@ +.size 8000 + +.text@48 + jp lprint_8000 + +.text@100 + jp lbegin + +.data@143 + c0 + +.text@150 +lbegin: + ld a, 02 + ldff(43), a + ld a, cf + ldff(51), a + ld a, f0 + ldff(52), a + xor a, a + ldff(53), a + ldff(54), a + ld sp, cff2 + ld hl, 1234 + push hl + pop hl + ld b, 02 + ld c, 41 +lbegin_waitm2: + ldff a, (c) + and a, 03 + cmp a, b + jrnz lbegin_waitm2 + ld a, 08 + ldff(41), a + ld a, 80 + ldff(55), a + ld a, 02 + ldff(ff), a + xor a, a + ldff(0f), a + ei + halt + +.text@7000 +lprint_8000: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, (8001) + ld b, a + swap a + and a, 0f + ld(9800), a + ld a, b + and a, 0f + ld(9801), a + ld a, (8000) + ld b, a + swap a + and a, 0f + ld(9802), a + ld a, b + and a, 0f + ld(9803), a + ld bc, 7a00 + ld hl, 8000 + ld d, 00 +lprint_copytiles: + ld a, (bc) + inc bc + ld(hl++), a + dec d + jrnz lprint_copytiles + ld a, c0 + ldff(47), a + ld a, 80 + ldff(68), a + ld a, ff + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + xor a, a + ldff(69), a + ldff(69), a + xor a, a + ldff(42), a + ldff(43), a + ld a, 91 + ldff(40), a +lprint_limbo: + jr lprint_limbo + +.text@7400 +lwaitly_b: + ld c, 44 +lwaitly_b_loop: + ldff a, (c) + cmp a, b + jrnz lwaitly_b_loop + ret + +.data@7a00 + 00 00 7f 7f 41 41 41 41 + 41 41 41 41 41 41 7f 7f + 00 00 08 08 08 08 08 08 + 08 08 08 08 08 08 08 08 + 00 00 7f 7f 01 01 01 01 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 01 01 01 01 + 3f 3f 01 01 01 01 7f 7f + 00 00 41 41 41 41 41 41 + 7f 7f 01 01 01 01 01 01 + 00 00 7f 7f 40 40 40 40 + 7e 7e 01 01 01 01 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 41 41 41 41 7f 7f + 00 00 7f 7f 01 01 02 02 + 04 04 08 08 10 10 10 10 + 00 00 3e 3e 41 41 41 41 + 3e 3e 41 41 41 41 3e 3e + 00 00 7f 7f 41 41 41 41 + 7f 7f 01 01 01 01 7f 7f + 00 00 08 08 22 22 41 41 + 7f 7f 41 41 41 41 41 41 + 00 00 7e 7e 41 41 41 41 + 7e 7e 41 41 41 41 7e 7e + 00 00 3e 3e 41 41 40 40 + 40 40 40 40 41 41 3e 3e + 00 00 7e 7e 41 41 41 41 + 41 41 41 41 41 41 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 40 40 + diff --git a/test/hwtests/irq_precedence/hdma_vs_m0_scx3_cgb04c_out1234.asm b/test/hwtests/irq_precedence/hdma_vs_m0_scx3_cgb04c_out1234.asm new file mode 100644 index 00000000..289a58b8 --- /dev/null +++ b/test/hwtests/irq_precedence/hdma_vs_m0_scx3_cgb04c_out1234.asm @@ -0,0 +1,141 @@ +.size 8000 + +.text@48 + jp lprint_8000 + +.text@100 + jp lbegin + +.data@143 + c0 + +.text@150 +lbegin: + ld a, 03 + ldff(43), a + ld a, cf + ldff(51), a + ld a, f0 + ldff(52), a + xor a, a + ldff(53), a + ldff(54), a + ld sp, cff2 + ld hl, 1234 + push hl + pop hl + ld b, 02 + ld c, 41 +lbegin_waitm2: + ldff a, (c) + and a, 03 + cmp a, b + jrnz lbegin_waitm2 + ld a, 08 + ldff(41), a + ld a, 80 + ldff(55), a + ld a, 02 + ldff(ff), a + xor a, a + ldff(0f), a + ei +lbegin_wait_int: + jr lbegin_wait_int + +.text@7000 +lprint_8000: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, (8001) + ld b, a + swap a + and a, 0f + ld(9800), a + ld a, b + and a, 0f + ld(9801), a + ld a, (8000) + ld b, a + swap a + and a, 0f + ld(9802), a + ld a, b + and a, 0f + ld(9803), a + ld bc, 7a00 + ld hl, 8000 + ld d, 00 +lprint_copytiles: + ld a, (bc) + inc bc + ld(hl++), a + dec d + jrnz lprint_copytiles + ld a, c0 + ldff(47), a + ld a, 80 + ldff(68), a + ld a, ff + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + xor a, a + ldff(69), a + ldff(69), a + xor a, a + ldff(42), a + ldff(43), a + ld a, 91 + ldff(40), a +lprint_limbo: + jr lprint_limbo + +.text@7400 +lwaitly_b: + ld c, 44 +lwaitly_b_loop: + ldff a, (c) + cmp a, b + jrnz lwaitly_b_loop + ret + +.data@7a00 + 00 00 7f 7f 41 41 41 41 + 41 41 41 41 41 41 7f 7f + 00 00 08 08 08 08 08 08 + 08 08 08 08 08 08 08 08 + 00 00 7f 7f 01 01 01 01 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 01 01 01 01 + 3f 3f 01 01 01 01 7f 7f + 00 00 41 41 41 41 41 41 + 7f 7f 01 01 01 01 01 01 + 00 00 7f 7f 40 40 40 40 + 7e 7e 01 01 01 01 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 41 41 41 41 7f 7f + 00 00 7f 7f 01 01 02 02 + 04 04 08 08 10 10 10 10 + 00 00 3e 3e 41 41 41 41 + 3e 3e 41 41 41 41 3e 3e + 00 00 7f 7f 41 41 41 41 + 7f 7f 01 01 01 01 7f 7f + 00 00 08 08 22 22 41 41 + 7f 7f 41 41 41 41 41 41 + 00 00 7e 7e 41 41 41 41 + 7e 7e 41 41 41 41 7e 7e + 00 00 3e 3e 41 41 40 40 + 40 40 40 40 41 41 3e 3e + 00 00 7e 7e 41 41 41 41 + 41 41 41 41 41 41 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 40 40 + diff --git a/test/hwtests/irq_precedence/late_hdma_vs_ei_scx1_1_cgb04c_out102E.asm b/test/hwtests/irq_precedence/late_hdma_vs_ei_scx1_1_cgb04c_out102E.asm new file mode 100644 index 00000000..6038d642 --- /dev/null +++ b/test/hwtests/irq_precedence/late_hdma_vs_ei_scx1_1_cgb04c_out102E.asm @@ -0,0 +1,151 @@ +.size 8000 + +.text@48 + jp lstatint + +.text@50 + jp lprint_8000 + +.text@100 + jp lbegin + +.data@143 + c0 + +.text@150 +lbegin: + ld a, 01 + ldff(43), a + ld a, cf + ldff(51), a + ld a, f0 + ldff(52), a + xor a, a + ldff(53), a + ldff(54), a + ld b, 03 + ld c, 41 +lbegin_waitm3: + ldff a, (c) + and a, b + cmp a, b + jrnz lbegin_waitm3 + ld a, 20 + ldff(41), a + ld a, 02 + ldff(ff), a + xor a, a + ldff(0f), a + ei + +.text@1000 +lstatint: + ld sp, cff2 + ld hl, 1234 + push hl + pop hl + ld a, 80 + ldff(55), a + ld a, 04 + ldff(0f), a + ldff(ff), a + +.text@102c + ei + +.text@7000 +lprint_8000: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, (8001) + ld b, a + swap a + and a, 0f + ld(9800), a + ld a, b + and a, 0f + ld(9801), a + ld a, (8000) + ld b, a + swap a + and a, 0f + ld(9802), a + ld a, b + and a, 0f + ld(9803), a + ld bc, 7a00 + ld hl, 8000 + ld d, 00 +lprint_copytiles: + ld a, (bc) + inc bc + ld(hl++), a + dec d + jrnz lprint_copytiles + ld a, c0 + ldff(47), a + ld a, 80 + ldff(68), a + ld a, ff + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + xor a, a + ldff(69), a + ldff(69), a + xor a, a + ldff(42), a + ldff(43), a + ld a, 91 + ldff(40), a +lprint_limbo: + jr lprint_limbo + +.text@7400 +lwaitly_b: + ld c, 44 +lwaitly_b_loop: + ldff a, (c) + cmp a, b + jrnz lwaitly_b_loop + ret + +.data@7a00 + 00 00 7f 7f 41 41 41 41 + 41 41 41 41 41 41 7f 7f + 00 00 08 08 08 08 08 08 + 08 08 08 08 08 08 08 08 + 00 00 7f 7f 01 01 01 01 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 01 01 01 01 + 3f 3f 01 01 01 01 7f 7f + 00 00 41 41 41 41 41 41 + 7f 7f 01 01 01 01 01 01 + 00 00 7f 7f 40 40 40 40 + 7e 7e 01 01 01 01 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 41 41 41 41 7f 7f + 00 00 7f 7f 01 01 02 02 + 04 04 08 08 10 10 10 10 + 00 00 3e 3e 41 41 41 41 + 3e 3e 41 41 41 41 3e 3e + 00 00 7f 7f 41 41 41 41 + 7f 7f 01 01 01 01 7f 7f + 00 00 08 08 22 22 41 41 + 7f 7f 41 41 41 41 41 41 + 00 00 7e 7e 41 41 41 41 + 7e 7e 41 41 41 41 7e 7e + 00 00 3e 3e 41 41 40 40 + 40 40 40 40 41 41 3e 3e + 00 00 7e 7e 41 41 41 41 + 41 41 41 41 41 41 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 40 40 + diff --git a/test/hwtests/irq_precedence/late_hdma_vs_ei_scx1_2_cgb04c_out1234.asm b/test/hwtests/irq_precedence/late_hdma_vs_ei_scx1_2_cgb04c_out1234.asm new file mode 100644 index 00000000..e45d56d7 --- /dev/null +++ b/test/hwtests/irq_precedence/late_hdma_vs_ei_scx1_2_cgb04c_out1234.asm @@ -0,0 +1,151 @@ +.size 8000 + +.text@48 + jp lstatint + +.text@50 + jp lprint_8000 + +.text@100 + jp lbegin + +.data@143 + c0 + +.text@150 +lbegin: + ld a, 01 + ldff(43), a + ld a, cf + ldff(51), a + ld a, f0 + ldff(52), a + xor a, a + ldff(53), a + ldff(54), a + ld b, 03 + ld c, 41 +lbegin_waitm3: + ldff a, (c) + and a, b + cmp a, b + jrnz lbegin_waitm3 + ld a, 20 + ldff(41), a + ld a, 02 + ldff(ff), a + xor a, a + ldff(0f), a + ei + +.text@1000 +lstatint: + ld sp, cff2 + ld hl, 1234 + push hl + pop hl + ld a, 80 + ldff(55), a + ld a, 04 + ldff(0f), a + ldff(ff), a + +.text@102d + ei + +.text@7000 +lprint_8000: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, (8001) + ld b, a + swap a + and a, 0f + ld(9800), a + ld a, b + and a, 0f + ld(9801), a + ld a, (8000) + ld b, a + swap a + and a, 0f + ld(9802), a + ld a, b + and a, 0f + ld(9803), a + ld bc, 7a00 + ld hl, 8000 + ld d, 00 +lprint_copytiles: + ld a, (bc) + inc bc + ld(hl++), a + dec d + jrnz lprint_copytiles + ld a, c0 + ldff(47), a + ld a, 80 + ldff(68), a + ld a, ff + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + xor a, a + ldff(69), a + ldff(69), a + xor a, a + ldff(42), a + ldff(43), a + ld a, 91 + ldff(40), a +lprint_limbo: + jr lprint_limbo + +.text@7400 +lwaitly_b: + ld c, 44 +lwaitly_b_loop: + ldff a, (c) + cmp a, b + jrnz lwaitly_b_loop + ret + +.data@7a00 + 00 00 7f 7f 41 41 41 41 + 41 41 41 41 41 41 7f 7f + 00 00 08 08 08 08 08 08 + 08 08 08 08 08 08 08 08 + 00 00 7f 7f 01 01 01 01 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 01 01 01 01 + 3f 3f 01 01 01 01 7f 7f + 00 00 41 41 41 41 41 41 + 7f 7f 01 01 01 01 01 01 + 00 00 7f 7f 40 40 40 40 + 7e 7e 01 01 01 01 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 41 41 41 41 7f 7f + 00 00 7f 7f 01 01 02 02 + 04 04 08 08 10 10 10 10 + 00 00 3e 3e 41 41 41 41 + 3e 3e 41 41 41 41 3e 3e + 00 00 7f 7f 41 41 41 41 + 7f 7f 01 01 01 01 7f 7f + 00 00 08 08 22 22 41 41 + 7f 7f 41 41 41 41 41 41 + 00 00 7e 7e 41 41 41 41 + 7e 7e 41 41 41 41 7e 7e + 00 00 3e 3e 41 41 40 40 + 40 40 40 40 41 41 3e 3e + 00 00 7e 7e 41 41 41 41 + 41 41 41 41 41 41 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 40 40 + diff --git a/test/hwtests/irq_precedence/late_hdma_vs_ei_scx2_1_cgb04c_out102F.asm b/test/hwtests/irq_precedence/late_hdma_vs_ei_scx2_1_cgb04c_out102F.asm new file mode 100644 index 00000000..774c94d2 --- /dev/null +++ b/test/hwtests/irq_precedence/late_hdma_vs_ei_scx2_1_cgb04c_out102F.asm @@ -0,0 +1,151 @@ +.size 8000 + +.text@48 + jp lstatint + +.text@50 + jp lprint_8000 + +.text@100 + jp lbegin + +.data@143 + c0 + +.text@150 +lbegin: + ld a, 02 + ldff(43), a + ld a, cf + ldff(51), a + ld a, f0 + ldff(52), a + xor a, a + ldff(53), a + ldff(54), a + ld b, 03 + ld c, 41 +lbegin_waitm3: + ldff a, (c) + and a, b + cmp a, b + jrnz lbegin_waitm3 + ld a, 20 + ldff(41), a + ld a, 02 + ldff(ff), a + xor a, a + ldff(0f), a + ei + +.text@1000 +lstatint: + ld sp, cff2 + ld hl, 1234 + push hl + pop hl + ld a, 80 + ldff(55), a + ld a, 04 + ldff(0f), a + ldff(ff), a + +.text@102d + ei + +.text@7000 +lprint_8000: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, (8001) + ld b, a + swap a + and a, 0f + ld(9800), a + ld a, b + and a, 0f + ld(9801), a + ld a, (8000) + ld b, a + swap a + and a, 0f + ld(9802), a + ld a, b + and a, 0f + ld(9803), a + ld bc, 7a00 + ld hl, 8000 + ld d, 00 +lprint_copytiles: + ld a, (bc) + inc bc + ld(hl++), a + dec d + jrnz lprint_copytiles + ld a, c0 + ldff(47), a + ld a, 80 + ldff(68), a + ld a, ff + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + xor a, a + ldff(69), a + ldff(69), a + xor a, a + ldff(42), a + ldff(43), a + ld a, 91 + ldff(40), a +lprint_limbo: + jr lprint_limbo + +.text@7400 +lwaitly_b: + ld c, 44 +lwaitly_b_loop: + ldff a, (c) + cmp a, b + jrnz lwaitly_b_loop + ret + +.data@7a00 + 00 00 7f 7f 41 41 41 41 + 41 41 41 41 41 41 7f 7f + 00 00 08 08 08 08 08 08 + 08 08 08 08 08 08 08 08 + 00 00 7f 7f 01 01 01 01 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 01 01 01 01 + 3f 3f 01 01 01 01 7f 7f + 00 00 41 41 41 41 41 41 + 7f 7f 01 01 01 01 01 01 + 00 00 7f 7f 40 40 40 40 + 7e 7e 01 01 01 01 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 41 41 41 41 7f 7f + 00 00 7f 7f 01 01 02 02 + 04 04 08 08 10 10 10 10 + 00 00 3e 3e 41 41 41 41 + 3e 3e 41 41 41 41 3e 3e + 00 00 7f 7f 41 41 41 41 + 7f 7f 01 01 01 01 7f 7f + 00 00 08 08 22 22 41 41 + 7f 7f 41 41 41 41 41 41 + 00 00 7e 7e 41 41 41 41 + 7e 7e 41 41 41 41 7e 7e + 00 00 3e 3e 41 41 40 40 + 40 40 40 40 41 41 3e 3e + 00 00 7e 7e 41 41 41 41 + 41 41 41 41 41 41 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 40 40 + diff --git a/test/hwtests/irq_precedence/late_hdma_vs_ei_scx2_2_cgb04c_out1234.asm b/test/hwtests/irq_precedence/late_hdma_vs_ei_scx2_2_cgb04c_out1234.asm new file mode 100644 index 00000000..25aa93dc --- /dev/null +++ b/test/hwtests/irq_precedence/late_hdma_vs_ei_scx2_2_cgb04c_out1234.asm @@ -0,0 +1,151 @@ +.size 8000 + +.text@48 + jp lstatint + +.text@50 + jp lprint_8000 + +.text@100 + jp lbegin + +.data@143 + c0 + +.text@150 +lbegin: + ld a, 02 + ldff(43), a + ld a, cf + ldff(51), a + ld a, f0 + ldff(52), a + xor a, a + ldff(53), a + ldff(54), a + ld b, 03 + ld c, 41 +lbegin_waitm3: + ldff a, (c) + and a, b + cmp a, b + jrnz lbegin_waitm3 + ld a, 20 + ldff(41), a + ld a, 02 + ldff(ff), a + xor a, a + ldff(0f), a + ei + +.text@1000 +lstatint: + ld sp, cff2 + ld hl, 1234 + push hl + pop hl + ld a, 80 + ldff(55), a + ld a, 04 + ldff(0f), a + ldff(ff), a + +.text@102e + ei + +.text@7000 +lprint_8000: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, (8001) + ld b, a + swap a + and a, 0f + ld(9800), a + ld a, b + and a, 0f + ld(9801), a + ld a, (8000) + ld b, a + swap a + and a, 0f + ld(9802), a + ld a, b + and a, 0f + ld(9803), a + ld bc, 7a00 + ld hl, 8000 + ld d, 00 +lprint_copytiles: + ld a, (bc) + inc bc + ld(hl++), a + dec d + jrnz lprint_copytiles + ld a, c0 + ldff(47), a + ld a, 80 + ldff(68), a + ld a, ff + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + xor a, a + ldff(69), a + ldff(69), a + xor a, a + ldff(42), a + ldff(43), a + ld a, 91 + ldff(40), a +lprint_limbo: + jr lprint_limbo + +.text@7400 +lwaitly_b: + ld c, 44 +lwaitly_b_loop: + ldff a, (c) + cmp a, b + jrnz lwaitly_b_loop + ret + +.data@7a00 + 00 00 7f 7f 41 41 41 41 + 41 41 41 41 41 41 7f 7f + 00 00 08 08 08 08 08 08 + 08 08 08 08 08 08 08 08 + 00 00 7f 7f 01 01 01 01 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 01 01 01 01 + 3f 3f 01 01 01 01 7f 7f + 00 00 41 41 41 41 41 41 + 7f 7f 01 01 01 01 01 01 + 00 00 7f 7f 40 40 40 40 + 7e 7e 01 01 01 01 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 41 41 41 41 7f 7f + 00 00 7f 7f 01 01 02 02 + 04 04 08 08 10 10 10 10 + 00 00 3e 3e 41 41 41 41 + 3e 3e 41 41 41 41 3e 3e + 00 00 7f 7f 41 41 41 41 + 7f 7f 01 01 01 01 7f 7f + 00 00 08 08 22 22 41 41 + 7f 7f 41 41 41 41 41 41 + 00 00 7e 7e 41 41 41 41 + 7e 7e 41 41 41 41 7e 7e + 00 00 3e 3e 41 41 40 40 + 40 40 40 40 41 41 3e 3e + 00 00 7e 7e 41 41 41 41 + 41 41 41 41 41 41 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 40 40 + diff --git a/test/hwtests/irq_precedence/late_hdma_vs_ie_scx1_1_cgb04c_out102E.asm b/test/hwtests/irq_precedence/late_hdma_vs_ie_scx1_1_cgb04c_out102E.asm new file mode 100644 index 00000000..57d9a51c --- /dev/null +++ b/test/hwtests/irq_precedence/late_hdma_vs_ie_scx1_1_cgb04c_out102E.asm @@ -0,0 +1,151 @@ +.size 8000 + +.text@48 + jp lstatint + +.text@50 + jp lprint_8000 + +.text@100 + jp lbegin + +.data@143 + c0 + +.text@150 +lbegin: + ld a, 01 + ldff(43), a + ld a, cf + ldff(51), a + ld a, f0 + ldff(52), a + xor a, a + ldff(53), a + ldff(54), a + ld b, 03 + ld c, 41 +lbegin_waitm3: + ldff a, (c) + and a, b + cmp a, b + jrnz lbegin_waitm3 + ld a, 20 + ldff(41), a + ld a, 02 + ldff(ff), a + xor a, a + ldff(0f), a + ei + +.text@1000 +lstatint: + ld sp, cff2 + ld hl, 1234 + push hl + pop hl + ld a, 80 + ldff(55), a + ld a, 04 + ldff(0f), a + ei + +.text@102c + ldff(ff), a + +.text@7000 +lprint_8000: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, (8001) + ld b, a + swap a + and a, 0f + ld(9800), a + ld a, b + and a, 0f + ld(9801), a + ld a, (8000) + ld b, a + swap a + and a, 0f + ld(9802), a + ld a, b + and a, 0f + ld(9803), a + ld bc, 7a00 + ld hl, 8000 + ld d, 00 +lprint_copytiles: + ld a, (bc) + inc bc + ld(hl++), a + dec d + jrnz lprint_copytiles + ld a, c0 + ldff(47), a + ld a, 80 + ldff(68), a + ld a, ff + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + xor a, a + ldff(69), a + ldff(69), a + xor a, a + ldff(42), a + ldff(43), a + ld a, 91 + ldff(40), a +lprint_limbo: + jr lprint_limbo + +.text@7400 +lwaitly_b: + ld c, 44 +lwaitly_b_loop: + ldff a, (c) + cmp a, b + jrnz lwaitly_b_loop + ret + +.data@7a00 + 00 00 7f 7f 41 41 41 41 + 41 41 41 41 41 41 7f 7f + 00 00 08 08 08 08 08 08 + 08 08 08 08 08 08 08 08 + 00 00 7f 7f 01 01 01 01 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 01 01 01 01 + 3f 3f 01 01 01 01 7f 7f + 00 00 41 41 41 41 41 41 + 7f 7f 01 01 01 01 01 01 + 00 00 7f 7f 40 40 40 40 + 7e 7e 01 01 01 01 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 41 41 41 41 7f 7f + 00 00 7f 7f 01 01 02 02 + 04 04 08 08 10 10 10 10 + 00 00 3e 3e 41 41 41 41 + 3e 3e 41 41 41 41 3e 3e + 00 00 7f 7f 41 41 41 41 + 7f 7f 01 01 01 01 7f 7f + 00 00 08 08 22 22 41 41 + 7f 7f 41 41 41 41 41 41 + 00 00 7e 7e 41 41 41 41 + 7e 7e 41 41 41 41 7e 7e + 00 00 3e 3e 41 41 40 40 + 40 40 40 40 41 41 3e 3e + 00 00 7e 7e 41 41 41 41 + 41 41 41 41 41 41 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 40 40 + diff --git a/test/hwtests/irq_precedence/late_hdma_vs_ie_scx1_2_cgb04c_out1234.asm b/test/hwtests/irq_precedence/late_hdma_vs_ie_scx1_2_cgb04c_out1234.asm new file mode 100644 index 00000000..b51d8118 --- /dev/null +++ b/test/hwtests/irq_precedence/late_hdma_vs_ie_scx1_2_cgb04c_out1234.asm @@ -0,0 +1,151 @@ +.size 8000 + +.text@48 + jp lstatint + +.text@50 + jp lprint_8000 + +.text@100 + jp lbegin + +.data@143 + c0 + +.text@150 +lbegin: + ld a, 01 + ldff(43), a + ld a, cf + ldff(51), a + ld a, f0 + ldff(52), a + xor a, a + ldff(53), a + ldff(54), a + ld b, 03 + ld c, 41 +lbegin_waitm3: + ldff a, (c) + and a, b + cmp a, b + jrnz lbegin_waitm3 + ld a, 20 + ldff(41), a + ld a, 02 + ldff(ff), a + xor a, a + ldff(0f), a + ei + +.text@1000 +lstatint: + ld sp, cff2 + ld hl, 1234 + push hl + pop hl + ld a, 80 + ldff(55), a + ld a, 04 + ldff(0f), a + ei + +.text@102d + ldff(ff), a + +.text@7000 +lprint_8000: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, (8001) + ld b, a + swap a + and a, 0f + ld(9800), a + ld a, b + and a, 0f + ld(9801), a + ld a, (8000) + ld b, a + swap a + and a, 0f + ld(9802), a + ld a, b + and a, 0f + ld(9803), a + ld bc, 7a00 + ld hl, 8000 + ld d, 00 +lprint_copytiles: + ld a, (bc) + inc bc + ld(hl++), a + dec d + jrnz lprint_copytiles + ld a, c0 + ldff(47), a + ld a, 80 + ldff(68), a + ld a, ff + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + xor a, a + ldff(69), a + ldff(69), a + xor a, a + ldff(42), a + ldff(43), a + ld a, 91 + ldff(40), a +lprint_limbo: + jr lprint_limbo + +.text@7400 +lwaitly_b: + ld c, 44 +lwaitly_b_loop: + ldff a, (c) + cmp a, b + jrnz lwaitly_b_loop + ret + +.data@7a00 + 00 00 7f 7f 41 41 41 41 + 41 41 41 41 41 41 7f 7f + 00 00 08 08 08 08 08 08 + 08 08 08 08 08 08 08 08 + 00 00 7f 7f 01 01 01 01 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 01 01 01 01 + 3f 3f 01 01 01 01 7f 7f + 00 00 41 41 41 41 41 41 + 7f 7f 01 01 01 01 01 01 + 00 00 7f 7f 40 40 40 40 + 7e 7e 01 01 01 01 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 41 41 41 41 7f 7f + 00 00 7f 7f 01 01 02 02 + 04 04 08 08 10 10 10 10 + 00 00 3e 3e 41 41 41 41 + 3e 3e 41 41 41 41 3e 3e + 00 00 7f 7f 41 41 41 41 + 7f 7f 01 01 01 01 7f 7f + 00 00 08 08 22 22 41 41 + 7f 7f 41 41 41 41 41 41 + 00 00 7e 7e 41 41 41 41 + 7e 7e 41 41 41 41 7e 7e + 00 00 3e 3e 41 41 40 40 + 40 40 40 40 41 41 3e 3e + 00 00 7e 7e 41 41 41 41 + 41 41 41 41 41 41 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 40 40 + diff --git a/test/hwtests/irq_precedence/late_hdma_vs_ie_scx2_1_cgb04c_out102F.asm b/test/hwtests/irq_precedence/late_hdma_vs_ie_scx2_1_cgb04c_out102F.asm new file mode 100644 index 00000000..9aeb02b6 --- /dev/null +++ b/test/hwtests/irq_precedence/late_hdma_vs_ie_scx2_1_cgb04c_out102F.asm @@ -0,0 +1,151 @@ +.size 8000 + +.text@48 + jp lstatint + +.text@50 + jp lprint_8000 + +.text@100 + jp lbegin + +.data@143 + c0 + +.text@150 +lbegin: + ld a, 02 + ldff(43), a + ld a, cf + ldff(51), a + ld a, f0 + ldff(52), a + xor a, a + ldff(53), a + ldff(54), a + ld b, 03 + ld c, 41 +lbegin_waitm3: + ldff a, (c) + and a, b + cmp a, b + jrnz lbegin_waitm3 + ld a, 20 + ldff(41), a + ld a, 02 + ldff(ff), a + xor a, a + ldff(0f), a + ei + +.text@1000 +lstatint: + ld sp, cff2 + ld hl, 1234 + push hl + pop hl + ld a, 80 + ldff(55), a + ld a, 04 + ldff(0f), a + ei + +.text@102d + ldff(ff), a + +.text@7000 +lprint_8000: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, (8001) + ld b, a + swap a + and a, 0f + ld(9800), a + ld a, b + and a, 0f + ld(9801), a + ld a, (8000) + ld b, a + swap a + and a, 0f + ld(9802), a + ld a, b + and a, 0f + ld(9803), a + ld bc, 7a00 + ld hl, 8000 + ld d, 00 +lprint_copytiles: + ld a, (bc) + inc bc + ld(hl++), a + dec d + jrnz lprint_copytiles + ld a, c0 + ldff(47), a + ld a, 80 + ldff(68), a + ld a, ff + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + xor a, a + ldff(69), a + ldff(69), a + xor a, a + ldff(42), a + ldff(43), a + ld a, 91 + ldff(40), a +lprint_limbo: + jr lprint_limbo + +.text@7400 +lwaitly_b: + ld c, 44 +lwaitly_b_loop: + ldff a, (c) + cmp a, b + jrnz lwaitly_b_loop + ret + +.data@7a00 + 00 00 7f 7f 41 41 41 41 + 41 41 41 41 41 41 7f 7f + 00 00 08 08 08 08 08 08 + 08 08 08 08 08 08 08 08 + 00 00 7f 7f 01 01 01 01 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 01 01 01 01 + 3f 3f 01 01 01 01 7f 7f + 00 00 41 41 41 41 41 41 + 7f 7f 01 01 01 01 01 01 + 00 00 7f 7f 40 40 40 40 + 7e 7e 01 01 01 01 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 41 41 41 41 7f 7f + 00 00 7f 7f 01 01 02 02 + 04 04 08 08 10 10 10 10 + 00 00 3e 3e 41 41 41 41 + 3e 3e 41 41 41 41 3e 3e + 00 00 7f 7f 41 41 41 41 + 7f 7f 01 01 01 01 7f 7f + 00 00 08 08 22 22 41 41 + 7f 7f 41 41 41 41 41 41 + 00 00 7e 7e 41 41 41 41 + 7e 7e 41 41 41 41 7e 7e + 00 00 3e 3e 41 41 40 40 + 40 40 40 40 41 41 3e 3e + 00 00 7e 7e 41 41 41 41 + 41 41 41 41 41 41 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 40 40 + diff --git a/test/hwtests/irq_precedence/late_hdma_vs_ie_scx2_2_cgb04c_out1234.asm b/test/hwtests/irq_precedence/late_hdma_vs_ie_scx2_2_cgb04c_out1234.asm new file mode 100644 index 00000000..6bc4fb66 --- /dev/null +++ b/test/hwtests/irq_precedence/late_hdma_vs_ie_scx2_2_cgb04c_out1234.asm @@ -0,0 +1,151 @@ +.size 8000 + +.text@48 + jp lstatint + +.text@50 + jp lprint_8000 + +.text@100 + jp lbegin + +.data@143 + c0 + +.text@150 +lbegin: + ld a, 02 + ldff(43), a + ld a, cf + ldff(51), a + ld a, f0 + ldff(52), a + xor a, a + ldff(53), a + ldff(54), a + ld b, 03 + ld c, 41 +lbegin_waitm3: + ldff a, (c) + and a, b + cmp a, b + jrnz lbegin_waitm3 + ld a, 20 + ldff(41), a + ld a, 02 + ldff(ff), a + xor a, a + ldff(0f), a + ei + +.text@1000 +lstatint: + ld sp, cff2 + ld hl, 1234 + push hl + pop hl + ld a, 80 + ldff(55), a + ld a, 04 + ldff(0f), a + ei + +.text@102e + ldff(ff), a + +.text@7000 +lprint_8000: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, (8001) + ld b, a + swap a + and a, 0f + ld(9800), a + ld a, b + and a, 0f + ld(9801), a + ld a, (8000) + ld b, a + swap a + and a, 0f + ld(9802), a + ld a, b + and a, 0f + ld(9803), a + ld bc, 7a00 + ld hl, 8000 + ld d, 00 +lprint_copytiles: + ld a, (bc) + inc bc + ld(hl++), a + dec d + jrnz lprint_copytiles + ld a, c0 + ldff(47), a + ld a, 80 + ldff(68), a + ld a, ff + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + xor a, a + ldff(69), a + ldff(69), a + xor a, a + ldff(42), a + ldff(43), a + ld a, 91 + ldff(40), a +lprint_limbo: + jr lprint_limbo + +.text@7400 +lwaitly_b: + ld c, 44 +lwaitly_b_loop: + ldff a, (c) + cmp a, b + jrnz lwaitly_b_loop + ret + +.data@7a00 + 00 00 7f 7f 41 41 41 41 + 41 41 41 41 41 41 7f 7f + 00 00 08 08 08 08 08 08 + 08 08 08 08 08 08 08 08 + 00 00 7f 7f 01 01 01 01 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 01 01 01 01 + 3f 3f 01 01 01 01 7f 7f + 00 00 41 41 41 41 41 41 + 7f 7f 01 01 01 01 01 01 + 00 00 7f 7f 40 40 40 40 + 7e 7e 01 01 01 01 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 41 41 41 41 7f 7f + 00 00 7f 7f 01 01 02 02 + 04 04 08 08 10 10 10 10 + 00 00 3e 3e 41 41 41 41 + 3e 3e 41 41 41 41 3e 3e + 00 00 7f 7f 41 41 41 41 + 7f 7f 01 01 01 01 7f 7f + 00 00 08 08 22 22 41 41 + 7f 7f 41 41 41 41 41 41 + 00 00 7e 7e 41 41 41 41 + 7e 7e 41 41 41 41 7e 7e + 00 00 3e 3e 41 41 40 40 + 40 40 40 40 41 41 3e 3e + 00 00 7e 7e 41 41 41 41 + 41 41 41 41 41 41 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 40 40 + diff --git a/test/hwtests/irq_precedence/late_hdma_vs_tima_scx1_1_cgb04c_out1234.asm b/test/hwtests/irq_precedence/late_hdma_vs_tima_scx1_1_cgb04c_out1234.asm new file mode 100644 index 00000000..e94c721c --- /dev/null +++ b/test/hwtests/irq_precedence/late_hdma_vs_tima_scx1_1_cgb04c_out1234.asm @@ -0,0 +1,153 @@ +.size 8000 + +.text@50 + jp ltimaint + +.text@100 + jp lbegin + +.data@143 + c0 + +.text@150 +lbegin: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, fe + ldff(05), a + ldff(06), a + ld a, 04 + ldff(07), a + ldff(ff), a + xor a, a + ldff(0f), a + ei + +.text@1000 +ltimaint: + ldff a, (40) + and a, 80 + jpnz lprint_8000 + ld sp, cff2 + ld hl, 1234 + push hl + pop hl + +.text@113c + ld a, 91 + ldff(40), a + ld a, 01 + ldff(43), a + ld a, cf + ldff(51), a + ld a, f0 + ldff(52), a + xor a, a + ldff(53), a + ldff(54), a + +.text@11c0 + ld a, 80 + ldff(55), a + xor a, a + ldff(0f), a + ei + +.text@7000 +lprint_8000: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, (8001) + ld b, a + swap a + and a, 0f + ld(9800), a + ld a, b + and a, 0f + ld(9801), a + ld a, (8000) + ld b, a + swap a + and a, 0f + ld(9802), a + ld a, b + and a, 0f + ld(9803), a + ld bc, 7a00 + ld hl, 8000 + ld d, 00 +lprint_copytiles: + ld a, (bc) + inc bc + ld(hl++), a + dec d + jrnz lprint_copytiles + ld a, c0 + ldff(47), a + ld a, 80 + ldff(68), a + ld a, ff + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + xor a, a + ldff(69), a + ldff(69), a + xor a, a + ldff(42), a + ldff(43), a + ld a, 91 + ldff(40), a +lprint_limbo: + jr lprint_limbo + +.text@7400 +lwaitly_b: + ld c, 44 +lwaitly_b_loop: + ldff a, (c) + cmp a, b + jrnz lwaitly_b_loop + ret + +.data@7a00 + 00 00 7f 7f 41 41 41 41 + 41 41 41 41 41 41 7f 7f + 00 00 08 08 08 08 08 08 + 08 08 08 08 08 08 08 08 + 00 00 7f 7f 01 01 01 01 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 01 01 01 01 + 3f 3f 01 01 01 01 7f 7f + 00 00 41 41 41 41 41 41 + 7f 7f 01 01 01 01 01 01 + 00 00 7f 7f 40 40 40 40 + 7e 7e 01 01 01 01 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 41 41 41 41 7f 7f + 00 00 7f 7f 01 01 02 02 + 04 04 08 08 10 10 10 10 + 00 00 3e 3e 41 41 41 41 + 3e 3e 41 41 41 41 3e 3e + 00 00 7f 7f 41 41 41 41 + 7f 7f 01 01 01 01 7f 7f + 00 00 08 08 22 22 41 41 + 7f 7f 41 41 41 41 41 41 + 00 00 7e 7e 41 41 41 41 + 7e 7e 41 41 41 41 7e 7e + 00 00 3e 3e 41 41 40 40 + 40 40 40 40 41 41 3e 3e + 00 00 7e 7e 41 41 41 41 + 41 41 41 41 41 41 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 40 40 + diff --git a/test/hwtests/irq_precedence/late_hdma_vs_tima_scx1_2_cgb04c_out11E9.asm b/test/hwtests/irq_precedence/late_hdma_vs_tima_scx1_2_cgb04c_out11E9.asm new file mode 100644 index 00000000..bb19234f --- /dev/null +++ b/test/hwtests/irq_precedence/late_hdma_vs_tima_scx1_2_cgb04c_out11E9.asm @@ -0,0 +1,153 @@ +.size 8000 + +.text@50 + jp ltimaint + +.text@100 + jp lbegin + +.data@143 + c0 + +.text@150 +lbegin: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, fe + ldff(05), a + ldff(06), a + ld a, 04 + ldff(07), a + ldff(ff), a + xor a, a + ldff(0f), a + ei + +.text@1000 +ltimaint: + ldff a, (40) + and a, 80 + jpnz lprint_8000 + ld sp, cff2 + ld hl, 1234 + push hl + pop hl + +.text@113d + ld a, 91 + ldff(40), a + ld a, 01 + ldff(43), a + ld a, cf + ldff(51), a + ld a, f0 + ldff(52), a + xor a, a + ldff(53), a + ldff(54), a + +.text@11c0 + ld a, 80 + ldff(55), a + xor a, a + ldff(0f), a + ei + +.text@7000 +lprint_8000: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, (8001) + ld b, a + swap a + and a, 0f + ld(9800), a + ld a, b + and a, 0f + ld(9801), a + ld a, (8000) + ld b, a + swap a + and a, 0f + ld(9802), a + ld a, b + and a, 0f + ld(9803), a + ld bc, 7a00 + ld hl, 8000 + ld d, 00 +lprint_copytiles: + ld a, (bc) + inc bc + ld(hl++), a + dec d + jrnz lprint_copytiles + ld a, c0 + ldff(47), a + ld a, 80 + ldff(68), a + ld a, ff + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + xor a, a + ldff(69), a + ldff(69), a + xor a, a + ldff(42), a + ldff(43), a + ld a, 91 + ldff(40), a +lprint_limbo: + jr lprint_limbo + +.text@7400 +lwaitly_b: + ld c, 44 +lwaitly_b_loop: + ldff a, (c) + cmp a, b + jrnz lwaitly_b_loop + ret + +.data@7a00 + 00 00 7f 7f 41 41 41 41 + 41 41 41 41 41 41 7f 7f + 00 00 08 08 08 08 08 08 + 08 08 08 08 08 08 08 08 + 00 00 7f 7f 01 01 01 01 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 01 01 01 01 + 3f 3f 01 01 01 01 7f 7f + 00 00 41 41 41 41 41 41 + 7f 7f 01 01 01 01 01 01 + 00 00 7f 7f 40 40 40 40 + 7e 7e 01 01 01 01 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 41 41 41 41 7f 7f + 00 00 7f 7f 01 01 02 02 + 04 04 08 08 10 10 10 10 + 00 00 3e 3e 41 41 41 41 + 3e 3e 41 41 41 41 3e 3e + 00 00 7f 7f 41 41 41 41 + 7f 7f 01 01 01 01 7f 7f + 00 00 08 08 22 22 41 41 + 7f 7f 41 41 41 41 41 41 + 00 00 7e 7e 41 41 41 41 + 7e 7e 41 41 41 41 7e 7e + 00 00 3e 3e 41 41 40 40 + 40 40 40 40 41 41 3e 3e + 00 00 7e 7e 41 41 41 41 + 41 41 41 41 41 41 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 40 40 + diff --git a/test/hwtests/irq_precedence/late_hdma_vs_tima_scx1_halt_1_cgb04c_out1234.asm b/test/hwtests/irq_precedence/late_hdma_vs_tima_scx1_halt_1_cgb04c_out1234.asm new file mode 100644 index 00000000..9f77b02f --- /dev/null +++ b/test/hwtests/irq_precedence/late_hdma_vs_tima_scx1_halt_1_cgb04c_out1234.asm @@ -0,0 +1,155 @@ +.size 8000 + +.text@50 + jp ltimaint + +.text@100 + jp lbegin + +.data@143 + c0 + +.text@150 +lbegin: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, fe + ldff(05), a + ldff(06), a + ld a, 04 + ldff(07), a + ld a, 04 + ldff(ff), a + xor a, a + ldff(0f), a + ei + +.text@1000 +ltimaint: + ldff a, (40) + and a, 80 + jpnz lprint_8000 + ld sp, cff2 + ld hl, 1234 + push hl + pop hl + +.text@113d + ld a, 91 + ldff(40), a + ld a, 01 + ldff(43), a + ld a, cf + ldff(51), a + ld a, f0 + ldff(52), a + xor a, a + ldff(53), a + ldff(54), a + +.text@11c0 + ld a, 80 + ldff(55), a + xor a, a + ldff(0f), a + ei + halt + +.text@7000 +lprint_8000: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, (8001) + ld b, a + swap a + and a, 0f + ld(9800), a + ld a, b + and a, 0f + ld(9801), a + ld a, (8000) + ld b, a + swap a + and a, 0f + ld(9802), a + ld a, b + and a, 0f + ld(9803), a + ld bc, 7a00 + ld hl, 8000 + ld d, 00 +lprint_copytiles: + ld a, (bc) + inc bc + ld(hl++), a + dec d + jrnz lprint_copytiles + ld a, c0 + ldff(47), a + ld a, 80 + ldff(68), a + ld a, ff + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + xor a, a + ldff(69), a + ldff(69), a + xor a, a + ldff(42), a + ldff(43), a + ld a, 91 + ldff(40), a +lprint_limbo: + jr lprint_limbo + +.text@7400 +lwaitly_b: + ld c, 44 +lwaitly_b_loop: + ldff a, (c) + cmp a, b + jrnz lwaitly_b_loop + ret + +.data@7a00 + 00 00 7f 7f 41 41 41 41 + 41 41 41 41 41 41 7f 7f + 00 00 08 08 08 08 08 08 + 08 08 08 08 08 08 08 08 + 00 00 7f 7f 01 01 01 01 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 01 01 01 01 + 3f 3f 01 01 01 01 7f 7f + 00 00 41 41 41 41 41 41 + 7f 7f 01 01 01 01 01 01 + 00 00 7f 7f 40 40 40 40 + 7e 7e 01 01 01 01 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 41 41 41 41 7f 7f + 00 00 7f 7f 01 01 02 02 + 04 04 08 08 10 10 10 10 + 00 00 3e 3e 41 41 41 41 + 3e 3e 41 41 41 41 3e 3e + 00 00 7f 7f 41 41 41 41 + 7f 7f 01 01 01 01 7f 7f + 00 00 08 08 22 22 41 41 + 7f 7f 41 41 41 41 41 41 + 00 00 7e 7e 41 41 41 41 + 7e 7e 41 41 41 41 7e 7e + 00 00 3e 3e 41 41 40 40 + 40 40 40 40 41 41 3e 3e + 00 00 7e 7e 41 41 41 41 + 41 41 41 41 41 41 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 40 40 + diff --git a/test/hwtests/irq_precedence/late_hdma_vs_tima_scx1_halt_2_cgb04c_out11C9.asm b/test/hwtests/irq_precedence/late_hdma_vs_tima_scx1_halt_2_cgb04c_out11C9.asm new file mode 100644 index 00000000..d9ea0725 --- /dev/null +++ b/test/hwtests/irq_precedence/late_hdma_vs_tima_scx1_halt_2_cgb04c_out11C9.asm @@ -0,0 +1,155 @@ +.size 8000 + +.text@50 + jp ltimaint + +.text@100 + jp lbegin + +.data@143 + c0 + +.text@150 +lbegin: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, fe + ldff(05), a + ldff(06), a + ld a, 04 + ldff(07), a + ld a, 04 + ldff(ff), a + xor a, a + ldff(0f), a + ei + +.text@1000 +ltimaint: + ldff a, (40) + and a, 80 + jpnz lprint_8000 + ld sp, cff2 + ld hl, 1234 + push hl + pop hl + +.text@113e + ld a, 91 + ldff(40), a + ld a, 01 + ldff(43), a + ld a, cf + ldff(51), a + ld a, f0 + ldff(52), a + xor a, a + ldff(53), a + ldff(54), a + +.text@11c0 + ld a, 80 + ldff(55), a + xor a, a + ldff(0f), a + ei + halt + +.text@7000 +lprint_8000: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, (8001) + ld b, a + swap a + and a, 0f + ld(9800), a + ld a, b + and a, 0f + ld(9801), a + ld a, (8000) + ld b, a + swap a + and a, 0f + ld(9802), a + ld a, b + and a, 0f + ld(9803), a + ld bc, 7a00 + ld hl, 8000 + ld d, 00 +lprint_copytiles: + ld a, (bc) + inc bc + ld(hl++), a + dec d + jrnz lprint_copytiles + ld a, c0 + ldff(47), a + ld a, 80 + ldff(68), a + ld a, ff + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + xor a, a + ldff(69), a + ldff(69), a + xor a, a + ldff(42), a + ldff(43), a + ld a, 91 + ldff(40), a +lprint_limbo: + jr lprint_limbo + +.text@7400 +lwaitly_b: + ld c, 44 +lwaitly_b_loop: + ldff a, (c) + cmp a, b + jrnz lwaitly_b_loop + ret + +.data@7a00 + 00 00 7f 7f 41 41 41 41 + 41 41 41 41 41 41 7f 7f + 00 00 08 08 08 08 08 08 + 08 08 08 08 08 08 08 08 + 00 00 7f 7f 01 01 01 01 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 01 01 01 01 + 3f 3f 01 01 01 01 7f 7f + 00 00 41 41 41 41 41 41 + 7f 7f 01 01 01 01 01 01 + 00 00 7f 7f 40 40 40 40 + 7e 7e 01 01 01 01 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 41 41 41 41 7f 7f + 00 00 7f 7f 01 01 02 02 + 04 04 08 08 10 10 10 10 + 00 00 3e 3e 41 41 41 41 + 3e 3e 41 41 41 41 3e 3e + 00 00 7f 7f 41 41 41 41 + 7f 7f 01 01 01 01 7f 7f + 00 00 08 08 22 22 41 41 + 7f 7f 41 41 41 41 41 41 + 00 00 7e 7e 41 41 41 41 + 7e 7e 41 41 41 41 7e 7e + 00 00 3e 3e 41 41 40 40 + 40 40 40 40 41 41 3e 3e + 00 00 7e 7e 41 41 41 41 + 41 41 41 41 41 41 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 40 40 + diff --git a/test/hwtests/irq_precedence/late_hdma_vs_tima_scx2_1_cgb04c_out1234.asm b/test/hwtests/irq_precedence/late_hdma_vs_tima_scx2_1_cgb04c_out1234.asm new file mode 100644 index 00000000..e520c6c0 --- /dev/null +++ b/test/hwtests/irq_precedence/late_hdma_vs_tima_scx2_1_cgb04c_out1234.asm @@ -0,0 +1,153 @@ +.size 8000 + +.text@50 + jp ltimaint + +.text@100 + jp lbegin + +.data@143 + c0 + +.text@150 +lbegin: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, fe + ldff(05), a + ldff(06), a + ld a, 04 + ldff(07), a + ldff(ff), a + xor a, a + ldff(0f), a + ei + +.text@1000 +ltimaint: + ldff a, (40) + and a, 80 + jpnz lprint_8000 + ld sp, cff2 + ld hl, 1234 + push hl + pop hl + +.text@113b + ld a, 91 + ldff(40), a + ld a, 02 + ldff(43), a + ld a, cf + ldff(51), a + ld a, f0 + ldff(52), a + xor a, a + ldff(53), a + ldff(54), a + +.text@11c0 + ld a, 80 + ldff(55), a + xor a, a + ldff(0f), a + ei + +.text@7000 +lprint_8000: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, (8001) + ld b, a + swap a + and a, 0f + ld(9800), a + ld a, b + and a, 0f + ld(9801), a + ld a, (8000) + ld b, a + swap a + and a, 0f + ld(9802), a + ld a, b + and a, 0f + ld(9803), a + ld bc, 7a00 + ld hl, 8000 + ld d, 00 +lprint_copytiles: + ld a, (bc) + inc bc + ld(hl++), a + dec d + jrnz lprint_copytiles + ld a, c0 + ldff(47), a + ld a, 80 + ldff(68), a + ld a, ff + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + xor a, a + ldff(69), a + ldff(69), a + xor a, a + ldff(42), a + ldff(43), a + ld a, 91 + ldff(40), a +lprint_limbo: + jr lprint_limbo + +.text@7400 +lwaitly_b: + ld c, 44 +lwaitly_b_loop: + ldff a, (c) + cmp a, b + jrnz lwaitly_b_loop + ret + +.data@7a00 + 00 00 7f 7f 41 41 41 41 + 41 41 41 41 41 41 7f 7f + 00 00 08 08 08 08 08 08 + 08 08 08 08 08 08 08 08 + 00 00 7f 7f 01 01 01 01 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 01 01 01 01 + 3f 3f 01 01 01 01 7f 7f + 00 00 41 41 41 41 41 41 + 7f 7f 01 01 01 01 01 01 + 00 00 7f 7f 40 40 40 40 + 7e 7e 01 01 01 01 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 41 41 41 41 7f 7f + 00 00 7f 7f 01 01 02 02 + 04 04 08 08 10 10 10 10 + 00 00 3e 3e 41 41 41 41 + 3e 3e 41 41 41 41 3e 3e + 00 00 7f 7f 41 41 41 41 + 7f 7f 01 01 01 01 7f 7f + 00 00 08 08 22 22 41 41 + 7f 7f 41 41 41 41 41 41 + 00 00 7e 7e 41 41 41 41 + 7e 7e 41 41 41 41 7e 7e + 00 00 3e 3e 41 41 40 40 + 40 40 40 40 41 41 3e 3e + 00 00 7e 7e 41 41 41 41 + 41 41 41 41 41 41 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 40 40 + diff --git a/test/hwtests/irq_precedence/late_hdma_vs_tima_scx2_2_cgb04c_out11E9.asm b/test/hwtests/irq_precedence/late_hdma_vs_tima_scx2_2_cgb04c_out11E9.asm new file mode 100644 index 00000000..f42c7d98 --- /dev/null +++ b/test/hwtests/irq_precedence/late_hdma_vs_tima_scx2_2_cgb04c_out11E9.asm @@ -0,0 +1,153 @@ +.size 8000 + +.text@50 + jp ltimaint + +.text@100 + jp lbegin + +.data@143 + c0 + +.text@150 +lbegin: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, fe + ldff(05), a + ldff(06), a + ld a, 04 + ldff(07), a + ldff(ff), a + xor a, a + ldff(0f), a + ei + +.text@1000 +ltimaint: + ldff a, (40) + and a, 80 + jpnz lprint_8000 + ld sp, cff2 + ld hl, 1234 + push hl + pop hl + +.text@113c + ld a, 91 + ldff(40), a + ld a, 02 + ldff(43), a + ld a, cf + ldff(51), a + ld a, f0 + ldff(52), a + xor a, a + ldff(53), a + ldff(54), a + +.text@11c0 + ld a, 80 + ldff(55), a + xor a, a + ldff(0f), a + ei + +.text@7000 +lprint_8000: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, (8001) + ld b, a + swap a + and a, 0f + ld(9800), a + ld a, b + and a, 0f + ld(9801), a + ld a, (8000) + ld b, a + swap a + and a, 0f + ld(9802), a + ld a, b + and a, 0f + ld(9803), a + ld bc, 7a00 + ld hl, 8000 + ld d, 00 +lprint_copytiles: + ld a, (bc) + inc bc + ld(hl++), a + dec d + jrnz lprint_copytiles + ld a, c0 + ldff(47), a + ld a, 80 + ldff(68), a + ld a, ff + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + xor a, a + ldff(69), a + ldff(69), a + xor a, a + ldff(42), a + ldff(43), a + ld a, 91 + ldff(40), a +lprint_limbo: + jr lprint_limbo + +.text@7400 +lwaitly_b: + ld c, 44 +lwaitly_b_loop: + ldff a, (c) + cmp a, b + jrnz lwaitly_b_loop + ret + +.data@7a00 + 00 00 7f 7f 41 41 41 41 + 41 41 41 41 41 41 7f 7f + 00 00 08 08 08 08 08 08 + 08 08 08 08 08 08 08 08 + 00 00 7f 7f 01 01 01 01 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 01 01 01 01 + 3f 3f 01 01 01 01 7f 7f + 00 00 41 41 41 41 41 41 + 7f 7f 01 01 01 01 01 01 + 00 00 7f 7f 40 40 40 40 + 7e 7e 01 01 01 01 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 41 41 41 41 7f 7f + 00 00 7f 7f 01 01 02 02 + 04 04 08 08 10 10 10 10 + 00 00 3e 3e 41 41 41 41 + 3e 3e 41 41 41 41 3e 3e + 00 00 7f 7f 41 41 41 41 + 7f 7f 01 01 01 01 7f 7f + 00 00 08 08 22 22 41 41 + 7f 7f 41 41 41 41 41 41 + 00 00 7e 7e 41 41 41 41 + 7e 7e 41 41 41 41 7e 7e + 00 00 3e 3e 41 41 40 40 + 40 40 40 40 41 41 3e 3e + 00 00 7e 7e 41 41 41 41 + 41 41 41 41 41 41 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 40 40 + diff --git a/test/hwtests/irq_precedence/late_hdma_vs_tima_scx2_halt_1_cgb04c_out1234.asm b/test/hwtests/irq_precedence/late_hdma_vs_tima_scx2_halt_1_cgb04c_out1234.asm new file mode 100644 index 00000000..9ee10bab --- /dev/null +++ b/test/hwtests/irq_precedence/late_hdma_vs_tima_scx2_halt_1_cgb04c_out1234.asm @@ -0,0 +1,155 @@ +.size 8000 + +.text@50 + jp ltimaint + +.text@100 + jp lbegin + +.data@143 + c0 + +.text@150 +lbegin: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, fe + ldff(05), a + ldff(06), a + ld a, 04 + ldff(07), a + ld a, 04 + ldff(ff), a + xor a, a + ldff(0f), a + ei + +.text@1000 +ltimaint: + ldff a, (40) + and a, 80 + jpnz lprint_8000 + ld sp, cff2 + ld hl, 1234 + push hl + pop hl + +.text@113c + ld a, 91 + ldff(40), a + ld a, 02 + ldff(43), a + ld a, cf + ldff(51), a + ld a, f0 + ldff(52), a + xor a, a + ldff(53), a + ldff(54), a + +.text@11c0 + ld a, 80 + ldff(55), a + xor a, a + ldff(0f), a + ei + halt + +.text@7000 +lprint_8000: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, (8001) + ld b, a + swap a + and a, 0f + ld(9800), a + ld a, b + and a, 0f + ld(9801), a + ld a, (8000) + ld b, a + swap a + and a, 0f + ld(9802), a + ld a, b + and a, 0f + ld(9803), a + ld bc, 7a00 + ld hl, 8000 + ld d, 00 +lprint_copytiles: + ld a, (bc) + inc bc + ld(hl++), a + dec d + jrnz lprint_copytiles + ld a, c0 + ldff(47), a + ld a, 80 + ldff(68), a + ld a, ff + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + xor a, a + ldff(69), a + ldff(69), a + xor a, a + ldff(42), a + ldff(43), a + ld a, 91 + ldff(40), a +lprint_limbo: + jr lprint_limbo + +.text@7400 +lwaitly_b: + ld c, 44 +lwaitly_b_loop: + ldff a, (c) + cmp a, b + jrnz lwaitly_b_loop + ret + +.data@7a00 + 00 00 7f 7f 41 41 41 41 + 41 41 41 41 41 41 7f 7f + 00 00 08 08 08 08 08 08 + 08 08 08 08 08 08 08 08 + 00 00 7f 7f 01 01 01 01 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 01 01 01 01 + 3f 3f 01 01 01 01 7f 7f + 00 00 41 41 41 41 41 41 + 7f 7f 01 01 01 01 01 01 + 00 00 7f 7f 40 40 40 40 + 7e 7e 01 01 01 01 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 41 41 41 41 7f 7f + 00 00 7f 7f 01 01 02 02 + 04 04 08 08 10 10 10 10 + 00 00 3e 3e 41 41 41 41 + 3e 3e 41 41 41 41 3e 3e + 00 00 7f 7f 41 41 41 41 + 7f 7f 01 01 01 01 7f 7f + 00 00 08 08 22 22 41 41 + 7f 7f 41 41 41 41 41 41 + 00 00 7e 7e 41 41 41 41 + 7e 7e 41 41 41 41 7e 7e + 00 00 3e 3e 41 41 40 40 + 40 40 40 40 41 41 3e 3e + 00 00 7e 7e 41 41 41 41 + 41 41 41 41 41 41 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 40 40 + diff --git a/test/hwtests/irq_precedence/late_hdma_vs_tima_scx2_halt_2_cgb04c_out11C9.asm b/test/hwtests/irq_precedence/late_hdma_vs_tima_scx2_halt_2_cgb04c_out11C9.asm new file mode 100644 index 00000000..ac499c12 --- /dev/null +++ b/test/hwtests/irq_precedence/late_hdma_vs_tima_scx2_halt_2_cgb04c_out11C9.asm @@ -0,0 +1,155 @@ +.size 8000 + +.text@50 + jp ltimaint + +.text@100 + jp lbegin + +.data@143 + c0 + +.text@150 +lbegin: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, fe + ldff(05), a + ldff(06), a + ld a, 04 + ldff(07), a + ld a, 04 + ldff(ff), a + xor a, a + ldff(0f), a + ei + +.text@1000 +ltimaint: + ldff a, (40) + and a, 80 + jpnz lprint_8000 + ld sp, cff2 + ld hl, 1234 + push hl + pop hl + +.text@113d + ld a, 91 + ldff(40), a + ld a, 02 + ldff(43), a + ld a, cf + ldff(51), a + ld a, f0 + ldff(52), a + xor a, a + ldff(53), a + ldff(54), a + +.text@11c0 + ld a, 80 + ldff(55), a + xor a, a + ldff(0f), a + ei + halt + +.text@7000 +lprint_8000: + ld b, 91 + call lwaitly_b + xor a, a + ldff(40), a + ld a, (8001) + ld b, a + swap a + and a, 0f + ld(9800), a + ld a, b + and a, 0f + ld(9801), a + ld a, (8000) + ld b, a + swap a + and a, 0f + ld(9802), a + ld a, b + and a, 0f + ld(9803), a + ld bc, 7a00 + ld hl, 8000 + ld d, 00 +lprint_copytiles: + ld a, (bc) + inc bc + ld(hl++), a + dec d + jrnz lprint_copytiles + ld a, c0 + ldff(47), a + ld a, 80 + ldff(68), a + ld a, ff + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + ldff(69), a + xor a, a + ldff(69), a + ldff(69), a + xor a, a + ldff(42), a + ldff(43), a + ld a, 91 + ldff(40), a +lprint_limbo: + jr lprint_limbo + +.text@7400 +lwaitly_b: + ld c, 44 +lwaitly_b_loop: + ldff a, (c) + cmp a, b + jrnz lwaitly_b_loop + ret + +.data@7a00 + 00 00 7f 7f 41 41 41 41 + 41 41 41 41 41 41 7f 7f + 00 00 08 08 08 08 08 08 + 08 08 08 08 08 08 08 08 + 00 00 7f 7f 01 01 01 01 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 01 01 01 01 + 3f 3f 01 01 01 01 7f 7f + 00 00 41 41 41 41 41 41 + 7f 7f 01 01 01 01 01 01 + 00 00 7f 7f 40 40 40 40 + 7e 7e 01 01 01 01 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 41 41 41 41 7f 7f + 00 00 7f 7f 01 01 02 02 + 04 04 08 08 10 10 10 10 + 00 00 3e 3e 41 41 41 41 + 3e 3e 41 41 41 41 3e 3e + 00 00 7f 7f 41 41 41 41 + 7f 7f 01 01 01 01 7f 7f + 00 00 08 08 22 22 41 41 + 7f 7f 41 41 41 41 41 41 + 00 00 7e 7e 41 41 41 41 + 7e 7e 41 41 41 41 7e 7e + 00 00 3e 3e 41 41 40 40 + 40 40 40 40 41 41 3e 3e + 00 00 7e 7e 41 41 41 41 + 41 41 41 41 41 41 7e 7e + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 7f 7f + 00 00 7f 7f 40 40 40 40 + 7f 7f 40 40 40 40 40 40 +