CSEG   SEGMENT
       ASSUME CS:CSEG,DS:DSEG

MAIN   PROC
       MOV  AX,DSEG
       MOV  DS,AX
       MOV  SI,0
       MOV  CX,5
OUTERLOOP:
       PUSH CX
       MOV  CX,4
INNERLOOP:
       MOV  AL,HOSTS[SI]
       AND  AL,MASKS[SI]
       INC  SI
       MOV  AH,0
       CALL NUMBER
       CMP  CX,1
       JE   SKIPDOT
       CALL DOT
SKIPDOT:
       LOOP INNERLOOP
       CALL CRLF
       POP  CX
       LOOP OUTERLOOP
       MOV  AX,4C00h
       INT  21h
MAIN   ENDP

NUMBER PROC
       PUSH AX
       PUSH BX
       PUSH CX
       PUSH DX
       MOV  BX,10
       MOV  CX,0
PUSHLOOP:
       MOV  DX,0
       DIV  BX
       PUSH DX
       INC  CX
       CMP  AX,0
       JNE  PUSHLOOP
       MOV  AH,2
POPLOOP:
       POP  DX
       ADD  DL,'0'
       INT  21h
       LOOP POPLOOP
       POP  DX
       POP  CX
       POP  BX
       POP  AX
       RET
NUMBER ENDP

DOT    PROC
       PUSH AX
       PUSH DX
       MOV  AH,2
       MOV  DL,'.'
       INT  21h
       POP  DX
       POP  AX
       RET
DOT    ENDP

CRLF   PROC
       PUSH AX
       PUSH DX
       MOV  AH,2
       MOV  DL,13
       INT  21h
       MOV  DL,10
       INT  21h
       POP  DX
       POP  AX
       RET
CRLF   ENDP

CSEG   ENDS

DSEG   SEGMENT
HOSTS  DB     1,  2,  3,  4
       DB   129,125,121,117
       DB   129,133,137,141
       DB   193,186,179,172
       DB   193,200,207,214
MASKS  DB   255,255,  0,  0
       DB   255,255,240,  0
       DB   255,255,255,  0
       DB   255,255,255,192
       DB   255,255,255,252
DSEG   ENDS

SSEG   SEGMENT STACK
       DW   256 DUP (?)
SSEG   ENDS

       END MAIN