Advertisement
redsees

uprocessorProject

Dec 19th, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. ; You may customize this and other start-up templates;
  3. ; The location of this template is c:\emu8086\inc\0_com_template.txt
  4.  
  5. org 100h
  6.                
  7. ; GREEN LED     BL = 0x10
  8. ; YELLOW LED    BL = 0x20
  9. ; RED LED       BL = 0x30                
  10.  
  11. ; Temperature is read from sensors and stored at AX register
  12.                
  13.  
  14. CHECK:          CALL    GETINPUT
  15.                 CALL    CHECKTEMP
  16.                 CALL    DELAY
  17.                 JMP     CHECK
  18.  
  19.  
  20.  
  21. ; Read input from user using DOS 21h interrupt
  22. GETINPUT        PROC
  23.                 MOV     AH, 0x0A
  24.                 INT     21h
  25.                 MOV     SI, DX
  26.                 XOR     BX, BX
  27.                 XOR     AX, AX
  28.                 ADD     SI, 0x02
  29.                 MOV     AL, DS:[SI]
  30.                 SUB     AL, 0x30
  31.                 MOV     DL, 100
  32.                 MUL     DL
  33.                 ADD     BX, AX
  34.                 INC     SI
  35.                 MOV     AL, DS:[SI]
  36.                 SUB     AL, 0x30
  37.                 MOV     DL, 10
  38.                 MUL     DL
  39.                 ADD     BX, AX
  40.                 INC     SI
  41.                 MOV     AL, DS:[SI]
  42.                 SUB     AL, 0x30
  43.                 ADD     BL, AL
  44.                 MOV     AX, BX
  45.                 RET
  46. GETINPUT        ENDP
  47.  
  48. ; Checktemp procedure, takes 1 parameter in AL and returns
  49. ; LED value into BL
  50. CHECKTEMP       PROC
  51.                 XOR     BL, BL
  52.                 CMP     AX, 200
  53.                 JBE     GREENLED
  54.                 CMP     AX, 500
  55.                 JAE     REDLED
  56.                 MOV     BL, 0x20
  57.                 JMP     ENDCHECK
  58. GREENLED:       MOV     BL, 0x10
  59.                 JMP     ENDCHECK
  60. REDLED:         MOV     BL, 0x30
  61. ENDCHECK:       RET
  62. CHECKTEMP       ENDP
  63.  
  64. ; Delay procedure
  65. ; 0x8F is about 1 second, therefore 3 minutes = 0x648C
  66. DELAY           PROC
  67.                 PUSHA
  68.                 MOV CX, 0x11E       ; 2 seconds
  69.                 LOOP $
  70.                 POPA
  71.                 RET
  72. DELAY           ENDP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement