how to fill file with 0

Programming, for all ages and all languages.
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

david wrote:
Dex wrote:What does this assemble too ?

Code: Select all

.model tiny
.code
.386
start:
    xor ax, ax
    org 1024
    org 64511                        
    db 0
If it will allow it.
org 64511
db 0
The byte's offset is 64511, not (64511 + 1024).
The logic is this

Code: Select all

.model tiny
.code
.386
start:
    xor ax, ax
    org 1024 ; you have code above, random size, so we know this is 1024 ;bytes from  start of program
    org 64511   ; Then we know this should be  64511 bytes + 1024 bytes                     
    db 0            ; 1 byte, so 1024 + 64511 + 1 = ????????????????
I make it 64k, unless masm will not let you stack org ?.
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Try this

Post by DeletedAccount »

I do not think there is any need of programming for this just use the existing tools .....

eg

Code: Select all

dd if=/dev/zero of=output.com bs = 1k count = 64
dd if=myfile of=output.com  conv = notrunc

Post Reply