Hi!
12-Мар-2004 13:29 [EMAIL PROTECTED] (junk) wrote to freedos-devel
<[EMAIL PROTECTED]>:
j> Scanning for EPROMS:
j> uchar far *pmem = MK_FP(mem,0);
j> if ( pmem[0] != 0x55u || pmem[1] != 0xaau)
if (*(word far*) MK_FP (mem,0) != 0xAA55)
j> - romsize = pmem[2] / 2;
j> +*****
j> if (pmem[2] == 0)
j> romsize = 2; /* there was a valid EPROM
j> signiture !! */
j> else
j> {
j> /* By definition, EPROMS are
j> located
j> on 2K boundaries.
j> so in any case, the search
j> pointer
j> must remain 2K-aligned
j> */
j> romsize = ((uint)pmem[2] + 3) / 4 * 2;
j> }
j> +*****
romsize = *(byte far*) MK_FP (mem, 2);
/* now romsize contains ROM size in 512-byte pages */
if (romsize == 0)
romsize = 1; /* there was a valid EPROM signiture !! */
/* By definition, EPROMS are located on 2K boundaries.
so in any case, the search pointer must remain 2K-aligned
*/
romsize = ((romsize - 1) / 4u + 1) * 2u;
/* now romsize contains size of ROM in kbytes,
rounded up to 2k boundary (2k, 4k, etc).
*/
If you wish to count romsize in 512-byte pages, then last align expression
should/may be changed so:
romsize = (romsize + 3u) & ~3u;
/* now romsize contains size of ROM in 512-byte pages,
rounded up to 2k boundary (4 pages, 8 pages, etc).
*/
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
Freedos-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-devel