Compare commits

..

No commits in common. "e8b5503595e396e4ba3ee1036f7322a684c0a37a" and "ab3b0263241e03e2b1fd52ec90cc943a2b8043e5" have entirely different histories.

7 changed files with 40 additions and 24 deletions

View File

@ -8,11 +8,10 @@ all: ls7emulator
clean:
rm -rf bin/ls7emulator bin/
rm -rf src/*.o
ls7emulator:
cd src
$(CC) main.c -o ls7emulator $(CFLAGS) -O2
$(CC) ls7emulator.c -o ls7emulator $(CFLAGS) -O2
rm ../bin -rf
mkdir ../bin

View File

@ -1,3 +1,8 @@
#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 */
@ -13,5 +18,3 @@
#define CPUSPEED 4096 * 16
static float displayScale = 2;

View File

@ -1,4 +1,6 @@
#include <stdint.h>
#include <SFML/Graphics/RenderWindow.h>
#include <SFML/System.h>
#include <SFML/Graphics.h>
#include <SFML/Window.h>

View File

@ -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;
}

View File

@ -8,6 +8,7 @@
#include <SFML/Graphics.h>
#include <SFML/Window.h>
#include "ls7emulator.h"
#include "config.h"
#include "events.c"
#include "cpu.c"
@ -16,10 +17,6 @@
#include "keyboard.c"
sfVertexArray *renderArray;
sfRenderWindow *window;
sfRenderStates renderStates;
void openFile(const char *inputFile){
FILE *file = fopen(inputFile, "rb");
@ -71,7 +68,7 @@ int main(int argc, char *argv[]){
sfTransform_scale(&renderStates.transform, 2, 2);
resetSystem();
while (sfRenderWindow_isOpen(window)){
pollEvents(window);

13
src/ls7emulator.h Normal file
View File

@ -0,0 +1,13 @@
#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;

View File

@ -1,5 +1,7 @@
#include <stdint.h>
#include "config.h"
extern void scanKeyboard();
extern void writeVideo();
extern uint8_t readVideo();