-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added config parser, device factories, BigInt, reference resolution, …
…Graphics handlers, easy computer interrupts, read-only bypass for programming the computer, ASSEMBLE and file loading macros Sophisticated config format should allow users to configure the computer however they want, to better suit programs and games. New macros for compiling other assembly files, and injecting file contents into memory; line by line or a straight dump
- Loading branch information
Showing
63 changed files
with
7,657 additions
and
1,110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,81 @@ | ||
!! The address to start placing components at | ||
start_address = 0 | ||
|
||
rom_address = 0 | ||
rom_bytes = 8192 | ||
|
||
ram_address = 8192 | ||
ram_bytes = 8192 | ||
|
||
!! The address the stack starts at (fills backwards) | ||
stack_address = 16384 | ||
|
||
clocks_per_frame = 1000 | ||
|
||
!! For each component create an object with a string variable 'component_type', | ||
!! and whatever other information the component needs | ||
components = [ | ||
components = | ||
[ | ||
{ | ||
component_type = "RAM" | ||
RAM_words = 16384 | ||
} | ||
component_type = "ROM", | ||
size_words = 2048 | ||
default_byte = 0 | ||
}, | ||
{ | ||
component_type = "ROM" | ||
ROM_words = 16384 | ||
} | ||
component_type = "RAM", | ||
size_words = 2048 | ||
default_byte = 0 | ||
}, | ||
{ | ||
component_type = "Colour Character Display", | ||
|
||
texture_file = "./assets/char set.png" , | ||
texture_position = (0,0), | ||
texture_char_size = (8,8), | ||
texture_columns = 16, | ||
|
||
text_size = (16,16), | ||
|
||
pixel_position = (0,0), | ||
pixel_scale = (4,4), | ||
|
||
!! Modes: | ||
!! 0 - Locked to cpu cycles | ||
!! 1 - Locked to FPS | ||
!! 2 - Locked to time per frame | ||
!! 3 - VSYNC? | ||
framerate_mode = 0, | ||
|
||
!! 0 - Cycles per frame | ||
!! 1 - Target FPS | ||
!! 2 - ms per frame | ||
!! 3 - Ignored | ||
framerate_lock = 3000, | ||
|
||
labels = | ||
{ | ||
CHAR_MEM = 0, | ||
COLOUR_MEM = "colour_position", | ||
RENDER_INT = "interrupt_position" | ||
} | ||
}, | ||
{ | ||
component_type = "ROM" | ||
ROM_words = 16384 | ||
component_type = "Keyboard", | ||
labels = | ||
{ | ||
KEYBOARD = 0 | ||
} | ||
} | ||
] | ||
|
||
palettes = "assets/palette.png" | ||
|
||
character_set = { | ||
file = "assets/char set.png" | ||
character_size = (8,8) | ||
characters_per_row = 16 | ||
} | ||
|
||
display = { | ||
size_chars = (16,16) | ||
position = (0,0) | ||
scale = (4,4) | ||
} | ||
|
||
viewport_size = (512,512) | ||
|
||
!! Used for the debug bar at the bottom of the window | ||
gui_colours = { | ||
neutral = #FF6A00 | ||
hover = #F26000 | ||
gui_colours = | ||
{ | ||
neutral = #FF6A00, | ||
hover = #F26000, | ||
click = #D85600 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#pragma once | ||
|
||
#ifndef L32_BigInt_h_ | ||
#define L32_BigInt_h_ | ||
|
||
#include <cassert> | ||
#include <string_view> | ||
#include <vector> | ||
|
||
namespace Little32 | ||
{ | ||
struct BigInt | ||
{ | ||
bool negative = false; | ||
std::vector<uint64_t> bits = {}; | ||
|
||
BigInt(); | ||
|
||
BigInt(uint64_t value); | ||
|
||
BigInt(int64_t value); | ||
|
||
BigInt(std::string_view value); | ||
|
||
inline constexpr bool operator==(const BigInt& other) const | ||
{ | ||
if (negative != other.negative) return false; | ||
|
||
if (bits.size() != other.bits.size()) return false; | ||
|
||
for (size_t i = bits.size(); i--;) | ||
{ | ||
if (bits[i] != other.bits[i]) return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
inline constexpr bool operator!=(const BigInt& other) const | ||
{ | ||
if (negative != other.negative) return true; | ||
|
||
if (bits.size() != other.bits.size()) return true; | ||
|
||
for (size_t i = bits.size(); i--;) | ||
{ | ||
if (bits[i] != other.bits[i]) return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
BigInt& operator-=(BigInt other); | ||
|
||
BigInt& operator+=(BigInt other); | ||
|
||
BigInt& operator+=(uint64_t other); | ||
|
||
BigInt& operator=(uint64_t other); | ||
|
||
BigInt& operator=(int64_t other); | ||
|
||
BigInt& shift_left(); | ||
|
||
BigInt& shift_right(); | ||
|
||
BigInt& operator>>=(uint16_t shift); | ||
|
||
BigInt& operator<<=(uint16_t shift); | ||
|
||
BigInt& operator*=(BigInt other); | ||
|
||
BigInt& operator*=(int64_t other); | ||
|
||
std::string ToStringCheap() const; | ||
|
||
size_t NumBits() const noexcept; | ||
|
||
bool TryToUInt64(uint64_t& out) const noexcept; | ||
|
||
bool TryToUInt32(uint32_t& out) const noexcept; | ||
|
||
bool TryToUInt16(uint16_t& out) const noexcept; | ||
|
||
bool TryToUInt8(uint8_t& out) const noexcept; | ||
|
||
bool TryToUIntX(BigInt& out, size_t bits) const noexcept; | ||
|
||
bool TryToInt64(int64_t& out) const noexcept; | ||
|
||
bool TryToInt32(int32_t& out) const noexcept; | ||
|
||
bool TryToInt16(int16_t& out) const noexcept; | ||
|
||
bool TryToInt8(int8_t& out) const noexcept; | ||
|
||
bool TryToIntX(BigInt& out, size_t bits) const noexcept; | ||
}; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.