Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to index page
Thread view  Board view
sinclaj1(R)

U.S.A.,
29.12.2009, 20:53
 

Galactic Conquest v9 beta 55 (Announce)

I've made a few more changes to the game, and have finally finished the documentation. This should hopefully make the game a bit easier to understand and play. The documentation is in .txt form, I've left the .PDF and all other unnecessary files out.

I've put all source files in the PAS folder, in case you want to look at them. I've also included the CRT70.TPU I used to replace my own CRT.TPU in my TURBO.TPL. This is how I found it, so I have no source for you. It was distributed as freeware.

I would upload the .ZIP file to this post, however I don't seem to have that capability. Hopefully RR can put it on here somewhere.
Until then, you can download the new file from the following URL:

http://www.elevationchurchonline.org/media/gc

Let me know what you think!

Thanks,
Jason

Rugxulo(R)

Homepage

Usono,
29.12.2009, 22:05

@ sinclaj1
 

Galactic Conquest v9 beta 55

>
> http://www.elevationchurchonline.org/media/gc
>
> Let me know what you think!

All I can say is DOS is cool, games are cool, you're cool, and Christus Rex! :-D

Deniska(R)

Homepage E-mail

07.01.2010, 00:53

@ sinclaj1
 

Galactic Conquest v9 beta 55

Thanks for the cool game. I've played it twice and really enjoyed it! :-D

sinclaj1(R)

U.S.A.,
07.01.2010, 05:46

@ Deniska
 

Galactic Conquest v9 beta 55

> Thanks for the cool game. I've played it twice and really enjoyed it! :-D

Awesome! I'm glad you enjoyed it and I appreciate hearing it! Let me know if you have any comments or ideas for the game, or questions.

sinclaj1(R)

U.S.A.,
08.05.2010, 04:21

@ sinclaj1
 

Galactic Conquest v9 beta 55

I'm about to take this from beta version to final version. Any last ideas, bugs, or comments before this goes "gold"?

Also, RR -- any chance this file can be hosted and linked on your site? I'm going to have to remove it from the borrowed space it's currently at.

Arjay(R)

08.05.2010, 15:07
(edited by Arjay, 08.05.2010, 15:25)

@ sinclaj1
 

Galactic Conquest v9 beta 55

> I'm about to take this from beta version to final version.
Excellent news. Well done and looking forward to seeing your next projects!

> Any last ideas, bugs, or comments before this goes "gold"?
Remembering back to our discussions re libraries. Provide as much source as you can. If you have used any external libraries ensure that you document the name of the original ZIP file (e.g. TP7RTLXYZ.ZIP), the name of the files used required from that ZIP file (e.g. crt.tpu and system.tpu) and any current URL's for them in your documentation, file sizes/dates of the files.

In other words think about someone in the future say 10 years from now wanting to re-compile your game. Be verbose, don't assume that because a webpage exists somewhere with something on it that will stay there for ever. If you provide enough good info others can re-locate things later and will help preserve your good work for future generations and allow others to recover other lost works by acting as a sign post of where to look within large diverse archives.

For example if you know a full URL you can already go to archive sites like archive.org or oocities.com to recover "lost" websites and their contents. The problem with these sites is knowing where to look. So by providing full URL's etc you will aid the recovery of lost works by giving that info to someone.

Hope this helps.

rr(R)

Homepage E-mail

Berlin, Germany,
08.05.2010, 21:06

@ sinclaj1
 

Galactic Conquest v9 beta 55

> Also, RR -- any chance this file can be hosted and linked on your site?

Sure, but it may take some time.

Arjay(R)

09.05.2010, 21:26
(edited by Arjay, 09.05.2010, 22:29)

@ sinclaj1
 

Galactic Conquest v9 beta 55 - additional feedback

> I'm about to take this from beta version to final version. Any last ideas,
> bugs, or comments before this goes "gold"?

Some additional feedback:

+ Game - Overall a well designed game with an excellent use of text gfx/sfx
+ Game - Good intro - reminded me of some early PC games
+ Game - Good use of fading, scrolling texts - it would have been good BBS door game!
- Game - It is not obvious that pressing anykey (except obviously Y/N) will change the challenger
- Game - Data entry fields filter needs to be better, e.g. non valid characters CTRL ^A or CTRL ^C are shown
- Game - seems impossible to quit easily other than at certain points in play
- Game - Impossible to quit if computer is in the middle of playing itself?
- Game - Method for entry the length of time entry could be more friendlier
- GC.TXT - Overall formatting is not very nice to view with most TEXT editors
- GC.TXT - uses various special characters for no reason, e.g. 96h, A9h, 95h
- GC.TXT - No credit/with thanks to library authors: Mike Schutz, Pedt Scragg
- GC.TXT - Need to be clear re GPL as Scragg/Schutz's code never was GPL'd
- GC.TXT - would be nice if viewable or better help existed within the game
- *.TXT - I would suggest mergeing GCver.txt into GC.TXT to reduce files
- GALCON.EXE - A file compressor will give over 50% (at least) size reduction
- CRT70 files - remove or at least include the *full* distribution version
- GCDEBUG.LOG - I turned this on by accident. Source could document better.
- GCDOSBOX.conf - I seem to remember somebody suggested removing this (I agree)
- .DAT files - does it matter if they are missing? No error was provided.
- INTVFONT.COM - Refer back to my earlier comments re this PC Magazine program
- INTVFONT.COM - When this is "missing" your error handling could be nicer

Regarding the last point I recommend now days to wait for a keypress after bombing out with an error. If anything because if someone is using Windows or DOSBox to run your game your error message will disappear quickly.

I tend to use this simple code for waiting for a keypress after a fatal error:

Asm
  xor ax, ax  {zero the accumulator}
  int 16h     {Call BIOS to wait for a keypress}
End;

sinclaj1(R)

U.S.A.,
13.05.2010, 05:58

@ Arjay
 

Galactic Conquest v9 beta 55 - additional feedback

> - Game - It is not obvious that pressing anykey (except obviously Y/N)
> will change the challenger

Good point, something I need to improve.

> - Game - Data entry fields filter needs to be better, e.g. non valid
> characters CTRL ^A or CTRL ^C are shown

That I hadn't noticed before, I'll check into that.

> - Game - seems impossible to quit easily other than at certain points in
> play

