RS Flip Flop

The RS (Reset Set) flip flop has a set input IN1 and a reset input IN2. Once set the OUT1 is 1.

INIT
LD     IN1
STO    RAM0  
LDC    IN2
XNOR   RAM0
OEN    RR     If 1 then OUT0 changes
LD     RAM0
STO    OUT0
JMP    X      Resets Program Counter

The XNOR function is used to detect if one of the input is 1 and the other 0. If so RR will be 1 and OUT1 might change its status. If both inputs are equal, RR is 0 and OEN 0 disables any write access to OUT0. RAM0 holds the set input IN1 and can be written if IN1 is different from IN2 to OUT1.

The OEN RR line acts as an IF condition.

The command ./mc14500.py --html rs.asm produces the rs.html file that contains the link https://www.linurs.org/mc14500sim/index.html?rom=60A0B011882278B01880C0&program=rs&ilsb=False&iowidth=4&pcwidth=8&endian=little that starts the simulator with the program.

An other approach than run over the instructions that can not modify the outputs is using SKZ and jump over a JMP instruction. If SKZ find RR=1 then the JMP instruction is executed and the loop aborted. If RR=0 the the JMP instruction is skipped and the following instruction updating OUT are processed.

INIT
LD     IN1
STO    RAM0  
LDC    IN2
XNOR   RAM0
LDC    RR
SKZ    X     If 0 then OUT0 changes
JMP    X
LD     RAM0
STO    OUT0
JMP    X     Resets Program Counter

The command ./mc14500.py --html skz.asm produces the skz.html file that contains the link https://www.linurs.org/mc14500sim/index.html?rom=60A0B01188227820E0C01880C0&program=skz&ilsb=False&iowidth=4&pcwidth=8&endian=little that starts the simulator with the program.


Linurs Servernest startpage