Compare commits
7 Commits
ab3b026324
...
e8b5503595
Author | SHA1 | Date | |
---|---|---|---|
|
e8b5503595 | ||
|
ccf8abbeca | ||
|
945f5e679c | ||
|
80dfbb3d0a | ||
|
0f6e5abcb6 | ||
|
056712f943 | ||
|
5842e91dd2 |
3
Makefile
3
Makefile
@ -8,10 +8,11 @@ all: ls7emulator
|
||||
|
||||
clean:
|
||||
rm -rf bin/ls7emulator bin/
|
||||
rm -rf src/*.o
|
||||
|
||||
ls7emulator:
|
||||
cd src
|
||||
$(CC) ls7emulator.c -o ls7emulator $(CFLAGS) -O2
|
||||
$(CC) main.c -o ls7emulator $(CFLAGS) -O2
|
||||
|
||||
rm ../bin -rf
|
||||
mkdir ../bin
|
||||
|
@ -1,8 +1,3 @@
|
||||
#include <stdint.h>
|
||||
#include <SFML/System.h>
|
||||
#include <SFML/Graphics.h>
|
||||
|
||||
|
||||
#define NOP 0xEA /* CPU NoOp */
|
||||
#define PAGESIZE 0x1F /* Pagesize of extra addressing of devices */
|
||||
#define VIDADDRS 0xBE00 /* Video Address */
|
||||
@ -18,3 +13,5 @@
|
||||
|
||||
#define CPUSPEED 4096 * 16
|
||||
|
||||
|
||||
static float displayScale = 2;
|
||||
|
@ -1,6 +1,4 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include <SFML/Graphics/RenderWindow.h>
|
||||
#include <SFML/System.h>
|
||||
#include <SFML/Graphics.h>
|
||||
#include <SFML/Window.h>
|
||||
|
@ -6,23 +6,23 @@ extern uint8_t keyboardResult;
|
||||
extern sfKeyCode currentKey;
|
||||
|
||||
const static sfKeyCode scanMatrix[48] = {
|
||||
sfKeyNum1, sfKeyNum2, sfKeyNum3, sfKeyNum4, sfKeyNum5, sfKeyNum6, sfKeyNum7, sfKeyNum8,
|
||||
sfKeyQ, sfKeyW, sfKeyE, sfKeyR, sfKeyT, sfKeyY, sfKeyU, sfKeyI,
|
||||
sfKeyA, sfKeyS, sfKeyD, sfKeyF, sfKeyG, sfKeyH, sfKeyJ, sfKeyK,
|
||||
sfKeyZ, sfKeyX, sfKeyC, sfKeyV, sfKeyB, sfKeyN, sfKeyM, sfKeyComma,
|
||||
sfKeyNum9, sfKeyNum0, sfKeyL, sfKeyO, sfKeyP, sfKeyPeriod,sfKeyEnter, sfKeyBackspace,
|
||||
sfKeyLShift,sfKeyLControl, sfKeyLAlt, sfKeySpace, sfKeyUp, sfKeyRight, sfKeyDown, sfKeyLeft,
|
||||
sfKeyNum1, sfKeyNum2, sfKeyNum3, sfKeyNum4, sfKeyNum5, sfKeyNum6, sfKeyNum7, sfKeyNum8,
|
||||
sfKeyQ, sfKeyW, sfKeyE, sfKeyR, sfKeyT, sfKeyY, sfKeyU, sfKeyI,
|
||||
sfKeyA, sfKeyS, sfKeyD, sfKeyF, sfKeyG, sfKeyH, sfKeyJ, sfKeyK,
|
||||
sfKeyZ, sfKeyX, sfKeyC, sfKeyV, sfKeyB, sfKeyN, sfKeyM, sfKeyComma,
|
||||
sfKeyNum9, sfKeyNum0, sfKeyL, sfKeyO, sfKeyP, sfKeyPeriod,sfKeyEnter, sfKeyBackspace,
|
||||
sfKeyLShift,sfKeyLControl, sfKeyLAlt, sfKeySpace, sfKeyUp, sfKeyRight, sfKeyDown, sfKeyLeft,
|
||||
};
|
||||
|
||||
|
||||
void scanKeyboard(){
|
||||
keyboardResult = 0;
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (currentKey == scanMatrix[i + (((systemRegister & 0x07) % 6) * 8)]){
|
||||
keyboardResult |= (0x80 >> i);
|
||||
}
|
||||
}
|
||||
|
||||
keyboardResult ^= 0xFF;
|
||||
keyboardResult = 0;
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (currentKey == scanMatrix[i + (((systemRegister & 0x07) % 6) * 8)]){
|
||||
keyboardResult |= (0x80 >> i);
|
||||
}
|
||||
}
|
||||
|
||||
keyboardResult ^= 0xFF;
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
#include <SFML/System.h>
|
||||
#include <SFML/Graphics.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
/* Display Scale used for VertexArray */
|
||||
static float displayScale = 2;
|
||||
|
||||
|
||||
static sfVertexArray *renderArray;
|
||||
|
||||
static sfRenderWindow *window;
|
||||
static sfRenderStates renderStates;
|
@ -8,7 +8,6 @@
|
||||
#include <SFML/Graphics.h>
|
||||
#include <SFML/Window.h>
|
||||
|
||||
#include "ls7emulator.h"
|
||||
#include "config.h"
|
||||
#include "events.c"
|
||||
#include "cpu.c"
|
||||
@ -17,6 +16,10 @@
|
||||
#include "keyboard.c"
|
||||
|
||||
|
||||
sfVertexArray *renderArray;
|
||||
sfRenderWindow *window;
|
||||
sfRenderStates renderStates;
|
||||
|
||||
|
||||
void openFile(const char *inputFile){
|
||||
FILE *file = fopen(inputFile, "rb");
|
||||
@ -68,7 +71,7 @@ int main(int argc, char *argv[]){
|
||||
sfTransform_scale(&renderStates.transform, 2, 2);
|
||||
|
||||
resetSystem();
|
||||
|
||||
|
||||
while (sfRenderWindow_isOpen(window)){
|
||||
pollEvents(window);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
extern void scanKeyboard();
|
||||
extern void writeVideo();
|
||||
extern uint8_t readVideo();
|
||||
|
Loading…
Reference in New Issue
Block a user