mirror of
https://github.com/pevans/erc-c.git
synced 2025-01-30 12:38:25 +00:00
Remove unnecessary functions and tests
This commit is contained in:
parent
bf529d6c9b
commit
6670df930b
48
src/apple2.c
48
src/apple2.c
@ -260,20 +260,6 @@ apple2_reset(apple2 *mach)
|
||||
apple2_set_memory_mode(mach, MEMORY_DEFAULT);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function will clear the 8th bit, which is the "strobe" bit, from
|
||||
* the position in memory where the value of the last key that was
|
||||
* pressed is held.
|
||||
*/
|
||||
void
|
||||
apple2_clear_strobe(apple2 *mach)
|
||||
{
|
||||
vm_8bit ch;
|
||||
|
||||
ch = vm_segment_get(mach->main, LAST_KEY);
|
||||
vm_segment_set(mach->main, LAST_KEY, ch & 0x7F);
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the memory reserved for an apple2 struct.
|
||||
*/
|
||||
@ -318,40 +304,6 @@ apple2_free(apple2 *mach)
|
||||
free(mach);
|
||||
}
|
||||
|
||||
/*
|
||||
* Emulate the notion of a pressed key in the apple2 with a given
|
||||
* character.
|
||||
*/
|
||||
void
|
||||
apple2_press_key(apple2 *mach, vm_8bit ch)
|
||||
{
|
||||
// The apple2 can only handle ASCII values of 0 through 127.
|
||||
// However, the eigth bit is called the "strobe" bit, and is treated
|
||||
// specially. In particular, the strobe bit is 1 if a key was
|
||||
// pressed down, and remains 1 until you reset it by reading from
|
||||
// the clear-strobe location.
|
||||
ch = ch | 0x80;
|
||||
|
||||
// This is the location in memory where a program will expect to
|
||||
// find the value of the last key that was pressed.
|
||||
vm_segment_set(mach->main, LAST_KEY, ch);
|
||||
|
||||
// This area is a combination of flags; the eighth bit here is the
|
||||
// "any-key-down" flag, which is a bit of a mouthful. It's 1 if a
|
||||
// key is pressed, and 0 if not. The effect of reading this bit will
|
||||
// also _clear_ the strobe bit in the $C000 address (above).
|
||||
vm_segment_set(mach->main, ANY_KEY_DOWN, 0x80);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function will clear the value of the any-key-down switch/flag.
|
||||
*/
|
||||
void
|
||||
apple2_release_key(apple2 *mach)
|
||||
{
|
||||
vm_segment_set(mach->main, ANY_KEY_DOWN, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* The run loop is the function that essentially waits for user input
|
||||
* and continues to present the apple2 abstraction for you to use. At
|
||||
|
@ -55,33 +55,6 @@ Test(apple2, boot)
|
||||
cr_assert_neq(apple2_boot(mach), OK);
|
||||
}
|
||||
|
||||
Test(apple2, press_key)
|
||||
{
|
||||
apple2_press_key(mach, 123);
|
||||
cr_assert_eq(vm_segment_get(mach->main, 0xC000), 123 | 0x80);
|
||||
cr_assert_eq(vm_segment_get(mach->main, 0xC010), 0x80);
|
||||
}
|
||||
|
||||
Test(apple2, clear_strobe)
|
||||
{
|
||||
apple2_press_key(mach, 123);
|
||||
cr_assert_eq(vm_segment_get(mach->main, 0xC000), 123 | 0x80);
|
||||
apple2_clear_strobe(mach);
|
||||
cr_assert_eq(vm_segment_get(mach->main, 0xC000), 123);
|
||||
}
|
||||
|
||||
/*
|
||||
* This also tests the press_key function (as does the clear_strobe
|
||||
* test, in its own way).
|
||||
*/
|
||||
Test(apple2, release_key)
|
||||
{
|
||||
apple2_press_key(mach, 123);
|
||||
cr_assert_eq(vm_segment_get(mach->main, 0xC010), 0x80);
|
||||
apple2_release_key(mach);
|
||||
cr_assert_eq(vm_segment_get(mach->main, 0xC010), 0);
|
||||
}
|
||||
|
||||
Test(apple2, set_color)
|
||||
{
|
||||
apple2_set_color(mach, COLOR_AMBER);
|
||||
|
Loading…
x
Reference in New Issue
Block a user