Simon Programs:
4-bit Negation

Description: Compute the 2s-complement negative of a 4-bit value.
Input: A 4-bit value from the front panel.
Output: The negated value is displayed on the output lamps.
Written by: bhilpert (2006 Sep)
Assembled:
Ref  Tape      Assembly
---  --------  --------------------------------------------------
000: 12.10.00  SR1=*        / wait for value
001: 03.00.01  SR2=^        / save high bits as well

002: 08.00.02  CR1=SR1      / negate low bits
003: 1B.01.00  NEG
004: 0D.00.0C  OR1=CR5      /   and display
005: 08.00.03  CR1=SR2      / negate high bits
006: 1B.09.00  NGC
007: 0E.00.0C  OR2=CR5

008: 18.00.00  CR1=0        / display 5th bit of result
009: 19.00.00  CR2=0        /
010: 1B.08.00  ADC          / add 0+0+carry
011: 0F.00.0C  OR3=CR5      /



  Programs
Simon
bhilpert
2006 Sep