Classic Computer Magazine Archive PROGRAM LISTING: 89-09a/PRTSCRN.M65


��j%�+X***************************************�+X* ATARI PRINTSCREEN                   *�+X* This program was written using      *+X* MAC65.  By Steve Derderian          *+X* (c) 1989 ANTIC PUBLISHING, INC.     *+X* Date Written:  November 2, 1988     *$+X*                                     *.+X***************************************8X*B3�START@;;Initial load address for the programL7�DOSINI;;Vector to the DOS initialization routineV6�POKMSK;;Interupt request enable shadow register`$�SAVMSCX;;Pointer to screen RAMj3�ZMEMLO�;;Work area used by relocation sectiont2�C0�;;Work areas used by print screen section~1�C1�;;Data residing between $CB and $CE will�1�C2�;;be destroyed when print screen is used�7�VKEYBD;;Vector to the keyboard interupt routine�!�RUNAD�;;DOS run after load�#�MEMLO�;;Everyone knows MEMLO�,�HATABS;;Device handler address table�@�KBCODE	�;;KBCODE is the register used to store a key press�8�IRQEN�;;The real interupt request enable register�X*�
�START�+X***************************************�+X*                                     *�+X* This program consists of three      *+X* sections.  The first section is     *
+X* responsible for loading the program *+X* at START ($4000), modifying the     *+X* rest of the program to run at LOMEM *(+X* (actual address unknown until run   *2+X* time), and moving the program to    *<+X* LOMEM.                              *F+X*                                     *P+X* The following section of the        *Z+X* program is not moved to LOMEM so it *d+X* does not take up any memory in your *n+X* computer.                           *x+X*                                     *�+X***************************************�X*�$>;;Search the handler�'�P01Q�HATABS9;;address table looking�R>
P;;for the printer�F�P02;;device handler.�2;;Each handler entry�2;;consists of three�2;;bytes.�H�P01;;Not found, try again.�X*��P02Q�HATABS9;;Found P:.�#P�C0;;Move the address of the#Q�HATABS9;;P: vector table toP�C0;;page 0.X*"%>;;Pick up the address of,#Q@�C07;;the P: put byte routine.6>@3J	Q@�C07T?^$2;;The table contains the addressh!H�P03;;of the routine minus 1.r"3;;Add 1 to so we can do a JSR.|X*�)�P03&�P17;;Store the address of the� &�P20;;put byte routine in�!'�P17;;section three of the�'�P20;;program.�X*�#Q�VKEYBD;;Save the address of�!P�P10;;the current keyboard�!Q�VKEYBD;;interupt routine.�P�P10�X*�#Q�DOSINI;;Save the address of�"P�P06;;the current DOS reset�Q�DOSINI;;routine.P�P06X*,$�MEMLO;;MEMLO points to the last byte&+%�MEMLO;;used by DOS.  We need to add0!2;;1 to MEMLO so we don't step:H�P04;;on that byte.D3N)�P04&�ZMEMLO;;Stash the address forX'�ZMEMLO;;use later.b(&�P07;;Section two of this programl*'�P07;;also needs to remember MEMLO.vX*�',;;Add MEMLO to the relative address�!A;;of the print screen routine�(O>4�P09�P06;;(section three) so that�!P�P08;;we can calculate its�C;;absolute address.�O>5�P09�P06�P�P08�X*�',;;Add MEMLO to the relative address� A;;of the internal to atascii�$O>4�INTATA�P06;;conversion table�$P�P14;;so we can calculate its�C;;absolute address.O>5�INTATA�P06P�P14X* ',;;Add MEMLO to the relative address*A;;of the printer code 4$O>4�OUTTBL�P06;;conversion table>$P�P15;;so we can calculate itsHC;;absolute address.RO>5�OUTTBL�P06\P�P15fX*p+%>�PGMEND�P06;;Move sections two andz#�P05Q�P068;;three down to MEMLO.�
P@�ZMEMLO7�1�)>��H�P05�-F�P07;;UNCONDITIONAL SKIP.  1ST TIME ONLY.�X*�+X***************************************�+X*                                     *�+X* This is section two.  It is         *�+X* responsible for protecting our      *�+X* program and installing (and         *�+X* reinstalling) the print screen      *�+X* program each time the system reset  *	+X* button is pressed.                  *	+X*                                     *	+X* This section (except for the first  *$	+X* JSR) is also performed when the     *.	+X* program is initially loaded from    *8	+X* DOS.                                *B	+X*                                     *L	+X***************************************V	X*`	5�P06 ��;;Call the old DOS initialization routine.j	X*t	2�P07$>�;;Change the DOS initialization routine~	%>�;;vector to point to our�	'&�DOSINI;;initialization routine.�	'�DOSINI�	X*�	(,;;Raise MEMLO so that our program is�	Q�MEMLO;;protected.�	O>4�PGMEND�P06�	
P�MEMLO�	
Q�MEMLO�	O>5�PGMEND�P06�	
P�MEMLO�	X*�	)�P08$>�;;Change the keyboard interupt
%>�;;vector to point to

