home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-05 | 23.2 KB | 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 NoDosText(pc),a0
- bra.s OpenAlert
-
- NoRequest
- lea NoRequestText(pc),a0
- bra.s OpenAlert
-
- NoMsgPort
- lea NoMsgPortText(pc),a0
- bra.s OpenAlert
-
- NoGfx36
- lea NoGfx36Text(pc),a0
- bra.s OpenAlert
-
- NoSignal
- lea NoSignalText(pc),a0
- bra.s OpenAlert
-
- NoGadTools
- lea NoGadToolsText(pc),a0
- ; bra.s OpenAlert
-
- OpenAlert
- move.l IntuitionBase(pc),a6
- moveq.l #0,d0
- moveq.l #24,d1
- jsr _LVODisplayAlert(a6)
- bra Quit
-
- ShowAlert
- move.l IntuitionBase(pc),a6
- moveq.l #0,d0
- moveq.l #24,d1
- jsr _LVODisplayAlert(a6)
- rts
-
- NoWindow
- lea NoWindowText(pc),a0
- bsr.s ShowAlert
- move.b #1,QuitFlag
- rts
-
-
- GetFlags
- move.l IntuitionBase(pc),a6
- lea NewWindow(pc),a0
- move.l PreviousPlace(pc),(a0)
- jsr _LVOOpenWindow(a6)
- move.l d0,MyWindow
- tst.l d0
- beq.s NoWindow
-
- move.l 60(a6),-(sp) ; Store FirstScreen
-
- move.l d0,a0
- move.l 86(a0),MyUserPort
- move.l GadToolsBase(pc),a6
- move.l 46(a0),a5
- move.l a5,a0
- sub.l a1,a1
- jsr _LVOGetVisualInfoA(a6)
- move.l d0,VisualInfo
-
- bsr CreateGadgets
-
- move.l IntuitionBase(pc),a6
- move.l a5,a0
- jsr _LVOScreenToFront(a6)
-
- WaitForMessage
- tst.b QuitFlag
- bne GetFlags2
-
- move.l 4,a6
- move.l MyUserPort(pc),a0
- jsr _LVOWaitPort(a6)
- WaitForMessage2
- move.l 4,a6
- move.l MyUserPort(pc),a0
- jsr _LVOGetMsg(a6)
- tst.l d0
- beq.s WaitForMessage
- move.l d0,a1
- move.l 20(a1),Class
- move.w 24(a1),Code
- move.w 26(a1),Qualifier
- move.l 28(a1),IAddress
- jsr _LVOReplyMsg(a6)
- cmp.l #IDCMP_CLOSEWINDOW,Class
- bne.s WaitForMessage3
- bra.s GetFlags2
- WaitForMessage3
- cmp.l #IDCMP_GADGETUP,Class
- bne.s WaitForMessage4
- move.l IAddress(pc),a1
- move.l a1,a0
- tst.l 40(a0)
- beq.s WaitForMessage4
- move.l IntuitionBase(pc),a6
- move.l 40(a0),a0
- jsr (a0)
- WaitForMessage4
- bra WaitForMessage2
- GetFlags2
- move.l IntuitionBase(pc),a6
- move.l MyWindow(pc),a0
- move.l 4(a0),PreviousPlace
- jsr _LVOCloseWindow(a6)
- move.l (sp)+,a0
- jsr _LVOScreenToFront(a6)
-
- move.l GadToolsBase(pc),a6
- move.l GList(pc),a0
- jsr _LVOFreeGadgets(a6)
- move.l VisualInfo(pc),a0
- jsr _LVOFreeVisualInfo(a6)
- rts
-
-
- SetQuitFlag
- move.b #1,QuitFlag
- rts
-
- SaveConfig
- move.l DosBase(pc),a6
- move.l #ConfigFile,d1
- move.l #1006,d2
- jsr _LVOOpen(a6)
- move.l d0,d7
- tst.l d0
- beq.s SaveConfig2
-
- move.l d7,d1
- move.l #SpecialFlags,d2
- ; moveq.l #6,d3
- moveq.l #5,d3
- jsr _LVOWrite(a6)
-
- move.l d7,d1
- jsr _LVOClose(a6)
- SaveConfig2
- rts
-
- LoadConfig
- move.l DosBase(pc),a6
- move.l #ConfigFile,d1
- move.l #1005,d2
- jsr _LVOOpen(a6)
- move.l d0,d7
- tst.l d0
- beq.s LoadConfig2
-
- move.l d7,d1
- move.l #SpecialFlags,d2
- ; moveq.l #6,d3
- moveq.l #5,d3
- jsr _LVORead(a6)
-
- move.l d7,d1
- jsr _LVOClose(a6)
- LoadConfig2
- rts
-
-
- CreateGadgets
- move.l GadToolsBase(pc),a6
- lea GList(pc),a0
- move.l #0,(a0)
- jsr _LVOCreateContext(a6)
- move.l d0,LastGadget
-
- lea SelectedTags(pc),a4
- sub.l a2,a2
- tst.b ResetBeforeFlag
- beq.s CreateGadgets1.2
- move.l a4,a2
- CreateGadgets1.2
- lea ResetBeforeGadget(pc),a1
- bsr CreateGadgets2
- sub.l a2,a2
- tst.b ResetAfterFlag
- beq.s CreateGadgets1.3
- move.l a4,a2
- CreateGadgets1.3
- lea ResetAfterGadget(pc),a1
- bsr CreateGadgets2
- move.w SpecialFlags(pc),d4
- sub.l a2,a2
- move.w d4,d0
- and.w #$0080,d0
- beq.s CreateGadgets1.4
- move.l a4,a2
- CreateGadgets1.4
- lea AspectGadget(pc),a1
- bsr CreateGadgets2
- sub.l a2,a2
- move.w d4,d0
- and.w #$0040,d0
- beq.s CreateGadgets1.5
- move.l a4,a2
- CreateGadgets1.5
- lea CenterGadget(pc),a1
- bsr CreateGadgets2
- sub.l a2,a2
- move.w d4,d0
- and.w #$0800,d0
- beq.s CreateGadgets1.6
- move.l a4,a2
- CreateGadgets1.6
- lea NoFormFeedGadget(pc),a1
- bsr CreateGadgets2
- sub.l a2,a2
- move.w d4,d0
- and.w #$0004,d0
- beq.s CreateGadgets1.7
- move.l a4,a2
- CreateGadgets1.7
- lea FullColumnsGadget(pc),a1
- bsr CreateGadgets2
- sub.l a2,a2
- move.w d4,d0
- and.w #$0008,d0
- beq.s CreateGadgets1.8
- move.l a4,a2
- CreateGadgets1.8
- lea FullRowsGadget(pc),a1
- bsr CreateGadgets2
-
- lea ActiveScreenTags(pc),a2
- move.b ActiveScreenFlag(pc),7(a2)
- moveq.l #CYCLE_KIND,d0
- lea ActiveScreenGadget(pc),a1
- bsr CreateGadgets2.2
- lea SaveFileTags(pc),a2
- move.b SaveFileFlag(pc),7(a2)
- moveq.l #CYCLE_KIND,d0
- lea SaveFileGadget(pc),a1
- bsr CreateGadgets2.2
- moveq.l #BUTTON_KIND,d0
- lea SaveGadget(pc),a1
- sub.l a2,a2
- bsr CreateGadgets2.2
- moveq.l #BUTTON_KIND,d0
- lea QuitGadget(pc),a1
- sub.l a2,a2
- bsr CreateGadgets2.2
- moveq.l #STRING_KIND,d0
- lea FileNameGadget(pc),a1
- lea FileNameTags(pc),a2
- bsr CreateGadgets2.2
- move.l d0,FileNameGadgetBase
-
- move.l IntuitionBase(pc),a6
- move.l MyWindow(pc),a0
- move.l GList(pc),a1
- moveq.l #-1,d0
- moveq.l #-1,d1
- sub.l a2,a2
- jsr _LVOAddGList(a6)
- bsr RefreshGadgets
- rts
-
-
- CreateGadgets2
- moveq.l #CHECKBOX_KIND,d0
- CreateGadgets2.2
- move.l VisualInfo(pc),22(a1)
- move.l LastGadget(pc),a0
- jsr _LVOCreateGadgetA(a6)
- move.l d0,LastGadget
- rts
-
-
- ResetBefore
- bchg #0,ResetBeforeFlag
- rts
-
- ResetAfter
- bchg #0,ResetAfterFlag
- rts
-
- SetScreenFlag
- bchg #0,ActiveScreenFlag
- move.l GadToolsBase(pc),a6
- move.l a1,a0
- move.l MyWindow(pc),a1
- sub.l a2,a2
- lea ActiveScreenTags(pc),a3
- move.b ActiveScreenFlag(pc),7(a3)
- jsr _LVOGT_SetGadgetAttrsA(a6)
- bsr RefreshGadgets
- rts
-
- SetSaveFileFlag
- bchg #0,SaveFileFlag
- move.l GadToolsBase(pc),a6
- move.l a1,a0
- move.l MyWindow(pc),a1
- sub.l a2,a2
- lea SaveFileTags(pc),a3
- move.b SaveFileFlag(pc),7(a3)
- jsr _LVOGT_SetGadgetAttrsA(a6)
- bsr RefreshGadgets
- rts
-
- SetAspectFlag
- bchg #7,SpecialFlags2
- rts
-
- SetCenterFlag
- bchg #6,SpecialFlags2
- rts
-
- SetNoFormFeedFlag
- bchg #3,SpecialFlags
- rts
-
- SetFullColumnsFlag
- bchg #2,SpecialFlags2
- rts
-
- SetFullRowsFlag
- bchg #3,SpecialFlags2
- rts
-
- ResetIt ; Reset the printer
- move.l Request3(pc),a1
- move.w #PRD_PRTCOMMAND,io_Command(a1)
- move.w #0,io_PrtCommand(a1)
- move.l #0,io_Parm0(a1)
- jsr _LVODoIO(a6)
- rts
-
-
- RefreshGadgets
- movem.l a0-a2/a6/d0-d1,-(sp)
- move.l IntuitionBase(pc),a6
- move.l GList(pc),a0
- move.l MyWindow(pc),a1
- move.l #0,a2
- move.l #-1,d0
- jsr _LVORefreshGList(a6)
- movem.l (sp)+,a0-a2/a6/d0-d1
- rts
-
-
-
- MyHandler ; The handler itself
- move.l a0,-(sp) ; Store event list
- CheckLoop
- cmp.b #IECLASS_RAWKEY,ie_Class(a0) ; Is this a key event?
- bne.s CheckNext ; No, get the next event
- cmp.w #$5d,ie_Code(a0) ; NumPad '*' pressed?
- bne.s CheckNext ; No, get the next event
- move.w ie_Qualifier(a0),d0 ; Get the qualifiers
- btst #IEQUALIFIER_LSHIFT,d0 ; Left Shift?
- bne.s SendPrintSignal ; Yes
- btst #IEQUALIFIER_RSHIFT,d0 ; Right Shift?
- bne.s SendPrintSignal ; Yes
- btst #IEQUALIFIER_LALT,d0 ; Left Alt?
- bne.s SendWindowSignal ; Yes
- btst #IEQUALIFIER_RALT,d0 ; Right Alt?
- bne.s SendWindowSignal ; Yes
- bra.s CheckNext
- EatIt
- move.b #IECLASS_NULL,ie_Class(a0) ; Nobody knows anything about any key event...
- CheckNext
- move.l (a0),d0 ; Get next event
- move.l d0,a0 ; Into a0
- bne.s CheckLoop ; If there is a next one, check it
-
- move.l (sp)+,d0 ; Restore event list
- rts
- SendPrintSignal
- movem.l d0-d1/a0-a1/a6,-(sp)
- move.l 4,a6
- moveq.l #0,d0
- move.l PrintSignal(pc),d1
- bset d1,d0
- move.l MyTask(pc),a1
- jsr _LVOSignal(a6)
- movem.l (sp)+,d0-d1/a0-a1/a6
- bra.s EatIt
- SendWindowSignal
- movem.l d0-d1/a0-a1/a6,-(sp)
- move.l 4,a6
- moveq.l #0,d0
- move.l WindowSignal(pc),d1
- bset d1,d0
- move.l MyTask(pc),a1
- jsr _LVOSignal(a6)
- movem.l (sp)+,d0-d1/a0-a1/a6
- bra.s EatIt
-
-
-
- SaveFile
- move.l IntuitionBase(pc),a5
- move.l 56(a5),a4 ; ActiveScreen
- tst.b ActiveScreenFlag
- beq.s SaveFile2
- move.l 60(a5),a4 ; FirstScreen
- SaveFile2
- move.l a4,ActiveScreen
- add.l #44,a4
- move.l a4,ActiveVPort
-
- move.l ActiveScreen(pc),a0
- move.w 12(a0),ScreenWidth
- move.w 14(a0),ScreenHeight
- lea 184(a0),a0 ; BitMap
- move.w (a0),d0 ; BytesPerRow
- asl.w #3,d0 ; =>Pixels
- move.w d0,PicWidth
- move.w 2(a0),PicHeight
- move.b 5(a0),ScreenDepth
-
- move.l DosBase(pc),a6
- move.l #FileName,d1
- move.l #1006,d2
- jsr _LVOOpen(a6)
- move.l d0,d7
- tst.l d0
- beq SaveFile3
-
- move.l d7,d1
- move.l #FileHeader,d2
- moveq.l #44,d3
- jsr _LVOWrite(a6)
-
- moveq.l #2,d4
- move.b ScreenDepth(pc),d3
- sub.b #1,d3
- asl.l d3,d4
- move.l d4,d5
- subq.l #1,d5
- mulu #3,d4
- move.l d4,Buffer
- bsr WriteBuffer
- lea Buffer(pc),a4
- move.l ActiveVPort(pc),a3
- move.l 4(a3),a3 ; ColorMap
- move.l 4(a3),a3 ; ColorTable
- SaveFile4
- move.b (a3)+,d0
- asl.b #4,d0
- move.b (a3)+,d1
- move.b d1,d2
- and.b #$F0,d1
- asl.b #4,d2
- move.b d0,(a4) ; Store R
- move.b d1,1(a4) ; Store G
- move.b d2,2(a4) ; Store B
- move.l d7,d1
- move.l a4,d2
- moveq.l #3,d3 ; Save 'em
- jsr _LVOWrite(a6)
- dbf d5,SaveFile4
-
- move.l #'CAMG',Buffer
- bsr WriteBuffer
- move.l #4,Buffer
- bsr WriteBuffer
- move.l GfxBase(pc),a6
- move.l ActiveVPort(pc),a0
- jsr _LVOGetVPModeID(a6)
- move.l d0,Buffer
- bsr WriteBuffer
-
- move.l #'BODY',Buffer
- bsr WriteBuffer
- move.w PicWidth(pc),d0
- asr.w #3,d0 ; =>Bytes
- move.b ScreenDepth(pc),d1
- ext.w d1
- mulu d1,d0
- move.w PicHeight(pc),d1
- mulu d1,d0
- move.l d0,Buffer
- bsr WriteBuffer
-
- move.l ActiveScreen(pc),a4
- move.w 184(a4),d3 ; pic width
- lea 192(a4),a4 ; BitMap.Planes
- moveq.l #0,d4
- move.w PicHeight(pc),d6
- subq.w #1,d6
- SaveFile5
- move.b ScreenDepth(pc),d5
- ext.w d5
- subq.w #1,d5
- move.l a4,a3
- SaveFile6
- move.l d7,d1
- move.l (a3)+,d2
- add.l d4,d2
- jsr _LVOWrite(a6)
- dbf d5,SaveFile6
- add.l d3,d4
- dbf d6,SaveFile5
-
- move.l d7,d1
- moveq.l #0,d2
- moveq.l #1,d3
- jsr _LVOSeek(a6)
- subq.l #8,d0
- move.l d0,Buffer ; File size
- move.l d7,d1
- moveq.l #4,d2
- moveq.l #-1,d3
- jsr _LVOSeek(a6)
- bsr WriteBuffer ; Write FORM size
-
- move.l d7,d1
- jsr _LVOClose(a6)
- SaveFile3
- rts
-
-
-
- WriteBuffer
- move.l DosBase(pc),a6
- move.l d7,d1
- move.l #Buffer,d2
- moveq.l #4,d3
- jsr _LVOWrite(a6)
- rts
-
-
-
- CopyString ; in: a0=from, a1=to
- movem.l a0-a1,-(sp)
- CopyString2
- tst.b (a0)
- beq.s CopyString3
- move.b (a0)+,(a1)+
- bra.s CopyString2
- CopyString3
- move.b (a0),(a1) ; Copy null too
- movem.l (sp)+,a0-a1
- rts
-
-
-
- StoreFileName
- move.l FileNameGadgetBase(pc),a0
- move.l 34(a0),a0
- move.l (a0),a0
- lea FileName,a1
- bsr CopyString
- rts
-
-
-
- IntuitionBase dc.l 0
- GfxBase dc.l 0
- DosBase dc.l 0
- GadToolsBase dc.l 0
- MsgPort dc.l 0
- Request dc.l 0
- Request3 dc.l 0
- ActiveScreen dc.l 0
- ActiveVPort dc.l 0
- ActiveRPort dc.l 0
- MsgPort2 dc.l 0
- Request2 dc.l 0
- MyWindow dc.l 0
- MyUserPort dc.l 0
- PrintSignal dc.l 0
- WindowSignal dc.l 0
- SignalMask dc.l 0
- MyTask dc.l 0
- WorkbenchMsg dc.l 0
- LastGadget dc.l 0
- GList dc.l 0
- VisualInfo dc.l 0
- FileNameGadgetBase dc.l 0
- Buffer dc.l 0
- PreviousPlace dc.w 160,40 ; The previous place of the window
-
- Class dc.l 0
- IAddress dc.l 0
- Code dc.w 0
- Qualifier dc.w 0
-
- FileHeader dc.b 'FORMSPY!ILBMBMHD'
- dc.l 20
- PicWidth dc.w 0
- PicHeight dc.w 0,0,0
- ScreenDepth dc.b 0,0,0,0
- dc.w 0,0
- ScreenWidth dc.w 0
- ScreenHeight dc.w 0
- dc.b 'CMAP'
-
-
- NewWindow
- dc.w 152,56,304,110
- dc.b 1,2
- dc.l IDCMP_GADGETUP!IDCMP_CLOSEWINDOW
- dc.l WFLG_DRAGBAR!WFLG_DEPTHGADGET!WFLG_CLOSEGADGET!WFLG_ACTIVATE!WFLG_RMBTRAP!WFLG_NOCAREREFRESH!WFLG_SIMPLE_REFRESH
- dc.l 0,0,WindowTitle,0,0
- dc.w 304,88,304,88,WBENCHSCREEN
-
-
- ResetBeforeGadget ; GadgetUp!
- dc.w 10,15,16,10
- dc.l ResetBeforeName,Font0
- dc.w 0
- dc.l PLACETEXT_RIGHT,0,ResetBefore
-
- ResetAfterGadget ; GadgetUp!
- dc.w 10,28,16,10
- dc.l ResetAfterName,Font0
- dc.w 0
- dc.l PLACETEXT_RIGHT,0,ResetAfter
-
- AspectGadget ; GadgetUp!
- dc.w 10,45,16,10
- dc.l AspectName,Font0
- dc.w 0
- dc.l PLACETEXT_RIGHT,0,SetAspectFlag
-
- CenterGadget ; GadgetUp!
- dc.w 10,58,16,10
- dc.l CenterName,Font0
- dc.w 0
- dc.l PLACETEXT_RIGHT,0,SetCenterFlag
-
- NoFormFeedGadget ; GadgetUp!
- dc.w 10,71,16,10
- dc.l NoFormFeedName,Font0
- dc.w 0
- dc.l PLACETEXT_RIGHT,0,SetNoFormFeedFlag
-
- FullRowsGadget ; GadgetUp!
- dc.w 158,15,16,10
- dc.l FullRowsName,Font0
- dc.w 0
- dc.l PLACETEXT_RIGHT,0,SetFullRowsFlag
-
- FullColumnsGadget ; GadgetUp!
- dc.w 158,28,16,10
- dc.l FullColumnsName,Font0
- dc.w 0
- dc.l PLACETEXT_RIGHT,0,SetFullColumnsFlag
-
- ActiveScreenGadget ; GadgetUp!
- dc.w 158,45,136,14
- dc.l 0,Font0
- dc.w 0
- dc.l 0,0,SetScreenFlag
-
- SaveFileGadget ; GadgetUp!
- dc.w 158,67,136,14
- dc.l 0,Font0
- dc.w 0
- dc.l 0,0,SetSaveFileFlag
-
- FileNameGadget ; GadgetUp!
- dc.w 192,88,102,14
- dc.l FileNameName,Font0
- dc.w 0
- dc.l 0,0,StoreFileName
-
- SaveGadget ; GadgetUp!
- dc.w 10,88,65,14
- dc.l SaveName,Font0
- dc.w 0
- dc.l PLACETEXT_IN,0,SaveConfig
-
- QuitGadget ; GadgetUp!
- dc.w 81,88,65,14
- dc.l QuitName,Font0
- dc.w 0
- dc.l PLACETEXT_IN,0,SetQuitFlag
-
-
- SelectedTags
- dc.l GTCB_Checked,1
- dc.l TAG_DONE
-
- ActiveScreenTags
- dc.l GTCY_Active,0
- dc.l GTCY_Labels,ScreenLabels
- dc.l TAG_DONE
-
- SaveFileTags
- dc.l GTCY_Active,0
- dc.l GTCY_Labels,SaveFileLabels
- dc.l TAG_DONE
-
- FileNameTags
- dc.l GTST_String,FileName
- dc.l GTST_MaxChars,104
- dc.l TAG_DONE
-
- ScreenLabels
- dc.l ActiveScreenName,FirstScreenName,0
-
- SaveFileLabels
- dc.l DumpScreenName,SaveScreenName,0
-
- Font0
- dc.l Font0Name
- dc.w 8
- dc.b 0,1
-
-
- SpecialFlags dc.b 0 ; 1
- SpecialFlags2 dc.b 0 ; 2
- ResetBeforeFlag dc.b 0 ; 3
- ResetAfterFlag dc.b 0 ; 4
- ActiveScreenFlag dc.b 0 ; 5
- SaveFileFlag dc.b 0 ; 6 bytes
- QuitFlag dc.b 0
-
- IntuitionName dc.b 'intuition.library',0
- GfxName dc.b 'graphics.library',0
- DosName dc.b 'dos.library',0
- GadToolsName dc.b 'gadtools.library',0
- PrinterName dc.b 'printer.device',0
- InputName dc.b 'input.device',0
- Font0Name dc.b 'topaz.font',0
-
- NoGfx36Text dc.b 0,170,14,'Can''t open graphics.library V36+',0,0
- NoDosText dc.b 0,210,14,'Can''t open dos.library',0,0
- NoGadToolsText dc.b 0,202,14,'Can''t open gadtools.library',0,0
- NoMsgPortText dc.b 0,198,14,'Can''t create message port',0,0
- NoRequestText dc.b 0,210,14,'Can''t create IORequest',0,0
- NoPrinterText dc.b 0,210,14,'Can''t open printer.device',0,0
- NoWindowText dc.b 0,202,14,'Can''t open window, quitting',0,0
- NoSignalText dc.b 0,214,14,'Can''t allocate signal',0,0
- VersionString dc.b '$VER: PrintScreen V1.75 (12.3.94) ©1993-1994 Jan Hagqvist',10,0
-
- ResetBeforeName dc.b 'Reset before',0
- ResetAfterName dc.b 'Reset after',0
- AspectName dc.b 'Aspect',0
- CenterName dc.b 'Center',0
- NoFormFeedName dc.b 'No formfeed',0
- FullRowsName dc.b 'Full rows',0
- FullColumnsName dc.b 'Full columns',0
- SaveName dc.b 'Save',0
- QuitName dc.b 'Quit',0
- ActiveScreenName dc.b 'ActiveScreen',0
- FirstScreenName dc.b 'FirstScreen',0
- DumpScreenName dc.b 'Dump screen',0
- SaveScreenName dc.b 'Save screen',0
- FileNameName dc.b 'File',0
- ConfigFile dc.b 's:PrtSc.cfg',0
- MyHandlerName dc.b 'PrtSc-key eater',0
- WindowTitle dc.b 'PrtSc V1.75, Shareware.',0
-
- SECTION 2,data
-
- Interrupt dcb.b 22,0
- FileName dcb.b 104,0
-
- END
-