Turbo Assembler	 Version 3.1	    05/15/18 20:58:22	    Page 1
LAB5_2.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_2.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 00C6		       call PutCh
     21	0137  8B 16 0122r	       mov dx, chcol
     22	013B  83 C2 26		       add dx, 38
     23	013E  E8 00BC		       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 00B1		       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 00AD			      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:58:22	    Page 2
LAB5_2.asm



     57	0175						     ENIF:
     58	0175  8A D0						     MOV DL,AL
     59	0177  E8 0083						     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 0079						     CALL PutCh
     66	0184  89 3E 0122r					     mov chcol,	di
     67	0188  B2 28						     mov dl, 28h ; '('
     68	018A  E8 0070						     call putch
     69	018D  E8 FF94						     call putchcol
     70	0190  B2 29						     mov dl, 29h ; ')'
     71	0192  E8 0068						     call putch
     72	0195  46						     inc si
     73	0196  B2 20						     MOV DL, ' '
     74	0198  E8 0062						     CALL PutCh
     75	019B  B2 3D						     MOV DL, '='
     76
     77	019D  E8 005D						     CALL PutCh
     78	01A0  B2 20						     MOV DL, ' '
     79	01A2  E8 0058						     CALL PutCh
     80								     ;MOV DI, 0
     81	01A5  4F						     dec di
     82	01A6  4F						     dec di
     83	01A7				      Cycle3:
     84	01A7  8A 95 0022r			      MOV DL,str[di]
     85	01AB  52				      PUSH DX
     86	01AC  83 FF 00				      CMP DI, 0h
     87	01AF  75 03				      JNE Hexing
     88	01B1  EB 0A 90				      JMP G1
     89	01B4						     Hexing:
     90	01B4  E8 0028						     CALL Hex
     91	01B7  4F						     DEC DI
     92	01B8  B2 20						     MOV DL, ' '
     93	01BA  E8 0040						     CALL PutCh
     94	01BD						     G1:
     95	01BD  5A						     POP DX
     96	01BE  83 FF 00						     CMP DI, 0h
     97	01C1  75 E4						     JNE Cycle3
     98	01C3  B4 08				      MOV AH,08h
     99	01C5  CD 21				      INT 21h
    100	01C7  50				      PUSH AX
    101	01C8  E8 0043				      CALL Clrf
    102	01CB  58				      POP AX
    103	01CC  3C 2A				      CMP AL, '*'
    104	01CE  75 88				      JNE Cycle1
    105	01D0  E8 003B				      CALL Clrf
    106	01D3  E8 0033				      CALL GetCh
    107	01D6  E8 0029				      CALL ClrScr
    108	01D9  B0 00			      MOV AL,0
    109	01DB  B4 4C			      MOV AH,4ch
    110	01DD  CD 21			      int 21h
    111	01DF				     Hex PROC
    112	01DF  8B C2				      MOV AX,DX
    113	01E1  50				      PUSH AX
Turbo Assembler	 Version 3.1	    05/15/18 20:58:22	    Page 3
LAB5_2.asm



    114	01E2  D0 E8				      shr AL,1
    115	01E4  D0 E8				      shr AL,1
    116	01E6  D0 E8				      shr AL,1
    117	01E8  D0 E8				      shr AL,1
    118	01EA  BB 0000r				      MOV BX, offset alf
    119	01ED  D7				      XLAT
    120	01EE  8A D0				      MOV DL,AL
    121	01F0  E8 000A				      CALL PutCh
    122	01F3  58				      POP AX
    123	01F4  24 0F				      and AL,00001111b
    124	01F6  D7				      XLAT
    125	01F7  8A D0				      MOV DL,AL
    126	01F9  E8 0001				      CALL PutCh
    127	01FC  C3				      ret
    128	01FD				     Hex ENDP
    129	01FD				     PutCh Proc
    130	01FD  B4 02				      MOV AH,02h
    131	01FF  CD 21				      INT 21h
    132	0201  C3				      ret
    133	0202				     PutCh ENDP
    134	0202				     ClrScr PROC
    135	0202  B4 00				      MOV AH,00
    136	0204  B0 03				      MOV AL,03
    137	0206  CD 10				      INT 10h
    138	0208  C3				      ret
    139	0209				     ClrScr ENDP
    140	0209				     GetCh PROC
    141	0209  B4 01				      MOV AH,01H
    142	020B  CD 21				      INT 021H
    143	020D  C3				      RET
    144	020E				     GetCh ENDP
    145	020E				     Clrf PROC
    146	020E  B4 02				      MOV AH,02
    147	0210  B2 0D				      MOV DL,13
    148	0212  CD 21				      INT 21H
    149	0214  B4 02				      MOV AH,02
    150	0216  B2 0A				      MOV DL,10
    151	0218  CD 21				      INT 21H
    152	021A  C3				      RET
    153	021B				     Clrf ENDP
    154	021B			      MYCODE ENDS
    155				      END START
Turbo Assembler	 Version 3.1	    05/15/18 20:58:22	    Page 4
Symbol Table




Symbol Name			  Type	 Value

??DATE				  Text	 "05/15/18"
??FILENAME			  Text	 "LAB5_2  "
??TIME				  Text	 "20:58:22"
??VERSION			  Number 030A
@CHAR				  Near	 MYCODE:015B
@CPU				  Text	 0101H
@CURSEG				  Text	 MYCODE
@FILENAME			  Text	 LAB5_2
@WORDSIZE			  Text	 2
ALF				  Byte	 MYCODE:0000
CHCOL				  Word	 MYCODE:0122
CLRF				  Near	 MYCODE:020E
CLRSCR				  Near	 MYCODE:0202
CYCLE1				  Near	 MYCODE:0158
CYCLE2				  Near	 MYCODE:015B
CYCLE3				  Near	 MYCODE:01A7
ENDEF				  Near	 MYCODE:017A
ENIF				  Near	 MYCODE:0175
G1				  Near	 MYCODE:01BD
GETCH				  Near	 MYCODE:0209
HEX				  Near	 MYCODE:01DF
HEXING				  Near	 MYCODE:01B4
HI				  Near	 MYCODE:0131
LO				  Near	 MYCODE:0142
NOADD				  Near	 MYCODE:016A
PUTCH				  Near	 MYCODE:01FD
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  021B Para	  none	  CODE
Turbo Assembler	 Version 3.1	    05/15/18 20:58:22	    Page 5
Error Summary



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