old-computer-simulator

godot game
git clone git://git.evenfri.pw/old-computer-simulator.git
Log | Files | Refs

commit 6d4a1dfd97392854d583f32dbb546f63075d439c
parent ef873235e84af879f075d75c54c1c89c2c39f00b
Author: evenfri <evenfri@4plt.ch>
Date:   Tue, 27 Oct 2026 23:46:24 +0800

PATCH: fix fonts, add book system

Diffstat:
Dcomputer.png.import | 40----------------------------------------
Dcomputer_interface.cs | 210-------------------------------------------------------------------------------
Dcomputer_interface.cs.uid | 1-
Demulator.cs.uid | 1-
Memulator/dat.h | 14+++++++-------
Memulator/emu.h | 7++++---
Memulator/emu.so | 0
Memulator/main.c | 245++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------
Afont/LICENSE.txt | 202+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Afont/SpecialElite-Regular.ttf | 0
Afont/SpecialElite-Regular.ttf.import | 36++++++++++++++++++++++++++++++++++++
Afont/times.ttf | 0
Afont/times.ttf.import | 36++++++++++++++++++++++++++++++++++++
Dlamp.png.import | 40----------------------------------------
Mmain.tscn | 610+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------
Dpaper.png.import | 40----------------------------------------
Dpaper_list.cs | 34----------------------------------
Dpaper_list.cs.uid | 1-
Mproject.godot | 15+++++++++++++--
Ascripts/book_page.cs | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ascripts/book_page.cs.uid | 1+
Ascripts/book_target.cs | 34++++++++++++++++++++++++++++++++++
Ascripts/book_target.cs.uid | 1+
Ascripts/computer_interface.cs | 209+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ascripts/computer_interface.cs.uid | 1+
Remulator.cs -> scripts/emulator.cs | 0
Ascripts/emulator.cs.uid | 1+
Asprites/book.png | 0
Asprites/book.png.import | 40++++++++++++++++++++++++++++++++++++++++
Rcomputer.png -> sprites/computer.png | 0
Asprites/computer.png.import | 40++++++++++++++++++++++++++++++++++++++++
Rlamp.png -> sprites/lamp.png | 0
Asprites/lamp.png.import | 40++++++++++++++++++++++++++++++++++++++++
Rpaper.png -> sprites/paper.png | 0
Asprites/paper.png.import | 40++++++++++++++++++++++++++++++++++++++++
35 files changed, 1379 insertions(+), 618 deletions(-)

