commit d8117dc8d37b7c00da929384ece4693be57d12a8
parent 478e5216c3e15d2ac9c33bc5a7f43a912f3a1a7d
Author: evenfri <evenfri256@gmail.com>
Date: Sat, 12 Sep 2026 22:03:20 +0800
add sta
Diffstat:
11 files changed, 64 insertions(+), 30 deletions(-)
diff --git a/PxPlus_IBM_VGA8.ttf b/PxPlus_IBM_VGA8.ttf
Binary files differ.
diff --git a/PxPlus_IBM_VGA8.ttf.import b/PxPlus_IBM_VGA8.ttf.import
@@ -0,0 +1,36 @@
+[remap]
+
+importer="font_data_dynamic"
+type="FontFile"
+uid="uid://bq48lr0d5eg8h"
+path="res://.godot/imported/PxPlus_IBM_VGA8.ttf-4eae0e9f40467468ccc4ab703e6e051f.fontdata"
+
+[deps]
+
+source_file="res://PxPlus_IBM_VGA8.ttf"
+dest_files=["res://.godot/imported/PxPlus_IBM_VGA8.ttf-4eae0e9f40467468ccc4ab703e6e051f.fontdata"]
+
+[params]
+
+Rendering=null
+antialiasing=1
+generate_mipmaps=false
+disable_embedded_bitmaps=true
+multichannel_signed_distance_field=false
+msdf_pixel_range=8
+msdf_size=48
+allow_system_fallback=true
+force_autohinter=false
+modulate_color_glyphs=false
+hinting=3
+subpixel_positioning=4
+keep_rounding_remainders=true
+oversampling=0.0
+Fallbacks=null
+fallbacks=[]
+Compress=null
+compress=true
+preload=[]
+language_support={}
+script_support={}
+opentype_features={}
diff --git a/altair.bin b/altair.bin
Binary files differ.
diff --git a/computer_interface.cs b/computer_interface.cs
@@ -32,12 +32,12 @@ bool worked = false;
public override void _Ready() {
_emu = emu_create();
- /*
+
int r = emu_load_program(_emu, "altair.bin");
if (r != 0) {
GD.Print("error to load program: altair.bin");
}
- */
+
if (button_run != null) button_run.Pressed += run_pressed;
if (button_stop != null) button_stop.Pressed += stop_pressed;
diff --git a/emulator/emu.h b/emulator/emu.h
@@ -3,8 +3,8 @@
#include <stdlib.h>
#include <stdint.h>
-#include <string.h>
#include <stdio.h>
+#include <string.h>
#define reg_a 0b111
#define reg_b 0b000
diff --git a/emulator/emu.so b/emulator/emu.so
Binary files differ.
diff --git a/emulator/main.c b/emulator/main.c
@@ -81,6 +81,16 @@ int emu_step(emulator *e) {
if (src == 0b110) {
set_reg(e, dst, e->memory[e->pc+1]);
e->pc += 2;
+ } else if (src == reg_d) {
+ uint16_t addr = (uint16_t)e->memory[e->pc + 1] |
+ ((uint16_t)e->memory[e->pc + 2] << 8);
+
+ if (dst == reg_a) {
+ e->a = e->memory[addr];
+ } else if (dst == reg_m) {
+ e->memory[addr] = e->a;
+ }
+ e->pc += 3;
} else {
e->pc++;
}
diff --git a/main.tscn b/main.tscn
@@ -5,6 +5,7 @@
[ext_resource type="Texture2D" uid="uid://bb5mof51kodyv" path="res://lamp.png" id="3_h2yge"]
[ext_resource type="Texture2D" uid="uid://blxdcjt4qu82c" path="res://paper.png" id="4_1bvp3"]
[ext_resource type="Script" uid="uid://b6lty8spdabbf" path="res://paper_list.cs" id="4_lquwl"]
+[ext_resource type="FontFile" uid="uid://bq48lr0d5eg8h" path="res://PxPlus_IBM_VGA8.ttf" id="6_7mycd"]
[sub_resource type="LabelSettings" id="LabelSettings_7mycd"]
font_size = 8
@@ -36,30 +37,9 @@ font_size = 8
line_spacing = 0.0
font_size = 8
-[sub_resource type="FontFile" id="FontFile_272bh"]
-cache/0/variation_coordinates = {}
-cache/0/face_index = 0
-cache/0/embolden = 0.0
-cache/0/transform = Transform2D(1, 0, 0, 1, 0, 0)
-cache/0/spacing_top = 0
-cache/0/spacing_bottom = 0
-cache/0/spacing_space = 0
-cache/0/spacing_glyph = 0
-cache/0/baseline_offset = 0.0
-cache/0/16/0/ascent = 0.0
-cache/0/16/0/descent = 0.0
-cache/0/16/0/underline_position = 0.0
-cache/0/16/0/underline_thickness = 0.0
-cache/0/16/0/scale = 1.0
-cache/0/8/0/ascent = 0.0
-cache/0/8/0/descent = 0.0
-cache/0/8/0/underline_position = 0.0
-cache/0/8/0/underline_thickness = 0.0
-cache/0/8/0/scale = 1.0
-
[sub_resource type="LabelSettings" id="LabelSettings_a5vro"]
line_spacing = 0.0
-font = SubResource("FontFile_272bh")
+font = ExtResource("6_7mycd")
font_size = 8
font_color = Color(0, 0, 0, 1)
@@ -608,22 +588,30 @@ mouse_filter = 1
text = "NAME OPCODE DESCRIPTION
MVI 00<dst>110 move immediate
MOV 01<dst><src> move register
+ STA 00110010 move to memory
HLT 01110110 halt machine
"
label_settings = SubResource("LabelSettings_a5vro")
[node name="example program" type="Label" parent="paper/doc" unique_id=702865304]
offset_left = -100.0
-offset_top = 27.0
+offset_top = 32.0
offset_right = 100.0
-offset_bottom = 75.0
+offset_bottom = 80.0
mouse_filter = 1
text = "Example program:
ADDR OPCODE ASM
0000 00111110 MOV A
0001 00001000 8
- 0002 01000111 MOV B, A
- 0003 01110110 HLT"
+ 0002 00110010 STA
+ 0003 00000000 00
+ 0004 00010000 10
+ 0005 00111110 MOV A
+ 0006 00001001 9
+ 0007 00110010 STA
+ 0008 00000000 01
+ 0009 00010000 10
+ 000A 01110110 HLT"
label_settings = SubResource("LabelSettings_a5vro")
[node name="collision" type="CollisionShape2D" parent="paper" unique_id=1149371540]
diff --git a/old-pc-simulator.csproj b/old-pc-simulator.csproj
@@ -1,4 +1,4 @@
-<Project Sdk="Godot.NET.Sdk/4.7.1">
+<Project Sdk="Godot.NET.Sdk/4.7.2">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net9.0</TargetFramework>
diff --git a/old-pc-simulator.csproj b/old-pc-simulator.csproj.old
diff --git a/old-pc-simulator.csproj b/old-pc-simulator.csproj.old.1