> - Game - Impossible to quit if computer is in the middle of playing
> itself?

I'm going to try to figure out how to hook Alt-Q into bringing up that procedure (similar to how I have CTRL-BREAK locked out).

> - Game - Method for entry the length of time entry could be more
> friendlier

Originally it was 3 prompts (one each for hours, mins, secs). Any recommendations on this?

> - GC.TXT - Overall formatting is not very nice to view with most TEXT
> editors
> - GC.TXT - uses various special characters for no reason, e.g. 96h, A9h,
> 95h

I'll look into that.

> - GC.TXT - No credit/with thanks to library authors: Mike Schutz, Pedt
> Scragg
> - GC.TXT - Need to be clear re GPL as Scragg/Schutz's code never was
> GPL'd

Will update.

> - GC.TXT - would be nice if viewable or better help existed within the
> game

I had thought about doing that, however it seemed to be a major undertaking. I'll give that one some more thought.

> - *.TXT - I would suggest mergeing GCver.txt into GC.TXT to reduce files

Good idea.

> - GALCON.EXE - A file compressor will give over 50% (at least) size
> reduction

Why would this be necessary?

> - CRT70 files - remove or at least include the *full* distribution
> version

The CRT70 files were only included for testing purposes, I wasn't planning on including them with the game. As for the version, I thought they were the full distribution, what makes you think they are not?

> - GCDEBUG.LOG - I turned this on by accident. Source could document
> better.

This will be deactivated once it goes gold, it is for debugging purposes only.

> - GCDOSBOX.conf - I seem to remember somebody suggested removing this (I
> agree)

I'm leaving it in as an example for how to use it with DosBox.

> - .DAT files - does it matter if they are missing? No error was
> provided.
> - INTVFONT.COM - When this is "missing" your error handling could be
> nicer

I'll look into error handling for missing files.

> - INTVFONT.COM - Refer back to my earlier comments re this PC Magazine
> program.

I won't be including FONTEDIT.COM, but I will be including INTVFONT.COM (or renaming it), as the game requires it to work properly. FONTEDIT.COM isn't required.

> Regarding the last point I recommend now days to wait for a keypress after
> bombing out with an error. If anything because if someone is using Windows
> or DOSBox to run your game your error message will disappear quickly.
>
> I tend to use this simple code for waiting for a keypress after a fatal
> error:
>
> Asm
> xor ax, ax  {zero the accumulator}
> int 16h     {Call BIOS to wait for a keypress}
> End;
>


Thanks! I will try that out.
I appreciate the feedback, hopefully I can get some of this knocked out pretty quickly. Let me know if you think of anything else.

Arjay(R)

19.05.2010, 17:27

@ sinclaj1
 

Galactic Conquest v9 beta 55 - additional feedback

Firstly thank you for taking my feedback on board.

> > - Game - Data entry fields filter needs to be better, e.g. non valid
> > characters CTRL ^A or CTRL ^C are shown
>
> That I hadn't noticed before, I'll check into that.
I spotted you are using TP's built in Readkey (well drop in replacement). Readkey sucks for key filtering to be honest. The following snippet from a longer routine within one of my own TP (circ. 1995) games is NOT perfect but should give you an example of a game keyboard handler without using Readkey:

{****************************************************************************}

Function Keyboard_Handler:Byte;

Var
    TempByte:Byte;

Begin
Asm
@readk:
    mov ah, 1
    Int 16h
    jnz @gotone
    jmp @not_us

@gotone:
    mov TempByte, 1
    xor ax,ax
    int 16h
    cmp al, 27 {ESCape}
    je @quit
@chkcursors:
    cmp al, 0  {extended character?}
    jne @not_us
@chkdwn:
    cmp ah, 50h  {down}
    jne @chkup
@down:
    mov direction, 4
    jmp @done
@chkup:  {Doctor, I don't feel very well :)}
    cmp ah, 48h  {up}
    jne @chklft
@up:
    mov direction, 1
    jmp @done
@chklft:
    cmp ah, 4bh  {left}
    jne @chkrht
@left:
    mov direction, 2
    jmp @done
@chkrht:
    cmp ah, 4dh  {right}
    jne @chkF1
@right:
    mov direction, 3
    jmp @done

@quit:
    mov TempByte, 5
    jmp @done
@not_us:
    mov TempByte, 0

@done:
End;
  KeyBoard_Handler:=TempByte;
End;

{****************************************************************************}


Basically in brief: the above code returns either a direction 1-4 (e.g. cursor up is 1, cursor left is 2, cursor right is 3, cursor down is 4) or if ESCape is press 5 is returned to quit. The routine "could" be used like this:


Terminating:=FALSE;
Repeat
  Case Keyboard_Hander of
     1: move_left;
     2: move_up;
     3: move_right;
     4: move_down;
     5: Terminating:=TRUE;
     else {ignore should not get here anyway};
   End; {of case, Dr Watson!}
  KillSomeTime;
Until Terminating;


Note: Feel free to modify reuse the above code and GPL the resulting code.


> I'm going to try to figure out how to hook Alt-Q into bringing up that
> procedure (similar to how I have CTRL-BREAK locked out).
To be honest I would recommend you quit with ESCape as you will find this easier to implement than Alt-Q. Yes, easier to press but knowing what is involved with doing a Alt-Q handler I think you are best off doing the later.

Moving onto your CTRL-Break handler be aware that when you call TP halt routine via the halt commands in your "debug" code and in the "data" and "font" loaders that you are currently *NOT* restoring the control break Interrupt.

The best thing to do is have a standard single clean exit routine which you call instead of halt. This exit routine would then be called within the main program and in these error situations as well to ensure the control break interrupt was restored in all cases and would in turn call halt if needed.

Basically I suggest changing your main code to look something like this:


Begin
  Initialize;
  RunGame;
  Terminate(0);
End.



Where initialize has your existing initialization code (currently in the main program body) and terminate has the opposite code. Note: I'm suggesting this at a high level rather than saying this is exactly how to do it. But it makes it easier to do things like Terminate(5); instead of Halt(5) where NOT only does Terminate(5) call halt(5) but it does some clean ups before it does.

I would also strongly suggest keeping your init and terminate routines simple rather than trying to be too clever for now with ExitProc/ExitCode/ExitAddr.

I suggest this as when you use the Halt command within a TP program Borland's own Runtime library "exit" routines still get called under normal circumstances. Including I might add when there is a "runtime error". Think of Borland's own exit routines as hidden procedures you don't get to see.

If you implement an ExitProc handler incorrectly then Borland runtime library exit routines may NOT get called which is very bad since the Borland runtime library (in the case of TP7) "redirects" 19 interrupts to its own code.....


> > - Game - Method for entry the length of time entry could be more
> > friendlier
> Originally it was 3 prompts (one each for hours, mins, secs). Any
> recommendations on this?
To be honest "no". I wrote down some raw thoughts as they occurred to me. In many ways what you have got is probably sufficient. I'd focus elsewhere.

> > - GC.TXT
> Will update.
thanks

> > - GALCON.EXE - A file compressor will give over 50% (at least) size
> > reduction
> Why would this be necessary?
This isn't but IMHO looks better. Importantly it also means your game will be smaller for people to share around the world where bandwidth, diskspace aren't always as readily available as they are in the western world.


> > - CRT70 files - remove or at least include the *full* distribution
> > version
> The CRT70 files were only included for testing purposes, I wasn't planning
> on including them with the game.
Ok.

> As for the version, I thought they were the full distribution,
> what makes you think they are not?
Because I previously downloaded the full version when I was working to help you work out which replacement CRT library you had used by studying the actual runtime code. So I know these files are included within the full version but on their own are NOT the full version which has more files. It would be a bit like me just including GALCON.EXE without anything else (such as your documentation, other files) in another totally unrelated distribution.

> > - GCDEBUG.LOG
> This will be deactivated once it goes gold, it is for debugging purposes
> only.
Ok! I kind of guessed its function ;-)


