Turbo Assembler	 Version 3.1	    05/15/18 20:53:54	    Page 1
LAB5.asm



      1	0000			     MYCODE SEGMENT 'CODE'
      2				      ASSUME CS:MYCODE,DS:MYCODE
      3	0000  30 31 32 33 34 35	36+   alf DB '0123456789ABCDEF'
      4	      37 38 39 41 42 43	44+
      5	      45 46
      6	0010  54 6F 20 65 78 69	74+   Vyhod DB "To exit	enter '*'$"
      7	      20 65 6E 74 65 72	20+
      8	      27 2A 27 24
      9	0022  0100*(24)		      str db 256 dup(24h)
*Warning* LAB5.asm(5) Reserved word used as symbol: STR
     10
     11	0122  01*(00FF)		     chcol dw 1	dup (0ffh) ; temp 4 byte var
     12
     13	0124			     proc putchcol
     14	0124  FF 0E 0122r	      DEC chcol
     15	0128  83 3E 0122r 0A	      cmp chcol, 10
     16	012D  72 13		      jb lo
     17	012F  73 00		      jae hi ;if(dx>=10)
     18	0131			      hi:
     19	0131  BA 0031		       mov dx, 49
     20	0134  E8 00C7		       call PutCh
     21	0137  8B 16 0122r	       mov dx, chcol
     22	013B  83 C2 26		       add dx, 38
     23	013E  E8 00BD		       call PutCh
     24	0141  C3		       ret
     25	0142			      lo:
     26	0142  8B 16 0122r	       mov dx, chcol
     27	0146  83 C2 30		       add dx, 48
     28	0149  E8 00B2		       call PutCh
     29	014C  C3		       ret
     30	014D  C3		      ret
     31	014E			     endp
     32
     33	014E			      START:
     34	014E  0E			      PUSH CS
     35	014F  1F			      POP DS
     36	0150  1E			      PUSH DS
     37	0151  07			      POP ES
     38
     39	0152  E8 00AE			      CALL ClrScr
     40	0155  BE 0000			      MOV SI,0
     41	0158				      Cycle1:
     42	0158  BF 0000				     MOV DI,0
     43	015B				      Cycle2:
     44	015B					      @char:
     45	015B  B4 08					      MOV AH,08
     46	015D  CD 21					      INT 21h
     47	015F  3C 21					      cmp AL,21h
     48	0161  72 F8					      jb @char
     49	0163  83 FF 13				  cmp di, 13h
     50	0166  75 02				      jne NOADD
     51	0168  B0 24				      mov al, '$' ; костыль
     52	016A					      NOADD:
     53	016A  88 85 0022r			      MOV str[di],AL
     54	016E  3C 24				      CMP AL, '$'
     55	0170  75 03				      JNE ENIF
     56	0172  EB 06 90				      JMP ENDEF
Turbo Assembler	 Version 3.1	    05/15/18 20:53:54	    Page 2
LAB5.asm



     57	0175						     ENIF:
     58	0175  8A D0						     MOV DL,AL
     59	0177  E8 0084						     CALL PutCh
     60	017A						     ENDEF:
     61	017A  47						     INC DI
     62	017B  3C 24						     CMP AL,'$'
     63	017D  75 DC						     JNE Cycle2
     64	017F  B2 20						     MOV DL, ' '
     65	0181  E8 007A						     CALL PutCh
     66	0184  89 3E 0122r					     mov chcol,	di
     67	0188  B2 28						     mov dl, 28h ; '('
     68	018A  E8 0071						     call putch
     69	018D  E8 FF94						     call putchcol
     70	0190  B2 29						     mov dl, 29h ; ')'
     71	0192  E8 0069						     call putch
     72	0195  46						     inc si
     73	0196  B2 20						     MOV DL, ' '
     74	0198  E8 0063						     CALL PutCh
     75	019B  B2 3D						     MOV DL, '='
     76
     77	019D  E8 005E						     CALL PutCh
     78	01A0  B2 20						     MOV DL, ' '
     79	01A2  E8 0059						     CALL PutCh
     80	01A5  BF 0000						     MOV DI, 0
     81	01A8				      Cycle3:
     82	01A8  8A 95 0022r			      MOV DL,str[di]
     83	01AC  52				      PUSH DX
     84	01AD  80 FA 24				      CMP DL, '$'
     85	01B0  75 03				      JNE Hexing
     86	01B2  EB 0A 90				      JMP G1
     87	01B5						     Hexing:
     88	01B5  E8 0028						     CALL Hex
     89	01B8  47						     INC DI
     90	01B9  B2 20						     MOV DL, ' '
     91	01BB  E8 0040						     CALL PutCh
     92	01BE						     G1:
     93	01BE  5A						     POP DX
     94	01BF  80 FA 24						     CMP DL, '$'
     95	01C2  75 E4						     JNE Cycle3
     96	01C4  B4 08				      MOV AH,08h
     97	01C6  CD 21				      INT 21h
     98	01C8  50				      PUSH AX
     99	01C9  E8 0043				      CALL Clrf
    100	01CC  58				      POP AX
    101	01CD  3C 2A				      CMP AL, '*'
    102	01CF  75 87				      JNE Cycle1
    103	01D1  E8 003B				      CALL Clrf
    104	01D4  E8 0033				      CALL GetCh
    105	01D7  E8 0029				      CALL ClrScr
    106	01DA  B0 00			      MOV AL,0
    107	01DC  B4 4C			      MOV AH,4ch
    108	01DE  CD 21			      int 21h
    109	01E0				     Hex PROC
    110	01E0  8B C2				      MOV AX,DX
    111	01E2  50				      PUSH AX
    112	01E3  D0 E8				      shr AL,1
    113	01E5  D0 E8				      shr AL,1
