PC Star Wars

Digging around in some old archived data, I came across the source code for the PC (DOS) version of Star Wars, which consists of about 750K of ASM files -  quite a lot more than I’d have guessed at. A couple of the other files indicate that this is a copy of the source we brought back from California after working on the final testing over there, so it’s definitely the ‘latest’ version. There’s also a compiled EXE, but unsurprisingly it crashes when I try and run it under Windows XP.

The source makes for a very entertaining read, at least for me, bringing back a lot of memories. It’s definitely not what you’d call a fine example of software engineering, even for its time, but it did work very well. Following is a choice excerpt, featuring few comments, and a smattering of self-modifying code which appears to be more for the sake of it than for performance in this case.

DoTrenchWalls    PROC    NEAR
 
        mov    cx,TrenchWidth        ;Draw outer walls of trench.
        add    cx,TrenchX
        mov    Pxl,cx
        add    cx,CentreX
        mov    dx,TrenchBottom
        mov    Pyl,dx
        add    dx,CentreY
        mov    Sx,cx
        mov    Sy,dx
        mov    W cs:InnSy+4,dx
        mov    W cs:UseLaterX+4,cx
        sub    cx,CentreX
        sub    dx,CentreY
        mov    ax,ZDist
        mov    Pzl,ax
        call    View3d        ; Same point in Distance
        mov    Fx,cx
        mov    Fy,dx
        mov    bx,RecursePosition
        mov    ResX[bx],cx
        mov    ResY[bx],dx
        push    cx
        call    Msdraw
        mov    ax,01200h
        add    ax,TrenchY
        mov    Pyl,ax
        call    YView3d
        pop    cx
        mov    Fx,cx
        mov    Fy,dx
        mov    W cs:WasJustBufY+4,dx
        call    MsDraw            ; VertDraw.............!!!
        mov    dx,Pyl
        add    dx,CentreY
        mov    Fy,dx
        push    dx
UseLaterX:    mov    Fx,0FFFFh      ;self mod
        call    MsDraw
        mov    ax,0-TrenchWidth
        add    ax,TrenchX
        mov    Pxl,ax
        add    ax,CentreX
        mov    Sx,ax
        mov    W cs:WasBufX10+4,ax
        mov    dx,W [cs:InnSy+4]
        mov    Sy,dx
        mov    bx,RecursePosition
        mov    dx,W ResY[bx]
        mov    Fy,dx
        mov    ax,ZDist
        mov    Pzl,ax
        call    XView3d
        mov    Fx,cx
        mov    W cs:UseLater2+4,cx
        push    cx
        call    Msdraw
        pop    cx
        mov    Fx,cx
WasJustBufY:    mov    Fy,0FFFFh      ;self mod
        call    MsDraw            ;VertDraw............!!!
WasBufX10:    mov    Fx,0FFFFh      ;self mod
        pop    dx
        mov    Fy,dx
        call    MsDraw
        mov    bx,RecursePosition
        mov    cx,W ResX[bx]
        mov    Sx,cx
        mov    dx,W ResY[bx]
        mov    Sy,dx
        mov    Fy,dx
UseLater2:    mov    Fx,0FFFFh      ;self mod
        call    HorzDraw
        ret
 
DoTrenchWalls    ENDP

The question now is what to do with this blast from the past, which judging by the state of the CD it was on (a 1998 archive of 1988 code), it was about to disappear forever since much of the rest of the contents wouldn’t read at all. I could try and get it working as is, or port the data and logic to a more modern environment, or I could re-archive it and come back to it in another 20 years. Probably the latter is the sensible option.

  1. ringbark’s avatar

    Cool label names, Luke:

    UseLater:
    UseLater2:

    Reply

Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">