Re: bug report - loop broken
oops sorry... i noticed that i broke
cache = allocate_low(S * 512 + 16)
cache += 4-remainder(cache,16) -- align(4)
replace with...
cache = allocate_low(S * 512 + 4)
cache += 4-remainder(cache,4) -- align(4)
Hayden McKay wrote:
>
> I wrote this script while playing arround with bochs, if you scroll down
> to the main loop and uncomment the line
> }}}
<eucode>
>
> -- dpmi[REG_DX] = NULL -- broke inner loop
>
> </eucode>
{{{
> you will see the inner loop gets broken
>
> Another issue is that sometimes dos_interrupt() returns bogus results as
> in sighned words & unsighned dwords, the return sequence should be words
> eh? if you scroll down and comment out the line
>
> }}}
<eucode>
>
> dpmi = and_bits(dpmi,#FFFF) -- patch bogus result
>
> </eucode>
{{{
>
> loop is broken completly cause 'dos_interrupt()' return a sighned dword
> note that causeway v3.45 supports dword dos interrupts although the old
> causeway wrapped with eu v2.4 sometimes return theese bogus result too?
>
> }}}
<eucode>
> include euphoria.e
>
> sequence dpmi -- dpmi structure
>
> dpmi = repeat(-1,REG_LIST_SIZE)
>
> -- check for the drive a: geometry
>
> dpmi[REG_ES] = NULL
> dpmi[REG_DI] = NULL
> dpmi[REG_DX] = NULL
> dpmi[REG_AX] = 8 * 256
> dpmi = dos_interrupt(#13,dpmi)
>
> dpmi = and_bits(dpmi,#FFFF) -- patch bogus result
>
> constant fn = open("fdd.img","wb")
>
> constant S = and_bits(dpmi[REG_CX],#3F)
>
> atom cache
>
> cache = allocate_low(S * 512 + 16)
> cache += 4-remainder(cache,16) -- align(4)
>
> atom t t = time()
>
> for C = NULL to floor(dpmi[REG_CX]/256) by 1 do
> for H = NULL to floor(dpmi[REG_DX]/256) by 1 do
>
> -- docs state that you should have at least three
> -- io attempts if failed, but i assume the bios's
> -- fdd handler will do that...?
>
> mem_set(cache,#4E,S*512)
>
> dpmi[REG_DX] = NULL
> dpmi[REG_AX] = NULL
> dpmi = dos_interrupt(#13,dpmi) -- recalibrate fdd
>
> dpmi[REG_ES] = floor (cache/16)
> dpmi[REG_BX] = and_bits(cache,15)
> dpmi[REG_DX] = or_bits(H * 256,0) -- {head,drive}
> dpmi[REG_CX] = or_bits(C * 256,1) -- {cyld,start}
> dpmi[REG_AX] = or_bits(2 * 256,S) -- {func,count}
>
> dpmi = dos_interrupt(#13,dpmi) -- get fdd sectors
>
> -- dpmi[REG_DX] = NULL -- broke inner loop
> -- dpmi[REG_AX] = 1 * 256
> -- dpmi = dos_interrupt(#13,dpmi)
>
> -- dpmi[REG_CX] = NULL -- but not brake outer loop
>
> ? {C,H}
>
> puts(fn,peek({cache,S*512})) -- flush the cache
>
> end for
> end for
>
> t = time() - t
> printf(1,"%d secs\n",floor(t))
>
> close(fn)
> abort(NULL)
> </eucode>
{{{
>
> <OT> i'm currently messing arround with a customized bootdisk ( kernel )
> created in assembler, hence this is my bootdisk imager for da bochs
> i'll probably end up useing the lba style sector addressing so then
> i'll only need one loop variable.
>
> everyone is welcome to use this code...public domain...
>
> nb. latest causeway is v3.49 and there is a 4.02 patch file cw32.asm
> that allows smid intructions in dos. although i doubt people use
> smid in dos since mmx is usualy good enough for the old dos code
|
Not Categorized, Please Help
|
|