; Copyright (C) 2014-2022 Joonas Javanainen ; ; Permission is hereby granted, free of charge, to any person obtaining a copy ; of this software and associated documentation files (the "Software"), to deal ; in the Software without restriction, including without limitation the rights ; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the Software is ; furnished to do so, subject to the following conditions: ; ; The above copyright notice and this permission notice shall be included in ; all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ; SOFTWARE. ; PUSH rr is expected to have the following timing: ; M = 0: instruction decoding ; M = 1: internal delay ; M = 2: memory access for high byte ; M = 3: memory access for low byte ; Verified results: ; pass: DMG, MGB, SGB, SGB2, CGB, AGB, AGS ; fail: - .include "common.s" di ; set first $20 bytes of VRAM to $81, so we ; have a known value when reading results wait_vblank ld hl, VRAM ld bc, $20 ld a, $81 call memset run_hiram_test test_finish: setup_assertions assert_h $42 assert_l $24 assert_d $81 assert_e $24 quit_check_asserts hiram_test: ld sp, OAM+$10 ld d, $42 ld e, $24 start_oam_dma $80 ld a, 39 - dec a jr nz, - nops 2 ; OAM is accessible at M=2 push de nops 7 pop hl start_oam_dma $80 ld a, 39 - dec a jr nz, - nops 1 ; OAM is accessible at M=3 push de nops 7 pop de jp test_finish