tasm - Assembly 8086: get and print 32bit filesize using 16bit registers -
i need print filesize using function 23h http://www.ousob.com/ng/asm/ng4d85d.php dont understand how can value (offset 21h) of fcb, should 4byte value, need move pair of 16bit registers, e.g. bx , cx simple code:
mov dx,offset input mov ah,23h int 21h
then need print it, know how print 1 16bit register , dont know find tutorial how 32bit value (2 registers) simply, thanks
the fcb returns both number of records (a 32-bit quantity @ offset 21h of fcb) , size of each record (a 16-bit quantity @ offset 0eh of fcb). need multiply approximation of file size. it's approximation because partial block counted whole block call.
so assuming input
declared fcb structure in memory in data segment , file consists exclusively of records 27 bytes long, code might this.
mov dx,offset input ; point fcb mov si, dx ; copy pointer add si,0eh ; point record size within fcb mov [si],27 ; load record size = 27 bytes mov ah,23h ; file size int 21h ; call dos interrupt cmp al,0 ; call successful? jnz error ; if not, handle error add si,13h ; advance pointer point fcb:21h ; ds:si points file size in records
see this derivation of age-old "ralf brown's interrupt list" list of of many precautions regarding interrupt.
Comments
Post a Comment