Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; You may customize this and other start-up templates;
- ; The location of this template is c:\emu8086\inc\0_com_template.txt
- org 100h
- ; GREEN LED BL = 0x10
- ; YELLOW LED BL = 0x20
- ; RED LED BL = 0x30
- ; Temperature is read from sensors and stored at AX register
- CHECK: CALL GETINPUT
- CALL CHECKTEMP
- CALL DELAY
- JMP CHECK
- ; Read input from user using DOS 21h interrupt
- GETINPUT PROC
- MOV AH, 0x0A
- INT 21h
- MOV SI, DX
- XOR BX, BX
- XOR AX, AX
- ADD SI, 0x02
- MOV AL, DS:[SI]
- SUB AL, 0x30
- MOV DL, 100
- MUL DL
- ADD BX, AX
- INC SI
- MOV AL, DS:[SI]
- SUB AL, 0x30
- MOV DL, 10
- MUL DL
- ADD BX, AX
- INC SI
- MOV AL, DS:[SI]
- SUB AL, 0x30
- ADD BL, AL
- MOV AX, BX
- RET
- GETINPUT ENDP
- ; Checktemp procedure, takes 1 parameter in AL and returns
- ; LED value into BL
- CHECKTEMP PROC
- XOR BL, BL
- CMP AX, 200
- JBE GREENLED
- CMP AX, 500
- JAE REDLED
- MOV BL, 0x20
- JMP ENDCHECK
- GREENLED: MOV BL, 0x10
- JMP ENDCHECK
- REDLED: MOV BL, 0x30
- ENDCHECK: RET
- CHECKTEMP ENDP
- ; Delay procedure
- ; 0x8F is about 1 second, therefore 3 minutes = 0x648C
- DELAY PROC
- PUSHA
- MOV CX, 0x11E ; 2 seconds
- LOOP $
- POPA
- RET
- DELAY ENDP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement