mirror of
https://github.com/rzzzwilson/pymlac.git
synced 2025-06-10 09:32:41 +00:00
Reverted to better old copy
This commit is contained in:
41
vimlac/kb.c
Executable file
41
vimlac/kb.c
Executable file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Implementation for the vimlac KB device (keyboard).
|
||||
*/
|
||||
|
||||
#include "vimlac.h"
|
||||
#include "kb.h"
|
||||
|
||||
|
||||
/*****
|
||||
* constants for the KB device
|
||||
******/
|
||||
|
||||
|
||||
/*****
|
||||
* State variables for the PTR device
|
||||
******/
|
||||
|
||||
static bool flag; /* true if char ready to read */
|
||||
|
||||
|
||||
void
|
||||
kb_clear_flag(void)
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
|
||||
|
||||
BYTE
|
||||
kb_get_char(void)
|
||||
{
|
||||
return ' ';
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
kb_ready(void)
|
||||
{
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
12
vimlac/kb.h
Executable file
12
vimlac/kb.h
Executable file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Interface for the vimlac KB device (keyboard).
|
||||
*/
|
||||
|
||||
#ifndef KB_H
|
||||
#define KB_H
|
||||
|
||||
void kb_clear_flag(void);
|
||||
BYTE kb_get_char(void);
|
||||
bool kb_ready(void);
|
||||
|
||||
#endif
|
||||
76
vimlac/vimlac.c
Executable file
76
vimlac/vimlac.c
Executable file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Miscellaneous routines for the vimlac machine.
|
||||
*/
|
||||
|
||||
#include "vimlac.h"
|
||||
#include "memory.h"
|
||||
#include "ptr.h"
|
||||
#include "cpu.h"
|
||||
|
||||
|
||||
void
|
||||
error(char *msg, ...)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
WORD PtrROMImage[] = {0060077, /* start lac base ;40 get load address */
|
||||
0020010, /* dac 10 ;41 put into auto-inc reg */
|
||||
0104100, /* lwc 0100 ;42 -0100 into AC */
|
||||
0020020, /* dac 20 ;43 put into memory */
|
||||
0001061, /* hon ;44 start PTR */
|
||||
0100011, /* wait cal ;45 clear AC+LINK */
|
||||
0002400, /* hsf ;46 skip if PTR has data */
|
||||
0010046, /* jmp .-1 ;47 wait until is data */
|
||||
0001051, /* hrb ;50 read PTR -> AC */
|
||||
0074075, /* sam what ;51 skip if AC == 2 */
|
||||
0010045, /* jmp wait ;52 wait until PTR return 0 */
|
||||
0002400, /* loop hsf ;53 skip if PTR has data */
|
||||
0010053, /* jmp .-1 ;54 wait until is data */
|
||||
0001051, /* hrb ;55 read PTR -> AC */
|
||||
0003003, /* ral 3 ;56 move byte into high AC */
|
||||
0003003, /* ral 3 ;57 */
|
||||
0003002, /* ral 2 ;60 */
|
||||
0102400, /* hsn ;61 wait until PTR moves */
|
||||
0010061, /* jmp .-1 ;62 */
|
||||
0002400, /* hsf ;63 skip if PTR has data */
|
||||
0010063, /* jmp .-1 ;64 wait until is data */
|
||||
0001051, /* hrb ;65 read PTR -> AC */
|
||||
0120010, /* dac *10 ;66 store word, inc pointer */
|
||||
0102400, /* hsn ;67 wait until PTR moves */
|
||||
0010067, /* jmp .-1 ;70 */
|
||||
0100011, /* cal ;71 clear AC & LINK */
|
||||
0030020, /* isz 20 ;72 inc mem and skip zero */
|
||||
0010053, /* jmp loop ;73 if not finished, jump */
|
||||
0110076, /* jmp *go ;74 execute loader */
|
||||
0000002, /* what data 2 ;75 */
|
||||
0003700, /* go word 03700H;76 */
|
||||
0003677 /* base word 03677H;77 */};
|
||||
|
||||
void
|
||||
run(WORD pc)
|
||||
{
|
||||
cpu_set_PC(pc);
|
||||
cpu_start();
|
||||
while (true)
|
||||
{
|
||||
int cycles = cpu_execute_one();
|
||||
if (cycles < 1)
|
||||
break;
|
||||
ptr_tick(cycles);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
mem_clear();
|
||||
mem_set_rom(PtrROMImage);
|
||||
ptr_mount("test_add.ptp");
|
||||
run(040);
|
||||
run(0100);
|
||||
mem_save_core("vimlac.core");
|
||||
}
|
||||
|
||||
|
||||
28
vimlac/vimlac.h
Executable file
28
vimlac/vimlac.h
Executable file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Interface for the vimlac emulator.
|
||||
*/
|
||||
|
||||
#ifndef VIMLAC_H
|
||||
#define VIMLAC_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
typedef unsigned int WORD;
|
||||
typedef unsigned char BYTE;
|
||||
|
||||
#define CPU_HERZ 1800000
|
||||
#define MEMMASK 0xffff
|
||||
#define HIGHBITMASK 0x8000
|
||||
#define WORD_MASK 0xffff
|
||||
#define OVERFLOWMASK 0x10000
|
||||
#define LOWBITMASK 0x1
|
||||
|
||||
|
||||
void error(char *msg, ...);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user