home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 4
/
FreshFish_May-June1994.bin
/
new
/
amigalibdisks
/
d991
/
prtsc
/
prtsc.s
< prev
Wrap
Text File
|
1994-04-04
|
24KB
|
1,146 lines
;
; PrintScreen V1.75 Saturday, 12-Mar-1994
;
; (c) 1993-1994 by Jan Hagqvist
;
; Utilizies the PrtSc-key and makes it to
; create a graphics dump to the printer
; or save the screen into a file
XREF _LVOOpenLibrary
XREF _LVOCloseLibrary
XREF _LVOOpenDevice
XREF _LVOCloseDevice
XREF _LVODisplayAlert
XREF _LVOCreateMsgPort
XREF _LVODeleteMsgPort
XREF _LVOCreateIORequest
XREF _LVODeleteIORequest
XREF _LVOGetVPModeID
XREF _LVODoIO
XREF _LVODelay
XREF _LVOOpenWindow
XREF _LVOCloseWindow
XREF _LVOWaitPort
XREF _LVOGetMsg
XREF _LVOReplyMsg
XREF _LVOOpen
XREF _LVOClose
XREF _LVOWrite
XREF _LVORead
XREF _LVOWait
XREF _LVOAllocSignal
XREF _LVOFreeSignal
XREF _LVOFindTask
XREF _LVOSignal
XREF _LVOAddGList
XREF _LVOCreateContext
XREF _LVOGetVisualInfoA
XREF _LVOFreeGadgets
XREF _LVOFreeVisualInfo
XREF _LVOCreateGadgetA
XREF _LVORefreshGList
XREF _LVOGT_SetGadgetAttrsA
XREF _LVOScreenToFront
XREF _LVOSeek
JAM1 equ 0
WBENCHSCREEN equ 1
PRD_PRTCOMMAND equ $a
io_Device equ 20
io_Unit equ 24
io_Command equ 28
io_PrtCommand equ 32
io_Parm0 equ 34
io_Data equ 40
is_Pri equ 9
is_Name equ 10
is_Data equ 14
is_Code equ 18
ie_Class equ 4
ie_Code equ 6
ie_Qualifier equ 8
IND_ADDHANDLER equ 9
IND_REMHANDLER equ 10
IECLASS_NULL equ 0
IECLASS_RAWKEY equ 1
IEQUALIFIER_LSHIFT equ 0
IEQUALIFIER_RSHIFT equ 1
IEQUALIFIER_LALT equ 4
IEQUALIFIER_RALT equ 5
pr_MsgPort equ 92
pr_CLI equ 172
BUTTON_KIND equ 1
CHECKBOX_KIND equ 2
CYCLE_KIND equ 7
STRING_KIND equ 12
PLACETEXT_RIGHT equ $0002
PLACETEXT_IN equ $0010
IDCMP_GADGETUP equ $00000040
IDCMP_CLOSEWINDOW equ $00000200
WFLG_DRAGBAR equ $00000002
WFLG_DEPTHGADGET equ $00000004
WFLG_CLOSEGADGET equ $00000008
WFLG_SIMPLE_REFRESH equ $00000040
WFLG_ACTIVATE equ $00001000
WFLG_RMBTRAP equ $00010000
WFLG_NOCAREREFRESH equ $00020000
GTCB_Checked equ $80080004
GTCY_Labels equ $8008000e
GTCY_Active equ $8008000f
GTST_String equ $8008002d
GTST_MaxChars equ $8008002e
TAG_DONE equ 0
PrtSc
move.l 4,a6
sub.l a1,a1
jsr _LVOFindTask(a6)
move.l d0,MyTask
move.l d0,a4
tst.l pr_CLI(a4)
bne.s NoWorkbench
lea pr_MsgPort(a4),a0
jsr _LVOWaitPort(a6) ; Wait for message
lea pr_MsgPort(a4),a0
jsr _LVOGetMsg(a6) ; Get it
move.l d0,WorkbenchMsg ; Store it
NoWorkbench
moveq.l #0,d0
lea IntuitionName(pc),a1
jsr _LVOOpenLibrary(a6)
move.l d0,IntuitionBase
tst.l d0
beq Quit
moveq.l #36,d0
lea GfxName(pc),a1
jsr _LVOOpenLibrary(a6)
move.l d0,GfxBase
tst.l d0
beq NoGfx36
moveq.l #0,d0
lea DosName(pc),a1
jsr _LVOOpenLibrary(a6)
move.l d0,DosBase
tst.l d0
beq NoDos
moveq.l #0,d0
lea GadToolsName(pc),a1
jsr _LVOOpenLibrary(a6)
move.l d0,GadToolsBase
tst.l d0
beq NoGadTools
jsr _LVOCreateMsgPort(a6)
move.l d0,MsgPort
tst.l d0
beq NoMsgPort
move.l d0,a0
moveq.l #62,d0
jsr _LVOCreateIORequest(a6) ; IODRPReq
move.l d0,Request
tst.l d0
beq NoRequest
move.l MsgPort(pc),a0
moveq.l #38,d0
jsr _LVOCreateIORequest(a6) ; IOPrtCmdReq
move.l d0,Request3
tst.l d0
beq NoRequest
jsr _LVOCreateMsgPort(a6)
move.l d0,MsgPort2
tst.l d0
beq NoMsgPort
move.l d0,a0
moveq.l #48,d0
jsr _LVOCreateIORequest(a6) ; IOStdReq
move.l d0,Request2
tst.l d0
beq NoRequest
lea InputName(pc),a0
move.l Request2(pc),a1
moveq.l #0,d0 ; unit 0
moveq.l #0,d1
jsr _LVOOpenDevice(a6)
tst.l d0
bne Quit
move.l 4,a6
moveq.l #-1,d0
jsr _LVOAllocSignal(a6)
move.l d0,PrintSignal
cmp.b #-1,d0
beq NoSignal
moveq.l #-1,d0
jsr _LVOAllocSignal(a6)
move.l d0,WindowSignal
cmp.b #-1,d0
beq NoSignal
bsr LoadConfig ; Load the configuration!
lea Interrupt,a0
move.l #MyHandler,is_Code(a0)
move.l #0,is_Data(a0)
move.b #100,is_Pri(a0)
move.l #MyHandlerName,is_Name(a0)
move.l 4,a6
move.l Request2(pc),a1
move.l #Interrupt,io_Data(a1)
move.w #IND_ADDHANDLER,io_Command(a1)
jsr _LVODoIO(a6)
moveq.l #0,d0
move.l PrintSignal(pc),d1
bset d1,d0
move.l WindowSignal(pc),d1
bset d1,d0
move.l d0,SignalMask
clr.b QuitFlag
GetKey
tst.b QuitFlag
bne.s GetKey4
move.l 4,a6
move.l SignalMask(pc),d0
jsr _LVOWait(a6)
move.l d0,d7
move.l PrintSignal(pc),d1
btst d1,d7
bne.s GetKey2
move.l WindowSignal(pc),d1
btst d1,d7
bne.s GetKey3
bra.s GetKey
GetKey2
bsr DoTheDump ; Shift+PrtSc pressed
bra.s GetKey
GetKey3
bsr GetFlags ; Alt+PrtSc pressed
bra.s GetKey
GetKey4
RemoveHandler
move.l 4,a6
move.l Request2(pc),a1
move.l #Interrupt,io_Data(a1)
move.w #IND_REMHANDLER,io_Command(a1)
jsr _LVODoIO(a6)
Quit
move.l 4,a6
tst.l GadToolsBase
beq.s Quit12
move.l GadToolsBase(pc),a1
jsr _LVOCloseLibrary(a6)
Quit12
cmp.l #-1,PrintSignal
beq.s Quit11
move.l PrintSignal(pc),d0
jsr _LVOFreeSignal(a6)
Quit11
cmp.l #-1,WindowSignal
beq.s Quit10
move.l WindowSignal(pc),d0
jsr _LVOFreeSignal(a6)
Quit10
tst.l DosBase
beq.s Quit9
move.l DosBase(pc),a1
jsr _LVOCloseLibrary(a6)
Quit9
tst.l Request2
beq.s Quit8
move.l Request2(pc),a1
jsr _LVOCloseDevice(a6)
move.l Request2(pc),a0
jsr _LVODeleteIORequest(a6)
Quit8
tst.l Request3
beq.s Quit7
move.l Request3(pc),a0
jsr _LVODeleteIORequest(a6)
Quit7
tst.l MsgPort2
beq.s Quit6
move.l MsgPort2(pc),a0
jsr _LVODeleteMsgPort(a6)
Quit6
tst.l Request
beq.s Quit5
move.l Request(pc),a0
jsr _LVODeleteIORequest(a6)
Quit5
tst.l MsgPort
beq.s Quit4
move.l MsgPort(pc),a0
jsr _LVODeleteMsgPort(a6)
Quit4
tst.l GfxBase
beq.s Quit3
move.l GfxBase(pc),a1
jsr _LVOCloseLibrary(a6)
Quit3
tst.l IntuitionBase
beq.s Quit2
move.l IntuitionBase(pc),a1
jsr _LVOCloseLibrary(a6)
Quit2
tst.l WorkbenchMsg
bne.s WBQuit ; We were started from WB
moveq.l #0,d0
rts ; Exit to CLI
WBQuit
move.l 4,a6
move.l WorkbenchMsg(pc),a1
jsr _LVOReplyMsg(a6)
moveq.l #0,d0
rts ; Exit to WB
DoTheDump
tst.b SaveFileFlag
bne SaveFile
move.l 4,a6
lea PrinterName(pc),a0
move.l Request(pc),a1
moveq.l #0,d0 ; unit 0
moveq.l #0,d1
jsr _LVOOpenDevice(a6)
tst.l d0
bne DoTheDump3
move.l Request(pc),a0
move.l Request3(pc),a1
move.l io_Device(a0),io_Device(a1) ; Copy device to Request3
move.l io_Unit(a0),io_Unit(a1) ; Copy unit to Request3
tst.b ResetBeforeFlag
beq.s DoTheDump1.1
bsr ResetIt
DoTheDump1.1
move.l IntuitionBase(pc),a5
move.l 56(a5),a4 ; ActiveScreen
tst.b ActiveScreenFlag
beq.s DoTheDump1.15
move.l 60(a5),a4 ; FirstScreen
DoTheDump1.15
move.l a4,ActiveScreen
add.l #44,a4
move.l a4,ActiveVPort
add.l #40,a4
move.l a4,ActiveRPort
move.l GfxBase(pc),a6
move.l ActiveVPort(pc),a0
jsr _LVOGetVPModeID(a6)
move.l Request(pc),a5
move.l d0,40(a5) ; io_Modes
move.l ActiveRPort(pc),32(a5) ; io_RastPort
move.l ActiveScreen(pc),a4
move.w 8(a4),44(a5) ; io_ScrX
move.w 10(a4),46(a5) ; io_ScrY
move.w 12(a4),48(a5) ; io_ScrWidth
move.w 12(a4),d0
swap d0
move.l d0,52(a5) ; io_DestCols
move.w 14(a4),50(a5) ; io_ScrHeight
move.w 14(a4),d0
swap d0
move.l d0,56(a5) ; io_DestRows
move.l ActiveVPort(pc),a4
move.l 4(a4),36(a5) ; io_ColorMap
move.w SpecialFlags,60(a5) ; io_Special = ASPECT+NOFORMFEED
move.w #$b,io_Command(a5) ; io_Command = PRD_DUMPRPORT
move.l 4,a6
move.l a5,a1
jsr _LVODoIO(a6) ; Dump it!
tst.b ResetAfterFlag
beq.s DoTheDump1.2
bsr ResetIt
DoTheDump1.2
move.l Request(pc),a1
jsr _LVOCloseDevice(a6)
DoTheDump2
rts
DoTheDump3
lea NoPrinterText(pc),a0
bsr.s ShowAlert
bra.s DoTheDump2
NoDos
lea