It starts at address zero and it rolls through these values as long the program runs.
When you stop (toggle STOP) and examine octal address 200 (just A7 up) you will see the value, represented in a pattern on the data LEDs.
Here it is:
- Code: Select all
Address Data Assembler
000 006 start MVI B,6 ; Start value of the dice is 6
001 006
002 041 LXI HL,lut ; Start address of the look-up-table
003 021
004 000
005 176 next MOV A,M ; Store memory contents in A
006 062 STA 200 ; Store A in address 200
007 200
010 000
011 043 INX HL ; Increase address look-up-table
012 005 DCR B ; Decrease dice value
013 312 JZ start ; Jump to start if zero
014 000
015 000
016 303 JMP next ; Otherwise look up the next pattern
017 005
020 000
021 167 lut 167 ; 01110111 = 6
022 076 076 ; 00111110 = 5
023 066 066 ; 00110110 = 4
024 052 052 ; 00101010 = 3
025 024 024 ; 00010100 = 2
026 010 010 ; 00001000 = 1