ASM command

Hello.
I am a Pascal beginner, I have a question on using the asm command.
Well, maybe it is better to use an example to present my question.

[code]procedure asm1; assembler;
asm
mov ax,$0000
int 21h
end;[/code]

and

[code]procedure asm1;
var
regs : registers;
begin
regs.ax := $0000;
intr($21,regs);
end;[/code]

Are they the same? Or is there any pros and cons using different method? (Actually I don't know what do these commands for, just an example :P)

Thanks a lot

ps. Sorry for my poor English.

Comments


  • : [code]: procedure asm1; assembler;
    : asm
    : mov ax,$0000
    : int 21h
    : end;[/code]:

    This would be my choice to implement asm in my code, although Pascal's assembly has lots of limitations it makes a big difference when you need to sped up certain parts of your code, specially the tight loops.

    :
    : and
    :
    : [code]: procedure asm1;
    : var
    : regs : registers;
    : begin
    : regs.ax := $0000;
    : intr($21,regs);
    : end;[/code]:
    :
    : Are they the same? Or is there any pros and cons using different
    : method?

    This does the very same thing (equals the [b]halt;[/b] command more or less), however it can be used to implement interrupt calls only, nothing else. And requires the use of [b]dos[/b] unit to work. I'm not quite sure how the two would compare when compiled regarding size and speed, my guess is the first would top the second...


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion