Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
DrKilobyte authored Jun 5, 2023
1 parent 9b77a34 commit 5b90ff6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Binary file modified omicron.exe
Binary file not shown.
7 changes: 6 additions & 1 deletion omicron.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ def mem(instruction):
i = 0
markers = {}
for m in range(0, len(program)):
if program[m].startswith(":"): markers[int(program[m][1:])] = m
try:
if program[m].startswith(":"): markers[int(program[m][1:])] = m
except ValueError:
error("Marker must be a number: :%s"%program[m][1:])
while i < len(program):
try:
instruction = program[i]
Expand Down Expand Up @@ -123,6 +126,8 @@ def mem(instruction):
with open(program[i+1], 'rb') as f: memory[pointer] = f.read()[mem(program[i+2])]
except FileNotFoundError:
error("File not found: %s"%program[i+1])
except IndexError:
error("Specified byte is beyond the end of the file: %s"%mem(program[i+2]))
i += 2
elif instruction == 'size':
with open(program[i+1], 'rb') as f: memory[pointer] = len(f.read())
Expand Down

0 comments on commit 5b90ff6

Please sign in to comment.