$&�VKEYBD;;our interupt handler
 '�VKEYBD;;(section three).
X*(
0:;;Return to DOS (or the OS if system reset).2
X*<
+X***************************************F
+X*                                     *P
+X* This is section three.  It is the   *Z
+X* part of the program that actually   *d
+X* performs the screen print function. *n
+X* (This is why we did all of that     *x
+X* stuff above.)                       *�
+X*                                     *�
+X* This section is called each time a  *�
+X* key is pressed.                     *�
+X*                                     *�
+X***************************************�
X*�
=�P09Q�KBCODE;;Pick up the code from the keyboard register.�
"R>�;;Was it <SHIFT><CONTROL>P?�
F�P11;;YES!�
X*�
(�P10!��;;NO! - Let the OS handle it.�
X*�
+�P11A;;Since this is an interupt routine#5;;we are responsible for saving!C;;all of the registers.  (The&5;;A-register was saved by the OS.)"+Q�POKMSK;;We don't have to do this, but ,!5;;we want to save POKMSK too.6X*@(M>?;;0011 1111 Turn off keyboard andJ!P�POKMSK;;break key interupts.T
P�IRQENY.;;Allow SIO Interrupts...^X*h,Q>;;C0 holds the index into screen RAM.rP�C0|X*�$Q>4�;;C1 holds the counter used�#P�C1;;to tell us when we have�"Q>5�;;finished coping all 960�1P�C1;;bytes from the screen to the printer.�X*�$�P12Q>(;;C2 counts from 40 to 0.�3P�C2;;When it hits 0, we do a printer line feed.�X*��P13%�C0;;Recall the index.�,Q@�SAVMSC7;;Pick up the screen character.�#5;;Convert it from internal code�U?;;to ATASCII.  (Trust me.)�U?U?U?M>&>07:M>D�P14L��9N>X7�P15Q��9;;Pick up the equilivant printer character.b%(>
 ;;Was the character < a space?lD�P16;;YES!v-A;;NO! - bring it back.  It was OK before.�R>
|;;Virgule?�H�P16;;NO! - print it�Q>�;;YES! - change to solid�X*� �P16$>;;For XL/XE machines.�!�P17 ��;;Print the character.�X*�*#�C0;;NO! - Increment our screen index.�-H�P18;;If the index rolls from $FF to $00,�-#�SAVMSC;;increment the screen address.�X*�*�P18"�C1;;Decrement our 960 counter.�H�P19
"�C1
X*
%�P19"�C2;;Decrement our 40 counter 
-H�P21;;It's not zero.  Aren't we done yet?*
X*4
%Q>
;;It was zero, do a line feed.>
$>;;For XL/XE machines.H
!�P20 ��;;Print the character.R
X*\
�P21Q�C1f
M�C1p
R>�;;Did we hit -1?z
#F�P22;;YES! - We're almost done.�
X*�
Q�C2�
#H�P13;;Haven't filled a line yet�
/F�P12;;UNCONDITIONAL - reset the 40 counter.�
X*�
'�P22"�SAVMSC;;Restore the pointer�
"�SAVMSC;;to screen RAM.�
"�SAVMSC�
X*�
Q>�;;Clear the key press so�
*P�KBCODE;;we don't get stuck in a loop.�
X*�
7;;Restore the interuptP�POKMSK;;request register.
P�IRQEN 7;;Restore the CPU registers.$?.78>B7L9;;Return from the interupt.VX*`+X***************************************j+X*                                     *t+X* The following table is used to      *~+X* convert the ATASCII graphics        *�+X* character to the equilivant         *�+X* IBM printer character.  If you have *�+X* Panasonic, Epson, or any other      *�+X* printer that supports IBM graphics  *�+X* characters, this should work fine.  *�+X* The table will also protect you     *�+X* from the escape or other printer    *�+X* control characters.                 *�+X*                                     *�+X* If this program does not work       *�+X* properly with your printer, you may *�+X* have to modify this table.          *+X*                                     *
+X***************************************"�OUTTBLA���ἴ�/\������������AA�����������A(X*2+X***************************************<+X*                                     *F+X* The following table is used to      *P+X* convert screen characters to        *Z+X* ATASCII characters.  DON'T CHANGE   *d+X* IT.                                 *n+X*                                     *x+X***************************************��INTATA =@==`�X*�+X***************************************�+X*                                     *�+X* The following message places the    *�+X* program name and version number in  *�+X* the object code created by the      *�+X* Assembler.  This is so you can see  *�+X* if you are running an old version   *�+X* of the program.                     *�+X*                                     *�+X* This message is not copied down to  *�+X* LOMEM after the program is loaded   *+X* so it will not take up any extra    *+X* memory in your computer.            *+X*                                     *"+X***************************************,4�PGMENDA�PRTSCRN VERSION 1.3 (C) ANTIC MAGAZINEA6
�RUNAD@'	�START;;Tell DOS to run the program

Back to previous page