Code: (emu8086) #START = THERMOMETER.EXE# #START = LED_DISPLAY.EXE# .STACK 100H .MODEL SMALL
Code: (emu8086)
#START = THERMOMETER.EXE#
#START = LED_DISPLAY.EXE#
.STACK 100H
.MODEL SMALL
.DATA
MSG1 DB 10,13,' WELCOME ',
DB 10,13,' CHOOSE TYPE OF FOOD ',
DB 10,13,'1.) PIZZA 2.) BAKED MACARONI 3.) FRENCH FRIES',
DB 10,13,'ENTER: $'
MSG2 DB 10,13,'PLEASE SELECT WHAT WILL BE THE MAX TEMPERATURE',
DB 10,13,'1.) 20 DEG',
DB 10,13,'2.) 40 DEG',
DB 10,13,'3.) 60 DEG',
DB 10,13,'4.) 80 DEG',
DB 10,13,'5.) 100 DEG',
DB 10,13,'6.) 119 DEG',
DB 10,13,'ENTER: $'
NUM1 DB 20
NUM2 DB 40
NUM3 DB 60
NUM4 DB 80
NUM5 DB 100
NUM6 DB 119
TIMEOP1 DB 10,13,'SET THE TIMER',
DB 10,13,'ENTER 1: 00:00:50',
DB 10,13,'ENTER 2: 00:01:40',
DB 10,13,'ENTER 3: 00:02:30',
DB 10,13,'ENTER 4: 00:03:20',
DB 10,13,'ENTER 5: 00:04:10',
DB 10,13,'ENTER: $'
A DB 0
B DB 0
C DB 0
D DB 0
OPTIONERROR DB 10,13,'INVALID OPTION $'
DONE DB 'DONE','$'
RESTARTMENU1 DB 10,13,'PRESS 1 TO GO BACK TO MAIN MENU',
DB 10,13,'PRESS 2 TO EXIT',
DB 10,13,'ENTER: $'
EXT DB 10,13,'GOOD BYE $'
NEWLINE DB 10,13, '$'
.CODE
START:
MOV AX,@DATA
MOV DS,AX
LEA DX, MSG1
MOV AH, 09H
INT 21H
MOV AH,01H
INT 21H
MOV A,AL
SUB BH,48
CMP A,'1'
JE TEMPOPTION
CMP A,'2'
JE TEMPOPTION
CMP A,'3'
JE TEMPOPTION
ERROR:
LEA DX,ERROR
MOV AH,09H
INT 21H
JMP EXIT
TEMPOPTION:
LEA DX,NEWLINE
MOV AH,09H
INT 21H
LEA DX, MSG2
MOV AH, 09H
INT 21H
MOV AH, 01H
INT 21H
MOV BL, AL
COMPARE:
CMP BL, 31H
MOV CL, NUM1
JE T1
CMP BL, 32H
MOV CL, NUM2
JE T2
CMP BL, 33H
MOV CL, NUM3
JE T3
CMP BL, 34H
MOV CL, NUM4
JE T4
CMP BL, 35H
MOV CL, NUM5
JE T5
CMP BL, 36H
MOV CL, NUM6
JE T6
CMP BL, 37H
JE EXIT
;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
T1:
IN AL, 125
CMP AL, 1
JL LOW1
CMP AL, CL
JG HIGH1
LOW1:
MOV AL, 1
OUT 127, AL
JMP LOOP1
HIGH1:
MOV AL, 0
OUT 127, AL
JMP TIMEOPTION
OFF1:
OUT 127, AL
LOOP1:
JMP T1
T2:
IN AL, 125
CMP AL, 1
JL LOW2
CMP AL, CL
JG HIGH2
LOW2:
MOV AL, 1
OUT 127, AL
JMP LOOP2
HIGH2:
MOV AL, 0
OUT 127, AL
JMP TIMEOPTION
LOOP2:
JMP T2
OFF2:
OUT 127, AL
T3:
IN AL, 125
CMP AL, 1
JL LOW3
CMP AL, CL
JG HIGH3
LOW3:
MOV AL, 1
OUT 127, AL
JMP LOOP3
HIGH3:
MOV AL, 0
OUT 127, AL
LOOP3:
JMP T3
JMP TIMEOPTION
OFF3:
OUT 127, AL
T4:
IN AL, 125
CMP AL, 1
JL LOW4
CMP AL, CL
JG HIGH4
LOW4:
MOV AL, 1
OUT 127, AL
JMP LOOP4
HIGH4:
MOV AL, 0
OUT 127, AL
LOOP4:
JMP T4
JMP TIMEOPTION
OFF4:
OUT 127, AL
T5:
IN AL, 125
CMP AL, 1
JL LOW5
CMP AL, CL
JG HIGH5
LOW5:
MOV AL, 1
OUT 127, AL
JMP LOOP5
HIGH5:
MOV AL, 0
OUT 127, AL
LOOP5:
JMP T5
JMP TIMEOPTION
OFF5:
OUT 127, AL
T6:
IN AL, 125
CMP AL, 1
JL LOW6
CMP AL, CL
JG HIGH6
LOW6:
MOV AL, 1
OUT 127, AL
JMP LOOP6
HIGH6:
MOV AL, 0
OUT 127, AL
LOOP6:
JMP T6
JMP TIMEOPTION
OFF6:
OUT 127, AL
;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
TIMEOPTION:
LEA DX,NEWLINE
MOV AH,09H
INT 21H
LEA DX,TIMEOP1
MOV AH,09H
INT 21H
MOV AH,01H
INT 21H
MOV C,AL
SUB BH,48
MOV AH,09H
MOV DX, OFFSET NEWLINE
INT 21H
CMP C,'1'
JE TIMER1
CMP C,'2'
JE TIMER2
CMP C,'3'
JE TIMER3
CMP C,'4'
JE TIMER4
CMP B,'5'
JE TIMER5
TIMER1:
MOV AL,50
TI1:
OUT 199,AL
DEC AL
MOV CX,0fh
MOV AH,86h
INT 15H
CMP AL,255
JNE TI1
CALL ALARMSOUND
MOV AH,09H
MOV DX, OFFSET NEWLINE
INT 21H
TIMER2:
MOV AL,100
TI2:
OUT 199,AL
DEC AL
MOV CX,0fh
MOV AH,86h
INT 15H
CMP AL,255
JNE TI2
CALL ALARMSOUND
MOV AH,09H
MOV DX, OFFSET NEWLINE
INT 21H
TIMER3:
MOV AL,150
TI3:
OUT 199,AL
DEC AL
MOV CX,0fh
MOV AH,86h
INT 15H
CMP AL,255
JNE TI3
CALL ALARMSOUND
MOV AH,09H
MOV DX, OFFSET NEWLINE
INT 21H
TIMER4:
MOV AL,200
TI4:
OUT 199,AL
DEC AL
MOV CX,0fh
MOV AH,86h
INT 15H
CMP AL,255
JNE TI4
CALL ALARMSOUND
MOV AH,09H
MOV DX, OFFSET NEWLINE
INT 21H
TIMER5:
MOV AL,250
TI5:
OUT 199,AL
DEC AL
MOV CX,0fh
MOV AH,86h
INT 15H
CMP AL,255
JNE TI5
CALL ALARMSOUND
MOV AH,09H
MOV DX, OFFSET NEWLINE
INT 21H
;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ALARMSOUND:
MOV AH,09H
MOV DX, OFFSET NEWLINE
INT 21H
LEA DX,DONE
MOV AH,09H
INT 21H
MOV AH,2
MOV DL,7
INT 21H
MOV AH,2
MOV DL,7
INT 21H
MOV AH,2
MOV DL,7
INT 21H
MOV AH,2
MOV DL,7
INT 21H
MOV AH,09H
MOV DX, OFFSET NEWLINE
INT 21H
CALL RESTART
;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
RESTART:
LEA DX, NEWLINE
MOV AH, 09H
INT 21H
LEA DX, RESTARTMENU1
MOV AH, 09H
INT 21H
MOV AH,01H
INT 21H
MOV D,AL
SUB BH,48
CMP D,'1'
JE RESTARTMENU
CMP D,'2'
JE EXIT
RESTARTMENU:
JMP START
EXIT:
LEA DX, NEWLINE
MOV AH, 09H
INT 21H
MOV DX, OFFSET EXT
MOV AH, 09H
INT 21H
MOV AH, 4CH
INT 21H
ENDS START
END
Step by step
Solved in 3 steps with 1 images