seven segment asm 8086
the code for a random numer generator
the main program consist of a simple loop to increment a byte counter.The counter after reaching FFh,become 0 again with one further increment and thus is alwyas a value between 0 and FFh.Whenever the user presses KBINT (rst7.5 interrupt in our trainer kit)the interrupt service routine fetches the counter value ,masks off the most significant 6 bits,displays the value (thus the number displayed is alwats 0,1,,2,3)and returns to main program which to update the counter value
main program
MVI A,0B; UNMASK RST7.5 INTERRUPT
SIM;enable interrupts
EI;intialise interrupt
XRA A
LOOP:INR A
JMP LOOP
now in my kit whenever kbint is presses it transfers the control to 8fbf mem location after executing the instruction at 3C
So at 8FBF we eneter JMP to some new location (say address 8820)
now at 8820H we writ
PUSH PSW ;for saving a counter
ANI 03 :to mask off the most significant 6 bits
LOOP: STA 8FF1 ;STORE CONTENT OF ACC TO ADRESS 8FF1
MVI B,00; LOAD REG B WITH 0(TO AVOID DOTS IN DISPLAY)
CALL UPDDT;(DISPLAY THE DATA AT ADDRESS 8FF1)KIT'S SPECIFIC FUNXN
POP PSW
EI
RET ;RETURN TO MAIN PROGRAM
ANY RANDOM NUMBER BETWEEN 0 AN 3 IS DISPLAYED WHENVR KBINT IS PRESSED.
thIS PROGRAM IS SPECIFIC TO A KIT BUT I THINK THE LOGIC WOULD BE CLEAR TO YOU.BUT THE CODING DEPENDS ON THE HARDWARE