PGL
Newbie
I am new to Proteus simulation and 8086 interfacings, but I tried to create a random password generator using 8086 and LCD interfacing. But when I tried to use INT 1AH to generate random password, my simulation doesn't display any character. Can you tell me how does INT command work in proteus.
This is my assembly code
AND THIS IS MY INTERFACING CIRCUIT
This is my assembly code
Code:
DATA SEGMENT
PORTA EQU 00H
PORTB EQU 02H
PORTC EQU 04H
PORT_CON EQU 06H
SIZE EQU 10
DATA ENDS
CODE SEGMENT
MOV AX,DATA
MOV DS, AX
ORG 0000H
START:
MOV DX, PORT_CON
MOV AL, 10000000B
OUT DX, AL
JMP XX
XX:
MOV AL,00H ;command setting cursor
MOV DX,PORTC
OUT DX,AL
MOV AL, 0EH
MOV DX, PORTA
OUT DX,AL
MOV CX,00FFH; Delay
Delay0:loop Delay0
MOV AL,0FFH
MOV DX,PORTC
OUT DX,AL
MOV CX,00FFH; Delay
Delay1:loop Delay1
MOV AL,00H ;command setting 8 bit mode
MOV DX,PORTC
OUT DX,AL
MOV AL, 038H
MOV DX, PORTA
OUT DX,AL
MOV CX,00FFH; Delay
Delay2:loop Delay2
MOV AL,0FFH
MOV DX,PORTC
OUT DX,AL
MOV CX,00FFH; Delay
Delay3:loop Delay3
MOV AL,00H ;command setting 8 bit mode
MOV DX,PORTC
OUT DX,AL
MOV AL,0FH ;command setting 8 bit mode
MOV DX,PORTB
OUT DX,AL
JMP RANDOM
RANDOM: xor ax,ax ; xor register to itself same as zeroing register
int 1ah ; Int 1ah/ah=0 get timer ticks since midnight in CX:DX
mov ax,dx ; Use lower 16 bits (in DX) for random value
xor dx,dx ; Compute randval(DX) mod 126 to get num
mov bx,126 ; between 0 and 125
div bx ; Divide dx:ax by bx
inc dx ; DX = modulo from division
; Add 1 to give us # between 1 and 126 (not 0 to 125)
cmp dx, 33 ; If the number (remainder) is below 33, increase it to be between 33 and 126
jb INCREASE
jmp DISPLAY
INCREASE:
add dx, 32 ; We are adding 32 as the lowest value DX can take is 1 and 33 is the least acceptable value
jmp DISPLAY
DISPLAY:
mov ax,dx ; Move to AX to print
MOV DX, PORTA
OUT DX,AL
MOV CX,00FFH; Delay
Delay4:loop Delay4
MOV AL,0FFH
MOV DX,PORTC
OUT DX,AL
MOV CX,00FFH; Delay
Delay5:loop Delay5
MOV CX,SIZE
DEC CX
MOV SIZE,CX
CMP CX,00H
JNE RANDOM
HLT
AND THIS IS MY INTERFACING CIRCUIT
Last edited by a moderator: