Answer the question
In order to leave comments, you need to log in
COSMAC ELF 1802 commands?
The list of 1802 teams is here .
I am disassembling the lamp blinking program on the COSMAC ELF emulator from the site . First comes command 7A - turn off the light bulb. The command loads the number 2 into register R0. Why?
Next comes the command F8 Description of this command M(R(P)) → D; R(P) + 1 → R(P)
The F8 command loads the number 3 into the F8 register, although the command, judging by the description, must add the number 1 to the R0 register and store the result in R0, which means that the number 1 should appear in R0, not so whether?
Command 7B - turn on the lamp - also register R0 number 2.
The entire program for flashing the lamp
7A
F8
10
B1
21
91
3A
04
31
00
7B
30
01
00
Answer the question
In order to leave comments, you need to log in
First comes command 7A - turn off the light bulb. The command loads the number 2 into register R0. Why?
Next comes the command F8 Description of this command M(R(P)) → D; R(P) + 1 → R(P)
The F8 command loads the number 3 into the F8 register, although the command, judging by the description, must add the number 1 to the R0 register and store the result in R0, which means that the number 1 should end up in R0.
0: 7A -- reset Q (Q = 0)
1: F8 -- ldi 10 (D = 10)
2: 10
3: B1 -- phi 1 (R(1).1 = D, т.е. R(1) = 1000)
4: 21 -- dec 1 (R(1) = R(1) - 1, т.е. R(1) = fff)
5: 91 -- ghi 1 (D = R(1).1, т.е. D = f)
6: 3A -- bnz 4 (переход к адресу 4, пока D != 0)
7: 04
8: 31 -- bq 0 (переход к адресу 0 если Q == 1)
9: 00
a: 7B -- set Q (Q = 1)
b: 30 -- br 1 (переход к адресу 1)
с: 01
d: 00 -- idle (никогда не попадаем сюда).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question