init
This commit is contained in:
commit
58dd27253e
14
.clang-format
Normal file
14
.clang-format
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
BasedOnStyle: WebKit
|
||||||
|
Language: Cpp
|
||||||
|
IndentWidth: 4
|
||||||
|
ColumnLimit: 80
|
||||||
|
IndentCaseLabels: true
|
||||||
|
InsertNewlineAtEOF: true
|
||||||
|
AllowShortFunctionsOnASingleLine: None
|
||||||
|
|
||||||
|
BinPackArguments: false
|
||||||
|
AllowAllArgumentsOnNextLine: true
|
||||||
|
|
||||||
|
BinPackParameters: false
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
|
|
||||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
build/
|
||||||
|
.vscode/
|
||||||
11
CMakeLists.txt
Normal file
11
CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
cmake_minimum_required(VERSION 4.4)
|
||||||
|
project(vc6)
|
||||||
|
|
||||||
|
find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3-shared)
|
||||||
|
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
add_subdirectory(src)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
85
readme.txt
Normal file
85
readme.txt
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
|
||||||
|
16-bit architecture
|
||||||
|
|
||||||
|
8-bit addressing
|
||||||
|
|
||||||
|
# instructions
|
||||||
|
|
||||||
|
nop
|
||||||
|
hlt
|
||||||
|
|
||||||
|
mov reg, reg/imm
|
||||||
|
mov reg, byte/word [reg/imm]
|
||||||
|
mov byte/word [reg/imm], reg
|
||||||
|
|
||||||
|
or reg, reg/imm
|
||||||
|
xor reg, reg/imm
|
||||||
|
and reg, reg/imm
|
||||||
|
not reg
|
||||||
|
|
||||||
|
shr reg, reg/imm
|
||||||
|
shl reg, reg/imm
|
||||||
|
rshr reg, reg/imm
|
||||||
|
rshl reg, reg/imm
|
||||||
|
|
||||||
|
add reg, reg/imm
|
||||||
|
sub reg, reg/imm
|
||||||
|
rsub reg, reg/imm
|
||||||
|
|
||||||
|
cmp reg, reg/imm
|
||||||
|
|
||||||
|
jmp rel/abs reg/imm
|
||||||
|
jnz reg, rel/abs reg/imm
|
||||||
|
|
||||||
|
# registers
|
||||||
|
|
||||||
|
a/name b/name purpose
|
||||||
|
-----------------------------------
|
||||||
|
r0 general purpose
|
||||||
|
r1 -
|
||||||
|
r2 -
|
||||||
|
r3 -
|
||||||
|
r4 sp stack pointer
|
||||||
|
r5 bp base pointer
|
||||||
|
r6 fl flags
|
||||||
|
r7 pc program counter
|
||||||
|
|
||||||
|
# instruction
|
||||||
|
|
||||||
|
0000 0000 0000 0000
|
||||||
|
| || | |+----+--- opcode
|
||||||
|
| || +-+--------- op1 reg
|
||||||
|
| |+------------- imm
|
||||||
|
+-+-------------- op2 reg
|
||||||
|
|
||||||
|
# flags
|
||||||
|
|
||||||
|
0 zero
|
||||||
|
1 eq
|
||||||
|
2 less than
|
||||||
|
3 below
|
||||||
|
|
||||||
|
# keyboard
|
||||||
|
|
||||||
|
ff00 status register
|
||||||
|
ff02 scancode register
|
||||||
|
ff04 keydown handler
|
||||||
|
ff06 keyup handler
|
||||||
|
|
||||||
|
## status
|
||||||
|
|
||||||
|
0 type 1 if release
|
||||||
|
1 shift
|
||||||
|
2 ctrl
|
||||||
|
3 alt
|
||||||
|
4 capslock
|
||||||
|
|
||||||
|
# screen
|
||||||
|
|
||||||
|
40 x 25 ascii character display
|
||||||
|
|
||||||
|
display buffer starts at fb00
|
||||||
|
|
||||||
|
character = fb00 + (y * 40 + x)
|
||||||
|
|
||||||
|
|
||||||
19
src/CMakeLists.txt
Normal file
19
src/CMakeLists.txt
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
add_executable(emu WIN32
|
||||||
|
main.c
|
||||||
|
)
|
||||||
|
|
||||||
|
set_property(TARGET emu PROPERTY C_STANDARD 23)
|
||||||
|
set_property(TARGET emu PROPERTY C_STANDARD_REQUIRED ON)
|
||||||
|
target_compile_features(emu PUBLIC c_std_23)
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
target_compile_options(emu PRIVATE /W4)
|
||||||
|
else()
|
||||||
|
target_compile_options(emu PRIVATE -Wall -Wextra -Wpedantic -Werror=switch)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(emu PRIVATE SDL3::SDL3)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
1035
src/main.c
Normal file
1035
src/main.c
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user