_LVOForbid = -132 _LVOPermit = -138 _LVOGetMsg = -$174 _LVOReplyMsg = -$17A _LVOWaitPort = -$180 _LVOCloseLibrary = -408 _LVOOpenLibrary = -552 _LVOLoadView = -222 _LVOWaitTOF = -270 _LVOAllocRaster = -492 _LVOFreeRaster = -498 gb_ActiView = $22 gb_copinit = $26 gb_LOFlist = $32 pr_MsgPort = $5c pr_CLI = $ac ThisTask = $114 COP1LC = $80 COPJMP1 = $88 DIWSTRT = $8E DIWSTOP = $90 DDFSTRT = $92 DDFSTOP = $94 DMACON = $96 BPL1PTH = $E0 BPL1PTL = $E2 BPLCON0 = $100 BPLCON1 = $102 COLOR00 = $180 COLOR01 = $182 Start: move.l $4,a6 * test if WB or CLI move.l ThisTask(a6),a0 moveq #0,d0 tst.l pr_CLI(a0) bne.s isCLI lea pr_MsgPort(a0),a0 * for WB get WB Message jsr _LVOWaitPort(a6) jsr _LVOGetMsg(a6) isCLI: move.l d0,-(a7) jsr _LVOForbid(a6) moveq #33,d0 lea GfxName(pc),a1 jsr _LVOOpenLibrary(a6) move.l d0,a6 beq Exit * backup current view move.l d0,GFXBase move.l gb_LOFlist(a6),OldCopper move.l gb_ActiView(a6),OldView * Reset the view sub.l a1,a1 jsr _LVOLoadView(a6) jsr _LVOWaitTOF(a6) jsr _LVOWaitTOF(a6) * Allocate CHIP Ram for screen ptr move.l #320,d0 ;Screen Width move.l #200,d1 ;Screen Height (NTSC) jsr _LVOAllocRaster(a6) tst.l d0 beq Restore_System * Setup Bitplane pointers move.l d0,Plane1Ptr move.w d0,Plane1L swap d0 move.w d0,Plane1H * Install CopperList move.l #CopperList,$dff080 Loop: * btst #6,$bfe001 * bne.b Loop move.b $bfec01,d0 ;Get 'encoded' key that is pressed ror.b #1,d0 not.b d0 * move.b d0,_KeyPressed ;store rawkey that was pressed cmp.b #$50,d0 ;check for $50 = F1 beq Loop cmp.b #$51,d0 ;check for $51 = F2 bne.b Loop * Reset to remembered state the view (Restore Intuition) Restore_System: move.l GFXBase,a6 lea $DFF000,a5 move.l gb_copinit(a6),COP1LC(a5) move.w #0,COPJMP1(a5) move.w #$83E0,DMACON(a5) move.l OldView,a1 move.l OldCopper,gb_LOFlist(a6) jsr _LVOLoadView(a6) jsr _LVOWaitTOF(a6) jsr _LVOWaitTOF(a6) move.l Plane1Ptr,a0 move.l #320,d0 move.l #200,d1 jsr _LVOFreeRaster(a6) move.l a6,a1 move.l $4,a6 jsr _LVOCloseLibrary(a6) Exit: jsr _LVOPermit(a6) move.l (a7)+,d0 beq.s EndIt jsr _LVOForbid(a6) move.l d0,a1 jsr _LVOReplyMsg(a6) jsr _LVOPermit(a6) EndIt: moveq #0,d0 rts GFXBase: dc.l 0 OldView: dc.l 0 OldCopper: dc.l 0 Plane1Ptr: dc.l 0 GfxName: dc.b 'graphics.library',0 SECTION COPPERLIST,DATA,CHIP * Settings for a plain NTSC display; screen 320x200 pixels CopperList: dc.w DIWSTRT,$2981 dc.w DIWSTOP,$F1C1 dc.w DDFSTRT,$0038 dc.w DDFSTOP,$00D0 dc.w BPLCON0,$1000 dc.w BPLCON1,$0000 dc.w COLOR00,$0000 dc.w COLOR01,$0FFF dc.w BPL1PTH Plane1H: dc.w 0 dc.w BPL1PTL Plane1L: dc.w 0 dc.w $FFFF,$FFFE END