994 DOSSEG .MODEL SMALL .STACK .DATA outfile db 'DXCC.IMP',0 usage db 'DXCC converts K2DI DXCC list to semicolon separated list for database import',13,10 db 'usage: dxcc ',13,10,'$' open_err db 'Error opening file!',13,10,'$' .DATA? buf db 32768 dup(?) numread dw ? infile db 15 dup(?) inhand dw ? outhand dw ? linebuf db 128 dup(?) lbufptr dw ? cntr dw ? dummy db ? .CODE .STARTUP xor cx,cx mov cl,byte ptr es:[80h] cmp cl,0 jnz fname_ok mov ah,9 mov dx,offset usage int 21h jmp abort fname_ok: mov di,81h mov si,offset infile mov al,' ' repne scasb readlp: cmp byte ptr es:[di],13 jz read_rdy mov dl,byte ptr es:[di] mov byte ptr[si],dl inc si inc di jmp readlp read_rdy: mov byte ptr[si],0 mov ah,3dh mov al,0 mov dx,offset infile int 21h jnc open_ok mov ah,9 mov dx,offset open_err int 21h jmp abort open_ok: mov inhand,ax mov ah,3ch mov cx,0 mov dx,offset outfile int 21h mov ah,3dh mov al,1 mov dx,offset outfile int 21h mov outhand,ax call findfirstrec convlp: mov ah,3fh mov bx,inhand mov cx,32768 mov dx,offset buf int 21h mov numread,ax jc eof mov cx,numread mov si,offset buf cmplp: cmp byte ptr[si],':' jnz nocolon mov byte ptr[si],';' nocolon: inc si loop cmplp mov ah,40h mov bx,outhand mov cx,numread mov dx,offset buf int 21h cmp numread,32768 jz convlp eof: mov ah,3eh mov bx,inhand int 21h mov ah,3eh mov bx,outhand int 21h abort: mov ax,4c00h int 21h ; procedure findfirstrec searches for a "--------------------------" line ; after which the records are supposed to start (not too sure...) findfirstrec PROC nxt_line: mov di,offset linebuf call read_line mov cntr,0 scan_line: cmp byte ptr[di],13 jnz go_on cmp cntr,20 ;If 20 -'s then take it as a valid line jae ffr_rdy jmp nxt_line go_on: cmp byte ptr[di],'-' jz slash cmp cntr,20 jae ffr_rdy mov cntr,0 inc di jmp scan_line slash: inc cntr inc di jmp scan_line ffr_rdy: ret findfirstrec ENDP read_line PROC push di line_lp: mov ah,3fh mov bx,inhand mov cx,1 mov dx,di int 21h cmp byte ptr[di],10 ;Read to LF jz line_rdy inc di jmp line_lp line_rdy: pop di ret read_line ENDP END . 0