Compare commits

..

2 Commits

Author SHA1 Message Date
0e594245c2 rename vm 2026-01-25 00:17:46 +01:00
6abfae10a4 fix assembler 2026-01-25 00:11:59 +01:00
3 changed files with 14 additions and 10 deletions

View File

@ -12,23 +12,27 @@ obj_dir = $(build_dir)/obj
sources := $(shell find src/ -name *.cpp -and -not -name *main.cpp) sources := $(shell find src/ -name *.cpp -and -not -name *main.cpp)
vc5_sources := $(sources) src/main.cpp vm_bin = $(build_dir)/vm
vm_sources := $(sources) src/vm_main.cpp
asm_bin = $(build_dir)/asm
asm_sources := $(sources) src/asm_main.cpp asm_sources := $(sources) src/asm_main.cpp
all: $(build_dir)/vc5 $(build_dir)/asm all: $(vm_bin) $(asm_bin) $(build_dir)/boot.bin
$(build_dir)/vc5: $(vc5_sources:%.cpp=$(obj_dir)/%.o) $(vm_bin): $(vm_sources:%.cpp=$(obj_dir)/%.o)
@mkdir -p $(dir $@)
g++ $^ -o $@ $(CXXFLAGS) $(LDFLAGS) g++ $^ -o $@ $(CXXFLAGS) $(LDFLAGS)
$(build_dir)/asm: $(asm_sources:%.cpp=$(obj_dir)/%.o) $(asm_bin): $(asm_sources:%.cpp=$(obj_dir)/%.o)
@mkdir -p $(dir $@)
g++ $^ -o $@ $(CXXFLAGS) $(LDFLAGS) g++ $^ -o $@ $(CXXFLAGS) $(LDFLAGS)
$(obj_dir)/%.o: %.cpp $(obj_dir)/%.o: %.cpp
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
g++ $< -c -o $@ -MMD -MP $(CXXFLAGS) g++ $< -c -o $@ -MMD -MP $(CXXFLAGS)
$(build_dir)/boot.bin: programs/boot.vc5asm $(asm_bin)
./$(asm_bin) $< -o $@
.PHONY: clean .PHONY: clean
clean: clean:
rm -rf $(build_dir) rm -rf $(build_dir)

View File

@ -5,7 +5,6 @@ const KBD_CODE 0x1ffe
const VCD 0x2000 const VCD 0x2000
const FL_EQ 0x2 const FL_EQ 0x2
const FL_EQ 0x4
const KBD_FLAG_IS_RELEASE 0x1 const KBD_FLAG_IS_RELEASE 0x1

View File

@ -10,7 +10,6 @@
using namespace std::chrono_literals; using namespace std::chrono_literals;
using namespace vc5; using namespace vc5;
using namespace vc5::regs;
static void make_program(uint8_t* data); static void make_program(uint8_t* data);
@ -25,7 +24,7 @@ int main(int argc, char** argv)
make_program(disk.data()); make_program(disk.data());
std::println("memory disk"); std::println("memory disk");
for (size_t i = 0; i < 64; i += 4) { for (size_t i = 0; i < 128; i += 4) {
std::println("{:02x} {:02x} {:02x} {:02x}", std::println("{:02x} {:02x} {:02x} {:02x}",
disk.data()[i], disk.data()[i],
disk.data()[i + 1], disk.data()[i + 1],
@ -48,7 +47,7 @@ int main(int argc, char** argv)
memory_disk.read(memory_block.data(), 0); memory_disk.read(memory_block.data(), 0);
std::println("file disk"); std::println("file disk");
for (size_t i = 0; i < 64; i += 4) { for (size_t i = 0; i < 128; i += 4) {
std::println("{:02x} {:02x} {:02x} {:02x}", std::println("{:02x} {:02x} {:02x} {:02x}",
file_block[i], file_block[i],
file_block[i + 1], file_block[i + 1],
@ -63,6 +62,8 @@ int main(int argc, char** argv)
void make_program(uint8_t* data) void make_program(uint8_t* data)
{ {
using namespace vc5::regs;
auto l = tools::Builder(data); auto l = tools::Builder(data);
l.mov_imm(rsp, 0x1000); l.mov_imm(rsp, 0x1000);