Compare commits

...

7 Commits

Author SHA1 Message Date
0xmac
e8b5503595 Changed ls7emulator.c to main.c 2024-12-10 09:58:03 +01:00
0xmac
ccf8abbeca Tab cleanup 2024-12-05 11:45:31 +01:00
0xmac
945f5e679c Moved SFML vars to main file 2024-12-05 11:45:05 +01:00
0xmac
80dfbb3d0a Cleanup 2024-12-05 11:44:43 +01:00
0xmac
0f6e5abcb6 Removed #includes, added more variables 2024-12-05 11:44:22 +01:00
0xmac
056712f943 Deleted LS7 header file 2024-12-05 11:43:56 +01:00
0xmac
5842e91dd2 Removed config reference 2024-12-05 11:43:38 +01:00
7 changed files with 24 additions and 40 deletions

View File

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

View File

@ -1,8 +1,3 @@
#include <stdint.h>
#include <SFML/System.h>
#include <SFML/Graphics.h>
#define NOP 0xEA /* CPU NoOp */ #define NOP 0xEA /* CPU NoOp */
#define PAGESIZE 0x1F /* Pagesize of extra addressing of devices */ #define PAGESIZE 0x1F /* Pagesize of extra addressing of devices */
#define VIDADDRS 0xBE00 /* Video Address */ #define VIDADDRS 0xBE00 /* Video Address */
@ -18,3 +13,5 @@
#define CPUSPEED 4096 * 16 #define CPUSPEED 4096 * 16
static float displayScale = 2;

View File

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

View File

@ -6,23 +6,23 @@ extern uint8_t keyboardResult;
extern sfKeyCode currentKey; extern sfKeyCode currentKey;
const static sfKeyCode scanMatrix[48] = { const static sfKeyCode scanMatrix[48] = {
sfKeyNum1, sfKeyNum2, sfKeyNum3, sfKeyNum4, sfKeyNum5, sfKeyNum6, sfKeyNum7, sfKeyNum8, sfKeyNum1, sfKeyNum2, sfKeyNum3, sfKeyNum4, sfKeyNum5, sfKeyNum6, sfKeyNum7, sfKeyNum8,
sfKeyQ, sfKeyW, sfKeyE, sfKeyR, sfKeyT, sfKeyY, sfKeyU, sfKeyI, sfKeyQ, sfKeyW, sfKeyE, sfKeyR, sfKeyT, sfKeyY, sfKeyU, sfKeyI,
sfKeyA, sfKeyS, sfKeyD, sfKeyF, sfKeyG, sfKeyH, sfKeyJ, sfKeyK, sfKeyA, sfKeyS, sfKeyD, sfKeyF, sfKeyG, sfKeyH, sfKeyJ, sfKeyK,
sfKeyZ, sfKeyX, sfKeyC, sfKeyV, sfKeyB, sfKeyN, sfKeyM, sfKeyComma, sfKeyZ, sfKeyX, sfKeyC, sfKeyV, sfKeyB, sfKeyN, sfKeyM, sfKeyComma,
sfKeyNum9, sfKeyNum0, sfKeyL, sfKeyO, sfKeyP, sfKeyPeriod,sfKeyEnter, sfKeyBackspace, sfKeyNum9, sfKeyNum0, sfKeyL, sfKeyO, sfKeyP, sfKeyPeriod,sfKeyEnter, sfKeyBackspace,
sfKeyLShift,sfKeyLControl, sfKeyLAlt, sfKeySpace, sfKeyUp, sfKeyRight, sfKeyDown, sfKeyLeft, sfKeyLShift,sfKeyLControl, sfKeyLAlt, sfKeySpace, sfKeyUp, sfKeyRight, sfKeyDown, sfKeyLeft,
}; };
void scanKeyboard(){ void scanKeyboard(){
keyboardResult = 0; keyboardResult = 0;
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
if (currentKey == scanMatrix[i + (((systemRegister & 0x07) % 6) * 8)]){ if (currentKey == scanMatrix[i + (((systemRegister & 0x07) % 6) * 8)]){
keyboardResult |= (0x80 >> i); keyboardResult |= (0x80 >> i);
} }
} }
keyboardResult ^= 0xFF; keyboardResult ^= 0xFF;
} }

View File

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

View File

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

View File

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