Execute Computer/Zero: Difference between revisions

RPL: optimized version
(RPL: add section)
(RPL: optimized version)
Line 2,189:
|-
|
{
SWAP DROP ''''RAM'''' SWAP GET1 ''''ACC''''+ STOGET
≪ ''''RAM'''' SWAP '''ACC'''1 + 3 PICK PUT ≫
≪ ''''RAM'''' SWAP GET1 '''ACC'''+ GET + 256 MOD ''''ACC'''' STO
≪ ''''RAM'''' SWAP GET1 '''ACC'''+ SWAPGET - 256 MOD ''''ACC'''' STO
≪ '''IF''' ACCOVER NOT '''THEN''' 1ROT -DROP ''''PC'''' STOSWAP '''ELSE''' DROP '''END''' ≫
1ROT -DROP ''''PC'''' STOSWAP
≪ DROP 1 SF ≫
} ''''µCODE'''' STO
Line 2,201:
{ 32 } RDM ''''RAM'''' STO
0 ''''ACC'''' STO 0 ''''PC'''' STO 1 CF
'''WHILE''' 1 FC? '''REPEAT'''
'''PC'''SWAP 1 + DUP 32 MOD ''''PC''''ROT STOROT ''''RAM'''' SWAP GET
32 DUP2 MOD 1 + ROT ROT / FLOOR
'''IF THEN 'µCODE'''' LAST GET EVAL '''ELSE''' DROP '''END'''
'''END ACCEND'''
‘'''RUN'''’‘RUN’ STO
|
'''µCODE''' ''( counter accumulator address -- new pointercounter valueaccumulator )''
LDA x
STA x
Line 2,216:
BRZ x
JMP x
STP x
'''RUN''' ''( [ program ] -- counter accumulator )''
load program to memory
reset accumulator, counter and flag
Line 2,225:
increment pointer and read byte
instruction, addresss = divmod(byte,32)
if instruction <> NOP then execute it
display accumulator
Line 2,232:
<pre>
[ 35 100 224 2 2 ] RUN
[ 44 106 76 43 141 75 168 192 44 224 8 7 0 1 ] RUN
[ 46 79 109 78 47 77 48 145 171 80 192 46 224 1 1 0 8 1 ] RUN
[ 45 111 69 112 71 0 78 0 171 79 192 46 224 32 0 28 1 0 0 0 6 0 2 26 5 20 3 30 1 22 4 24 ] RUN
[ 0 0 224 0 0 35 157 178 35 93 174 33 127 65 194 32 127 64 192 35 93 33 126 99 ] RUN
</pre>
{{out}}
1,150

edits