Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .MODEL SMALL ; use memory model
- .STACK 100H ; reserves 100h bytes for stack
- .CODE ; starts code segment
- START:
- MOV DX, 379H ; select status port of LPT1
- IN AX, DX ; read input X from status port of LPT1
- MOV AH, 00H ; neglect higher bytes of AX since LP1 is 8bit
- MOV BX,AX
- MOV CX,256 ; CX=256
- SUB CX,BX ; CX=256-X
- MOV AX,00H ; set initial value 0 for count
- COUNTUP:
- MOV DX,378H ; select data port of LPT1
- OUT DX,AX ; write value in AX to DATA port
- CMP AX,CX ; compare current count value with CX
- JZ DONE ; if AX and CX equal goto DONE
- INC AX ; else keep incrementing AX
- JUMP COUNTUP ; loop again counter
- DONE:
- MOV AH, 4CH ; turminate programe with exit code of ( 256-X )
- INT 21H ; Call the interrupt to exit
- END START
Advertisement
Add Comment
Please, Sign In to add comment