Initial Commit
This commit is contained in:
parent
ca081b8865
commit
0c8d7b57cb
6 changed files with 170 additions and 0 deletions
15
.clang-format
Executable file
15
.clang-format
Executable file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#BasedOnStyle: None
|
||||||
|
AlignTrailingComments: true
|
||||||
|
BreakBeforeBraces: Allman
|
||||||
|
ColumnLimit: 0
|
||||||
|
IndentWidth: 4
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||||
|
ObjCSpaceAfterProperty: true
|
||||||
|
ObjCSpaceBeforeProtocolList: true
|
||||||
|
PointerBindsToType: false
|
||||||
|
SpacesBeforeTrailingComments: 1
|
||||||
|
TabWidth: 4
|
||||||
|
UseTab: Never
|
||||||
|
|
||||||
|
AlignArrayOfStructures: Right
|
||||||
|
SpaceBeforeSquareBrackets: false
|
||||||
70
.gitignore
vendored
Executable file
70
.gitignore
vendored
Executable file
|
|
@ -0,0 +1,70 @@
|
||||||
|
# ---> C
|
||||||
|
# Prerequisites
|
||||||
|
*.d
|
||||||
|
|
||||||
|
# Object files
|
||||||
|
*.o
|
||||||
|
*.ko
|
||||||
|
*.obj
|
||||||
|
*.elf
|
||||||
|
|
||||||
|
# Linker output
|
||||||
|
*.ilk
|
||||||
|
*.map
|
||||||
|
*.exp
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Libraries
|
||||||
|
*.lib
|
||||||
|
*.a
|
||||||
|
*.la
|
||||||
|
*.lo
|
||||||
|
|
||||||
|
# Shared objects (inc. Windows DLLs)
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
*.i*86
|
||||||
|
*.x86_64
|
||||||
|
*.hex
|
||||||
|
eipaasm
|
||||||
|
eipaasm_debug
|
||||||
|
# Debug files
|
||||||
|
*.dSYM/
|
||||||
|
*.su
|
||||||
|
*.idb
|
||||||
|
*.pdb
|
||||||
|
|
||||||
|
# Kernel Module Compile Results
|
||||||
|
*.mod*
|
||||||
|
*.cmd
|
||||||
|
.tmp_versions/
|
||||||
|
modules.order
|
||||||
|
Module.symvers
|
||||||
|
Mkfile.old
|
||||||
|
dkms.conf
|
||||||
|
|
||||||
|
#EIPA specific
|
||||||
|
*.eipa
|
||||||
|
!test*.eipa
|
||||||
|
*.eipaimg
|
||||||
|
|
||||||
|
#Code editor
|
||||||
|
.vscode/*
|
||||||
|
.idea/*
|
||||||
|
compile_commands.json
|
||||||
|
.cache/*
|
||||||
|
.#*
|
||||||
|
*.*~
|
||||||
|
|
||||||
|
#Code analysis
|
||||||
|
softwipe*.*
|
||||||
20
Makefile
Executable file
20
Makefile
Executable file
|
|
@ -0,0 +1,20 @@
|
||||||
|
CC := clang
|
||||||
|
CFLAGS := -Wall -Wextra
|
||||||
|
SRC_DIR := src
|
||||||
|
HEADER_DIR := header
|
||||||
|
BUILD_DIR := build
|
||||||
|
LIBS :=
|
||||||
|
OBJECT_FILES := $(patsubst %.c, %.o, $(wildcard $(SRC_DIR)/*.c))
|
||||||
|
HEADER_FILES := $(wildcard $(HEADER_DIR)/*.h)
|
||||||
|
OBJECT_FILES := $(patsubst $(SRC_DIR)/%, $(BUILD_DIR)/%, $(OBJECT_FILES))
|
||||||
|
MAIN_EXE_NAME := eipaemulator
|
||||||
|
|
||||||
|
all build/eipaemulator: $(OBJECT_FILES)
|
||||||
|
$(CC) $(CFLAGS) $^ $(LIBS) -o $(BUILD_DIR)/$(MAIN_EXE_NAME)
|
||||||
|
|
||||||
|
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c $(HEADER_FILES)
|
||||||
|
@mkdir -p $(BUILD_DIR)
|
||||||
|
$(CC) -c $(CFLAGS) $(patsubst %.h,,$^) -o $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -r $(BUILD_DIR)
|
||||||
BIN
build/eipaemulator
Executable file
BIN
build/eipaemulator
Executable file
Binary file not shown.
24
design.txt
Executable file
24
design.txt
Executable file
|
|
@ -0,0 +1,24 @@
|
||||||
|
Instructions:
|
||||||
|
INP 0b0001 | +Adress
|
||||||
|
OUT 0b0010 | +Adress
|
||||||
|
LDA 0b0011 | +Adress
|
||||||
|
STA 0b0100 | +Adress
|
||||||
|
INC 0b0101 | no Adress
|
||||||
|
DEC 0b0110 | no Adress
|
||||||
|
JPP 0b0111 | +Adress/Label
|
||||||
|
JPZ 0b1000 | +Adress/Label
|
||||||
|
JPN 0b1001 | +Adress/Label
|
||||||
|
JPU 0b1010 | +Adress/Label
|
||||||
|
EOJ 0b1011 | no Adress
|
||||||
|
|
||||||
|
Instruction format, [] means optional:
|
||||||
|
instruction [mem_adress]; [Comment]
|
||||||
|
|
||||||
|
Memory:
|
||||||
|
32 Bit Data with
|
||||||
|
28 Bit Adresess-> 24Mb Memory
|
||||||
|
|
||||||
|
Instruction Layout:
|
||||||
|
XXXXYYYYYYYYYYYYYYYYYYYYYYYYYYYY
|
||||||
|
X: Instruction Opcode (4bit)
|
||||||
|
Y: Memory Adress (28bit)
|
||||||
41
src/main.c
Executable file
41
src/main.c
Executable file
|
|
@ -0,0 +1,41 @@
|
||||||
|
// This is a part of the EIPA Platform
|
||||||
|
|
||||||
|
// Read an EIPA image and print it out in Binary form
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#define MAX_MEMORY 268435456
|
||||||
|
|
||||||
|
void print_target_code(__uint32_t *target_code)
|
||||||
|
{
|
||||||
|
int instruction_index = 0;
|
||||||
|
while (target_code[instruction_index] != 0)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
for (i = (sizeof(target_code[instruction_index]) * 8) - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
putchar(target_code[instruction_index] & (1u << i) ? '1' : '0');
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
instruction_index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char const *argv[])
|
||||||
|
{
|
||||||
|
if(argc < 2)
|
||||||
|
{
|
||||||
|
printf("Specify input file\n");
|
||||||
|
}
|
||||||
|
FILE *input = fopen(argv[1], "r");
|
||||||
|
if(input == NULL) return -1;
|
||||||
|
|
||||||
|
__uint32_t *target_code = malloc(MAX_MEMORY*sizeof(target_code));
|
||||||
|
|
||||||
|
fread(target_code, sizeof(target_code), MAX_MEMORY, input);
|
||||||
|
|
||||||
|
print_target_code(target_code);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue