Hi all<br><br>i'm trying to use fpc in a old DOS environment by using FreeDOS inside Virtual PC (guess i should be using vmware)<br><br>the problem is that i have some low-level code which i would like to port to fpc. FreeDOS came with fpc
2.0.2 which i think is suitable for my needs.<br><br>1.) i can't even compile the code<br>----------------------start-------------------------------<br><img src="file:///C:/DOCUME%7E1/DFRANZ%7E1/CONFIG%7E1/Temp/moz-screenshot.jpg" alt="">
C:\>cd code <br>C:\code>fpc diskexp.pas <br>An unhandled exception occurred at $0001072C :
<br>EAccessViolation : Access violation <br> $0001072C <br> $00010752
<br> $00010CC0 <br> $00010D13 <br> $000100A8
<br> $00006E8F <br> $00006ED0 <br> $000022E3
<br> $0000279E <br>----------------------------end------------------------<br><br>the strange thing is that if i call fpc without parameters the (huge) usage shows up correctly...is fpc for go32v2 a pmode app? which extender do you recommend me to use?
<br><br>2.) i have some questions regarding pmode programming with fpc since i never used go32v2. with cwsdpmi, one compiles and links, getting an exe and this exe should be put in the same folder of cwsdpmi.exe. what's the general procedure for go32v2?
<br><br>3.) in other machine i tried and compiled the code but got some strange results (i can post as soon as a i get home and reach that machine). here is the code:<br>-------------------------------------------code start---------------------------------------------------------------------------
<br>program DiskExplorer;<br><br>uses crt, dos;<br><br>const<br> BUFLEN = 4608;<br> BUFSECT = 9;<br> COMMANDX = 1;<br> COMMANDY = 20;<br> COMMAND_RT = 79;<br> COMMAND_BOT = 24;<br>
STATUSX = 1;<br> STATUSY = 18;<br> STATUS_RT = 79;<br> STATUS_BOT = 19;<br> LEFTSCREEN = 1;<br> RIGHTSCREEN = 80;<br> TOPSCREEN = 1;<br> BOTTOMSCREEN = 17;<br> ERROR = -1;
<br><br>type<br> buf = array[0..BUFLEN] of byte;<br><br>var<br> finished: boolean;<br> drive: byte;<br> sector: integer;<br> buffer: buf;<br> regs: Registers;<br><br>function DiskRead(drive: byte; sector, n_sectors: integer; var buffer: buf): integer;
<br>begin<br> inline($55/ {this assembly code does nothing more than saving correct stuff, executes DOS}<br> $8B/$EC/ {interrupts for read/write the disk, restores stuff, flushes DOS buffer and exits }
<br> $83/$C5/$08/<br> $1E/<br> $8B/$5E/$00/<br> $8B/$46/$02/<br> $8E/$D8/<br> $8B/$4E/$04/<br> $8B/$56/$06/<br> $8A/$46/$08/
<br> $55/<br> $CD/$25/<br> $73/$08/<br> $9D/<br> $5D/<br> $89/$46/$0A/<br> $EB/$08/$90/<br> $9D/<br> $5D/
<br> $33/$C0/<br> $89/$46/$0A/<br> $1F/<br> $5D);<br>end;<br><br><br>function DiskWrite(drive: byte; sector, n_sectors: integer; var buffer: buf): integer;<br>begin<br>
inline($55/<br> $8B/$EC/<br> $83/$C5/$08/<br> $1E/<br> $8B/$5E/$00/<br> $8B/$46/$02/<br> $8E/$D8/<br> $8B/$4E/$04/<br>
$8B/$56/$06/<br> $8A/$46/$08/<br> $55/<br> $CD/$26/<br> $73/$08/<br> $9D/<br> $5D/<br> $89/$46/$0A/<br> $EB/$08/$90/
<br> $9D/<br> $5D/<br> $33/$C0/<br> $89/$46/$0A/<br> $1F/<br> $5D);<br> regs.ax := $D00;<br> intr($21, regs);<br>end;<br><br>
<br>procedure Beep;<br>begin<br> sound(400);<br> delay(500);<br> sound(300);<br> delay(500);<br> nosound;<br>end;<br><br>procedure DisplayStartScreen;<br>begin<br> clrscr;<br> window(1,1,80,25);
<br> writeln('=================Disk Examiner=================');<br> writeln;<br> writeln;<br> writeln;<br> writeln;<br> writeln('-------------------MAIN MENU-------------------');
<br> writeln('F1: Dump and modify sectors');<br> writeln;<br> writeln('F10: Exit');<br>end;<br><br><br>{ main routine }<br>begin<br> drive := 0;<br> sector := 0;<br> finished := false;
<br> while not finished do<br> begin<br> DisplayStartScreen;<br> regs.ax := 0;<br> intr($16, regs);<br> if regs.ax and $ff = 0 then<br> begin
<br> clrscr;<br> case (regs.ax) of<br> $4400: finished := true;<br> end;<br> end;<br> end;<br>end.<br>
-------------------------------------------code end---------------------------------------------------------------------------<br> <br>this code compiles fine with tp5.5 (altough the window function does not work)...what is the correct way to make such a thing in fpc?!
<br><br>how to mix assembly with fpc in the same procedure/function? i tried but it complained about the labels<br><br><br clear="all"><br>-- <br>Daniel<br><br>"Let us change our traditional attitude to the construction of programs. Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do." (Donald Knuth)
<br><br>"Yes, technogeeks can be funny, even if only to each other." (<a href="http://www.boogieonline.com/revolution/science/humor/">http://www.boogieonline.com/revolution/science/humor/</a>)"<br><br>"Man is driven to create; I know I really love to create things. And while I'm not good at painting, drawing, or music, I can write software." (Yukihiro Matsumoto,
a.k.a. ``Matz'')