Microsoft (R) Macro Assembler Version 4.00 1/13/5 Page 1-1 ; mojtaba amirzadeh date 1383/10/24 ; www.ifjam .com C include io.h .LIST = 000D cr equ 0dh = 000A Lf EQU 0ah = 001A contorol_z equ 1ah = 0378 lpt1_data equ 378h = 0379 lpt1_status equ lpt1_data+1 = 037A lpt1_control equ lpt1_data+2 0000 stack SEGMENT stack 0000 0100[ DW 100h DUP(?) ???? ] 0200 stack ENDS 0000 data SEGMENT 'data' 0000 0D 0A 45 4E 54 45 52 prompt db cr,lf ,'ENTER FILE NAME: $' 20 46 49 4C 45 20 4E 41 4D 45 3A 20 20 24 0015 0064[ filename db 100 dup(?) ?? ] 0079 ???? handle dw ? 007B 75 6E 61 62 6C 65 20 error_1 db 'unable to open file ',cr,lf,'$' 74 6F 20 6F 70 65 6E 20 66 69 6C 65 20 0D 0A 24 0092 63 72 2C 6C 66 2C 20 error_2 db 'cr,lf, *************** ERROR READI NG **************',CR,LF,'$' 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 20 45 52 52 4F 52 20 52 45 41 44 49 4E 47 20 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 0D 0A 24 00C8 63 72 2C 6C 66 2C 20 error_3 db 'cr,lf, *************** ERROR CLOSI NG **************',CR,LF,'$' 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 20 45 52 52 4F 52 20 43 4C 4F 53 49 4E 47 20 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 0D 0A 24 00FE ?? CHAR db ? 00FF 20 70 72 6F 67 72 61 maker db ' programer: mojtaba amirzadeh ',CR,L F,' url http:www.ifjam.com',CR,LF 6D 65 72 3A 20 6D 6F 6A 74 61 62 61 20 61 Microsoft (R) Macro Assembler Version 4.00 1/13/5 Page 1-2 6D 69 72 7A 61 64 65 68 20 0D 0A 20 75 72 6C 20 68 74 74 70 3A 77 77 77 2E 69 66 6A 61 6D 2E 63 6F 6D 0D 0A 0138 data ends 0000 code SEGMENT 'code' ASSUME cs:code ,ds:data 0000 B8 ---- R start: mov ax,SEG data 0003 8E D8 mov ds,ax output maker 0015 B0 08 mov al,00001000b 0017 BA 037A mov dx,lpt1_control 001A EE out dx,al 001B B9 0032 mov cx,50 001E 90 init_wait: nop 001F E2 FD loop init_wait 0021 B0 0C mov al,00001100b 0023 EE out dx,al 0024 B4 09 mov ah,09h 0026 BA 0000 R mov dx,offset prompt 0029 CD 21 int 21h 002B B4 0A mov ah,0ah 002D BA 0015 R mov dx,offset filename 0030 C6 06 0015 R 61 mov filename,97 0035 CD 21 int 21h 0037 8B DA mov bx,dx 0039 A0 0016 R mov al,filename+1 003C 2A E4 sub ah,ah 003E 03 D8 add bx,ax 0040 C6 47 02 00 mov byte ptr [bx+2],0 0044 B4 02 mov ah,02h 0046 B2 0A mov dl,lf 0048 CD 21 int 21h 004A CD 21 int 21h 004C B0 00 mov al,0 004E B4 3D mov ah,3dh 0050 BA 0017 R mov dx,offset filename+2 0053 CD 21 int 21h 0055 73 0A jnc read 0057 B4 09 mov ah,09h 0059 BA 007B R mov dx,offset error_1 005C CD 21 int 21h 005E EB 4E 90 jmp quit 0061 read: 0061 A3 0079 R mov handle,ax 0064 8B D8 mov bx,ax Microsoft (R) Macro Assembler Version 4.00 1/13/5 Page 1-3 0066 B9 0001 mov cx,1 0069 loop1: 0069 B4 3F mov ah,3fh 006B BA 00FE R mov dx, offset char 006E CD 21 int 21h 0070 73 0A jnc check 0072 B4 09 mov ah, 09h 0074 BA 0092 R mov dx,offset error_2 0077 CD 21 int 21h 0079 EB 33 90 jmp quit 007C 80 3E 00FE R 1A check: cmp char,contorol_z 0081 74 1A je end_loop1 0083 BA 0379 mov dx,lpt1_status 0086 EC while_busy: in al,dx 0087 24 80 and al,10000000b 0089 74 FB jz while_busy 008B A0 00FE R mov al,char 008E BA 0378 mov dx,lpt1_data 0091 EE out dx,al 0092 BA 037A mov dx,lpt1_control 0095 B0 0D mov al,00001101b 0097 EE out dx,al 0098 B0 0C mov al,00001100b 009A EE out dx,al 009B EB CC jmp loop1 009D end_loop1: 009D B4 3E mov ah,3eh 009F 8B 1E 0079 R mov bx,handle 00A3 CD 21 int 21h 00A5 73 07 jnc quit 00A7 B4 09 mov ah,09h 00A9 BA 00C8 R mov dx,offset error_3 00AC CD 21 int 21h 00AE quit: inputc 00B3 B0 00 mov al,0 00B5 B4 4C mov ah,4ch 00B7 CD 21 int 21h 00B9 code ends end start Microsoft (R) Macro Assembler Version 4.00 1/13/5 Symbols-1 Macros: N a m e Lines ATOI . . . . . . . . . . . . . . 12 INPUTC . . . . . . . . . . . . . 5 INPUTS . . . . . . . . . . . . . 13 ITOA . . . . . . . . . . . . . . 15 M_ERROR . . . . . . . . . . . . 9 OUTPUT . . . . . . . . . . . . . 19 Segments and Groups: N a m e Size Align Combine Class CODE . . . . . . . . . . . . . . 00B9 PARA NONE 'CODE' DATA . . . . . . . . . . . . . . 0138 PARA NONE 'DATA' STACK . . . . . . . . . . . . . 0200 PARA STACK Symbols: N a m e Type Value Attr ATOI_PROC . . . . . . . . . . . L FAR 0000 External CHAR . . . . . . . . . . . . . . L BYTE 00FE DATA CHECK . . . . . . . . . . . . . L NEAR 007C CODE CONTOROL_Z . . . . . . . . . . . Number 001A CR . . . . . . . . . . . . . . . Number 000D END_LOOP1 . . . . . . . . . . . L NEAR 009D CODE ERROR_1 . . . . . . . . . . . . L BYTE 007B DATA ERROR_2 . . . . . . . . . . . . L BYTE 0092 DATA ERROR_3 . . . . . . . . . . . . L BYTE 00C8 DATA FILENAME . . . . . . . . . . . . L BYTE 0015 DATA Length = 0064 HANDLE . . . . . . . . . . . . . L WORD 0079 DATA INC_PROC . . . . . . . . . . . . L FAR 0000 External INIT_WAIT . . . . . . . . . . . L NEAR 001E CODE INS_PROC . . . . . . . . . . . . L FAR 0000 External ITOA_PROC . . . . . . . . . . . L FAR 0000 External LF . . . . . . . . . . . . . . . Number 000A LOOP1 . . . . . . . . . . . . . L NEAR 0069 CODE LPT1_CONTROL . . . . . . . . . . Number 037A LPT1_DATA . . . . . . . . . . . Number 0378 LPT1_STATUS . . . . . . . . . . Number 0379 MAKER . . . . . . . . . . . . . L BYTE 00FF DATA OUT_PROC . . . . . . . . . . . . L FAR 0000 External Microsoft (R) Macro Assembler Version 4.00 1/13/5 Symbols-2 PROMPT . . . . . . . . . . . . . L BYTE 0000 DATA QUIT . . . . . . . . . . . . . . L NEAR 00AE CODE READ . . . . . . . . . . . . . . L NEAR 0061 CODE START . . . . . . . . . . . . . L NEAR 0000 CODE WHILE_BUSY . . . . . . . . . . . L NEAR 0086 CODE 224 Source Lines 249 Total Lines 57 Symbols 49200 Bytes symbol space free 0 Warning Errors 0 Severe Errors