Sam Trenholme's webpage
This article was posted to the Usenet group alt.hackers in 1995; any technical information is probably outdated.

Re: A useful .COM proggy:

Article: 8663 of alt.hackers
From: (Steve Holiman)
Newsgroups: alt.hackers
Subject: Re: A useful .COM proggy:
Date: 22 Sep 1995 08:13:28 GMT
Organization: Cloverleaf Inc., Lakewood, CA, USA
Lines: 100
Approved: Steve Holiman
Message-ID: 43tr78$
X-Newsreader: TIN [version 1.2 PL2]
Status: RO

David Hedley ( wrote:
: Michael Jarvis ( wrote:
: : Well, if we're going to do SIMPLE com files, here's one.  It just sends a
: : formfeed to lpt1.  It's useful if you do a "type foo.txt >
lpt1" and your
: : printer doesn't automagically send a formfeed.

: : It's only 17 bytes:

: : begin 755
: : 1LP2Q`;H0`;1`S2&X`$S-(0S]
: : `
: : end

: : Heck, I'll even include the TASM source:

: : ;
: : title 'Form Feed'
: : .model TINY
: : .data
: :         FormFeed        db 12
: : .code
: : org 100h
: : Start:
: :         mov     bl, 04h         ; We're going to output to file handle 4,
: :                                 ; which is the standard printer (PRN)
: :
: :         mov     cl, 01h         ; We're going to output one byte.
: :         lea     dx, FormFeed    ; Load DX with the offset of the ASCII 12
: :         mov     ah, 40h         ; Using INT 21h service 40h
: :         int     21h             ; Execute!
: :
: :         mov     ax, 4c00h       ; End the program
: :         int     21h
: :
: :         end     Start

<to Michael>
Is there any particular advantage to using the file handle service here?
Int 21h service 5 goes to std prn also; hence:

title 'Form Feed'
.model TINY
	FormFeed   EQU 0Ch	;this now becomes an assy constant
org 100h
	mov	ah, 05h		; which is the standard printer service (PRN)
	mov	dl, Formfeed	; We're going to output a Formfeed
	int	21h		; Execute!
	mov	ax, 4c00h	; End the program
	int	21h

	end	Start

This is only 11 bytes, and probably faster if we care  ;^)

: Hmm, I usually just do: echo ^L > prn

: (that's control-L for the newbies)

: David

I'm with you - this also has the advantage that you can create it as
ff.bat on whatever machine you happen to be working on (people can always
tell when I've been working on a system as I leave my little trail of
these "bread crumbs" behind ...).


Tyrone Cartwright just posted an interesting hack with his old Sinclair
Spectrum, so perhaps he'll appreciate this one:

My first ever assembly language program was a sort of OS hack on my old
Timex Sinclair.  Those of you who remember this incredibly inexpensive
little Z80 unit will recall that the tokenized basic OS only allowed you
to list your program to the screen 1 page at a time; i.e., List 50 would
start at line 50 and list until it ran out of screen and stop, which
required you to then enter List <whatever the last line on the screen
until you saw something you wanted to work on.	Well, that _had_ to go.
Fortunately my "mentor" at the time had gifted me with the ROM
disassembly book for the little beast (What a concept!	Sure could use
that kind of official documentation for some of the systems I work on
today).  After _much_ sleuthing through the code (the thing had about 3
chips in it so they had some aMAZingly "clever" code to do the screen
writing), I managed to isolate the appropriate routines used by the List
command (and where they could be jumped into for my purposes) and wrote my
hand assembled _machine_code_ program which reserved itself about
90 bytes above the (moved) RAMTOP pointer and hid there.  Now I could
execute the USR instruction from the command line and it would start
scrolling the listing from wherever I currently was at an easily read
rate until I stopped it (with a space, IIRC).  As my first experience
with assembly of any kind, I have to admit I'm still proud of it 15 years
later.	It sure made life a LOT easier!

Steve Holiman / | The rogue opinions which just
HACK / Holiman Audio/Computer Kibitzing | escaped do not necessarily reflect
Los Angeles CA (310) 942-0314 voice/fax | my moments of clear perception ...

Parent Parent Parent

Back to index