> > - GCDOSBOX.conf - I seem to remember somebody suggested removing this
> >(I agree)
> I'm leaving it in as an example for how to use it with DosBox.
Ok.

> I'll look into error handling for missing files.
Thanks. Refer back to my comments re a using a standard Terminate routine.

> I won't be including FONTEDIT.COM, but I will be including INTVFONT.COM
> (or renaming it), as the game requires it to work properly. FONTEDIT.COM
> isn't required.
Ok. TP/DOS's exec function should allow you to execute anything you like, e.g. GALACTIC.DAT which could be a renamed EXE file. This possible since the DOS kernel simply checks the top of the file for MZ to determine if an EXE file or NOT, else it simply assumes that it is a .COM file. It is COMMAND.COM etc which "associates" .COM + .EXE extensions as being executable.
So in short you can update "loadfont" in GCUNIT to use whatever name you like.


> Let me know if you think of anything else.
To be honest your general copyright/GPL statements. The reason I call this all out is I have coded with TP since 1989 hence I am familiar with many of the TP code examples out there as I've referred to many myself in the past.

Code has a signature, some of that signature can be very subtle. For example I know your LeadingZero is the exact example from the TP help files. How do I know? Not just because of the well known name but also the exact case used, the use of the S variable name, the spacing between ":=" and "S" etc.

So even though you've put a comment above to explain what it does, I can still see where that code originally came from as I that familiar with it.

Likewise IntToStr, SaveXY, LoadXY - TP help file examples etc. Don't get me wrong I'm not saying using these examples is bad. But when it is obvious to the trained eye that you didn't for example write BRIGHTBGON or BRIGHTBGOFF - it doesn't look to good if your just slapping copyright and the GPL on them.

How do I know you didn't write the later? Well again because of their code signatures which are also in a very different style to the rest of your code.

So what I would suggest doing is if you remember you didn't write something move it off into a separate unit but please don't stick GPL onto non-GPL code as you are likely to annoy a lot of people who wrote that code originally.

sinclaj1(R)

U.S.A.,
24.06.2010, 16:01

@ Arjay
 

Galactic Conquest v9 beta 55 - additional feedback

Okay...starting to work my way through some of this. To be honest, I don't know that I'm going to do much more with the game, as I'm about to become a father and I have little time before then.

Firstly, Arjay...what's your name so I can put you in the credits. Otherwise I'll just put "Arjay".

Now, for notes combined from this thread and the Gc9V53 thread.

CTR70 - Yes, confirmed to be CRT70 by Pedt Scragg. I patched the RTE200 bug a long long time ago, have no idea where from. There's so many out there it would be impossible to figure out who did it, but none of them are copyrighted so GPL isn't an issue here.

Added text to the title screens for CRT70, FONTEDIT, and fading text. Will also add to the text file. (Note that none of those EXE files or TPUs will be included with the final distro)

Working on cleaning up the text help file.

Adding help to the game - If I can figure out how to do it quickly, I'll add it. Same goes with viewing the GC.TXT file in game. (one concern: what to do about time left on turn when viewing help or GC.TXT). Otherwise it's a low priority for me at the moment.

Compressing file space - I'll compile everything and try a tar, and see if it still runs.

Adding .DAT contents (compname, etc) to main - Good idea for if those files are missing, I will add that to the main to recreate the files if they are missing. I want the files themselves to be external so they can be modified by the user.

Renaming INTVFONT.COM - I will rename the file, however I tried renaming it to something other than .COM and it failed to run. Apparently it must be a .COM to work. As for your FNT/FON font loader, that would work except I'm in ASCII mode, not VGA mode. As much as I'd seriously love to make this game VGA graphic-capable, I just don't have time right now, and may not in the future.

"Copyright" info on title screen - It's not actually copyrighted, I guess I stuck that on there a long time ago for looks. I'll figure something out about it.

GPL concerns with CRT70 and fading text - I'm not sure GPL applies here. On both sites they say their code is freely usable. Adding GPL here would simply mean that any time their code is used that they get credit for it. I'm doing that with my code, though I will add more comments to make sure they are adequately mentioned.

CTRL-Break handler - It is code I found ages ago, I think maybe from the TP7 help. It basically keeps people from hitting CTRL-BREAK to stop the game, or pause to pause it. I've never run into any problems running it or having a program break out unexpectedly and pause/break not return to normal function.

Method for entering time limits - I figured out a way to do it and will change it. Basically giving 5 options: OFF, 1Min, 2Min, 5Min, Custom. (If custom, it will show the current version of the prompt or something similar)

Challenger Y/N keys - Working on revamping the game setup a bit more. I will look into this though, I agree it's kinda wonky.

