Skip to content

Commit e6b9650

Browse files
Rename OUT_ascii instruction to OUTC and update related methods and documentation
1 parent 203d674 commit e6b9650

4 files changed

Lines changed: 15 additions & 15 deletions

File tree

CentralProcessingUnit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def __init__(
8181
# I/O operations
8282
0x16: ("INP", self.__io_controller.asm_INP, 1),
8383
0x17: ("OUT", self.__io_controller.asm_OUT, 1),
84-
0x18: ("OUT_ascii", self.__io_controller.asm_OUT_ascii, 1),
84+
0x18: ("OUTC", self.__io_controller.asm_OUTC, 1),
8585
}
8686
# Format {code: (type, operand_size_byte)}
8787
self.__operand_type_set: Dict[int, Tuple[str, int]] = {

IO_controller/IoController.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ def asm_OUT(self, register: Register):
1818
self.R2.set(register.get())
1919
print(f"OUT: {register.get()}")
2020

21-
def asm_OUT_ascii(self, register: Register):
21+
def asm_OUTC(self, register: Register):
2222
self.R2.set(register.get())
2323
print(f"OUT: {chr(register.get())}")

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ The virtual CPU implements a simplified architecture with the following componen
3838

3939
- RAM with configurable size (default: 1024 bytes)
4040
- Support for address-based memory access
41-
- Memory tracking to manage used/free space (for now, it only marks memory as used and checks if it is used, but does not free it)
4241

4342
## Bytecode Format
4443

@@ -79,6 +78,7 @@ The virtual CPU implements a simplified architecture with the following componen
7978
| **I/O Operations** |
8079
| 0x16 | INP | `INP Rd` | Read input from user and store in Rd | None |
8180
| 0x17 | OUT | `OUT Rd` | Output value from Rd to console | None |
81+
| 0x18 | OUTC | `OUTC Rd` | Output character from Rd to console | None |
8282

8383
Where:
8484

@@ -154,7 +154,7 @@ my_cpu.run()
154154

155155
1. **Assembler**: Create a tool to translate assembly language into bytecode
156156
2. **Loader**: Implement a loader to load programs from files
157-
3. **Memory Management**: Improve the memory allocation and management system (e.g., free memory)
157+
3. **Memory Management**: Improve the memory allocation and management system (e.g., malloc, free memory)
158158

159159
## Contributing
160160

main.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -273,27 +273,27 @@ def main():
273273
[
274274
# Hello World program
275275
0x02, 0x01, 0x00, 0x48, 0x00, # MOV R0, 72 (H) # fmt: skip
276-
0x18, 0x00, 0x00, # OUT_ascii R0 # fmt: skip
276+
0x18, 0x00, 0x00, # OUTC R0 # fmt: skip
277277
0x02, 0x01, 0x00, 0x65, 0x00, # MOV R0, 101 (e) # fmt: skip
278-
0x18, 0x00, 0x00, # OUT_ascii R0 # fmt: skip
278+
0x18, 0x00, 0x00, # OUTC R0 # fmt: skip
279279
0x02, 0x01, 0x00, 0x6c, 0x00, # MOV R0, 108 (l) # fmt: skip
280-
0x18, 0x00, 0x00, # OUT_ascii R0 # fmt: skip
280+
0x18, 0x00, 0x00, # OUTC R0 # fmt: skip
281281
0x02, 0x01, 0x00, 0x6c, 0x00, # MOV R0, 108 (l) # fmt: skip
282-
0x18, 0x00, 0x00, # OUT_ascii R0 # fmt: skip
282+
0x18, 0x00, 0x00, # OUTC R0 # fmt: skip
283283
0x02, 0x01, 0x00, 0x6f, 0x00, # MOV R0, 111 (o) # fmt: skip
284-
0x18, 0x00, 0x00, # OUT_ascii R0 # fmt: skip
284+
0x18, 0x00, 0x00, # OUTC R0 # fmt: skip
285285
0x02, 0x01, 0x00, 0x20, 0x00, # MOV R0, 32 (space) # fmt: skip
286-
0x18, 0x00, 0x00, # OUT_ascii R0 # fmt: skip
286+
0x18, 0x00, 0x00, # OUTC R0 # fmt: skip
287287
0x02, 0x01, 0x00, 0x57, 0x00, # MOV R0, 87 (W) # fmt: skip
288-
0x18, 0x00, 0x00, # OUT_ascii R0 # fmt: skip
288+
0x18, 0x00, 0x00, # OUTC R0 # fmt: skip
289289
0x02, 0x01, 0x00, 0x6f, 0x00, # MOV R0, 111 (o) # fmt: skip
290-
0x18, 0x00, 0x00, # OUT_ascii R0 # fmt: skip
290+
0x18, 0x00, 0x00, # OUTC R0 # fmt: skip
291291
0x02, 0x01, 0x00, 0x72, 0x00, # MOV R0, 114 (r) # fmt: skip
292-
0x18, 0x00, 0x00, # OUT_ascii R0 # fmt: skip
292+
0x18, 0x00, 0x00, # OUTC R0 # fmt: skip
293293
0x02, 0x01, 0x00, 0x6c, 0x00, # MOV R0, 108 (l) # fmt: skip
294-
0x18, 0x00, 0x00, # OUT_ascii R0 # fmt: skip
294+
0x18, 0x00, 0x00, # OUTC R0 # fmt: skip
295295
0x02, 0x01, 0x00, 0x64, 0x00, # MOV R0, 100 (d) # fmt: skip
296-
0x18, 0x00, 0x00, # OUT_ascii R0 # fmt: skip
296+
0x18, 0x00, 0x00, # OUTC R0 # fmt: skip
297297
0x01, # HLT # fmt: skip
298298
]
299299
)

0 commit comments

Comments
 (0)