read_rand() is really just floating_bus() return

This commit is contained in:
Aaron Culliney 2015-01-10 19:29:09 -08:00
parent 1ba28db8d7
commit dcafae8390
5 changed files with 7 additions and 30 deletions

View File

@ -274,14 +274,6 @@ void c_initialize_tables() {
/* RDVBLBAR switch */ /* RDVBLBAR switch */
cpu65_vmem_r[0xC019] = iie_check_vbl; cpu65_vmem_r[0xC019] = iie_check_vbl;
/* random number generator */
for (i = 0xC020; i < 0xC030; i++)
{
cpu65_vmem_r[i] =
cpu65_vmem_w[i] =
read_rand;
}
/* TEXT switch */ /* TEXT switch */
cpu65_vmem_r[0xC050] = cpu65_vmem_r[0xC050] =
cpu65_vmem_w[0xC050] = cpu65_vmem_w[0xC050] =

View File

@ -103,7 +103,6 @@ void c_set_primary_char();
void c_set_altchar(); void c_set_altchar();
void c_initialize_font(); void c_initialize_font();
void c_initialize_vm(); void c_initialize_vm();
uint8_t c_read_rand(uint16_t ea);
void reinitialize(); void reinitialize();
/* vm hooks */ /* vm hooks */

View File

@ -337,6 +337,8 @@ TEST test_cputrace_hello_nib() {
PASS(); PASS();
} }
#define EXPECTED_CPUTRACE_HELLO_PO_FILE_SIZE EXPECTED_CPUTRACE_HELLO_FILE_SIZE
#define EXPECTED_CPUTRACE_HELLO_PO_SHA EXPECTED_CPUTRACE_HELLO_SHA
TEST test_cputrace_hello_po() { TEST test_cputrace_hello_po() {
test_setup_boot_disk(BLANK_PO, 0); test_setup_boot_disk(BLANK_PO, 0);
@ -365,18 +367,18 @@ TEST test_cputrace_hello_po() {
FILE *fp = fopen(output, "r"); FILE *fp = fopen(output, "r");
fseek(fp, 0, SEEK_END); fseek(fp, 0, SEEK_END);
long expectedSize = ftell(fp); long expectedSize = ftell(fp);
ASSERT(expectedSize == EXPECTED_CPUTRACE_HELLO_FILE_SIZE); ASSERT(expectedSize == EXPECTED_CPUTRACE_HELLO_PO_FILE_SIZE);
fseek(fp, 0, SEEK_SET); fseek(fp, 0, SEEK_SET);
unsigned char *buf = malloc(EXPECTED_CPUTRACE_HELLO_FILE_SIZE); unsigned char *buf = malloc(EXPECTED_CPUTRACE_HELLO_PO_FILE_SIZE);
if (fread(buf, 1, EXPECTED_CPUTRACE_HELLO_FILE_SIZE, fp) != EXPECTED_CPUTRACE_HELLO_FILE_SIZE) { if (fread(buf, 1, EXPECTED_CPUTRACE_HELLO_PO_FILE_SIZE, fp) != EXPECTED_CPUTRACE_HELLO_PO_FILE_SIZE) {
ASSERT(false); ASSERT(false);
} }
fclose(fp); fp = NULL; fclose(fp); fp = NULL;
SHA1(buf, EXPECTED_CPUTRACE_HELLO_FILE_SIZE, md); SHA1(buf, EXPECTED_CPUTRACE_HELLO_PO_FILE_SIZE, md);
FREE(buf); FREE(buf);
sha1_to_str(md, mdstr0); sha1_to_str(md, mdstr0);
ASSERT(strcmp(mdstr0, EXPECTED_CPUTRACE_HELLO_SHA) == 0); ASSERT(strcmp(mdstr0, EXPECTED_CPUTRACE_HELLO_PO_SHA) == 0);
} while(0); } while(0);
unlink(output); unlink(output);
@ -1050,9 +1052,6 @@ void test_disk(int argc, char **argv) {
test_argc = argc; test_argc = argc;
test_argv = argv; test_argv = argv;
c_read_rand(0x0);
srandom(0); // force a known sequence
pthread_mutex_lock(&interface_mutex); pthread_mutex_lock(&interface_mutex);
test_common_init(/*cputhread*/true); test_common_init(/*cputhread*/true);

View File

@ -3471,9 +3471,6 @@ void test_vm(int argc, char **argv) {
test_argc = argc; test_argc = argc;
test_argv = argv; test_argv = argv;
c_read_rand(0x0);
srandom(0); // force a known sequence
pthread_mutex_lock(&interface_mutex); pthread_mutex_lock(&interface_mutex);
test_common_init(/*cputhread*/true); test_common_init(/*cputhread*/true);

View File

@ -149,16 +149,6 @@ GLUE_C_READ(read_keyboard_strobe)
return apple_ii_64k[0][0xC000]; return apple_ii_64k[0][0xC000];
} }
GLUE_C_READ(read_rand)
{
static time_t seed=0;
if (!seed) {
seed = time(NULL);
srandom(seed);
}
return (random() & 0xFF);
}
GLUE_C_READ(speaker_toggle) GLUE_C_READ(speaker_toggle)
{ {
#ifdef AUDIO_ENABLED #ifdef AUDIO_ENABLED