diff --git a/computer.png.import b/computer.png.import @@ -1,40 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://osbck513ghe3" -path="res://.godot/imported/computer.png-b68f47fb53ff69fa8b397299ff070cc0.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://computer.png" -dest_files=["res://.godot/imported/computer.png-b68f47fb53ff69fa8b397299ff070cc0.ctex"] - -[params] - -compress/mode=0 -compress/high_quality=false -compress/lossy_quality=0.7 -compress/uastc_level=0 -compress/rdo_quality_loss=0.0 -compress/hdr_compression=1 -compress/normal_map=0 -compress/channel_pack=0 -mipmaps/generate=false -mipmaps/limit=-1 -roughness/mode=0 -roughness/src_normal="" -process/channel_remap/red=0 -process/channel_remap/green=1 -process/channel_remap/blue=2 -process/channel_remap/alpha=3 -process/fix_alpha_border=true -process/premult_alpha=false -process/normal_map_invert_y=false -process/hdr_as_srgb=false -process/hdr_clamp_exposure=false -process/size_limit=0 -detect_3d/compress_to=1 diff --git a/computer_interface.cs b/computer_interface.cs @@ -1,209 +0,0 @@ -using Godot; -using System; -using static emulator; - -public partial class computer_interface : Node { - -const int INDEXES_BUTTON_DATA = 7; -const int INDEXES_BUTTON_ADDR = 15; - -[Export] public Button[] buttons; -[Export] public Sprite2D[] lamp_current_instruction; -[Export] public Sprite2D[] lamp_addr; - -[Export] public Color lamp_on = Colors.Red; -[Export] public Color lamp_off = Colors.DarkGray; - -[Export] public Button button_off_on; -[Export] public Button button_stop; -[Export] public Button button_run; -[Export] public Button button_single_step; -[Export] public Button button_examine; -[Export] public Button button_examine_next; -[Export] public Button button_deposit; -[Export] public Button button_deposit_next; -[Export] public Button button_reset; -[Export] public Button button_clear; - -IntPtr _emu; -ushort curr_addr; -byte curr_instr; -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; - if (button_single_step != null) button_single_step.Pressed += single_step_pressed; - if (button_examine != null) button_examine.Pressed += examine_pressed; - if (button_examine_next != null) button_examine_next.Pressed += examine_next_pressed; - if (button_deposit != null) button_deposit.Pressed += deposit_pressed; - if (button_deposit_next != null) button_deposit_next.Pressed += deposit_next_pressed; - if (button_reset != null) button_reset.Pressed += reset_pressed; - if (button_clear != null) button_clear.Pressed += clear_pressed; - - if (buttons != null) { - for (int i = 0; i < buttons.Length; i++) { - if (buttons[i] != null) { - buttons[i].Pressed += bit_button_pressed; - } - } - } - - update_lamps(); -} - -public override void _Notification(int what) { - if (what == NotificationPredelete) { - emu_destroy(_emu); - } -} - -public override void _Process(double delta) { - if (!worked) return; - - int r = emu_step(_emu); - if (r > 0) { - worked = false; - return; - } - - curr_addr = (ushort)emu_get_pc(_emu); - curr_instr = emu_mem_read(_emu, curr_addr); - - update_lamps(); - - byte reg_a = emu_get_reg(_emu, 0b111); - byte reg_b = emu_get_reg(_emu, 0b000); - byte reg_c = emu_get_reg(_emu, 0b001); - byte reg_d = emu_get_reg(_emu, 0b010); - GD.Print($"opcode=0x{curr_instr:X2}; pc=0x{curr_addr:X4}; a=0x{reg_a:X2}; b=0x{reg_b:X2}; c=0x{reg_c:X2}; d=0x{reg_d:X2}"); -} - -void update_lamps() { - update_data_lamps(curr_instr); - update_addr_lamps(curr_addr); -} - -ushort read_switches_addr() { - byte b0 = assem_byte(buttons, 0, 8); - byte b1 = assem_byte(buttons, 8, 8); - return (ushort)((b1 << 8) | b0); -} - -byte read_switches_data() { - return assem_byte(buttons, 0, INDEXES_BUTTON_DATA + 1); -} - -void bit_button_pressed() { - update_lamps(); -} - -void run_pressed() { - worked = true; -} - -void stop_pressed() { - worked = false; -} - -void single_step_pressed() { - worked = false; - emu_step(_emu); - curr_addr = (ushort)emu_get_pc(_emu); - curr_instr = emu_mem_read(_emu, curr_addr); - update_lamps(); -} - -void examine_pressed() { - worked = false; - curr_addr = read_switches_addr(); - emu_set_pc(_emu, curr_addr); - curr_instr = emu_mem_read(_emu, curr_addr); - update_lamps(); - - GD.Print($"Examine at 0x{curr_addr:X4}: 0x{curr_instr:X2}"); -} - -void examine_next_pressed() { - worked = false; - curr_addr++; - emu_set_pc(_emu, curr_addr); - curr_instr = emu_mem_read(_emu, curr_addr); - update_lamps(); - - GD.Print($"Examine Next at 0x{curr_addr:X4}: 0x{curr_instr:X2}"); -} - -void deposit_pressed() { - worked = false; - byte val = read_switches_data(); - - emu_mem_write(_emu, curr_addr, val); - curr_instr = val; - update_lamps(); - - GD.Print($"Deposit 0x{val:X2} at 0x{curr_addr:X4}"); -} - -void deposit_next_pressed() { - worked = false; - - curr_addr++; - emu_set_pc(_emu, curr_addr); - - byte val = read_switches_data(); - emu_mem_write(_emu, curr_addr, val); - curr_instr = val; - update_lamps(); - - GD.Print($"Deposit Next 0x{val:X2} at 0x{curr_addr:X4}"); -} - -void reset_pressed() { - worked = false; - emu_set_pc(_emu, 0); - curr_addr = 0; - curr_instr = emu_mem_read(_emu, curr_addr); - update_lamps(); -} - -void clear_pressed() { - update_lamps(); -} - -void update_data_lamps(byte value) { - for (int i = 0; i < 8 && i < lamp_current_instruction.Length; i++) { - bool is_bit_set = (value & (1 << i)) != 0; - lamp_current_instruction[i].SelfModulate = is_bit_set ? lamp_on : lamp_off; - } -} - -void update_addr_lamps(ushort value) { - for (int i = 0; i < 16 && i < lamp_addr.Length; i++) { - bool is_bit_set = (value & (1 << i)) != 0; - lamp_addr[i].SelfModulate = is_bit_set ? lamp_on : lamp_off; - } -} - -byte assem_byte(Button[] btns, int offset, int count = 8) { - byte r = 0; - if (btns == null) return r; - - for (int i = 0; i < count && i < 8; i++) { - int index = offset + i; - if (index < btns.Length && btns[index] != null && btns[index].ButtonPressed) { - r |= (byte)(1 << i); - } - } - return r; -} - -} -\ No newline at end of file diff --git a/computer_interface.cs.uid b/computer_interface.cs.uid @@ -1 +0,0 @@ -uid://cgdypxcbuexde diff --git a/emulator.cs.uid b/emulator.cs.uid @@ -1 +0,0 @@ -uid://betivycg1fnii diff --git a/emulator/dat.h b/emulator/dat.h @@ -1,6 +1,8 @@ #ifndef DAT_H #define DAT_H +#include <stdint.h> + #define MEMORY_SIZE 65536 #define REG_A 0b111 @@ -30,15 +32,13 @@ #define OP_DEC 0b101 #define OP_JMP 0b011 -#define OP_J 0b010 -#define OP_JNZ 0b000 -#define OP_JZ 0b001 +#define OP_J 0b010 #define F_CY 0 /* carry */ -#define F_P 1 /* parity */ -#define F_AC 2 /* auxiliary carry */ -#define F_Z 3 /* zero */ -#define F_S 4 /* sign */ +#define F_P 2 /* parity */ +#define F_AC 4 /* auxiliary carry */ +#define F_Z 6 /* zero */ +#define F_S 7 /* sign */ typedef struct { uint8_t mem[MEMORY_SIZE]; diff --git a/emulator/emu.h b/emulator/emu.h @@ -1,10 +1,11 @@ -#ifndef emu_h -#define emu_h +#ifndef EMU_H +#define EMU_H #include <stdlib.h> #include <stdint.h> #include <stdio.h> #include <string.h> +#include <stdbool.h> #include "dat.h" @@ -47,4 +48,4 @@ EXPORT byte emu_get_reg(emu_t *e, byte c); } #endif -#endif /* emu_h */ +#endif /* EMU_H */ diff --git a/emulator/emu.so b/emulator/emu.so Binary files differ. diff --git a/emulator/main.c b/emulator/main.c @@ -45,11 +45,9 @@ uint8_t emu_get(emu_t *e, uint8_t r) { } int emu_execute(emu_t *e, uint8_t i) { - - /* parse instr */ - uint8_t part1 = (i >> 6) & 0x03; /* [00]000000 */ - uint8_t dst = (i >> 3) & 0x07; /* 00[000]000 */ - uint8_t src = i & 0x07; /* 00000[000] */ + uint8_t part1 = (i >> 6) & 0x03; + uint8_t dst = (i >> 3) & 0x07; + uint8_t src = i & 0x07; switch (part1) { case OP_MV: @@ -58,16 +56,33 @@ int emu_execute(emu_t *e, uint8_t i) { return 1; } emu_set(e, dst, emu_get(e, src)); - e->pc++; + e->pc += 1; break; case OP_ZZ: { if (src == 0b110) { - /* MVI r, data */ + /* mvi r, data */ emu_set(e, dst, e->mem[e->pc + 1]); e->pc += 2; - } else if (src == REG_D) { + } else if (src == OP_INC) { + /* inr r */ + uint8_t old = emu_get(e, dst); + uint8_t val = old + 1; + FLAG_PUT(e, F_AC, ((old & 0x0F) + 1 > 0x0F)); + emu_set(e, dst, val); + set_zsp(e, val); + e->pc += 1; + } else if (src == OP_DEC) { + /* dcr r */ + uint8_t old = emu_get(e, dst); + uint8_t val = old - 1; + FLAG_PUT(e, F_AC, ((old & 0x0F) - 1 < 0)); + emu_set(e, dst, val); + set_zsp(e, val); + e->pc += 1; + } else if (src == 0b010 && (dst == REG_A || dst == REG_M)) { + /* lda / sta */ uint16_t addr = (uint16_t)e->mem[e->pc + 1] | ((uint16_t)e->mem[e->pc + 2] << 8); if (dst == REG_A) { @@ -76,95 +91,159 @@ int emu_execute(emu_t *e, uint8_t i) { e->mem[addr] = e->a; } e->pc += 3; - } else if (src == OP_INC) { - uint8_t val = emu_get(e, dst) + 1; - emu_set(e, dst, val); - set_zsp(e, val); - e->pc++; - } else if (src == OP_DEC) { - uint8_t val = emu_get(e, dst) - 1; - emu_set(e, dst, val); - set_zsp(e, val); - e->pc++; } else { - e->pc++; + e->pc += 1; } break; } case OP_ALU: - switch (dst) { - case OP_ALU_ADD: - emu_set(e, REG_A, emu_get(e, REG_A) + emu_get(e, src)); - set_zsp(e, emu_get(e, REG_A)); - break; - - case OP_ALU_SUB: - emu_set(e, REG_A, emu_get(e, REG_A) - emu_get(e, src)); - set_zsp(e, emu_get(e, REG_A)); - break; - - case OP_ALU_CMP: - { - uint8_t a = emu_get(e, REG_A); - uint8_t b = emu_get(e, src); - unsigned r = a - b; - uint8_t res = (uint8_t)r; - - FLAG_PUT(e, F_CY, a < b); - FLAG_PUT(e, F_AC, ((a ^ b ^ res) & 0x10) != 0); - - set_zsp(e, res); - break; - } - } - e->pc++; - break; - - case OP_OO: { - switch (src) { - case REG_M: + uint8_t alu_op = dst; + uint8_t val = emu_get(e, src); + uint8_t a = e->a; + + switch (alu_op) { + case OP_ALU_ADD: { - uint8_t imm = e->mem[e->pc + 1]; - if (dst == OP_ALU_ADD) { - emu_set(e, REG_A, emu_get(e, REG_A) + imm); - set_zsp(e, emu_get(e, REG_A)); - } else if (dst == OP_ALU_SUB) { - emu_set(e, REG_A, emu_get(e, REG_A) - imm); - set_zsp(e, emu_get(e, REG_A)); - } - e->pc += 2; + uint16_t res = (uint16_t)a + val; + e->a = (uint8_t)res; + FLAG_PUT(e, F_CY, res > 0xFF); + FLAG_PUT(e, F_AC, ((a & 0x0F) + (val & 0x0F) > 0x0F)); + set_zsp(e, e->a); + break; } - break; - - case OP_JMP: + case OP_ALU_ADC: { - uint16_t addr = (uint16_t)e->mem[e->pc + 1] | - ((uint16_t)e->mem[e->pc + 2] << 8); - e->pc = addr; + uint8_t cy = FLAG_GET(e, F_CY); + uint16_t res = (uint16_t)a + val + cy; + e->a = (uint8_t)res; + FLAG_PUT(e, F_CY, res > 0xFF); + FLAG_PUT(e, F_AC, ((a & 0x0F) + (val & 0x0F) + cy > 0x0F)); + set_zsp(e, e->a); + break; } - break; - - case OP_J: + case OP_ALU_SUB: { - bool jump = false; - if (dst == OP_JNZ) jump = (FLAG_GET(e, F_Z) == 0); - else if (dst == OP_JZ) jump = (FLAG_GET(e, F_Z) != 0); - - if (jump) { - uint16_t addr = (uint16_t)e->mem[e->pc + 1] | - ((uint16_t)e->mem[e->pc + 2] << 8); - e->pc = addr; - } else { - e->pc += 3; - } + int16_t res = (int16_t)a - val; + e->a = (uint8_t)res; + FLAG_PUT(e, F_CY, res < 0); + FLAG_PUT(e, F_AC, ((a & 0x0F) - (val & 0x0F) < 0)); + set_zsp(e, e->a); + break; + } + case OP_ALU_SBB: + { + uint8_t cy = FLAG_GET(e, F_CY); + int16_t res = (int16_t)a - val - cy; + e->a = (uint8_t)res; + FLAG_PUT(e, F_CY, res < 0); + FLAG_PUT(e, F_AC, ((a & 0x0F) - (val & 0x0F) - cy < 0)); + set_zsp(e, e->a); + break; } - break; + case OP_ALU_ANA: + { + e->a &= val; + FLAG_PUT(e, F_CY, 0); + FLAG_PUT(e, F_AC, ((a | val) & 0x08) != 0); + set_zsp(e, e->a); + break; + } + case OP_ALU_XRA: + { + e->a ^= val; + FLAG_PUT(e, F_CY, 0); + FLAG_PUT(e, F_AC, 0); + set_zsp(e, e->a); + break; + } + case OP_ALU_ORA: + { + e->a |= val; + FLAG_PUT(e, F_CY, 0); + FLAG_PUT(e, F_AC, 0); + set_zsp(e, e->a); + break; + } + case OP_ALU_CMP: + { + int16_t res = (int16_t)a - val; + FLAG_PUT(e, F_CY, res < 0); + FLAG_PUT(e, F_AC, ((a & 0x0F) - (val & 0x0F) < 0)); + set_zsp(e, (uint8_t)res); + break; + } + } + e->pc += 1; + break; + } + + case OP_OO: + { + if (src == REG_M) { + /* immediate alu */ + uint8_t imm = e->mem[e->pc + 1]; + uint8_t alu_op = dst; + uint8_t a = e->a; + + switch (alu_op) { + case OP_ALU_ADD: /* adi */ + { + uint16_t res = (uint16_t)a + imm; + e->a = (uint8_t)res; + FLAG_PUT(e, F_CY, res > 0xFF); + FLAG_PUT(e, F_AC, ((a & 0x0F) + (imm & 0x0F) > 0x0F)); + set_zsp(e, e->a); + break; + } + case OP_ALU_SUB: /* sui */ + { + int16_t res = (int16_t)a - imm; + e->a = (uint8_t)res; + FLAG_PUT(e, F_CY, res < 0); + FLAG_PUT(e, F_AC, ((a & 0x0F) - (imm & 0x0F) < 0)); + set_zsp(e, e->a); + break; + } + case OP_ALU_CMP: /* cpi */ + { + int16_t res = (int16_t)a - imm; + FLAG_PUT(e, F_CY, res < 0); + FLAG_PUT(e, F_AC, ((a & 0x0F) - (imm & 0x0F) < 0)); + set_zsp(e, (uint8_t)res); + break; + } + } + e->pc += 2; + } else if (src == OP_JMP) { + /* jmp */ + uint16_t addr = (uint16_t)e->mem[e->pc + 1] | + ((uint16_t)e->mem[e->pc + 2] << 8); + e->pc = addr; + } else if (src == OP_J) { + /* conditional jumps */ + bool jump = false; + switch (dst) { + case 0b000: jump = (FLAG_GET(e, F_Z) == 0); break; /* JNZ */ + case 0b001: jump = (FLAG_GET(e, F_Z) != 0); break; /* JZ */ + case 0b010: jump = (FLAG_GET(e, F_CY) == 0); break;/* JNC */ + case 0b011: jump = (FLAG_GET(e, F_CY) != 0); break;/* JC */ + case 0b100: jump = (FLAG_GET(e, F_P) == 0); break; /* JPO */ + case 0b101: jump = (FLAG_GET(e, F_P) != 0); break; /* JPE */ + case 0b110: jump = (FLAG_GET(e, F_S) == 0); break; /* JP */ + case 0b111: jump = (FLAG_GET(e, F_S) != 0); break; /* JM */ + } - default: - e->pc++; - break; + if (jump) { + uint16_t addr = (uint16_t)e->mem[e->pc + 1] | + ((uint16_t)e->mem[e->pc + 2] << 8); + e->pc = addr; + } else { + e->pc += 3; + } + } else { + e->pc += 1; } break; } diff --git a/font/LICENSE.txt b/font/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/font/SpecialElite-Regular.ttf b/font/SpecialElite-Regular.ttf Binary files differ. diff --git a/font/SpecialElite-Regular.ttf.import b/font/SpecialElite-Regular.ttf.import @@ -0,0 +1,36 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://ce3nyd6xn2div" +path="res://.godot/imported/SpecialElite-Regular.ttf-3acc620b727ecb79be5c327009bb8bd2.fontdata" + +[deps] + +source_file="res://font/SpecialElite-Regular.ttf" +dest_files=["res://.godot/imported/SpecialElite-Regular.ttf-3acc620b727ecb79be5c327009bb8bd2.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/font/times.ttf b/font/times.ttf Binary files differ. diff --git a/font/times.ttf.import b/font/times.ttf.import @@ -0,0 +1,36 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://uwtk2bw1k3y" +path="res://.godot/imported/times.ttf-091f50826e81af89c0e1027b38179869.fontdata" + +[deps] + +source_file="res://font/times.ttf" +dest_files=["res://.godot/imported/times.ttf-091f50826e81af89c0e1027b38179869.fontdata"] + +[params] + +Rendering=null +antialiasing=0 +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/lamp.png.import b/lamp.png.import @@ -1,40 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://bb5mof51kodyv" -path="res://.godot/imported/lamp.png-a09bb450d3eef19f1d08c9cf2f65382f.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://lamp.png" -dest_files=["res://.godot/imported/lamp.png-a09bb450d3eef19f1d08c9cf2f65382f.ctex"] - -[params] - -compress/mode=0 -compress/high_quality=false -compress/lossy_quality=0.7 -compress/uastc_level=0 -compress/rdo_quality_loss=0.0 -compress/hdr_compression=1 -compress/normal_map=0 -compress/channel_pack=0 -mipmaps/generate=false -mipmaps/limit=-1 -roughness/mode=0 -roughness/src_normal="" -process/channel_remap/red=0 -process/channel_remap/green=1 -process/channel_remap/blue=2 -process/channel_remap/alpha=3 -process/fix_alpha_border=true -process/premult_alpha=false -process/normal_map_invert_y=false -process/hdr_as_srgb=false -process/hdr_clamp_exposure=false -process/size_limit=0 -detect_3d/compress_to=1 diff --git a/main.tscn b/main.tscn @@ -1,84 +1,56 @@ [gd_scene format=3 uid="uid://ct47fh1ow17f"] -[ext_resource type="Texture2D" uid="uid://osbck513ghe3" path="res://computer.png" id="1_ig7tw"] -[ext_resource type="Script" uid="uid://cgdypxcbuexde" path="res://computer_interface.cs" id="2_0xm2m"] -[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="Texture2D" uid="uid://bqdsxdbpsw1vy" path="res://sprites/computer.png" id="1_h2yge"] +[ext_resource type="Script" uid="uid://b3mumd6nxk8ra" path="res://scripts/computer_interface.cs" id="2_lquwl"] +[ext_resource type="Texture2D" uid="uid://dsa8s3u28tygc" path="res://sprites/paper.png" id="3_1bvp3"] +[ext_resource type="Texture2D" uid="uid://cwvaat5d6g38c" path="res://sprites/lamp.png" id="3_272bh"] +[ext_resource type="Script" uid="uid://cy0elk1grlarl" path="res://scripts/book_target.cs" id="4_7mycd"] +[ext_resource type="Script" uid="uid://dlmelys4j7t4d" path="res://scripts/book_page.cs" id="5_5vw27"] +[ext_resource type="Texture2D" uid="uid://dpmottv7bqprd" path="res://sprites/book.png" id="5_272bh"] +[ext_resource type="FontFile" uid="uid://ce3nyd6xn2div" path="res://font/SpecialElite-Regular.ttf" id="6_7mycd"] +[ext_resource type="FontFile" uid="uid://uwtk2bw1k3y" path="res://font/times.ttf" id="9_kek77"] -[sub_resource type="LabelSettings" id="LabelSettings_7mycd"] -font_size = 8 - -[sub_resource type="LabelSettings" id="LabelSettings_272bh"] -font_size = 8 - -[sub_resource type="LabelSettings" id="LabelSettings_5vw27"] -line_spacing = -8.0 -font_size = 9 - -[sub_resource type="LabelSettings" id="LabelSettings_1bvp3"] -line_spacing = -8.0 -font_size = 9 - -[sub_resource type="LabelSettings" id="LabelSettings_h2yge"] -line_spacing = -4.0 -font_size = 8 - -[sub_resource type="LabelSettings" id="LabelSettings_lquwl"] -line_spacing = -4.0 -font_size = 8 +[sub_resource type="LabelSettings" id="LabelSettings_a5vro"] +line_spacing = 0.0 +font = ExtResource("9_kek77") +font_size = 64 -[sub_resource type="LabelSettings" id="LabelSettings_xpk6w"] +[sub_resource type="LabelSettings" id="LabelSettings_uxn5m"] line_spacing = 0.0 -font_size = 8 +font = ExtResource("9_kek77") +font_size = 24 [sub_resource type="LabelSettings" id="LabelSettings_kek77"] line_spacing = 0.0 +font = ExtResource("6_7mycd") font_size = 8 +font_color = Color(0, 0, 0, 1) -[sub_resource type="FontFile" id="FontFile_qbpvq"] -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"] +[sub_resource type="LabelSettings" id="LabelSettings_4c57u"] line_spacing = 0.0 -font = SubResource("FontFile_qbpvq") -font_size = 8 +font = ExtResource("9_kek77") +font_size = 32 font_color = Color(0, 0, 0, 1) +shadow_size = 0 [sub_resource type="RectangleShape2D" id="RectangleShape2D_a5vro"] -size = Vector2(206, 590) +size = Vector2(618, 487.33334) [node name="main" type="Node2D" unique_id=1804574269] [node name="cam" type="Camera2D" parent="." unique_id=1611617563] -zoom = Vector2(1.5, 1.5) [node name="computer" type="Sprite2D" parent="." unique_id=1267147980 node_paths=PackedStringArray("buttons", "lamp_current_instruction", "lamp_addr", "button_off_on", "button_stop", "button_run", "button_single_step", "button_examine", "button_examine_next", "button_deposit", "button_deposit_next", "button_reset", "button_clear")] -position = Vector2(-355, -141) -texture = ExtResource("1_ig7tw") +position = Vector2(-710, -282) +scale = Vector2(2, 2) +texture = ExtResource("1_h2yge") centered = false -script = ExtResource("2_0xm2m") +script = ExtResource("2_lquwl") buttons = [NodePath("buttons/0"), NodePath("buttons/1"), NodePath("buttons/2"), NodePath("buttons/3"), NodePath("buttons/4"), NodePath("buttons/5"), NodePath("buttons/6"), NodePath("buttons/7"), NodePath("buttons/8"), NodePath("buttons/9"), NodePath("buttons/10"), NodePath("buttons/11"), NodePath("buttons/12"), NodePath("buttons/13"), NodePath("buttons/14"), NodePath("buttons/15")] lamp_current_instruction = [NodePath("lamps_data/0"), NodePath("lamps_data/1"), NodePath("lamps_data/2"), NodePath("lamps_data/3"), NodePath("lamps_data/4"), NodePath("lamps_data/5"), NodePath("lamps_data/6"), NodePath("lamps_data/7")] lamp_addr = [NodePath("lamps_addr/0"), NodePath("lamps_addr/1"), NodePath("lamps_addr/2"), NodePath("lamps_addr/3"), NodePath("lamps_addr/4"), NodePath("lamps_addr/5"), NodePath("lamps_addr/6"), NodePath("lamps_addr/7"), NodePath("lamps_addr/8"), NodePath("lamps_addr/9"), NodePath("lamps_addr/10"), NodePath("lamps_addr/11"), NodePath("lamps_addr/12"), NodePath("lamps_addr/13"), NodePath("lamps_addr/14"), NodePath("lamps_addr/15")] +lamp_on = Color(1, 1, 1, 1) +lamp_off = Color(0, 0, 0, 1) button_off_on = NodePath("control/on_off") button_stop = NodePath("control/stop") button_run = NodePath("control/run") @@ -96,42 +68,113 @@ position = Vector2(274, 51) [node name="0" type="Sprite2D" parent="computer/lamps_data" unique_id=208655575] position = Vector2(261, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_data/0" unique_id=1726631500] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "D0 +" +label_settings = SubResource("LabelSettings_a5vro") [node name="1" type="Sprite2D" parent="computer/lamps_data" unique_id=1215730673] position = Vector2(237, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_data/1" unique_id=1675454148] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "D1 +" +label_settings = SubResource("LabelSettings_a5vro") [node name="2" type="Sprite2D" parent="computer/lamps_data" unique_id=930259770] position = Vector2(213, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_data/2" unique_id=32603783] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "D2" +label_settings = SubResource("LabelSettings_a5vro") [node name="3" type="Sprite2D" parent="computer/lamps_data" unique_id=519104149] position = Vector2(189, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_data/3" unique_id=314246776] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "D3 +" +label_settings = SubResource("LabelSettings_a5vro") [node name="4" type="Sprite2D" parent="computer/lamps_data" unique_id=243385059] position = Vector2(165, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_data/4" unique_id=2032037997] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "D4 +" +label_settings = SubResource("LabelSettings_a5vro") [node name="5" type="Sprite2D" parent="computer/lamps_data" unique_id=981124598] position = Vector2(141, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_data/5" unique_id=1258545799] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "D5 +" +label_settings = SubResource("LabelSettings_a5vro") [node name="6" type="Sprite2D" parent="computer/lamps_data" unique_id=221933103] position = Vector2(117, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_data/6" unique_id=167357648] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "D6 +" +label_settings = SubResource("LabelSettings_a5vro") [node name="7" type="Sprite2D" parent="computer/lamps_data" unique_id=1641223163] position = Vector2(93, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_data/7" unique_id=722737593] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "D7 +" +label_settings = SubResource("LabelSettings_a5vro") [node name="lamps_addr" type="Node2D" parent="computer" unique_id=1734725300] position = Vector2(274, 76) @@ -139,82 +182,224 @@ position = Vector2(274, 76) [node name="0" type="Sprite2D" parent="computer/lamps_addr" unique_id=1911411271] position = Vector2(261, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_addr/0" unique_id=1579766318] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "A0 +" +label_settings = SubResource("LabelSettings_a5vro") [node name="1" type="Sprite2D" parent="computer/lamps_addr" unique_id=2009264748] position = Vector2(237, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_addr/1" unique_id=1106498738] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "A1 +" +label_settings = SubResource("LabelSettings_a5vro") [node name="2" type="Sprite2D" parent="computer/lamps_addr" unique_id=307082814] position = Vector2(213, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_addr/2" unique_id=1388525364] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "A2 +" +label_settings = SubResource("LabelSettings_a5vro") [node name="3" type="Sprite2D" parent="computer/lamps_addr" unique_id=339122357] position = Vector2(189, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_addr/3" unique_id=604551364] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "A3 +" +label_settings = SubResource("LabelSettings_a5vro") [node name="4" type="Sprite2D" parent="computer/lamps_addr" unique_id=1864714391] position = Vector2(165, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_addr/4" unique_id=633336564] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "A4 +" +label_settings = SubResource("LabelSettings_a5vro") [node name="5" type="Sprite2D" parent="computer/lamps_addr" unique_id=140769146] position = Vector2(141, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_addr/5" unique_id=843605357] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "A5 +" +label_settings = SubResource("LabelSettings_a5vro") [node name="6" type="Sprite2D" parent="computer/lamps_addr" unique_id=1138734365] position = Vector2(117, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_addr/6" unique_id=604413795] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "A6 +" +label_settings = SubResource("LabelSettings_a5vro") [node name="7" type="Sprite2D" parent="computer/lamps_addr" unique_id=1284145815] position = Vector2(93, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_addr/7" unique_id=228856863] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "A7 +" +label_settings = SubResource("LabelSettings_a5vro") [node name="8" type="Sprite2D" parent="computer/lamps_addr" unique_id=1370430321] position = Vector2(69, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_addr/8" unique_id=349899222] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "A8 +" +label_settings = SubResource("LabelSettings_a5vro") [node name="9" type="Sprite2D" parent="computer/lamps_addr" unique_id=1368353718] position = Vector2(45, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_addr/9" unique_id=1365998183] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "A9 +" +label_settings = SubResource("LabelSettings_a5vro") [node name="10" type="Sprite2D" parent="computer/lamps_addr" unique_id=95336119] position = Vector2(21, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_addr/10" unique_id=702407577] +offset_left = -42.0 +offset_top = -84.0 +offset_right = 50.0 +offset_bottom = 60.0 +text = "AA +" +label_settings = SubResource("LabelSettings_a5vro") [node name="11" type="Sprite2D" parent="computer/lamps_addr" unique_id=1761830216] position = Vector2(-3, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_addr/11" unique_id=1929700766] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "AB +" +label_settings = SubResource("LabelSettings_a5vro") [node name="12" type="Sprite2D" parent="computer/lamps_addr" unique_id=446232673] position = Vector2(-27, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_addr/12" unique_id=572153376] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "AC" +label_settings = SubResource("LabelSettings_a5vro") [node name="13" type="Sprite2D" parent="computer/lamps_addr" unique_id=1509287834] position = Vector2(-51, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_addr/13" unique_id=1483775890] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "AD +" +label_settings = SubResource("LabelSettings_a5vro") [node name="14" type="Sprite2D" parent="computer/lamps_addr" unique_id=2063842413] position = Vector2(-75, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_addr/14" unique_id=955073979] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "AE" +label_settings = SubResource("LabelSettings_a5vro") [node name="15" type="Sprite2D" parent="computer/lamps_addr" unique_id=301037469] position = Vector2(-99, 8) scale = Vector2(0.25, 0.25) -texture = ExtResource("3_h2yge") +texture = ExtResource("3_272bh") + +[node name="Label" type="Label" parent="computer/lamps_addr/15" unique_id=1690630858] +offset_left = -38.0 +offset_top = -86.0 +offset_right = 40.0 +offset_bottom = 58.0 +text = "AF +" +label_settings = SubResource("LabelSettings_a5vro") [node name="buttons" type="Node2D" parent="computer" unique_id=733435300] position = Vector2(163, 137) @@ -225,6 +410,7 @@ offset_right = 404.0 offset_bottom = 24.0 rotation = 4.712389 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="1" type="CheckButton" parent="computer/buttons" unique_id=862879246] offset_left = 336.0 @@ -232,6 +418,7 @@ offset_right = 380.0 offset_bottom = 24.0 rotation = 4.712389 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="2" type="CheckButton" parent="computer/buttons" unique_id=70508066] offset_left = 312.0 @@ -239,6 +426,7 @@ offset_right = 356.0 offset_bottom = 24.0 rotation = 4.712389 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="3" type="CheckButton" parent="computer/buttons" unique_id=2099906965] offset_left = 288.0 @@ -246,6 +434,7 @@ offset_right = 332.0 offset_bottom = 24.0 rotation = 4.712389 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="4" type="CheckButton" parent="computer/buttons" unique_id=1943659506] offset_left = 264.0 @@ -253,6 +442,7 @@ offset_right = 308.0 offset_bottom = 24.0 rotation = 4.712389 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="5" type="CheckButton" parent="computer/buttons" unique_id=2076865949] offset_left = 240.0 @@ -260,6 +450,7 @@ offset_right = 284.0 offset_bottom = 24.0 rotation = 4.712389 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="6" type="CheckButton" parent="computer/buttons" unique_id=1421105136] offset_left = 216.0 @@ -267,6 +458,7 @@ offset_right = 260.0 offset_bottom = 24.0 rotation = 4.712389 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="7" type="CheckButton" parent="computer/buttons" unique_id=1283918352] offset_left = 192.0 @@ -274,6 +466,7 @@ offset_right = 236.0 offset_bottom = 24.0 rotation = 4.712389 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="8" type="CheckButton" parent="computer/buttons" unique_id=210349797] offset_left = 168.0 @@ -281,6 +474,7 @@ offset_right = 212.0 offset_bottom = 24.0 rotation = 4.712389 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="9" type="CheckButton" parent="computer/buttons" unique_id=313744853] offset_left = 144.0 @@ -288,6 +482,7 @@ offset_right = 188.0 offset_bottom = 24.0 rotation = 4.712389 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="10" type="CheckButton" parent="computer/buttons" unique_id=1404060575] offset_left = 120.0 @@ -295,6 +490,7 @@ offset_right = 164.0 offset_bottom = 24.0 rotation = 4.712389 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="11" type="CheckButton" parent="computer/buttons" unique_id=760018466] offset_left = 96.0 @@ -302,6 +498,7 @@ offset_right = 140.0 offset_bottom = 24.0 rotation = 4.712389 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="12" type="CheckButton" parent="computer/buttons" unique_id=1690503583] offset_left = 72.0 @@ -309,6 +506,7 @@ offset_right = 116.0 offset_bottom = 24.0 rotation = 4.712389 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="13" type="CheckButton" parent="computer/buttons" unique_id=695745454] offset_left = 48.0 @@ -316,6 +514,7 @@ offset_right = 92.0 offset_bottom = 24.0 rotation = 4.712389 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="14" type="CheckButton" parent="computer/buttons" unique_id=1336488479] offset_left = 24.0 @@ -323,12 +522,14 @@ offset_right = 68.0 offset_bottom = 24.0 rotation = 4.712389 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="15" type="CheckButton" parent="computer/buttons" unique_id=325488317] offset_right = 44.0 offset_bottom = 24.0 rotation = 4.712389 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="control" type="Node2D" parent="computer" unique_id=1094110876] position = Vector2(355, 163) @@ -340,28 +541,40 @@ offset_right = -261.0 offset_bottom = 11.000001 rotation = 1.5707964 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="off" type="Label" parent="computer/control/on_off" unique_id=887485295] -layout_mode = 0 +layout_mode = 1 +anchors_preset = -1 +anchor_left = -0.09090909 +anchor_top = 0.125 +anchor_right = 0.22727273 +anchor_bottom = 0.33333316 offset_left = -3.0 offset_top = 19.000004 offset_right = 27.0 offset_bottom = 42.000008 rotation = -1.5707964 -mouse_filter = 1 +scale = Vector2(0.5, 0.5) text = "OFF" -label_settings = SubResource("LabelSettings_7mycd") +label_settings = SubResource("LabelSettings_uxn5m") +metadata/_edit_use_anchors_ = true [node name="on" type="Label" parent="computer/control/on_off" unique_id=965272764] -layout_mode = 0 +layout_mode = 1 +anchors_preset = -1 +anchor_top = 0.083333336 +anchor_right = 0.3409091 +anchor_bottom = 0.29166666 offset_left = 36.0 offset_top = 18.0 offset_right = 56.0 offset_bottom = 41.0 rotation = -1.5707964 -mouse_filter = 1 +scale = Vector2(0.5, 0.5) text = "ON" -label_settings = SubResource("LabelSettings_272bh") +label_settings = SubResource("LabelSettings_uxn5m") +metadata/_edit_use_anchors_ = true [node name="stop" type="Button" parent="computer/control" unique_id=886115773] offset_left = -188.0 @@ -369,17 +582,23 @@ offset_top = -5.999999 offset_right = -172.0 offset_bottom = 10.000001 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="text" type="Label" parent="computer/control/stop" unique_id=1984568674] -layout_mode = 0 +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.21875 +anchor_right = 1.28125 +anchor_bottom = 0.3125 offset_left = -11.0 offset_top = -12.0 offset_right = 30.0 offset_bottom = 11.0 -mouse_filter = 1 +scale = Vector2(0.5, 0.5) text = "STOP" -label_settings = SubResource("LabelSettings_5vw27") +label_settings = SubResource("LabelSettings_uxn5m") horizontal_alignment = 1 +metadata/_edit_use_anchors_ = true [node name="run" type="Button" parent="computer/control" unique_id=214883096] offset_left = -188.0 @@ -387,36 +606,50 @@ offset_top = 11.000001 offset_right = -172.0 offset_bottom = 27.0 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="text" type="Label" parent="computer/control/run" unique_id=1347445060] -layout_mode = 0 +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.34375 +anchor_top = 0.15625001 +anchor_right = 0.96875 +anchor_bottom = 0.46875003 offset_left = -11.0 offset_top = 13.0 offset_right = 30.0 offset_bottom = 36.0 -mouse_filter = 1 +scale = Vector2(0.5, 0.5) text = "RUN" -label_settings = SubResource("LabelSettings_1bvp3") +label_settings = SubResource("LabelSettings_uxn5m") horizontal_alignment = 1 +metadata/_edit_use_anchors_ = true [node name="s_step" type="Button" parent="computer/control" unique_id=1023167207] -offset_left = -133.0 -offset_top = 2.000001 -offset_right = -117.0 -offset_bottom = 18.0 +offset_left = -135.0 +offset_top = 10.000001 +offset_right = -119.0 +offset_bottom = 26.0 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="text" type="Label" parent="computer/control/s_step" unique_id=822028633] -layout_mode = 0 +layout_mode = 1 +anchors_preset = -1 +anchor_left = -0.0625 +anchor_top = -0.56250006 +anchor_right = 2.625 +anchor_bottom = 1.3125001 offset_left = -12.0 offset_top = -19.0 offset_right = 30.0 offset_bottom = 7.0 -mouse_filter = 1 +scale = Vector2(0.5, 0.5) text = "SINGLE STEP" -label_settings = SubResource("LabelSettings_h2yge") +label_settings = SubResource("LabelSettings_uxn5m") horizontal_alignment = 1 +metadata/_edit_use_anchors_ = true [node name="examine" type="Button" parent="computer/control" unique_id=296196073] offset_left = -76.0 @@ -424,6 +657,7 @@ offset_top = -5.999999 offset_right = -60.0 offset_bottom = 10.000001 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="text" type="Label" parent="computer/control/examine" unique_id=1867917591] layout_mode = 0 @@ -431,10 +665,11 @@ offset_left = -17.0 offset_top = -14.0 offset_right = 36.0 offset_bottom = 9.0 -mouse_filter = 1 +scale = Vector2(0.5, 0.5) text = "EXAMINE" -label_settings = SubResource("LabelSettings_1bvp3") +label_settings = SubResource("LabelSettings_uxn5m") horizontal_alignment = 1 +metadata/_edit_use_anchors_ = true [node name="examine_n" type="Button" parent="computer/control" unique_id=107187658] offset_left = -76.0 @@ -442,6 +677,7 @@ offset_top = 11.000001 offset_right = -60.0 offset_bottom = 27.0 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="text" type="Label" parent="computer/control/examine_n" unique_id=551910634] layout_mode = 0 @@ -449,11 +685,12 @@ offset_left = -17.0 offset_top = 12.0 offset_right = 36.0 offset_bottom = 46.0 -mouse_filter = 1 +scale = Vector2(0.5, 0.5) text = "EXAMINE NEXT" -label_settings = SubResource("LabelSettings_lquwl") +label_settings = SubResource("LabelSettings_uxn5m") horizontal_alignment = 1 +metadata/_edit_use_anchors_ = true [node name="deposit" type="Button" parent="computer/control" unique_id=1692201661] offset_left = -11.0 @@ -461,17 +698,23 @@ offset_top = -5.999999 offset_right = 5.0 offset_bottom = 10.000001 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="text" type="Label" parent="computer/control/deposit" unique_id=1183008914] -layout_mode = 0 +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.15625 +anchor_right = 3.03125 +anchor_bottom = 0.3125 offset_left = -20.0 offset_top = -13.0 offset_right = 33.0 offset_bottom = 10.0 -mouse_filter = 1 +scale = Vector2(0.5, 0.5) text = "DEPOSIT" -label_settings = SubResource("LabelSettings_1bvp3") +label_settings = SubResource("LabelSettings_uxn5m") horizontal_alignment = 1 +metadata/_edit_use_anchors_ = true [node name="deposit_n" type="Button" parent="computer/control" unique_id=845138324] offset_left = -11.0 @@ -479,18 +722,24 @@ offset_top = 11.000001 offset_right = 5.0 offset_bottom = 27.0 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="text" type="Label" parent="computer/control/deposit_n" unique_id=926335548] -layout_mode = 0 +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.15625 +anchor_right = 3.03125 +anchor_bottom = 1.3750001 offset_left = -17.0 offset_top = 12.0 offset_right = 36.0 offset_bottom = 46.0 -mouse_filter = 1 +scale = Vector2(0.5, 0.5) text = "DEPOSIT NEXT" -label_settings = SubResource("LabelSettings_lquwl") +label_settings = SubResource("LabelSettings_uxn5m") horizontal_alignment = 1 +metadata/_edit_use_anchors_ = true [node name="reset" type="Button" parent="computer/control" unique_id=1280760691] offset_left = 52.0 @@ -498,17 +747,23 @@ offset_top = -5.999999 offset_right = 68.0 offset_bottom = 10.000001 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="text" type="Label" parent="computer/control/reset" unique_id=1297615840] -layout_mode = 0 +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.34375 +anchor_right = 1.59375 +anchor_bottom = 0.3125 offset_left = -16.0 offset_top = -12.0 offset_right = 37.0 offset_bottom = 11.0 -mouse_filter = 1 +scale = Vector2(0.5, 0.5) text = "RESET" -label_settings = SubResource("LabelSettings_1bvp3") +label_settings = SubResource("LabelSettings_uxn5m") horizontal_alignment = 1 +metadata/_edit_use_anchors_ = true [node name="clr" type="Button" parent="computer/control" unique_id=1324293289] offset_left = 52.0 @@ -516,59 +771,55 @@ offset_top = 11.000001 offset_right = 68.0 offset_bottom = 27.0 mouse_filter = 1 +metadata/_edit_use_anchors_ = true [node name="text" type="Label" parent="computer/control/clr" unique_id=2030335195] -layout_mode = 0 +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.8125 +anchor_top = 0.06250001 +anchor_right = 0.8125 +anchor_bottom = 1.4375001 offset_left = -19.0 offset_top = 14.0 offset_right = 34.0 offset_bottom = 48.0 -mouse_filter = 1 +scale = Vector2(0.5, 0.5) text = "CLR " -label_settings = SubResource("LabelSettings_lquwl") -horizontal_alignment = 1 - -[node name="d0-7" type="Label" parent="computer" unique_id=731723272] -offset_left = 363.0 -offset_top = 42.0 -offset_right = 541.0 -offset_bottom = 65.0 -mouse_filter = 1 -text = "D7 D6 D5 D4 D3 D2 D1 D0" -label_settings = SubResource("LabelSettings_xpk6w") -horizontal_alignment = 1 - -[node name="a0-15" type="Label" parent="computer" unique_id=554604991] -offset_left = 165.0 -offset_top = 67.0 -offset_right = 534.0 -offset_bottom = 90.0 -mouse_filter = 1 -text = "A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0" -label_settings = SubResource("LabelSettings_kek77") +label_settings = SubResource("LabelSettings_uxn5m") horizontal_alignment = 1 +metadata/_edit_use_anchors_ = true -[node name="paper" type="Area2D" parent="." unique_id=1717261404] +[node name="book" type="Area2D" parent="." unique_id=1717261404] z_index = 1 -position = Vector2(0, 349) -script = ExtResource("4_lquwl") -offset = -300.0 - -[node name="doc" type="Sprite2D" parent="paper" unique_id=1634288699] -texture = ExtResource("4_1bvp3") - -[node name="header" type="Label" parent="paper/doc" unique_id=2038232969] +position = Vector2(0, 800) +scale = Vector2(1.5, 1.5) +script = ExtResource("4_7mycd") +offset = -600.0 + +[node name="script" type="Node" parent="book" unique_id=1593142132 node_paths=PackedStringArray("button_next_page", "button_prev_page", "left_page_label", "right_page_label")] +script = ExtResource("5_5vw27") +button_next_page = NodePath("../button_next_page") +button_prev_page = NodePath("../button_prev_page") +left_page_label = NodePath("../left") +right_page_label = NodePath("../right") + +[node name="doc" type="Sprite2D" parent="book" unique_id=1634288699] +visible = false +texture = ExtResource("3_1bvp3") + +[node name="header" type="Label" parent="book/doc" unique_id=2038232969] offset_left = -99.0 offset_top = -141.0 offset_right = 101.0 offset_bottom = -133.0 mouse_filter = 1 text = "DOCUMENTATION" -label_settings = SubResource("LabelSettings_a5vro") +label_settings = SubResource("LabelSettings_kek77") horizontal_alignment = 1 -[node name="system" type="Label" parent="paper/doc" unique_id=1094384802] +[node name="system" type="Label" parent="book/doc" unique_id=1094384802] offset_left = -100.0 offset_top = -133.0 offset_right = 100.0 @@ -580,9 +831,9 @@ EXAMINE/NEXT - Change current address and show data from memory by address DEPOSIT/NEXT - Load data in memory by address RESET - Set address to 0x0000" -label_settings = SubResource("LabelSettings_a5vro") +label_settings = SubResource("LabelSettings_kek77") -[node name="registers" type="Label" parent="paper/doc" unique_id=1958491991] +[node name="registers" type="Label" parent="book/doc" unique_id=1958491991] offset_left = -100.0 offset_top = -80.0 offset_right = 100.0 @@ -597,9 +848,9 @@ text = "NAME OPCODE H 100 L 101 M 110" -label_settings = SubResource("LabelSettings_a5vro") +label_settings = SubResource("LabelSettings_kek77") -[node name="opcode" type="Label" parent="paper/doc" unique_id=720962544] +[node name="opcode" type="Label" parent="book/doc" unique_id=720962544] offset_left = -100.0 offset_top = -8.0 offset_right = 100.0 @@ -611,9 +862,9 @@ text = "NAME OPCODE DESCRIPTION STA 00110010 move to memory HLT 01110110 halt machine " -label_settings = SubResource("LabelSettings_a5vro") +label_settings = SubResource("LabelSettings_kek77") -[node name="example program" type="Label" parent="paper/doc" unique_id=702865304] +[node name="example program" type="Label" parent="book/doc" unique_id=702865304] offset_left = -100.0 offset_top = 32.0 offset_right = 100.0 @@ -632,8 +883,55 @@ text = "Example program: 0008 00000000 01 0009 00010000 10 000A 01110110 HLT" -label_settings = SubResource("LabelSettings_a5vro") +label_settings = SubResource("LabelSettings_kek77") -[node name="collision" type="CollisionShape2D" parent="paper" unique_id=1149371540] -position = Vector2(0, 148.5) +[node name="book" type="Sprite2D" parent="book" unique_id=75626602] +scale = Vector2(0.75, 0.75) +texture = ExtResource("5_272bh") + +[node name="left" type="Label" parent="book" unique_id=1159612953] +offset_left = -292.6667 +offset_top = -209.33334 +offset_right = 272.6667 +offset_bottom = 628.0 +scale = Vector2(0.5, 0.5) +label_settings = SubResource("LabelSettings_4c57u") + +[node name="right" type="Label" parent="book" unique_id=686626562] +offset_left = 7.3333435 +offset_top = -209.33334 +offset_right = 582.0 +offset_bottom = 626.6666 +scale = Vector2(0.5, 0.5) +label_settings = SubResource("LabelSettings_4c57u") + +[node name="block" type="Button" parent="book" unique_id=1351809403] +offset_left = -154.0 +offset_top = -108.0 +offset_right = 154.66669 +offset_bottom = 108.66667 +mouse_filter = 1 +flat = true + +[node name="button_next_page" type="Button" parent="book" unique_id=1735437504] +offset_left = 4.666668 +offset_top = -207.33333 +offset_right = 293.33334 +offset_bottom = 191.33336 +mouse_filter = 1 +action_mode = 0 +flat = true + +[node name="button_prev_page" type="Button" parent="book" unique_id=1151481640] +offset_left = -298.6667 +offset_top = -208.66667 +offset_right = -2.666687 +offset_bottom = 208.66664 +mouse_filter = 1 +action_mode = 0 +flat = true + +[node name="collision" type="CollisionShape2D" parent="book" unique_id=1149371540] +position = Vector2(-1, 27.000015) shape = SubResource("RectangleShape2D_a5vro") +debug_color = Color(0, 0.6, 0.69803923, 0) diff --git a/paper.png.import b/paper.png.import @@ -1,40 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://blxdcjt4qu82c" -path="res://.godot/imported/paper.png-7786f1cec57caf764293039fee58b648.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://paper.png" -dest_files=["res://.godot/imported/paper.png-7786f1cec57caf764293039fee58b648.ctex"] - -[params] - -compress/mode=0 -compress/high_quality=false -compress/lossy_quality=0.7 -compress/uastc_level=0 -compress/rdo_quality_loss=0.0 -compress/hdr_compression=1 -compress/normal_map=0 -compress/channel_pack=0 -mipmaps/generate=false -mipmaps/limit=-1 -roughness/mode=0 -roughness/src_normal="" -process/channel_remap/red=0 -process/channel_remap/green=1 -process/channel_remap/blue=2 -process/channel_remap/alpha=3 -process/fix_alpha_border=true -process/premult_alpha=false -process/normal_map_invert_y=false -process/hdr_as_srgb=false -process/hdr_clamp_exposure=false -process/size_limit=0 -detect_3d/compress_to=1 diff --git a/paper_list.cs b/paper_list.cs @@ -1,34 +0,0 @@ -using Godot; - -public partial class paper_list : Area2D { - -[Export] public -float offset = 300f; -[Export] public -float speed = 5f; - -float init_y; -float target_y; - -public override void _Ready() { - init_y = Position.Y; - target_y = init_y; - - MouseEntered += on_enter; - MouseExited += on_exited; -} - -public override void _Process(double delta) { - float y = Mathf.Lerp(Position.Y, target_y, speed * (float)delta); - Position = new Vector2(Position.X, y); -} - -void on_enter() { - target_y = init_y + offset; -} - -void on_exited() { - target_y = init_y; -} - -} diff --git a/paper_list.cs.uid b/paper_list.cs.uid @@ -1 +0,0 @@ -uid://b6lty8spdabbf diff --git a/project.godot b/project.godot @@ -13,17 +13,26 @@ config_version=5 config/name="old-pc-simulator" run/main_scene="uid://ct47fh1ow17f" config/features=PackedStringArray("4.7", "C#", "Forward Plus") +run/max_fps=60 config/icon="res://icon.svg" [display] -window/stretch/mode="canvas_items" -window/stretch/aspect="expand" +window/size/viewport_width=1920 +window/size/viewport_height=1080 [dotnet] project/assembly_name="old-pc-simulator" +[gui] + +theme/default_font_generate_mipmaps=true + +[internationalization] + +rendering/text_driver="ICU / HarfBuzz / Graphite (Built-in)" + [physics] 3d/physics_engine="Jolt Physics" @@ -31,3 +40,5 @@ project/assembly_name="old-pc-simulator" [rendering] rendering_device/driver.windows="d3d12" +2d/sdf/oversize=3 +2d/sdf/scale=0 diff --git a/scripts/book_page.cs b/scripts/book_page.cs @@ -0,0 +1,58 @@ +using Godot; + +public partial class book_page : Node { + +struct page { + public string source_left; + public string source_right; +} + +[Export] public +Button button_next_page; +[Export] public +Button button_prev_page; + +[Export] public +Label left_page_label; +[Export] public +Label right_page_label; + +page[] pages = new page[] { + new page { + source_left = + "\n", + source_right = + "\n" + }, +}; + +int current_page; + +public override void _Ready() { + if (button_next_page != null) button_next_page.Pressed += next_page; + if (button_prev_page != null) button_prev_page.Pressed += prev_page; + + update_page(); +} + +void next_page() { + if (current_page > pages.Length - 1) return; + current_page++; + update_page(); +} + +void prev_page() { + if (current_page < 0) return; + current_page--; + update_page(); +} + +void update_page() { + if (left_page_label != null) + left_page_label.Text = pages[current_page].source_left; + + if (right_page_label != null) + right_page_label.Text = pages[current_page].source_right; +} + +} diff --git a/scripts/book_page.cs.uid b/scripts/book_page.cs.uid @@ -0,0 +1 @@ +uid://dlmelys4j7t4d diff --git a/scripts/book_target.cs b/scripts/book_target.cs @@ -0,0 +1,34 @@ +using Godot; + +public partial class book_target : Area2D { + +[Export] public +float offset = -300f; +[Export] public +float speed = 5f; + +float init_y; +float target_y; + +public override void _Ready() { + init_y = Position.Y; + target_y = init_y; + + MouseEntered += on_enter; + MouseExited += on_exited; +} + +public override void _Process(double delta) { + float y = Mathf.Lerp(Position.Y, target_y, speed * (float)delta); + Position = new Vector2(Position.X, y); +} + +void on_enter() { + target_y = init_y + offset; +} + +void on_exited() { + target_y = init_y; +} + +} diff --git a/scripts/book_target.cs.uid b/scripts/book_target.cs.uid @@ -0,0 +1 @@ +uid://cy0elk1grlarl diff --git a/scripts/computer_interface.cs b/scripts/computer_interface.cs @@ -0,0 +1,209 @@ +using Godot; +using System; +using static emulator; + +public partial class computer_interface : Node { + +const int INDEXES_BUTTON_DATA = 7; +const int INDEXES_BUTTON_ADDR = 15; + +[Export] public Button[] buttons; +[Export] public Sprite2D[] lamp_current_instruction; +[Export] public Sprite2D[] lamp_addr; + +[Export] public Color lamp_on = Colors.Red; +[Export] public Color lamp_off = Colors.DarkGray; + +[Export] public Button button_off_on; +[Export] public Button button_stop; +[Export] public Button button_run; +[Export] public Button button_single_step; +[Export] public Button button_examine; +[Export] public Button button_examine_next; +[Export] public Button button_deposit; +[Export] public Button button_deposit_next; +[Export] public Button button_reset; +[Export] public Button button_clear; + +IntPtr _emu; +ushort curr_addr; +byte curr_instr; +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; + if (button_single_step != null) button_single_step.Pressed += single_step_pressed; + if (button_examine != null) button_examine.Pressed += examine_pressed; + if (button_examine_next != null) button_examine_next.Pressed += examine_next_pressed; + if (button_deposit != null) button_deposit.Pressed += deposit_pressed; + if (button_deposit_next != null) button_deposit_next.Pressed += deposit_next_pressed; + if (button_reset != null) button_reset.Pressed += reset_pressed; + if (button_clear != null) button_clear.Pressed += clear_pressed; + + if (buttons != null) { + for (int i = 0; i < buttons.Length; i++) { + if (buttons[i] != null) { + buttons[i].Pressed += bit_button_pressed; + } + } + } + + update_lamps(); +} + +public override void _Notification(int what) { + if (what == NotificationPredelete) { + emu_destroy(_emu); + } +} + +public override void _Process(double delta) { + if (!worked) return; + + int r = emu_step(_emu); + if (r > 0) { + worked = false; + return; + } + + curr_addr = (ushort)emu_get_pc(_emu); + curr_instr = emu_mem_read(_emu, curr_addr); + + update_lamps(); + + byte reg_a = emu_get_reg(_emu, 0b111); + byte reg_b = emu_get_reg(_emu, 0b000); + byte reg_c = emu_get_reg(_emu, 0b001); + byte reg_d = emu_get_reg(_emu, 0b010); + GD.Print($"opcode=0x{curr_instr:X2}; pc=0x{curr_addr:X4}; a=0x{reg_a:X2}; b=0x{reg_b:X2}; c=0x{reg_c:X2}; d=0x{reg_d:X2}"); +} + +void update_lamps() { + update_data_lamps(curr_instr); + update_addr_lamps(curr_addr); +} + +ushort read_switches_addr() { + byte b0 = assem_byte(buttons, 0, 8); + byte b1 = assem_byte(buttons, 8, 8); + return (ushort)((b1 << 8) | b0); +} + +byte read_switches_data() { + return assem_byte(buttons, 0, INDEXES_BUTTON_DATA + 1); +} + +void bit_button_pressed() { + update_lamps(); +} + +void run_pressed() { + worked = true; +} + +void stop_pressed() { + worked = false; +} + +void single_step_pressed() { + worked = false; + emu_step(_emu); + curr_addr = (ushort)emu_get_pc(_emu); + curr_instr = emu_mem_read(_emu, curr_addr); + update_lamps(); +} + +void examine_pressed() { + worked = false; + curr_addr = read_switches_addr(); + emu_set_pc(_emu, curr_addr); + curr_instr = emu_mem_read(_emu, curr_addr); + update_lamps(); + + GD.Print($"Examine at 0x{curr_addr:X4}: 0x{curr_instr:X2}"); +} + +void examine_next_pressed() { + worked = false; + curr_addr++; + emu_set_pc(_emu, curr_addr); + curr_instr = emu_mem_read(_emu, curr_addr); + update_lamps(); + + GD.Print($"Examine Next at 0x{curr_addr:X4}: 0x{curr_instr:X2}"); +} + +void deposit_pressed() { + worked = false; + byte val = read_switches_data(); + + emu_mem_write(_emu, curr_addr, val); + curr_instr = val; + update_lamps(); + + GD.Print($"Deposit 0x{val:X2} at 0x{curr_addr:X4}"); +} + +void deposit_next_pressed() { + worked = false; + + curr_addr++; + emu_set_pc(_emu, curr_addr); + + byte val = read_switches_data(); + emu_mem_write(_emu, curr_addr, val); + curr_instr = val; + update_lamps(); + + GD.Print($"Deposit Next 0x{val:X2} at 0x{curr_addr:X4}"); +} + +void reset_pressed() { + worked = false; + emu_set_pc(_emu, 0); + curr_addr = 0; + curr_instr = emu_mem_read(_emu, curr_addr); + update_lamps(); +} + +void clear_pressed() { + update_lamps(); +} + +void update_data_lamps(byte value) { + for (int i = 0; i < 8 && i < lamp_current_instruction.Length; i++) { + bool is_bit_set = (value & (1 << i)) != 0; + lamp_current_instruction[i].SelfModulate = is_bit_set ? lamp_on : lamp_off; + } +} + +void update_addr_lamps(ushort value) { + for (int i = 0; i < 16 && i < lamp_addr.Length; i++) { + bool is_bit_set = (value & (1 << i)) != 0; + lamp_addr[i].SelfModulate = is_bit_set ? lamp_on : lamp_off; + } +} + +byte assem_byte(Button[] btns, int offset, int count = 8) { + byte r = 0; + if (btns == null) return r; + + for (int i = 0; i < count && i < 8; i++) { + int index = offset + i; + if (index < btns.Length && btns[index] != null && btns[index].ButtonPressed) { + r |= (byte)(1 << i); + } + } + return r; +} + +} diff --git a/scripts/computer_interface.cs.uid b/scripts/computer_interface.cs.uid @@ -0,0 +1 @@ +uid://b3mumd6nxk8ra diff --git a/emulator.cs b/scripts/emulator.cs diff --git a/scripts/emulator.cs.uid b/scripts/emulator.cs.uid @@ -0,0 +1 @@ +uid://hsy53f0qyiws diff --git a/sprites/book.png b/sprites/book.png Binary files differ. diff --git a/sprites/book.png.import b/sprites/book.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dpmottv7bqprd" +path="res://.godot/imported/book.png-489e9e71f958e2c2e4665e685e425780.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/book.png" +dest_files=["res://.godot/imported/book.png-489e9e71f958e2c2e4665e685e425780.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/computer.png b/sprites/computer.png Binary files differ. diff --git a/sprites/computer.png.import b/sprites/computer.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bqdsxdbpsw1vy" +path="res://.godot/imported/computer.png-292e42d8896a38dde831d612595fd759.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/computer.png" +dest_files=["res://.godot/imported/computer.png-292e42d8896a38dde831d612595fd759.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/lamp.png b/sprites/lamp.png Binary files differ. diff --git a/sprites/lamp.png.import b/sprites/lamp.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cwvaat5d6g38c" +path="res://.godot/imported/lamp.png-e9618a1b36c31f2d31abeef7c1bef4ba.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/lamp.png" +dest_files=["res://.godot/imported/lamp.png-e9618a1b36c31f2d31abeef7c1bef4ba.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/paper.png b/sprites/paper.png Binary files differ. diff --git a/sprites/paper.png.import b/sprites/paper.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dsa8s3u28tygc" +path="res://.godot/imported/paper.png-991709bd6cb2b8ae2aeaa18029a4d78c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/paper.png" +dest_files=["res://.godot/imported/paper.png-991709bd6cb2b8ae2aeaa18029a4d78c.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1