CSEG SEGMENT
     ASSUME CS:CSEG
; MASM
     OPTION SCOPED
; TASM
;    LOCALS

MAIN PROC
     @@C = 10
     MOV CX,@@C
@@L: CALL UP
     IFDEF DEBUG
     CALL SHOWCX
     ENDIF
     LOOP @@L
     MOV AX,4C00h
     INT 21h
MAIN ENDP

UP   PROC
     @@C = 5
     PUSH CX
     MOV CX,@@C
@@L: IFDEF DEBUG
     CALL SHOWCX
     ENDIF
     LOOP @@L
     POP CX
     RET
UP   ENDP

SHOWCX PROC
     PUSH AX
     PUSH BX
     PUSH CX
     PUSH DX
     MOV  AX,CX
     MOV  BX,10
     MOV  CX,0
@@DIV_LOOP:
     MOV  DX,0
     DIV  BX
     PUSH DX
     INC  CX
     CMP  AX,0
     JNE  @@DIV_LOOP
     MOV  AH,02h
@@WRITE_LOOP:
     POP  DX
     ADD  DL,30h
     INT  21h
     LOOP @@WRITE_LOOP
     MOV  DL,10
     INT  21h
     MOV  DL,13
     INT  21h
     POP  DX
     POP  CX
     POP  BX
     POP  AX
     RET
SHOWCX ENDP

CSEG ENDS

DSEG SEGMENT
DSEG ENDS

SSEG SEGMENT STACK
     DW 128 DUP (?)
SSEG ENDS

     END MAIN