Arjay(R)

25.06.2010, 03:37
(edited by Arjay, 25.06.2010, 03:52)

@ sinclaj1
 

Congratulations / Galactic Conquest v9 beta 55

> as I'm about to become a father and I have little time before then.
Congratulations to you both! Will it be your first? Time soon flies indeed I realized earlier that our kind host http://www.bttr-software.de/forum/forum_entry.php?... is almost coming up the 6 month mark as a dad :) Perhaps he can offer up some dad tips... !?!

> Okay...starting to work my way through some of this. To be honest, I don't
> know that I'm going to do much more with the game,
:) I understand - still importantly as it stands your game is playable/works !


> Renaming INTVFONT.COM - I will rename the file, however I tried renaming it
> to something other than .COM and it failed to run. Apparently it must be a
> .COM to work.
This shouldn't have been a problem.... Anyway it should no longer matter as whilst watching a film tonight, I decided to write the following code especially for your use in Galactic Conquest which will enable you to easily use http://www.bttr-software.de/forum/mix_entry.php?id=8024#p8171BINOBJ/BGIOBJ as I recently described elsewhere on the forum for someone else[/link] (see also below) which will enable you to convert INTVFONT.COM into an .OBJect file which you can then just directly link/use inside the game thus avoid the hassles of executing it.


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

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.com 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;
  {Important - the following 2 lines should be the LAST lines in your game}
  Halt;                  {Halt to ensure TP never executes the line below}
  intvfont;              {the following line MUST never be called directly}
End.


Note: The font data begins at 63h (99 decimal) bytes into the INTVFONT.COM file and carries on till the end. The font data is 8192bytes/2000h in length.

Importantly the above code does NOT use any of the PC magazine code which it deliberately skips over. Indeed I have also designed the above so that if you so choose you can link in "just" the 8k font data itself. HOWEVER if you wish to do that then you need to modify the code slightly by removing the +$63 and just removing the "skip over header" comment on the same line.

You can very easily extract the font data out of INTVFONT.COM by using trusty DEBUG and then typing exactly what I have shown directly below in BOLD:


C:\yourdevpath>debug intvfont.com
-n intvfont.dat
-RCX
CX 2063
:2000
-w 0163
Writing 02000 bytes
-q


I have however the choice to you as to which to use. Regarding BINOBJ all you need to do to convert either file into an object file to use with the above code is type either:


C:\yourdevpath>binobj intvfont.com intvfont intvfont
BIN to OBJ Converter Version 5.5  Copyright (c) 1987,1989 Borland International

8291 bytes converted.

C:\yourdevpath>


or if you have saved out the font data separately:


C:\yourdevpath>binobj intvfont.dat intvfont intvfont
BIN to OBJ Converter Version 5.5  Copyright (c) 1987,1989 Borland International

8192 bytes converted.

C:\yourdevpath>



Obviously if you save out the font data separately and the +$63 line you will save just over 99 bytes from your game. [Enough for 2 asm tiny .COM games ;)]


> CTR70 - Yes, confirmed to be CRT70 by Pedt Scragg. I patched the RTE200
> bug a long long time ago, have no idea where from.
> There's so many out there it would be impossible to figure out who did it,
Not necessarily but that is academic. Interestingly I did a test compile earlier using the standard TP7 library intentionally not using the CRT70 library and noted that the game is smaller (57,392bytes) but also has issues (i.e. it breaks logo display). I was expecting some issues but thought I would try a test anyway as no doubt someone will try a compile of your game using the with standard TP7 library.

> GPL concerns with CRT70 and fading text - I'm not sure GPL applies here.
> On both sites they say their code is freely usable. Adding GPL here would
> simply mean that any time their code is used that they get credit for it.
>
> but none of them are copyrighted so GPL isn't an issue here.
IANAL (I Am Not A Lawyer) however my understanding of copyright leads me to believe that this is not the case since from memory in many countries a person doesn't need to specifically put copyright on something for it to be copyrighted. As said earlier I would thus suggest checking at least with any authors (e.g. Pedt Scragg's email addresses can be found on his website), or for the sake of time/simplicity simply calling out what is your GPL source and what isn't. As before you are welcome to GPL the source that I have specifically shared with you for this project that I have said you can. To be clear that includes the source that I have shared with you here today.

> Added text to the title screens for CRT70, FONTEDIT, and fading text. Will
> also add to the text file. (Note that none of those EXE files or TPUs will
> be included with the final distro)
Ok, well as above we've now eliminated the need to include INTVFONT.COM but in terms of the source you may want to include a intvfont.obj or similar.

> Working on cleaning up the text help file.
Ok.

> Adding help to the game - If I can figure out how to do it quickly.
A really quick and dirty method would be to clear the screen (or overlay it), and a few Writeln's and wait for a Keypress (e.g. asm xor ax,ax int 16h end;)

> Compressing file space - I'll compile everything and try a tar, and see if
> it still runs.
tar?? Regarding file compression I would suggest shrinking with aPACK:
http://www.ibsensoftware.com/products_aPACK.html

aPACK's XT (-x) option will ensure that any resulting compressed EXE runs on older computers. Testing it on your supplied GALCON.EXE earlier it only added an extra 5 bytes (remember you save more losing the INTVFONT.COM header ;-), so it will worth your while using the XT option to help ensure all round compatibility particularly as text mode games are of extra interest to many with older computers.

This is example of using aPACK to shrink down galcon.exe:

C:\yourdevdir>apack -x galcon.exe galcon2.exe

===============================================================================
aPACK v1.00                     Copyright (c) 1997-2009 by Joergen Ibsen / Jibz
                                                            All Rights Reserved

                                                  http://www.ibsensoftware.com/
===============================================================================

This copy of aPACK is freeware.

■ Packing code                 -> 65251 bytes

Done ... compression ratio: 67% (194256 bytes -> 65588 bytes)

C:\yourdevdir>


As you can see it achieves good results when compressing your current game.


> Adding .DAT contents (compname, etc) to main - Good idea for if those files
> are missing, I will add that to the main to recreate the files if they are
> missing. I want the files themselves to be external so they can be
> modified by the user.
Sounds like a good plan.


> that would work except I'm in ASCII mode, not VGA mode.
It would have been re-usable however for simplicity I would suggest using instead the object method above with the code that I have provided for you.