Turbo Assembler	 Version 3.1	    05/15/18 20:53:54	    Page 3
LAB5.asm



    114	01E7  D0 E8				      shr AL,1
    115	01E9  D0 E8				      shr AL,1
    116	01EB  BB 0000r				      MOV BX, offset alf
    117	01EE  D7				      XLAT
    118	01EF  8A D0				      MOV DL,AL
    119	01F1  E8 000A				      CALL PutCh
    120	01F4  58				      POP AX
    121	01F5  24 0F				      and AL,00001111b
    122	01F7  D7				      XLAT
    123	01F8  8A D0				      MOV DL,AL
    124	01FA  E8 0001				      CALL PutCh
    125	01FD  C3				      ret
    126	01FE				     Hex ENDP
    127	01FE				     PutCh Proc
    128	01FE  B4 02				      MOV AH,02h
    129	0200  CD 21				      INT 21h
    130	0202  C3				      ret
    131	0203				     PutCh ENDP
    132	0203				     ClrScr PROC
    133	0203  B4 00				      MOV AH,00
    134	0205  B0 03				      MOV AL,03
    135	0207  CD 10				      INT 10h
    136	0209  C3				      ret
    137	020A				     ClrScr ENDP
    138	020A				     GetCh PROC
    139	020A  B4 01				      MOV AH,01H
    140	020C  CD 21				      INT 021H
    141	020E  C3				      RET
    142	020F				     GetCh ENDP
    143	020F				     Clrf PROC
    144	020F  B4 02				      MOV AH,02
    145	0211  B2 0D				      MOV DL,13
    146	0213  CD 21				      INT 21H
    147	0215  B4 02				      MOV AH,02
    148	0217  B2 0A				      MOV DL,10
    149	0219  CD 21				      INT 21H
    150	021B  C3				      RET
    151	021C				     Clrf ENDP
    152	021C			      MYCODE ENDS
    153				      END START
Turbo Assembler	 Version 3.1	    05/15/18 20:53:54	    Page 4
Symbol Table




Symbol Name			  Type	 Value

??DATE				  Text	 "05/15/18"
??FILENAME			  Text	 "LAB5	  "
??TIME				  Text	 "20:53:54"
??VERSION			  Number 030A
@CHAR				  Near	 MYCODE:015B
@CPU				  Text	 0101H
@CURSEG				  Text	 MYCODE
@FILENAME			  Text	 LAB5
@WORDSIZE			  Text	 2
ALF				  Byte	 MYCODE:0000
CHCOL				  Word	 MYCODE:0122
CLRF				  Near	 MYCODE:020F
CLRSCR				  Near	 MYCODE:0203
CYCLE1				  Near	 MYCODE:0158
CYCLE2				  Near	 MYCODE:015B
CYCLE3				  Near	 MYCODE:01A8
ENDEF				  Near	 MYCODE:017A
ENIF				  Near	 MYCODE:0175
G1				  Near	 MYCODE:01BE
GETCH				  Near	 MYCODE:020A
HEX				  Near	 MYCODE:01E0
HEXING				  Near	 MYCODE:01B5
HI				  Near	 MYCODE:0131
LO				  Near	 MYCODE:0142
NOADD				  Near	 MYCODE:016A
PUTCH				  Near	 MYCODE:01FE
PUTCHCOL			  Near	 MYCODE:0124
START				  Near	 MYCODE:014E
STR				  Byte	 MYCODE:0022
VYHOD				  Byte	 MYCODE:0010

Groups & Segments		  Bit Size Align  Combine Class

MYCODE				  16  021C Para	  none	  CODE
Turbo Assembler	 Version 3.1	    05/15/18 20:53:54	    Page 5
Error Summary



*Warning* LAB5.asm(5) Reserved word used as symbol: STR
