creating interface i/o functions

This commit is contained in:
Thiago Auler 2017-11-20 12:36:53 -02:00 committed by GitHub
parent 50a17cd13b
commit 1170f3eaae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,3 @@
#include <stdio.h>
#include "inc/types.h" #include "inc/types.h"
#include "inc/memory.h" #include "inc/memory.h"
#include "inc/opcodes.h" #include "inc/opcodes.h"
@ -9,6 +7,8 @@ oct opcode_in_table;
void init() void init()
{ {
io_init();
// pc is set using 0xFFFC // pc is set using 0xFFFC
pc = read_word(0xFFFC); pc = read_word(0xFFFC);
sp = 0xFF; sp = 0xFF;
@ -81,7 +81,7 @@ void execute()
case BMI: return bmi(); case BMI: return bmi();
case BNE: return bne(); case BNE: return bne();
case BPL: return bpl(); case BPL: return bpl();
case BRK: return bkk(); case BRK: return brk();
case BVC: return bvc(); case BVC: return bvc();
case BVS: return bvs(); case BVS: return bvs();
case CLC: return clc(); case CLC: return clc();
@ -139,25 +139,6 @@ void execute()
} }
} }
void display()
{
//if (display_control == 0xA7)
{
// display is ready to ouptup
if (display_buffer & 0x80)
{
// outputs the buffer character
display_buffer = display_buffer & 0x7F;
printf("%c", display_buffer);
}
}
}
void read_input()
{
// verifies if the keyboard is being pressed...
}
void run() void run()
{ {
while (1) while (1)
@ -166,8 +147,8 @@ void run()
decode(); decode();
execute(); execute();
display(); input();
read_input(); output();
} }
} }