> As much as I'd seriously love to make this game VGA graphic-capable,
> I just don't have time right now, and may not in the future.
There are never enough hours in the day.

Arjay(R)

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

@ Arjay
 

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

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.

Arjay(R)

25.06.2010, 12:20

@ Arjay
 

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

A minor point but one that I noticed whilst looking to see where other similar drop in code to the above could be placed. Following units do NOT require DOS in the uses statement: fadeunit, gctitle, gcend, gcinit, gcwar

[EDIT - fadeunit also does NOT require CRT, so you can remove its USES line entirely]

sinclaj1(R)

U.S.A.,
26.10.2010, 05:56

@ Arjay
 

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

> 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.
> {-------------------------------------------------------------------------}
>

>

Works like a charm! I appreciate the use of this code. Question... is there any way to modify this to pass the object name as a parameter (maybe via dummyfilename?). I'm toying around with the idea of loading multiple fonts within the game (ie: font switching/animation). I can make multiple procedures in the unit (one for each font), but wondered if there were a simpler way to just pass in the name of the obj (and .obj file...would be identical).


> 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)
>


aPACK isn't working on my system, as I have a 64-bit OS. I'll try to dig up a 32-bit one to see if it works on that.


Other updates --

I'm hoping to have this done within a week or so, as I'm headed north with our newborn to introduce him to my family (2 months old already!) I'm hoping to take the final version 9 of this game to give to my brother as a gift to him. My time has practically disappeared though, so I may just fix a couple really small things in the game and call version 9 done.

Updated link for downloading the game (we had to change our website name):
http://www.godhasanswers.com/main/media/gc/
I will post updates to that directory.

I've looked into the "copyright" stuff. Per the latest GPL (under "copyleft" requirements), my code has to specify a copyright date. I've modified the copyright symbol to be a reverse C in a circle (for copyleft) but everything else already fits within the guidelines of GPL. I've also updated the GPL comments in the code and updated the GPL text file included with the game.

I've confirmed the code I've borrowed and modified from other authors has been used within their guidelines, and credit given in both code and game.

I'm working on revamping the player creation page.
I'm working on updating the text file to remove weird characters.
I'm working on updating the game's documentation to include updates to the game.
I've decided not to worry about adding in-game help for now.
I'm looking into using different keyboard handling, but I may simply use the Ctrl-Break code I have for popping up a window to quit the game (including during all-CPU wars).

Arjay(R)

26.10.2010, 11:57

@ sinclaj1
 

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

> Works like a charm!
Good glad to hear it. Thanks for the positive feedback.

> I appreciate the use of this code.
No problem happy to help as/when I can. Note: recently I've been very busy elsewhere (work/life/some project coding) hence I've been very quiet on here.

> Question... is
> there any way to modify this to pass the object name as a parameter
> (maybe via dummyfilename?).
Yes. Do you want the fonts to be stored in the EXE or as separate files? The reason for asking is depending on what you need depends on the end code.

> I'm toying around with the idea of loading multiple fonts within
> the game (ie: font switching/animation).
Ok.

> I can make multiple procedures in the unit (one for each font),
> but wondered if there were a simpler way to just pass in the name
> of the obj (and .obj file...would be identical).
Object files are designed for static linking to the EXE at compilation time or to put it another way object files are basically useful only for times when you want external content built into the binary not as separate files.

Aside from object files there are other ways of including data within the EXE but as object files are a fairly straight forward method I decided to use it for you here. I'll be interested in knowing a little more in terms of what you want to do and will then revisit this code (and similar code I have also written) and see what I can muster up which will be straight forward to use.


> Other updates --
>
> I'm hoping to have this done within a week or so, as I'm headed north with
> our newborn to introduce him to my family (2 months old already!)
Excellent update! Just be sure to introduce him to computers early also ;)

> http://www.godhasanswers.com/main/media/gc/
Ok great thanks! I noted the site changed then the directory disappeared :(

> credit given in both code and game.
Thanks for taking the time to credit folks.

> I'm looking into using different keyboard handling,

but I may simply use
> the Ctrl-Break code I have for popping up a window to quit the game
> (including during all-CPU wars).
Ok.

sinclaj1(R)

U.S.A.,
26.10.2010, 13:59

@ Arjay
 

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

> > Question... is
> > there any way to modify this to pass the object name as a parameter
> > (maybe via dummyfilename?).
> Yes. Do you want the fonts to be stored in the EXE or as separate files?
> The reason for asking is depending on what you need depends on the end
> code.
>

Hmm, didn't know I could store them in the EXE. Would be nice to know how to do that too, but for this I'm interested in basically having whatever font .obj files in the directory and calling them from the code. Right now I have four font.obj files (fonta1.obj, ... fonta4.obj) and the object names are fonta1 ... fonta4.

> Aside from object files there are other ways of including data within the
> EXE but as object files are a fairly straight forward method I decided to
> use it for you here. I'll be interested in knowing a little more in terms
> of what you want to do and will then revisit this code (and similar code I
> have also written) and see what I can muster up which will be straight
> forward to use.

Thanks, as always I appreciate it.

> > I'm hoping to have this done within a week or so, as I'm headed north
> with
> > our newborn to introduce him to my family (2 months old already!)
> Excellent update! Just be sure to introduce him to computers early also
> ;)
Oh definitely. He already watches me work in my office.

By the way...RR ... if you're out there...how's your baby doing? Getting close to their first birthday isn't it?

rr(R)

Homepage E-mail

Berlin, Germany,
26.10.2010, 21:13

@ sinclaj1
 

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

> By the way...RR ... if you're out there...how's your baby doing? Getting
> close to their first birthday isn't it?

We've celebrated his first birthday last weekend. :-)

rr(R)

Homepage E-mail

Berlin, Germany,
26.10.2010, 21:07

@ sinclaj1
 

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

> aPACK isn't working on my system, as I have a 64-bit OS. I'll try to dig
> up a 32-bit one to see if it works on that.

Maybe MS-DOS Player for Win32-x64 (WIP) helps you.

Rugxulo(R)

Homepage

Usono,
27.10.2010, 23:43

@ rr
 

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

> > aPACK isn't working on my system, as I have a 64-bit OS. I'll try to
> dig
> > up a 32-bit one to see if it works on that.
>
> Maybe MS-DOS Player for Win32-x64 (WIP) helps you.

