How to use 16-bits Assembly inline on Delphi on Windows98?

294 views Asked by At

Today I was playing with my old computer and trying to use 16-bits Assembly inside Delphi. It's works fine with 32-bits but I always had problem when I used interrupts. Blue Screen or Freezing, that was making me believe that's not possible to do it. I'm on Windows 98 and using Delphi 7, using this simple code.

program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils, Windows;
begin
    asm
    mov ax,$0301
    mov bx,$0200
    mov cx,$0001
    xor dx,dx
    int $13
    int $20
    end;
MessageBox(0,'Okay','Okay',MB_OK);
end.

To "format" a diskkete on the Floppy drive. There's a way to use it on Delphi 7 without freezing and blues screens? Or Delphi only allows to use 32-bits Assembly? Am I doing something wrong?

2

There are 2 answers

3
Roland Illig On

As long as your application is built as "32-bit Windows" application, the interrupts cannot work since these interrupts are simply not mapped.

You could try to compile your application as a "16-bit Console" application. I don't know if Delphi supports this, but that's my best guess for getting the emulation of int 0x13 and int 0x10.

By the way, shouldn't your assembly code use hexadecimal numbers, like this:?

mov ax, $0301
mov bx, $0200
mov cx, $0001
xor dx, dx
int $13
int $20

As it is now, you are probably calling interrupt $0d, which according to Ralf Brown's Interrupt List means:

INT 0D C - IRQ5 - FIXED DISK (PC,XT), LPT2 (AT), reserved (PS/2)

0
David Heffernan On

Delphi 7 produces 32 bit executables. Your 16 bit assembly code is therefore not compatible with the compiler you use. You might have some luck with a 16 bit compiler, e.g. Turbo Pascal or Delphi 1. But it would make more sense, I suspect, to use the Win32 API to achieve your goals.