; ; PRTINST.S ; ; Installs a DEGAS print driver as system screen dump driver ; Loads from \AUTO folder of boot disk ; ; Russ Wetmore ; Converted to ASSEMPRO format: 11/18/86 ; Last revision: 11/20/86 ; Include tos\gemdos.s Include tos\bios.s Include tos\xbios.s ;-------------------------------; ; global equates ; ;-------------------------------; CR = 13 LF = 10 scrndump = $0502 ;===================================================================; Text ;===================================================================; ;-------------------------------; start: ; Start here, install & stay resident ;-------------------------------; Move.L 4(SP),A0 ; A0 => base page Move.L $C(A0),D3 ; TEXT segment size... Add.L $14(A0),D3 ; ...plus DATA segment size Add.L $1C(A0),D3 ; ...plus BSS segment size Add.L #256,D3 ; ...plus base page size ; ...is size of whole program PRINTLINE whoweare ; Clue Butch in on who we are OPEN #0,filename ; Open file Bpl.S openok Cmp #-33,D0 ; File not found? Bne.S notfnf PRINTLINE cantfind ; Tell Butch we no can find PRINTLINE filename PRINTLINE crlf Bra.S nosave notfnf: PRINTLINE fileerror ; Tell Butch something's wrong nosave: TERM openok: Move D0,D4 READ routine,#2000,D4 ; Read in 2000 bytes Move.L D0,-(SP) ; Save number of bytes read CLOSE D4 Move.L (SP)+,D0 Bmi.S notfnf ; Negative means error! SUPEXEC install ; Point GEMDOS at our routine PRINTLINE filename ; Tell Butch all's right with PRINTLINE success ; ...the world KEEPPROC #0,D3 ; Save whole program & exit Nop ; Never comes back, but sometimes ; next word gets munged! ;-------------------------------; install: ; Must be executed in supervisor mode! ;-------------------------------; Lea dumper,A0 ; Point at routine Move.L A0,scrndump ; Stuff GEMDOS' vector Rts ;-------------------------------; dumper: ; Sets up and calls DEGAS driver ;-------------------------------; MoveM.L D0-D7/A0-A6,-(SP) GETREZ ; Fetch resolution Move D0,D3 PHYSBASE ; Fetch pointer to screen base Move.L D0,D4 Lea palette,A3 ; Point at palette Move #15,D5 ; Count is 15 to 0 Move #30,D6 palloop: SETCOLOR #-1,D5 ; Fetch color Move D0,0(A3,D6.W) ; Save in palette SubQ #2,D6 Dbra D5,palloop Cmp #2,D3 ; If high resolution... Bne.S nothigh Move (A3),D0 ; Fetch color0 And #1,D0 Beq.S isblack Move.L #$07770000,(A3) ; Color0=white, color1=black Bra.S nothigh isblack: Move.L #$00000777,(A3) ; Color0=black, color1=white nothigh: KBSHIFT #-1 ; See if SHIFT key is down And #%00000111,D0 ; (...or CONTROL key...) Sne D0 ; Mask bit 3 in if down, so And #%00001000,D0 ; ...Kbshift will simulate ALT ; At this point, D3=rez, D4=>screen, A3=>palette, & D0=Kbshift value KBSHIFT D0 Pea workarea ; 1280 byte scratch space Move.L A3,-(SP) ; Palette address Move.L D4,-(SP) ; Screen data base address Move D3,-(SP) ; Resolution Clr -(SP) ; Initialize printer command Bsr routine ; Call driver Lea 16(SP),SP ; Fix stack anomoly Cmp #0,D0 ; If init went okay Beq.S dontprint Pea workarea ; 1280 byte scratch space Move.L A3,-(SP) ; Palette address Move.L D4,-(SP) ; Screen data base address Move D3,-(SP) ; Resolution Move #1,-(SP) ; Print command Bsr routine ; Call driver Lea 16(SP),SP ; Fix stack anomoly dontprint: KBSHIFT #0 ; Fix ALT key if necessary MoveM.L (SP)+,D0-D7/A0-A6 Rts ;===================================================================; Data ;===================================================================; filename: ; Name of DEGAS print driver Dc.B "A:\DEGAS.PRT",0,0,0,0 Ds.B 16,0 ; 16 extra for futzing success: ; Let's party! Dc.B " successfully loaded." crlf: ; Carriage return/line feed Dc.B CR,LF,0 cantfind: ; Uh, where is it? Dc.B "Error! Can't find " fileerror: ; Some kind of file error... Dc.B "Unexpected file error!",CR,LF,0 whoweare: ; Blatant vanity Dc.B CR,LF,"DEGAS .PRT file loader",CR,LF Dc.B " by Russ Wetmore",CR,LF,0 ;===================================================================; Bss ;===================================================================; routine: ; Where driver will be stored Ds.B 2000 workarea: ; DEGAS' scratch data area Ds.B 1280 palette: ; Where palette will be stored Ds.W 16 End