It was thus said that the Great Zane H. Healy once stated:
>
> >Any thought been given to porting PUTR to FreeBSD/Linux/Unix??? Was hoping
> >to use it but really don't want to install a dos partition on my Unix PC.
> >Other solutions out there?
> >
> >Jay
>
> As I recall it's pure x86 ASM code, porting it is likely to be rather
> difficult, which isn't to say impossible. Will it run under stuff like
> WinXP? Err... I guess it's kind of useless on such systems since you
> really need a 1.2MB 5 1/4" floppy, and if a system is running WinXP, the
> odds are it doesn't have one.
One friend of mine, in the mid-90s, was hired to help port a MS-DOS
application to Unix. Most of the application was already in C, but with a
non-trivial portion in Assembly (mostly the I/O subsystem). My friend just
basically translated the x86 code to C, pretty much as straight a
translation as possible. So a routine like:
get_current: push es
push bx
push cx
push di
mov es,[video_seg]
mov bx,offset tank_sel
mov cx,4
xor si,si
get_c10: mov di,[bx+si]
cmp byte ptr es:[di],_tank_ind
je get_c20
inc si
inc si
loop get_c10
mov si,-1
get_c20: pop di
pop cx
pop bx
pop es
ret
Would get translated as something like:
int get_current(void)
{
char *es;
int *bx;
int cx;
int si;
int di;
es = video_seg;
bx = &tank_sel;
cx = 4;
si = 0;
for ( ; cx ; cx--)
{
di = bx[si];
if (es[di] == TANK_IND) return(si);
si++;
}
return(-1);
}
Not the greatest of C code, but it works and is a start in porting the
code to other systems.
-spc (Then later the code can be cleaned up ... )
Received on Sun Jan 18 2004 - 22:24:39 GMT
This archive was generated by hypermail 2.3.0
: Fri Oct 10 2014 - 23:36:46 BST