Re: fresh question: dos_interrupt()

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

>The constants defined in machine.e for dos_interrupt() don't make sense.
>For example, there's no AH, but it seems AH is equivalent to AX in
>Euphoria.  I don't get it.  Could someone please help?


AH, Stands for Variable: A Part: H(igh)

Proccesors have variables (as you might have noticed), you need to set those
variable to give an 'argument' to an interrupt call.

You have A, B, C, etc.
Each of those variables are 2, yes *2* bytes long.
If you want to set the HIGH-byte you use AH in ASM for example.
To acces the LOW-byte you use AL in ASM for example.
To acces both the bytes you can use AX in ASM for example.

Euphoria only lets you set all two bytes, however this should be no problem.

function make_x (byte low, byte high)
    return low*256 + high
end function

For example:

integer A

function set_high (integer a, integer val)
    a = and_bits (a, 256*255)
    a = a + val
    return a
end function

function set_low (integer a, integer val)
    a = and_bits (a, 255)
    a = a + (val * 256)
    return a
end function

So, to set AH of A to 4 do:

a = set_high (a, 4)

To set AL of A to 8 do:

a = set_low (a, 8)

To set AX of A to 12 do:

a = 12

Did this help ?

Ralf
nieuwen at xs4all.nl

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

Search



Quick Links

User menu

Not signed in.

Misc Menu