Turbo Assembler	 Version 3.1	    05/15/18 21:01:45	    Page 1
LAB5_3.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_3.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 00CE		       call PutCh
     21	0137  8B 16 0122r	       mov dx, chcol
     22	013B  83 C2 26		       add dx, 38
     23	013E  E8 00C4		       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 00B9		       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 00B5			      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 21:01:45	    Page 2
LAB5_3.asm



     57	0175						     ENIF:
     58	0175  8A D0						     MOV DL,AL
     59	0177  E8 008B						     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 0081						     CALL PutCh
     66	0184  89 3E 0122r					     mov chcol,	di
     67	0188  B2 28						     mov dl, 28h ; '('
     68	018A  E8 0078						     call putch
     69	018D  E8 FF94						     call putchcol
     70	0190  B2 29						     mov dl, 29h ; ')'
     71	0192  E8 0070						     call putch
     72	0195  46						     inc si
     73	0196  B2 20						     MOV DL, ' '
     74	0198  E8 006A						     CALL PutCh
     75	019B  B2 3D						     MOV DL, '='
     76
     77	019D  E8 0065						     CALL PutCh
     78	01A0  B2 20						     MOV DL, ' '
     79	01A2  E8 0060						     CALL PutCh
     80	01A5  83 FF 00						     cmp di, 0h
     81	01A8  73 02						     jae Cycle3
     82	01AA  4F						     dec di
     83	01AB  4F						     dec di
     84	01AC				      Cycle3:
     85	01AC  8A 95 0022r			      MOV DL,str[di]
     86	01B0  52				      PUSH DX
     87	01B1  83 FF 00				      CMP DI, 0h
     88	01B4  75 03				      JNE Hexing
     89	01B6  EB 0A 90				      JMP G1
     90	01B9						     Hexing:
     91	01B9  E8 002B						     CALL Hex
     92	01BC  4F						     DEC DI
     93	01BD  B2 20						     MOV DL, ' '
     94	01BF  E8 0043						     CALL PutCh
     95	01C2						     G1:
     96	01C2  5A						     POP DX
     97	01C3  83 FF 00						     CMP DI, 0h
     98	01C6  75 E4						     JNE Cycle3
     99	01C8  B4 08				      MOV AH,08h
    100	01CA  CD 21				      INT 21h
    101	01CC  50				      PUSH AX
    102	01CD  E8 0046				      CALL Clrf
    103	01D0  58				      POP AX
    104	01D1  3C 2A				      CMP AL, '*'
    105	01D3  BF 0000				      mov di, 0
    106	01D6  75 80				      JNE Cycle1
    107	01D8  E8 003B				      CALL Clrf
    108	01DB  E8 0033				      CALL GetCh
    109	01DE  E8 0029				      CALL ClrScr
    110	01E1  B0 00			      MOV AL,0
    111	01E3  B4 4C			      MOV AH,4ch
    112	01E5  CD 21			      int 21h
    113	01E7				     Hex PROC
Turbo Assembler	 Version 3.1	    05/15/18 21:01:45	    Page 3
LAB5_3.asm



    114	01E7  8B C2				      MOV AX,DX
    115	01E9  50				      PUSH AX
    116
    117	01EA  24 0F				      and AL,00001111b
    118	01EC  D7				      XLAT
    119	01ED  8A D0				      MOV DL,AL
    120	01EF  E8 0013				      CALL PutCh
    121
    122	01F2  58				      POP AX
    123
    124	01F3  D0 E8				      shr AL,1
    125	01F5  D0 E8				      shr AL,1
    126	01F7  D0 E8				      shr AL,1
    127	01F9  D0 E8				      shr AL,1
    128	01FB  BB 0000r				      MOV BX, offset alf
    129	01FE  D7				      XLAT
    130	01FF  8A D0				      MOV DL,AL
    131	0201  E8 0001				      CALL PutCh
    132	0204  C3				      ret
    133	0205				     Hex ENDP
    134	0205				     PutCh Proc
    135	0205  B4 02				      MOV AH,02h
    136	0207  CD 21				      INT 21h
    137	0209  C3				      ret
    138	020A				     PutCh ENDP
    139	020A				     ClrScr PROC
    140	020A  B4 00				      MOV AH,00
    141	020C  B0 03				      MOV AL,03
    142	020E  CD 10				      INT 10h
    143	0210  C3				      ret
    144	0211				     ClrScr ENDP
    145	0211				     GetCh PROC
    146	0211  B4 01				      MOV AH,01H
    147	0213  CD 21				      INT 021H
    148	0215  C3				      RET
    149	0216				     GetCh ENDP
    150	0216				     Clrf PROC
    151	0216  B4 02				      MOV AH,02
    152	0218  B2 0D				      MOV DL,13
    153	021A  CD 21				      INT 21H
    154	021C  B4 02				      MOV AH,02
    155	021E  B2 0A				      MOV DL,10
    156	0220  CD 21				      INT 21H
    157	0222  C3				      RET
    158	0223				     Clrf ENDP
    159	0223			      MYCODE ENDS
    160				      END START
Turbo Assembler	 Version 3.1	    05/15/18 21:01:45	    Page 4
Symbol Table




Symbol Name			  Type	 Value

??DATE				  Text	 "05/15/18"
??FILENAME			  Text	 "LAB5_3  "
??TIME				  Text	 "21:01:45"
??VERSION			  Number 030A
@CHAR				  Near	 MYCODE:015B
@CPU				  Text	 0101H
@CURSEG				  Text	 MYCODE
@FILENAME			  Text	 LAB5_3
@WORDSIZE			  Text	 2
ALF				  Byte	 MYCODE:0000
CHCOL				  Word	 MYCODE:0122
CLRF				  Near	 MYCODE:0216
CLRSCR				  Near	 MYCODE:020A
CYCLE1				  Near	 MYCODE:0158
CYCLE2				  Near	 MYCODE:015B
CYCLE3				  Near	 MYCODE:01AC
ENDEF				  Near	 MYCODE:017A
ENIF				  Near	 MYCODE:0175
G1				  Near	 MYCODE:01C2
GETCH				  Near	 MYCODE:0211
HEX				  Near	 MYCODE:01E7
HEXING				  Near	 MYCODE:01B9
HI				  Near	 MYCODE:0131
LO				  Near	 MYCODE:0142
NOADD				  Near	 MYCODE:016A
PUTCH				  Near	 MYCODE:0205
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  0223 Para	  none	  CODE
Turbo Assembler	 Version 3.1	    05/15/18 21:01:45	    Page 5
Error Summary



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