|
10 | 10 | """---------
|
11 | 11 | Notes:
|
12 | 12 |
|
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)? |
16 | 29 |
|
17 | 30 | I feel like a lot of the synchronicity is wrong (when compared to real). Need to check that.
|
18 | 31 |
|
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 |
| -
|
21 | 32 | Multi-source input is multiple line of file
|
22 | 33 |
|
23 | 34 | ---------"""
|
@@ -384,12 +395,30 @@ class jnz(abstractOp):
|
384 | 395 | def run(cls, node, args):
|
385 | 396 | if node['acc'] != 0:
|
386 | 397 | 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]) |
387 | 404 | class mov(abstractOp):
|
388 | 405 | nargs = 2
|
389 | 406 |
|
390 | 407 | @classmethod
|
391 | 408 | def run(cls, node, args):
|
392 | 409 | 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 |
393 | 422 | class sav(abstractOp):
|
394 | 423 | nargs = 0
|
395 | 424 |
|
@@ -494,6 +523,8 @@ def parseArg(arg):
|
494 | 523 | return arg.strip(',').lower()
|
495 | 524 |
|
496 | 525 | # todo handle line modifiers: @, !..., where do they live, what do they mean, etc?
|
| 526 | +# seem to belong unconditionally first on line |
| 527 | +# ! is breakpoint |
497 | 528 | def parseLine(line):
|
498 | 529 | # now check if line is too long
|
499 | 530 | code, _, comment = line.partition('#')
|
@@ -528,7 +559,7 @@ def parseProg(prog, cfg):
|
528 | 559 | # now validate line is only 's/@[0-9]+/'
|
529 | 560 | # if not:
|
530 | 561 | # 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? |
532 | 563 | # endif
|
533 | 564 | index = int(line[1:])
|
534 | 565 | # now validate index is in range
|
|
0 commit comments