- c unsigned char pointer or other unsigned type of your choice
- assembly code, set segment register ds to 0x000f or whatever and use nasm, 
set 
up a buffer for the filenames, one for the system bios, one r the extended 
bios.  set up a 64K disk buffer in memory.  make your code do an int 21h call 
to 
set the disk buffer to write to be at the system bios, then 


each bios is going to be different.  what is common between the BIOSes is the 
int21H functions, which are outlined here:
http://hdebruijn.soo.dto.tudelft.nl/newpage/interupt/out-0100.htm

however it does list some vendor-specific stuff.

I could write the C code right here and you can use djgpp to compile it, you 
will need cwsdpmi.zip from delorie's ftp site to make the executable useable.

realize than some BIOSes are actually EFI or UEFI on some 64-bit systems.  in 
that case, I don't think BIOS functions are available anymore.


#include <stdio.h>
typedef unsigned char byte;
typedef unsigned long long qword;

byte *plower=(byte *)(896*1024);
int sizelower=1048576-896*1024;
char filenamelower[]="lowbios.bin";

byte *pupper=(byte *)0xffe00000;
int sizeupper=2*1048576;
char filenamelower[]="highbios.bin";

bool writememorytodisk(char * fpath, byte * p, int length) {
    int i;
    FILE * f = fopen(fpath, "wb+");
    if (NULL==f) {
        printf("ERROR: could not open file %s for writing.\n", fpath);
        return false;//oops
    }
    for (i=0; i < length; i += 1024) {
        if (1024 != fwrite(f, p, 1024)) {
            printf("ERROR: out of disk space.\n");
            fclose(f);
            return false;//oops
        }
        p += 1024;
    }
    fclose(f);
    return true;//success
}

int main(void) {
    writememorytodisk(filenamelower, plower, sizelower);
    writememorytodisk(filenameupper, pupper, sizeupper);
    return 0;
}

try that.

------------
Jim Michaels
[email protected]
[email protected]
http://JimsComputerRepairandWebDesign.com
http://JesusnJim.com (my personal site, has software)
http://DoLifeComputers.JesusnJim.com (group which I lead)
---
Computer memory/disk size measurements:
[KB KiB] [MB MiB] [GB GiB] [TB TiB]
[10^3B=1000B=1KB][10^6B=1000000B=1MB][10^9B=1000000000B=1GB][10^12B=1000000000000B=1TB]

[2^10B=1024B=1KiB][2^20B=1048576B=1MiB][2^30B=1073741824B=1GiB][2^40B=1099511627776B=1TiB]

Note: disk size is measured in MB, GB, or TB, not in MiB, GiB, or TiB.  
computer 
memory (RAM) is measured in MiB and GiB.






________________________________
From: Braden Mailloux <[email protected]>
To: [email protected]
Sent: Sat, October 30, 2010 10:31:06 PM
Subject: [Freedos-devel] C/C++ BIOS backup

Hi Guys. I read through the boot code and didn't see and specifics written 
about 
where the system bios is stored in memory. I'd like to backup a copy of the 
bios 
and have a look-see through the file. Does anyone have any recommended 
algorithms for such an exploration?

-- 
Very Respectfully,
Braden C. Roberson-Mailloux
[email protected]


      
------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to