Skip to content

Commit fa8f8d3

Browse files
committed
Add some info from manual
tis100.py write missing instructions add / clarify some todo items
1 parent bd47100 commit fa8f8d3

File tree

1 file changed

+37
-6
lines changed

1 file changed

+37
-6
lines changed

tis100.py

+37-6
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,25 @@
1010
"""---------
1111
Notes:
1212
13-
todo List of states (from memory)?: IDLE, RUN, SLP, READ, WRTE
14-
15-
Will need to find a way to prevent deadlocks (timeout is okay I guess...) (maybe loop detect in barrier helper?) Does real TIS do this, or does it just stall forever?
13+
todo what is the list of states (from memory)?: IDLE, RUN, SLP, READ, WRTE
14+
todo implement LAST pseudoport (port of last ANY operation, if before any ANY, undefined)
15+
todo implement stack memory node operations
16+
todo implement visualization module output
17+
30w x 18h (0,0 is top left; 29,17 is bottom right) default
18+
36w x 22h in sandbox
19+
0: black
20+
1: dark grey
21+
2: light grey
22+
3: white
23+
4: red
24+
neg: terminator
25+
26+
From manual: writing/reading from disconnected port mena block indefinitely
27+
28+
Will need to find a way to prevent deadlocks (timeout is okay I guess...) (maybe loop detect in barrier helper?) Does real TIS do this, or does it just stall forever (until timeout)?
1629
1730
I feel like a lot of the synchronicity is wrong (when compared to real). Need to check that.
1831
19-
Just use regular events for the registers... then have a single syncho'd outgoing register to hold the value in each node (this may make 'any' more natural to handle)
20-
2132
Multi-source input is multiple line of file
2233
2334
---------"""
@@ -384,12 +395,30 @@ class jnz(abstractOp):
384395
def run(cls, node, args):
385396
if node['acc'] != 0:
386397
node.jumpLabel(args[0])
398+
class jro(abstractOp):
399+
nargs = 1
400+
401+
@classmethod
402+
def run(cls, node, args):
403+
node.jumpOffset(args[0])
387404
class mov(abstractOp):
388405
nargs = 2
389406

390407
@classmethod
391408
def run(cls, node, args):
392409
node[args[1]] = node[args[0]]
410+
class neg(abstractOp):
411+
nargs = 0
412+
413+
@classmethod
414+
def run(cls, node, args):
415+
node['acc'] = -node['acc']
416+
class nop(abstractOp):
417+
nargs = 0
418+
419+
@classmethod
420+
def run(cls, node, args):
421+
pass # technically, the real TIS-100 executes ADD NIL here
393422
class sav(abstractOp):
394423
nargs = 0
395424

@@ -494,6 +523,8 @@ def parseArg(arg):
494523
return arg.strip(',').lower()
495524

496525
# todo handle line modifiers: @, !..., where do they live, what do they mean, etc?
526+
# seem to belong unconditionally first on line
527+
# ! is breakpoint
497528
def parseLine(line):
498529
# now check if line is too long
499530
code, _, comment = line.partition('#')
@@ -528,7 +559,7 @@ def parseProg(prog, cfg):
528559
# now validate line is only 's/@[0-9]+/'
529560
# if not:
530561
# now check if line is too long
531-
line = line.split('#',1)[0]
562+
line = line.split('#',1)[0] # double comment e.g. "## hello" is the program title. Do we care?
532563
# endif
533564
index = int(line[1:])
534565
# now validate index is in range

0 commit comments

Comments
 (0)