mirror of
https://github.com/pevans/erc-c.git
synced 2024-12-21 08:30:55 +00:00
Add struct, initial create function for apple2
This commit is contained in:
parent
89ddd20658
commit
0e02fb8a1a
15
include/apple2.h
Normal file
15
include/apple2.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef _APPLE2_H_
|
||||
#define _APPLE2_H_
|
||||
|
||||
#include "mos6502.h"
|
||||
|
||||
typedef struct {
|
||||
/*
|
||||
* The apple 2 hardware used an MOS-6502 processor.
|
||||
*/
|
||||
mos6502 *cpu;
|
||||
} apple2;
|
||||
|
||||
extern apple2 *apple2_create();
|
||||
|
||||
#endif
|
@ -1,4 +1,5 @@
|
||||
set(emp_sources
|
||||
apple2.c
|
||||
log.c
|
||||
mos6502.c
|
||||
mos6502.addr.c
|
||||
|
20
src/apple2.c
Normal file
20
src/apple2.c
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* apple2.c
|
||||
*/
|
||||
|
||||
#include "apple2.h"
|
||||
|
||||
apple2 *
|
||||
apple2_create()
|
||||
{
|
||||
apple2 *mach;
|
||||
|
||||
mach = malloc(sizeof(apple2));
|
||||
if (mach == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mach->cpu = mos6502_create();
|
||||
|
||||
return mach;
|
||||
}
|
12
tests/apple2.c
Normal file
12
tests/apple2.c
Normal file
@ -0,0 +1,12 @@
|
||||
#include <criterion/criterion.h>
|
||||
|
||||
#include "apple2.h"
|
||||
|
||||
Test(apple2, create)
|
||||
{
|
||||
apple2 *mach;
|
||||
|
||||
mach = apple2_create();
|
||||
cr_assert_neq(mach, NULL);
|
||||
cr_assert_neq(mach->cpu, NULL);
|
||||
}
|
Loading…
Reference in New Issue
Block a user