mirror of
https://github.com/nobuh/napple1.git
synced 2025-08-09 14:25:14 +00:00
Added 'K' feature: press 'Shift-K' to 'type' file KBD.TXT
This commit is contained in:
1
KBD.TXT
Normal file
1
KBD.TXT
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Change content of the "kbd.txt" file to change auto-keyboard input.
|
13
README
13
README
@@ -1,3 +1,16 @@
|
|||||||
|
# Fork of napple1
|
||||||
|
|
||||||
|
This forks enables to emulate keyboard entry on the apple1
|
||||||
|
|
||||||
|
This kludge is done by creating a "KBD.TXT" file. When pressing "shift-K",
|
||||||
|
the keyboard I/O will be replaced by the content of this file.
|
||||||
|
|
||||||
|
This have been done to be able to load basic programs and use the 'dump"
|
||||||
|
features to transfer them to binary files.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
napple1 is an Apple 1 emulator using ncurses, ported from the SDL version
|
napple1 is an Apple 1 emulator using ncurses, ported from the SDL version
|
||||||
Pom1 emulafor. If you have some questions, please report it as an issue.
|
Pom1 emulafor. If you have some questions, please report it as an issue.
|
||||||
|
|
||||||
|
@@ -25,6 +25,10 @@
|
|||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
FILE *kbd_txt;
|
||||||
|
|
||||||
int handleInput(void)
|
int handleInput(void)
|
||||||
{
|
{
|
||||||
char tmp;
|
char tmp;
|
||||||
@@ -32,6 +36,12 @@ int handleInput(void)
|
|||||||
tmp = '\0';
|
tmp = '\0';
|
||||||
while ( (tmp = getch_screen()) == '\0' )
|
while ( (tmp = getch_screen()) == '\0' )
|
||||||
;
|
;
|
||||||
|
if (tmp=='K')
|
||||||
|
{
|
||||||
|
/* We open the "KBD.TXT" file if it exists */
|
||||||
|
kbd_txt = fopen("KBD.TXT", "r");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
if (tmp == 'B') {
|
if (tmp == 'B') {
|
||||||
loadBasic();
|
loadBasic();
|
||||||
resetPia6820();
|
resetPia6820();
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
# napple1 makefile
|
# napple1 makefile
|
||||||
# Nobu Hatano <nobuhatano@gmail.com>
|
# Nobu Hatano <nobuhatano@gmail.com>
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -Wall -ansi
|
CFLAGS = -Wall
|
||||||
|
# CFLAGS = -Wall -ansi
|
||||||
THREAD = -lpthread
|
THREAD = -lpthread
|
||||||
|
|
||||||
# Support Linux and Cygwin
|
# Support Linux and Cygwin
|
||||||
|
25
src/memory.c
25
src/memory.c
@@ -162,7 +162,30 @@ unsigned char memRead(unsigned short address)
|
|||||||
if (address == 0xD012)
|
if (address == 0xD012)
|
||||||
return readDsp();
|
return readDsp();
|
||||||
if (address == 0xD011)
|
if (address == 0xD011)
|
||||||
return readKbdCr();
|
{
|
||||||
|
unsigned char v = readKbdCr();
|
||||||
|
extern FILE *kbd_txt;
|
||||||
|
if (!(v & 0x80) && kbd_txt)
|
||||||
|
{
|
||||||
|
// Read on char from file
|
||||||
|
int c = fgetc(kbd_txt);
|
||||||
|
if (c!=EOF)
|
||||||
|
{
|
||||||
|
if (c=='\n')
|
||||||
|
c = 0x0d;
|
||||||
|
if (v>='a' && v<='z')
|
||||||
|
c = c - 'a' + 'A';
|
||||||
|
writeKbd((unsigned char)(c + 0x80));
|
||||||
|
writeKbdCr(0xA7);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fclose(kbd_txt);
|
||||||
|
kbd_txt = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
}
|
||||||
if (address == 0xD010)
|
if (address == 0xD010)
|
||||||
return readKbd();
|
return readKbd();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user