
Kenny Billiau wrote:
maybe we can give'm a potje tipex?
Fuck that, here is the assembly version: MainPgm proc far mov ax, seg dseg mov ds, ax mov es, ax mov ah, 3dh mov al, 0 ;Open file for reading lea dx, Filename ;File to open int 21h jnc GoodOpen print byte 'Cannot open file, aborting program...',cr,lf,0 jmp PgmExit GoodOpen: mov FileHandle1, ax ;Save input file handle mov ah, 3Ch ;Create file call mov cx, 0 ;Normal file attributes lea dx, OutFileName ;File to open int 21h jnc GoodOpen2 print byte 'Cannot open output file, aborting program...' byte cr,lf,0 mov ah, 3eh ;Close input file mov bx, FileHandle1 int 21h jmp PgmExit ;Ignore any error. GoodOpen2: mov FileHandle2, ax ;Save output file handle ReadFileLp: mov bx, FileHandle1 mov cx, 1 ;Read one byte lea dx, buffer ;Place to store that byte mov ah, 3Fh ;Read operation int 21h jc BadRead cmp ax, 1 ;Reached EOF? jz ReadOK jmp AtEOF ReadOK: mov al, Buffer ;Get the character read and cmp al, 'a' jb NotLower cmp al, 'z' ja NotLower and al, 5fh ;Set Bit #5 to zero. NotLower: mov Buffer, al mov bx, FileHandle2 mov cx, 1 ;Read one byte lea dx, buffer ;Place to store that byte mov ah, 40h ;Write operation int 21h jc BadWrite cmp ax, 1 ;Make sure disk isn't full jz ReadFileLp BadWrite: print byte cr, lf byte 'Error writing data to file, aborting operation' byte cr,lf,0 jmp short AtEOF BadRead: print byte cr, lf byte 'Error reading data from file, aborting ' byte 'operation',cr,lf,0 AtEOF: mov bx, FileHandle1 ;Close the file mov ah, 3Eh int 21h mov bx, FileHandle2 mov ah, 3eh int 21h PgmExit: ExitPgm MainPgm endp cseg ends dseg segment byte public 'data' Filename byte 'ucconvrt.asm',0 ;Filename to convert OutFileName byte 'output.txt',0 ;Output filename FileHandle1 word ? FileHandle2 word ? Buffer byte ? Position word 0 dseg ends sseg segment byte stack 'stack' stk word 0ffh dup (?) sseg ends zzzzzzseg segment para public 'zzzzzz' LastBytes byte 16 dup (?) zzzzzzseg ends end MainPgm ok, this just converts every character to uppercase in a file, and writes it to another file. Still figuring out how to make it skip the first n characters. -- ================================================================== Michiel Van Bel PhD student Tel:+32 (0)9 331 36 95 fax:+32 (0)9 3313809 VIB Department of Plant Systems Biology, Ghent University Technologiepark 927, 9052 Gent, BELGIUM mibel@psb.ugent.be http://www.psb.ugent.be ==================================================================