...me again

new topic     » topic index » view thread      » older message » newer message

Hayden McKay wrote:

> > 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?
> > 

    I found the problem to be with the line
   
dpmi = repeat(-1,REG_LIST_SIZE)
    
    -- it should read

    dpmi = repeat(NULL,REG_LIST_SIZE)
    

It seems as though I left my brain in bed...lol

here is the source code again with fixups...

include euphoria.e

sequence dpmi     -- dpmi structure

    dpmi = repeat(NULL,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 + 4)
    cache += 4-remainder(cache,4)        -- 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 too...?

    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)


new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu