Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Galactic Conquest: GCFONT.PAS (drop in LoadFont replacement) (Announce)

posted by Arjay, 25.06.2010, 10:16
(edited by Arjay on 25.06.2010, 10:35)

As I was also feeling nice this morning. This is a "drop in" unit which I would suggest you keep separate which you can use to as a direct replacement for your existing LoadFont procedure in GCUNIT.PAS. What you need to do is delete your existing LoadFont procedure from GCUNIT (remembering to remove the LoadFont reference from implementation as well) then simply add "GCFONT" to your uses section of GCUNIT.PAS, GCTITLE.PAS, GCINIT.PAS, GALCON.PAS:


Unit GCfont;
{Freeware - please re-use as appropriate}
{Provided by Richard L. James for Galcon}

{VERSION 1.0.0 -- RELEASE DATE: 25 June 2010}
{PROGRAM LAST REVISED ON: 25 June 2010/0900}
{PROGRAM LENGTH AS OF LAST REVISION: 72}

{-------------------------------------------------------------------------}

INTERFACE

Procedure LoadFont(DummyFilename:string); {DummyFilename for old proc refs}

{-------------------------------------------------------------------------}

IMPLEMENTATION

{-------------------------------------------------------------------------}

{$L intvfont.obj}
procedure intvfont; external;  {fool TP as $L is supposed to be for code only}

{-------------------------------------------------------------------------}

Procedure LoadFont(DummyFilename:string);

Begin
  Asm
    push bp              {Save BP as Turbo Pascal requires us to preserve it}
    mov ax, 0500h        {AH = 05h Set active display page / AL = page number}
    int 10h              {function 1110h below requires page 0 to be active}
    mov ax, seg intvfont {function 1110h expects ES:BP -> user font table}
    mov es, ax           {Set ES to point to the segment of our font data}
    mov ax, offset intvfont+$63  {Add 63h to skip over the INTVFONT header}
    mov bp, ax           {Set BP to point to the offset of our font data}
    mov cx, 100h {256d}  {CX = Number of patters we wish to load}
    xor dx, dx     {0d}  {DX = character offset into map 2 block}
    xor bl, bl     {0d}  {BL = block to load in map 2}
    mov bh, 10h   {16d}  {BH = number of bytes per character pattern}
    mov ax, 1110h        {text chargen http://www.ctyme.com/intr/rb-0142.htm}
    int 10h              {Load user-specified patterns (PS,EGA,VGA)}
    pop bp               {Restore BP}
  End;
End;

{-------------------------------------------------------------------------}
Begin
  {LoadFont('');} {uncomment this line if required-do NOT place after below}

  {Important - the following 2 lines should be the LAST lines of this UNIT}
  {            do not remove them as this will STOP TP linking in our font}
  {            or worse in the case of exit will attempt to "execute" data}
  Exit;                  {Exit to ensure TP never executes the line below}
  intvfont;              {the following line MUST never be called directly}
End.
{-------------------------------------------------------------------------}


This is the MAKE.BAT that I used to compile a GC with your font built in:
@echo off
tpc fadeunit.pas
tpc gcunit.pas
tpc gcinit.pas
tpc gctitle.pas
tpc gcend.pas
tpc gcwar.pas
tpc gcturn.pas
binobj intvfont.com intvfont intvfont
tpc gcfont.pas
tpc galcon.pas


Other than the changes talked about above no other changes to Galcon are required (this is by design). I also used CRT70 and just the standard SYSTEM.TPU and DOS.TPU (note: TURBO.TPL is just a library of these and is NOT actually required itself, if you have the TPU files separate). My compile with built in font (still with header) generated the following GALCON.EXE file:
25/06/2010  09:00            65,360 GALCON.EXE

Remember you can create a INTVFONT.DAT by removing the header (as show above) and modifying the code slightly (as above) to remove the +$63 COM header skip.

Running aPACK on the the above GALCON.EXE reduces it to just 30,811 bytes:

This copy of aPACK is freeware.
Packing code                 -> 30811 bytes
Done ... compression ratio: 53% (65360 bytes -> 31088 bytes)


Note: It would appear GALCON.EXE that you included in your distribution is a newer version which is later than your distribution source as it has extra introduction animations which I can see in the EXE but not source.

 

Complete thread:

Back to the forum
Board view  Mix view
22762 Postings in 2122 Threads, 402 registered users (2 online)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum