2

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?

Victor Melo
  • 188
  • 1
  • 13
  • In general you can't call the bios directly and bypass drivers. Btw don't you mean $13 and $20 ? – Marco van de Voort May 25 '17 at 21:40
  • I tried for both ways... Doesn't works. – Victor Melo May 25 '17 at 21:49
  • 1
    Those interrupts are not available to 32-bit applications, which Delphi 7 produces. You may be able to use Delphi 1 (which produces 16-bit apps), which was included with Delphi 2 when it was released as well (to bridge the conversion from 16 to 32 bit). You're not going to succeed with D7. – Ken White May 25 '17 at 22:27
  • 1
    No formatting of a diskette with a blue screen is fine for me these days :) – Victoria May 26 '17 at 02:01
  • 1
    If you really want to format a diskette, wouldn't it be easier to just start a new process with `"format A:"`? – Bo Persson May 26 '17 at 08:38

2 Answers2

3

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)

Roland Illig
  • 40,703
  • 10
  • 88
  • 121
2

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.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490