Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PrintNumber: PUSH DX ;Push DX to use it to print output[i] using interrupt
- MOV DL, 10 ;Clear DX
- PUSH CX ;Use CX to keep track of how many digits to print in this number
- MOV CX, 0
- PUSH BX ;Push BX to use it to store remainder that is in AH
- Divide: INC CX ;Increment digit counter
- DIV DL ;Divide AX/DX
- MOV BX, 0
- MOV BL, AH ;Store remainder in BL
- MOV AH, 0
- PUSH BX ;Push remainder
- CMP AL, 0
- JNZ Divide ;Divide till number is reaches 0
- MOV AH, 2h ;Prepare the call to print character ( 2h )
- Print:
- POP DX ;Pop remainders(digits)
- ADD DX, 48 ;Add 48 to make it an ASCII char
- INT 21H ;Print digit
- LOOP Print ;Loop till CX = 0
- MOV DL, 20H ;Print a space
- INT 21H ;^
- POP BX ;Restore all changed registers
- POP CX
- POP DX
- JMP Cont3 ;Continue calculating filter
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement