mirror of
https://github.com/RyuKojiro/apple1.git
synced 2024-12-21 13:29:38 +00:00
Some very basic PIA functionality
git-svn-id: svn+ssh://svn.phoenixbox.net/svn/apple1/trunk@5 64f78de7-aa59-e511-a0e8-0002a5492df0
This commit is contained in:
parent
622d6aca9c
commit
19733ba72b
@ -9,6 +9,7 @@
|
||||
/* Begin PBXBuildFile section */
|
||||
E668389E1BA4F51E008F0F06 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = E668389D1BA4F51E008F0F06 /* main.c */; };
|
||||
E66839001BA4F75C008F0F06 /* liblibv6502.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E66838F61BA4F705008F0F06 /* liblibv6502.a */; };
|
||||
E66839061BA53A82008F0F06 /* pia.c in Sources */ = {isa = PBXBuildFile; fileRef = E66839041BA53A82008F0F06 /* pia.c */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@ -114,6 +115,8 @@
|
||||
E668389A1BA4F51E008F0F06 /* apple1 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = apple1; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E668389D1BA4F51E008F0F06 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
|
||||
E66838D31BA4F705008F0F06 /* v6502.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = v6502.xcodeproj; path = v6502/v6502.xcodeproj; sourceTree = SOURCE_ROOT; };
|
||||
E66839041BA53A82008F0F06 /* pia.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pia.c; sourceTree = "<group>"; };
|
||||
E66839051BA53A82008F0F06 /* pia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pia.h; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -149,6 +152,8 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E668389D1BA4F51E008F0F06 /* main.c */,
|
||||
E66839041BA53A82008F0F06 /* pia.c */,
|
||||
E66839051BA53A82008F0F06 /* pia.h */,
|
||||
);
|
||||
path = apple1;
|
||||
sourceTree = "<group>";
|
||||
@ -322,6 +327,7 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E66839061BA53A82008F0F06 /* pia.c in Sources */,
|
||||
E668389E1BA4F51E008F0F06 /* main.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
30
apple1/pia.c
Normal file
30
apple1/pia.c
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// pia.c
|
||||
// apple1
|
||||
//
|
||||
// Created by Daniel Loffgren on 9/12/15.
|
||||
// Copyright (c) 2015 Daniel Loffgren. All rights reserved.
|
||||
//
|
||||
|
||||
#include "pia.h"
|
||||
#include <stdio.h>
|
||||
#include <as6502/color.h>
|
||||
|
||||
#define FIXME_I_SHOULDNT_BE_NULL NULL
|
||||
|
||||
void videoWriteCharCallback(struct _v6502_memory *memory, uint16_t offset, uint8_t value, void *context) {
|
||||
fprintf(stdout, ANSI_COLOR_BRIGHT_GREEN "%c" ANSI_COLOR_RESET, value);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
void videoWriteNewlineCallback(struct _v6502_memory *memory, uint16_t offset, uint8_t value, void *context) {
|
||||
fprintf(stdout, ANSI_COLOR_BRIGHT_GREEN "\n" ANSI_COLOR_RESET);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
void pia_map(v6502_memory *mem) {
|
||||
v6502_map(mem, A1PIA_KEYBOARD_INPUT, 1, FIXME_I_SHOULDNT_BE_NULL, NULL, NULL);
|
||||
v6502_map(mem, A1PIA_KEYBOARD_CRLF_REG, 1, FIXME_I_SHOULDNT_BE_NULL, NULL, NULL);
|
||||
v6502_map(mem, A1PIA_VIDEO_OUTPUT, 1, FIXME_I_SHOULDNT_BE_NULL, videoWriteCharCallback, NULL);
|
||||
v6502_map(mem, A1PIA_VIDEO_CRLF_REG, 1, FIXME_I_SHOULDNT_BE_NULL, videoWriteNewlineCallback, NULL);
|
||||
}
|
22
apple1/pia.h
Normal file
22
apple1/pia.h
Normal file
@ -0,0 +1,22 @@
|
||||
//
|
||||
// pia.h
|
||||
// apple1
|
||||
//
|
||||
// Created by Daniel Loffgren on 9/12/15.
|
||||
// Copyright (c) 2015 Daniel Loffgren. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __apple1__pia__
|
||||
#define __apple1__pia__
|
||||
|
||||
#include <v6502/mem.h>
|
||||
|
||||
#define A1PIA_KEYBOARD_INPUT 0xD010
|
||||
#define A1PIA_KEYBOARD_CRLF_REG 0xD011
|
||||
#define A1PIA_VIDEO_OUTPUT 0xD012
|
||||
#define A1PIA_VIDEO_CRLF_REG 0xD013
|
||||
|
||||
// Assumes stdin/stdout
|
||||
void pia_map(v6502_memory *mem);
|
||||
|
||||
#endif /* defined(__apple1__pia__) */
|
Loading…
Reference in New Issue
Block a user