Hard to imagine that DOSBox is less useful for that. Besides, did I miss something, was aPACK so horribly crucial over UPX? UPX is cross-platform and can pack/unpack on any OS (e.g. Win32 pack/unpacks DOS stuff on Win64).

EDIT: (Obviously) congrats on the baby! Kudos on the software update too. Now if I wasn't so lazy/forgetful to play it again ....

Rugxulo(R)

Homepage

Usono,
26.06.2010, 14:59

@ Arjay
 

Congratulations / Galactic Conquest v9 beta 55

> > as I'm about to become a father and I have little time before then.
> Congratulations to you both!

Ditto.

> > GPL concerns with CRT70 and fading text - I'm not sure GPL applies here.
>
> > On both sites they say their code is freely usable. Adding GPL here
> would
> > simply mean that any time their code is used that they get credit for
> it.

You could always use Frank Heckenbach's solution(s) in his NewDelay.pas. It's copyrighted but "free software" if you leave in the copyright text at the top.

> > but none of them are copyrighted so GPL isn't an issue here.
> IANAL (I Am Not A Lawyer) however my understanding of copyright leads me to
> believe that this is not the case since from memory in many countries a
> person doesn't need to specifically put copyright on something for it to be
> copyrighted.

That's the way I heard it too, it's pretty much copyrighted immediately. But many people take it too far. Also, some countries won't even let you p.d. software, so you have to use something more legalistic.

> As said earlier I would thus suggest checking at least with
> any authors (e.g. Pedt Scragg's email addresses can be found on his
> website), or for the sake of time/simplicity simply calling out what is
> your GPL source and what isn't.

Last I checked (recently?), Pedt's web page was valid but his download links weren't. So he probably hasn't kept up-to-date.

Also, I think you can (have to, even, if part is) GPL a program "as a whole" without every single part being GPL (as long as it's compatible).

> tar?? Regarding file compression I would suggest shrinking with aPACK:
> http://www.ibsensoftware.com/products_aPACK.html
>
> aPACK's XT (-x) option will ensure that any resulting compressed EXE runs
> on older computers.

I like aPACK, but you can't unpack its output. And some even (unnecessarily, IMHO) worry that it violates the GPL due to this. It writes a custom stub for every .EXE. (DOS386 had a .COM aPACK unpacker, but I don't think that would work here.) Long story short, it doesn't matter to me personally, but I would probably just use UPX (--ultra-brute --lzma --8086) as aPACK barely saves anything extra.

Arjay(R)

27.06.2010, 00:11
(edited by Arjay, 27.06.2010, 00:36)

@ Rugxulo
 

Galactic Conquest v9 file compression / UPX vs aPACK

> You could always use Frank Heckenbach's solution(s) in his
> NewDelay.pas.
Yes I fully agree Frank's unit works extremely well; I've used it many times.

> Last I checked (recently?), Pedt's web page was valid but his download
> links weren't. So he probably hasn't kept up-to-date.
Although he hasn't kept that part of his website up to date other parts are being updated. Sadly all 3 of his download links are now broken but the CRT library can certainly be downloaded via the following Garbo link as I sought out a current link to it which I meant to reference in my earlier reply.

This is a active CRT.ZIP download link: ftp://garbo.uwasa.fi/pc/turbopas/crt.zip (thank you UWASA!)

