mirror of
https://github.com/nobuh/napple1.git
synced 2025-01-17 14:32:12 +00:00
Merge pull request #7 from fstark/master
Added support for AUTOTYPING.TXT with Shift-K
This commit is contained in:
commit
9aa66f65f4
4
AUTOTYPING.TXT
Normal file
4
AUTOTYPING.TXT
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
E000R
|
||||||
|
10 PRINT "HELLO, WORLD! ";
|
||||||
|
20 GOTO 10
|
||||||
|
RUN
|
3
README
3
README
@ -59,7 +59,7 @@ type E2B3R<enter>
|
|||||||
- Emulator commands
|
- Emulator commands
|
||||||
|
|
||||||
Command Key Description
|
Command Key Description
|
||||||
--------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
Basic load Shidt + B Load rom/basic.rom to ram
|
Basic load Shidt + B Load rom/basic.rom to ram
|
||||||
Dump core Shift + D Dump memory to core/_file name_
|
Dump core Shift + D Dump memory to core/_file name_
|
||||||
Load core Shift + L Load memory from core/_file name_
|
Load core Shift + L Load memory from core/_file name_
|
||||||
@ -67,6 +67,7 @@ Reset Shift + R Reset the emulator
|
|||||||
Hard reset Shidt + H Reset & Clear memory
|
Hard reset Shidt + H Reset & Clear memory
|
||||||
Quit Shidt + Q Quit the emulator
|
Quit Shidt + Q Quit the emulator
|
||||||
Mode Shift + M Mode change 8KB & 32KB ram mode
|
Mode Shift + M Mode change 8KB & 32KB ram mode
|
||||||
|
Shift + K Automatically type in AUTOTYPING.TXT file if present
|
||||||
|
|
||||||
- Load / Save programs
|
- Load / Save programs
|
||||||
|
|
||||||
|
@ -25,6 +25,43 @@
|
|||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
FILE *autotyping_file = NULL;
|
||||||
|
|
||||||
|
int startAutotyping(const char *filename)
|
||||||
|
{
|
||||||
|
if (autotyping_file)
|
||||||
|
stopAutotyping();
|
||||||
|
autotyping_file = fopen(filename, "r");
|
||||||
|
return !!autotyping_file;
|
||||||
|
}
|
||||||
|
|
||||||
|
int nextAutotyping(void)
|
||||||
|
{
|
||||||
|
if (!autotyping_file)
|
||||||
|
return -1;
|
||||||
|
int c = fgetc(autotyping_file);
|
||||||
|
if (c!=EOF) {
|
||||||
|
if (c=='\n')
|
||||||
|
c = 0x0d;
|
||||||
|
if (c>='a' && c<='z')
|
||||||
|
c = c - 'a' + 'A';
|
||||||
|
writeKbd((unsigned char)(c + 0x80));
|
||||||
|
writeKbdCr(0xA7);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
stopAutotyping();
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
void stopAutotyping(void)
|
||||||
|
{
|
||||||
|
if (autotyping_file)
|
||||||
|
fclose(autotyping_file);
|
||||||
|
autotyping_file = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int handleInput(void)
|
int handleInput(void)
|
||||||
{
|
{
|
||||||
char tmp;
|
char tmp;
|
||||||
@ -32,7 +69,11 @@ int handleInput(void)
|
|||||||
tmp = '\0';
|
tmp = '\0';
|
||||||
while ( (tmp = getch_screen()) == '\0' )
|
while ( (tmp = getch_screen()) == '\0' )
|
||||||
;
|
;
|
||||||
if (tmp == 'B') {
|
if (tmp=='K') {
|
||||||
|
if (startAutotyping("AUTOTYPING.TXT"))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else if (tmp == 'B') {
|
||||||
loadBasic();
|
loadBasic();
|
||||||
resetPia6820();
|
resetPia6820();
|
||||||
resetM6502();
|
resetM6502();
|
||||||
|
@ -20,3 +20,6 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
int handleInput(void);
|
int handleInput(void);
|
||||||
|
int startAutotyping(const char *filename);
|
||||||
|
int nextAutotyping(void);
|
||||||
|
void stopAutotyping(void);
|
||||||
|
@ -82,6 +82,7 @@
|
|||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "msgbuf.h"
|
#include "msgbuf.h"
|
||||||
|
#include "keyboard.h"
|
||||||
|
|
||||||
#define MEMMAX 0xFFFF
|
#define MEMMAX 0xFFFF
|
||||||
#define FNAME_LEN_MAX 1024
|
#define FNAME_LEN_MAX 1024
|
||||||
@ -161,8 +162,12 @@ unsigned char memRead(unsigned short address)
|
|||||||
return readDspCr();
|
return readDspCr();
|
||||||
if (address == 0xD012)
|
if (address == 0xD012)
|
||||||
return readDsp();
|
return readDsp();
|
||||||
if (address == 0xD011)
|
if (address == 0xD011) {
|
||||||
return readKbdCr();
|
unsigned char v = readKbdCr();
|
||||||
|
if (!(v & 0x80))
|
||||||
|
nextAutotyping();
|
||||||
|
return v;
|
||||||
|
}
|
||||||
if (address == 0xD010)
|
if (address == 0xD010)
|
||||||
return readKbd();
|
return readKbd();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user