test setting/checking DHIRES

This commit is contained in:
Aaron Culliney 2014-05-04 15:19:57 -07:00
parent f69279eb66
commit 48856786d1

View File

@ -287,6 +287,18 @@ TEST test_read_random() {
#define TYPE_HIRES_ON() \
test_type_input("POKE49239,0:REM C057 HIRES ON\r")
#define ASM_DHIRES_ON() \
test_type_input(" STA $C05E\r")
#define ASM_DHIRES_OFF() \
test_type_input(" STA $C05F\r")
#define ASM_CHECK_DHIRES() \
test_type_input( \
" LDA $C07F\r" \
" STA $1F43\r" \
)
#define ASM_IOUDIS_ON() \
test_type_input(" STA $C07E\r")
@ -2554,6 +2566,131 @@ TEST test_check_ioudis(bool flag_ioudis) {
PASS();
}
TEST test_dhires_on(bool flag_ioudis/* FIXME TODO : possibly testing a existing bug? should this other switch matter? */) {
BOOT_TO_DOS();
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] != TEST_FINISHED);
ASM_INIT();
if (flag_ioudis) {
ASSERT((softswitches & SS_IOUDIS));
} else {
ASM_IOUDIS_OFF();
}
ASM_DHIRES_OFF();
ASM_TRIGGER_WATCHPT();
ASM_DHIRES_ON();
ASM_TRIGGER_WATCHPT();
ASM_DONE();
ASM_GO();
c_debugger_go();
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] == TEST_FINISHED);
ASSERT(!(softswitches & SS_DHIRES));
uint32_t switch_save = softswitches;
int save_current_page = video__current_page;
apple_ii_64k[0][WATCHPOINT_ADDR] = 0x00;
c_debugger_go();
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] == TEST_FINISHED);
ASSERT((softswitches & SS_DHIRES));
switch_save = switch_save | SS_DHIRES;
ASSERT(video__current_page == save_current_page);
ASSERT((softswitches ^ switch_save) == 0);
PASS();
}
TEST test_dhires_off(bool flag_ioudis/* FIXME TODO : possibly testing a existing bug? should this other switch matter? */) {
BOOT_TO_DOS();
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] != TEST_FINISHED);
ASM_INIT();
if (flag_ioudis) {
ASSERT((softswitches & SS_IOUDIS));
} else {
ASM_IOUDIS_OFF();
}
ASM_DHIRES_ON();
ASM_TRIGGER_WATCHPT();
ASM_DHIRES_OFF();
ASM_TRIGGER_WATCHPT();
ASM_DONE();
ASM_GO();
c_debugger_go();
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] == TEST_FINISHED);
ASSERT((softswitches & SS_DHIRES));
uint32_t switch_save = softswitches;
uint8_t *save_base_d000_rd = base_d000_rd;
uint8_t *save_base_d000_wrt = base_d000_wrt;
uint8_t *save_base_e000_rd = base_e000_rd;
uint8_t *save_base_e000_wrt = base_e000_wrt;
int save_current_page = video__current_page;
apple_ii_64k[0][WATCHPOINT_ADDR] = 0x00;
c_debugger_go();
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] == TEST_FINISHED);
ASSERT(!(softswitches & SS_DHIRES));
switch_save = switch_save & ~SS_DHIRES;
ASSERT(video__current_page == save_current_page);
ASSERT((softswitches ^ switch_save) == 0);
PASS();
}
TEST test_check_dhires(bool flag_dhires, bool flag_ioudis/* FIXME TODO : possibly testing a existing bug? should this other switch matter? */) {
BOOT_TO_DOS();
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] != TEST_FINISHED);
ASM_INIT();
if (flag_ioudis) {
ASSERT((softswitches & SS_IOUDIS));
} else {
ASM_IOUDIS_OFF();
}
if (flag_dhires) {
ASM_DHIRES_ON();
} else {
ASSERT(!(softswitches & SS_DHIRES));
}
ASM_CHECK_DHIRES();
ASM_TRIGGER_WATCHPT();
ASM_DONE();
ASM_GO();
apple_ii_64k[0][TESTOUT_ADDR] = 0x96;
c_debugger_go();
ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] == TEST_FINISHED);
if (flag_dhires) {
ASSERT(apple_ii_64k[0][TESTOUT_ADDR] == 0x80);
} else {
ASSERT(apple_ii_64k[0][TESTOUT_ADDR] == 0x00);
}
PASS();
}
// ----------------------------------------------------------------------------
// Test Suite
@ -2708,6 +2845,15 @@ GREATEST_SUITE(test_suite_vm) {
RUN_TESTp(test_check_ioudis, /*IOUDIS*/0);
RUN_TESTp(test_check_ioudis, /*IOUDIS*/1);
RUN_TESTp(test_dhires_on, /*IOUDIS*/0);
RUN_TESTp(test_dhires_on, /*IOUDIS*/1);
RUN_TESTp(test_dhires_off, /*IOUDIS*/0);
RUN_TESTp(test_dhires_off, /*IOUDIS*/1);
RUN_TESTp(test_check_dhires, /*DHIRES*/0, /*IOUDIS*/0);
RUN_TESTp(test_check_dhires, /*DHIRES*/0, /*IOUDIS*/1);
RUN_TESTp(test_check_dhires, /*DHIRES*/1, /*IOUDIS*/0);
RUN_TESTp(test_check_dhires, /*DHIRES*/1, /*IOUDIS*/1);
// ...
c_eject_6(0);
pthread_mutex_unlock(&interface_mutex);