> (DOS386 had a .COM aPACK unpacker, but I don't think that would work here.)
DOS386's Ultimate unPACKER doesn't support EXE files, however it works well with COM files. In case anyone wishes to use it and wants a quick way to create a the required garbage.gag, one can easily be created to use with it as follows:

c:\>debug
-n garbage.gag
-f 0000,ffff 00
-rbx
BX 0000
:1
-w
Writing 10000 bytes
-q
c:\>


> I like aPACK, but you can't unpack its output.
A few days ago I spotted your comment on the above FASM discussion re Frank Zago's Intelligent Executable Unpacker (IUP) and I created various files for IUP to see how it performed. I was very impressed with how well it works. However as I expect you know there is a problem with IUP in that it often inadvertently appends extra data to the header/main body/end of a file. Certainly common with uncompressed aPACK files. Indeed often uncompressed EXE files simply don't work afterwords (corrupted) hence during a lot of RJDUMP updates the other night I added the following "informational" flagging: WARNING: Executable has been UNpacked with IUP! to allow people to clear spot them.

Note: This was easy to achieve as IUP deliberately adds the signature *IUP as the first relocation table entry of rebuilt EXE file. Thus all RJDUMP does is simply flag up this entry when it detects it inside an EXE.

> probably just use UPX (--ultra-brute --lzma --8086) as
UPX is very good. I also added UPX SYS detection to RJDUMP as well. I haven't had time to add UPX EXE detection but it's on the cards probably next release. Not that I've released RJDUMP yet (been too busy with non-IT stuff).

> aPACK barely saves anything extra.
It depends. aPACK has a slightly more flexible license wise than UPX has.

Rugxulo(R)

Homepage

Usono,
27.06.2010, 08:10

@ Arjay
 

Galactic Conquest v9 file compression / UPX vs aPACK

> > You could always use Frank Heckenbach's solution(s) in his
> > NewDelay.pas.
> Yes I fully agree Frank's unit works extremely well; I've used it many
> times.

He seems to provide three methods, all different, in case someone can't use the best one (apparently RTL srcs needed for #2).

> > Last I checked (recently?), Pedt's web page was valid but his download
> > links weren't. So he probably hasn't kept up-to-date.
>
> This is a active CRT.ZIP download link:
> ftp://garbo.uwasa.fi/pc/turbopas/crt.zip

My main issue is that so much code is TP7 only, which hampers using TP55 freeware. Or other code is too big and complex to use for simple projects. I basically hacked up my own (lame) routines to read in *nix LF files and convert paramstr(1) from LFN to SFN (int 21h, 7160h) and don't use Delay (obviously). To be honest, the only huge benefits to using TP55 at all (IMHO) are 8086 compatibility and really small .EXE size. Otherwise I'd just use GPC or FPC or VPC or whatever. (Note that I'm a very very wimpy Pascal programmer now, heh, only been barely coding it for a few months off and on.)

> > I like aPACK, but you can't unpack its output.
> A few days ago I spotted your comment on the above FASM discussion re Frank
> Zago's Intelligent
> Executable Unpacker (IUP) and I created various files for IUP to see
> how it performed. I was very impressed with how well it works. However as
> I expect you know there is a problem with IUP in that it often
> inadvertently appends extra data to the header/main body/end of a file.
> Certainly common with uncompressed aPACK files. Indeed often uncompressed
> EXE files simply don't work afterwords (corrupted) hence during a lot of
> RJDUMP updates the other night I added the following "informational"
> flagging: WARNING: Executable has been UNpacked with IUP! to allow
> people to clear spot them.

Also, keep in mind that Eric Auer and I had a conversation in e-mail a few years ago about how FreeDOS somehow handles differently the tempfile mechanism in IUP, so for that platform you'll probably have to run IUP in the root directory for it to fully work (kludge).

> > probably just use UPX (--ultra-brute --lzma --8086) as
> UPX is very good. I also added UPX SYS detection to RJDUMP as well. I
> haven't had time to add UPX EXE detection but it's on the cards probably
> next release.

See Robert's UPXDUMP tool if you haven't already.

> > aPACK barely saves anything extra.
> It depends. aPACK has a slightly more flexible license wise than UPX has.

aPACK 1.00 is freeware even for commercial use. UPX is free for any use, including commercial, but you must GPL your UPX modifications if you don't use their stock stubs. Also, last I heard, FSF considers UPX itself non-free (due to NRV) but the stubs themselves are okay. (I still haven't rebuild UPX-UCL 3.05, but I doubt most people care anyways besides Jim, and he hasn't asked, probably too busy. Should be pretty much the same as 3.04, I hope.)

Arjay(R)

27.06.2010, 13:30
(edited by Arjay, 27.06.2010, 15:42)

@ Rugxulo
 

TP5_2COM - an example of how to generate a COM file from TP5

> My main issue is that so much code is TP7 only, which hampers using TP55
> freeware. Or other code is too big and complex to use for simple projects.
Ok, let's help fix some of that :) Just for you I have back ported to TP5 some TP7 code I wrote a while ago to generate COM files from TP. The TP5 version appears below and I quickly rewrote it for you this morning under TP5. It isn't as well tested as the TP7 version but "appears" fine, feel free to test as to be honest although it seems fine I haven't had a chance to fully review but thought I would share now "as is" to allow people to have a play with it.

Program TP5_2COM;  {This is an example of how to generate COM files from TP5}

{Freeware code example by Richard L. James http://www.wimborne.org/richard/ }
{VERY IMPORTANT: Always REVIEW generated code created with method shown here}
{This code example uses TP5 to generate EXE code from which we generate a COM}
{Mostly released as a technical curosity for interested people to play with!}
{Use of the following code is entirely at your own risk without any warranty}
{It is *NOT* recommend using this code as is with other versions of TP pascal}


Const
  ExitCodeLength=4;

  NewCode:Array[1..5] of byte =    {We need to ensure BP points after our PSP}
    ($BD, $10, $01, {mov  BP, 110h}  {TP code generated by "subtracks" off BP}
     $EB, $0C);     {jmp short 111}  {Jump to the start of TP generated code}


Var                {Note: We do NOT save the following variables to our .COM}
  COMFile:File;    {Define a binary COM file}
  NumWritten:Word; {BlockWrite needs this variable in this demo we ignore it}



Procedure SaveMe; {We setup code/data we want to save out in single procedure}

Var
  XCounter, YCounter:Word;   {These values are NOT saved but redefined below}


Begin
  {Note: NewCode is SAVED as the start of our .COM file starting org 100h}
  {Then we define some variable space using 00h bytes for 2 variables}

  {IMPORTANT: If adding variables you will NEED to increase this area and
              you will ALSO need to change NewCode appropriately.  Always
              (I repeat ALWAYS) view/check any generated code in a hex editor
              before attempting to run it and keep "everything" in one proc!}

  inline($00/$00/   {BP -A} {Unused variable in this example}
         $00/$00/   {BP -8} {Unused variable in this example}
         $00/$00/   {BP -6} {Unused variable in this example}
         $00/$00/   {BP -4} {In this example our redefined YCounter variable}
         $00/$00/   {BP -2} {In this example our redefined XCounter variable}
         $00/$00);  {BP   } {org 0110h - we point BP here via "newcode" above}

  {In this example the following code starts at org 111h "newcode" jumps here}
  inline($B8/$13/$00/  {mov ax, 0013}  {Change to 320x200 graphics mode}
         $CD/$10);     {int 10h}       {Call Int 10h}

  For XCounter:=0 to 319 do            {Generate a simple 320x200 picture}
    For YCounter:=0 to 199 do
      Mem[$A000:(YCounter*320)+XCounter]:=YCounter xor XCounter;

  inline($31/$C0/      {xor ax,ax}     {AX = 0}
         $CD/$16);     {int 16h}       {Call BIOS to wait for a keypress}

  inline($B8/$03/$00/  {mov ax, 0003h} {Change to 80x25 colour text mode}
         $CD/$10);     {int 10h}

  inline($B8/$00/$4C/  {mov ax, 4C00h} {Terminate with an error code of 0}
         $CD/$21);     {int 21h}       {End program}

  {TP5 generates proc exit code here - we avoid saving it with ExitCodeLength}
End;


Procedure UpToMe;  {Dummy "up to marker" marker to help save our TP code out}

Begin
  {do nothing}
End;


{Our main program does NOT call the above code but simply copies it to a COM}

Begin
  Writeln;
  Writeln('TP5_2com - example program of how to create a COM file with TP5');
  Writeln('Attempting to create tinytp5.com');

  Assign(COMFile, 'tinytp5.com');    { Assign output name to our TP5 .COM file}
  ReWrite(COMFile, 1);               { Create new file with record size = 1 }

  BlockWrite(COMFile, NewCode, SizeOf(NewCode), NumWritten); {Save COM header}
  BlockWrite(COMFile, Mem[Seg(SaveMe):Ofs(SaveMe)+14], {Save out TP proc code}
                     (Ofs(UpToMe)-14)-ExitCodeLength, NumWritten);
                     {note the above -14/+14 avoids saving TP entry/exit code}

  {Normally in a program some error checking would be good here but due to
   the nature of this example I would recommend manually checking any code !!}

  Close(COMFile);    {Close our new file}

  Writeln('tinytp5.com created - "review" with a hex editor before running!');
  Writeln;
  Halt;              {end our TP5 .COM after saving out our example COM file}
End.

Arjay(R)

27.06.2010, 14:00
(edited by Arjay, 28.06.2010, 08:11)

@ Rugxulo
 

Galactic Conquest v9 file compression / UPX vs aPACK

> > > You could always use Frank Heckenbach's solution(s) in his
> He seems to provide three methods, all different, in case someone can't use
> the best one (apparently RTL srcs needed for #2).
Correct the RTL source only came with Borland Pascal not Turbo Pascal. There are some extremely easy ways of patching Turbo Pascal CRT RTL from within Turbo Pascal, some of which are demonstrated by NewDelay others methods.

> and don't use Delay (obviously).
Ok. The problem being I guess no good fix like newdelay currently available for TP5? If need be I would be happy some time to help back port it to TP5 just to help anyone keen to use TP5. I started out with it but when TP3/TP4 when in education but brought TP7 for myself. The key thing about versions after TP5 is obviously the inclusion of Asm over the harder to use inline.
However importantly TP5 does of course also include external asm obj logic.

> To be honest, the only huge benefits to using TP55 at all (IMHO)
> are 8086 compatibility and really small .EXE size.
You meant the large EXE size :) Now I've shared some COM file generating code you can hopefully re-use that to get the added benefit of asm size with TP5!

> Otherwise I'd just use GPC or FPC or VPC or whatever.
It is nice to have a mix, there are lots of options and I think it is choosing the right tool for the right job. FPC is very well written.

> (Note that I'm a very very wimpy Pascal programmer now, heh,
heh that's exactly how I would describe my C programming but I can do both.

> Also, keep in mind that Eric Auer and I had a conversation in e-mail a few
> years ago about how FreeDOS somehow handles differently the tempfile
> mechanism in IUP, so for that platform you'll probably have to run IUP in
> the root directory for it to fully work (kludge).
Ok thanks for the warning.


> See Robert's
> UPXDUMP tool if
> you haven't already.
Thanks. I have but have deliberately not referenced UPXDUMP as often I like to understand/do things for myself before then seeing how others have done it.

> aPACK 1.00 is freeware even for commercial use. UPX is free for any use,
> including commercial, but you must GPL your UPX modifications if you don't
> use their stock stubs.
Indeed and these are the things that I like about aPACK over UPX :)

Rugxulo(R)

Homepage

Usono,
28.06.2010, 06:45

@ Arjay
 

Galactic Conquest v9 file compression / UPX vs aPACK

> Correct the RTL source only came with Borland Pascal not Turbo Pascal.

I read some (very old) newsgroup post earlier today where someone said they bought the RTL (except Graph) for TP6. So I guess it was available even then.

> > and don't use Delay (obviously).
> Ok. The problem being I guess no good fix like newdelay currently
> available for TP5? If need be I would be happy some time to help back port
> it to TP5 just to help anyone keen to use TP5.

Only TP7 has the CRT startup bug, but TP55 still has a broken Delay. I think there are known fixes for that, but I haven't ever needed Delay yet.

> The key thing about versions after TP5 is obviously the inclusion
> of Asm over the harder to use inline.

TP6 introduced that, and yeah, it's more convenient, but at least there are tools (INLIN219.ZIP) for helping although even DEBUG probably is sufficient.

However, I also heard that TP55 and older aren't pmode friendly, hence using the wrong interrupt vectors, assuming hardcoded addresses, which aren't always true for pmode OSes. (Note that I don't 100% understand this and have no examples of proof, but you probably know what I'm referring to.)

> However importantly TP5 does of course also include external asm obj
> logic.

Yes, but I haven't tried that (and I hope it doesn't require explicit TASM or MASM object files or specific directives, e.g. "pascal"; I haven't tried yet but I hope JWasm or ArrowASM works).

> > To be honest, the only huge benefits to using TP55 at all (IMHO)
> > are 8086 compatibility and really small .EXE size.
> You meant he large EXE size :) Now I've shared some COM file generating
> code you can hopefully re-use that to get the added benefit of asm size
> with TP5!

Not sure how space much this saves, but I'll take a look later (if I don't forget!). ;-)

> > Otherwise I'd just use GPC or FPC or VPC or whatever.
> It is nice to have a mix, there are lots of options and I think it is
> choosing the right tool for the right job. FPC is very well written.

Yes, it's quite nice to have a lot of choices, even if I'm afraid that I annoy Marco due to that. ;-)

> > (Note that I'm a very very wimpy Pascal programmer now, heh,
> heh that's exactly how I would describe my C programming but I can do
> both.

Found three different Pascal to C converters: p2c, ptoc, ptc. (Yes, they all are named horribly, heh.) :-D

> > aPACK 1.00 is freeware even for commercial use. UPX is free for any use,
> > including commercial, but you must GPL your UPX modifications if you
> don't
> > use their stock stubs.
> Indeed and these are the things that I like about aPACK over UPX :)

Well, if you wanted to modify the stub, then okay. :-)

Rugxulo(R)

Homepage

Usono,
28.06.2010, 07:02

@ Rugxulo
 

early Turbo Pascal quirks

> > > To be honest, the only huge benefits to using TP55 at all (IMHO)
> > > are 8086 compatibility and really small .EXE size.
> > You meant the large EXE size :) Now I've shared some COM file generating
> > code you can hopefully re-use that to get the added benefit of asm size
> > with TP5!

BTW, I know the .EXE header wastes a bit of space, but I guess they didn't figure it mattered much. Early TP (e.g. v1 or v302) only generated .COM files and also included the whole runtime inside! (Still smaller than the C alternative.) So TP55 output is actually a fair bit smaller (several kb).

Yeah, I know, those are old and odd (direct screen writes?). No longint and only v302 has paramcount/paramstr. And the codegen is slow (even moreso under DOSBox). But hey, it's kinda funny how tiny the whole compiler + runtime + editor is. ;-)

P.S. In case anybody else is wondering (like me earlier today, going crazy trying to find out), you quit the editor with ^K^D (which, AFAICT, isn't WordStar compatible, no idea where they came up with that weird combination.)

Back to index page
Thread view  Board view
15113 Postings in 1359 Threads, 249 registered users, 19 users online (0 registered, 19 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum