******************************************************************************* * intuition.library.S Written by Readysoft. * Copyright 1993,1994 RS. All rights reserved. 1993.03.04.-1994.05.18. * v2.0. ******************************************************************************* ******************************************************************************* * Macros ******************************************************************************* ;------------------------------------------------------------------------------ ; IntuitionName Macro ;------------------------------------------------------------------------------ INL.NAM MACRO DC.B 'intuition.library',0 EVEN ENDM ;------------------------------------------------------------------------------ ; GadList Macro ;------------------------------------------------------------------------------ INL.GAL MACRO DC.W \1 # of gadgets in list ENDM ;------------------------------------------------------------------------------ ; Gadget Macro ;------------------------------------------------------------------------------ INL.GG MACRO DC.W \1,\2 identifier,flags DC.W \3,\4,\5,\6 xpos,ypos,width,height DC.L \7,\8 normobj,selobj ENDM ******************************************************************************* * LIB Macro ******************************************************************************* INL.LIB MACRO ******************************************************************************* * Constant Definitions ******************************************************************************* ;------------------------------------------------------------------------------ ; CList Structure ;------------------------------------------------------------------------------ RSRESET inl_cl_COLORS RS.W 64 inl_cl_DIWSTRT RS.W 2 inl_cl_DIWSTOP RS.W 2 inl_cl_DDFSTRT RS.W 2 inl_cl_DDFSTOP RS.W 2 inl_cl_BPLCON1 RS.W 2 inl_cl_BPLCON2 RS.W 2 inl_cl_BPL1MOD RS.W 2 inl_cl_BPL2MOD RS.W 2 inl_cl_BPLPT RS.W 24 inl_cl_SizeOf RS.B 0 ;------------------------------------------------------------------------------ ; NewScreen Structure ;------------------------------------------------------------------------------ RSRESET inl_ns_LeftEdge RS.W 1 left edge inl_ns_TopEdge RS.W 1 top edge inl_ns_DWidth RS.W 1 display width inl_ns_DHeight RS.W 1 display height inl_ns_BPWidth RS.W 1 bitplane width inl_ns_BPHeight RS.W 1 bitplane height inl_ns_Depth RS.W 1 # of bitplanes inl_ns_ViewMode RS.W 1 viewmodes inl_ns_IDCMP RS.L 1 IDCMP flags inl_ns_BitPlane RS.L 1 ptr to custom bitplane inl_ns_Colors RS.L 1 ptr to palette inl_ns_SizeOf RS.B 0 ;------------------------------------------------------------------------------ ; Screen Structure ;------------------------------------------------------------------------------ RSRESET inl_sc_Next RS.L 1 ptr to next screen inl_sc_BackScr RS.L 1 prt to backgroundscreen inl_sc_Gadgets RS.L 1 ptr to gadget list inl_sc_IDCMP RS.L 1 IDCMP flags inl_sc_LeftEdge RS.W 1 left edge rel. inl_sc_TopEdge RS.W 1 top edge rel. inl_sc_Left RS.W 1 left abs. inl_sc_Top RS.W 1 left abs. inl_sc_DWidth RS.W 1 display width inl_sc_DHeight RS.W 1 display height inl_sc_BPWidth RS.W 1 bitplane width inl_sc_BPHeight RS.W 1 bitplane height inl_sc_Depth RS.W 1 # of bitplanes inl_sc_ViewMode RS.W 1 viewmode BPLCON0 inl_sc_Priority RS.W 1 priority BPLCON2 inl_sc_VHeight RS.W 1 visible height inl_sc_HOffs RS.W 1 horizontal offset inl_sc_VOffs RS.W 1 vertical offset inl_sc_BitPlane RS.L 1 ptr to first bitplane inl_sc_NextBPl RS.L 1 offset of next bitplane inl_sc_NextRaw RS.W 1 offset of next raw inl_sc_DRawSize RS.W 1 bytes p. raw on display inl_sc_MemAddr RS.L 1 addr. of allocated area inl_sc_MemSize RS.L 1 size of allocated area inl_sc_CList RS.L 1 address of CList inl_sc_Colors RS.W 32 colortable inl_sc_SizeOf RS.B 0 ;------------------------------------------------------------------------------ ; ViewMode Bit Definitions ;------------------------------------------------------------------------------ inl_wm_b_HIRES EQU 15 high resolution inl_wm_b_HOMOD EQU 11 hold and modify inl_wm_b_DBLPF EQU 10 double playfield inl_wm_b_LACE EQU 2 interlace ;------------------------------------------------------------------------------ ; ViewMode Values ;------------------------------------------------------------------------------ inl_wm_HIRES EQU 1< Screen(d0) ;------------------------------------------------------------------------------ inl.OpenScr movem.l d1/a0-a1/a4-a5,-(a7) lea intuition.lib(pc),a5 move.l a0,a4 move.l #inl_sc_SizeOf,d0 allocate memory move.l #mem_ty_PublicC,d1 for Screen structure bsr mem.AllocMem tst.l d0 beq .Error move.l inl_FirstScreen(a5),d0 insert into screenlist move.l d0,inl_sc_Next(a0) move.l a0,inl_FirstScreen(a5) move.w inl_ns_LeftEdge(a4),d0 copy NewScreen data move.w d0,inl_sc_LeftEdge(a0) move.w inl_ns_TopEdge(a4),d0 move.w d0,inl_sc_TopEdge(a0) move.w inl_ns_DWidth(a4),d0 move.w d0,inl_sc_DWidth(a0) move.w inl_ns_DHeight(a4),d0 move.w d0,inl_sc_DHeight(a0) move.w inl_ns_BPWidth(a4),d0 move.w d0,inl_sc_BPWidth(a0) move.w inl_ns_BPHeight(a4),d0 move.w d0,inl_sc_BPHeight(a0) move.w inl_ns_Depth(a4),d0 move.w d0,inl_sc_Depth(a0) move.w inl_ns_ViewMode(a4),d1 ror.w #4,d0 or.w d0,d1 move.w d1,inl_sc_ViewMode(a0) move.l inl_ns_IDCMP(a4),d0 move.l d0,inl_sc_IDCMP(a0) move.l inl_ns_BitPlane(a4),d0 move.l d0,inl_sc_BitPlane(a0) clr.w inl_sc_HOffs(a0) init Screen data clr.w inl_sc_VOffs(a0) move.w #$24,inl_sc_Priority(a0) moveq #0,d0 move.w inl_ns_DWidth(a4),d0 addq.w #7,d0 lsr.w #4,d0 lsl.w #1,d0 move.w d0,inl_sc_DRawSize(a0) move.w inl_ns_BPWidth(a4),d0 addq.w #7,d0 lsr.w #4,d0 lsl.w #1,d0 move.l d0,inl_sc_NextBPl(a0) mulu inl_ns_Depth(a4),d0 move.w d0,inl_sc_NextRaw(a0) clr.l inl_sc_Gadgets(a0) clr.l inl_sc_MemAddr(a0) clr.l inl_sc_MemSize(a0) clr.l inl_sc_BackScr(a0) tst.l inl_sc_BitPlane(a0) is there BitPlane ? bne.s .BPlOK move.l inl_sc_NextBPl(a0),d0 mulu inl_sc_BPHeight(a0),d0 mulu inl_sc_Depth(a0),d0 BPl size move.l d0,inl_sc_MemSize(a0) move.l #mem_ty_ChipC,d1 allocate memory bsr mem.AllocMem for BPl tst.l d0 beq .Error2 move.l a0,inl_sc_MemAddr(a0) move.l a0,inl_sc_BitPlane(a0) .BPlOK clr.l inl_sc_CList(a0) no clist move.l inl_ns_Colors(a4),a1 set palette bsr inl.SetPalette move.l a0,d0 addq.w #1,inl_ScreenCount(a5) one more screen .Exit movem.l (a7)+,d1/a0-a1/a4-a5 rts .Error moveq #0,d0 bra.s .Exit .Error2 move.l #inl_sc_SizeOf,d0 free Screen structure move.l a0,a1 bsr mem.FreeMem bra.s .Error ;------------------------------------------------------------------------------ ; CloseScr Screen(a0) ;------------------------------------------------------------------------------ inl.CloseScr rts ;------------------------------------------------------------------------------ ; SetBackgr Screen,BackgrScreen(a0,a1) ;------------------------------------------------------------------------------ inl.SetBackgr move.l a1,inl_sc_BackScr(a0) rts ;------------------------------------------------------------------------------ ; SetScrPos Screen,XPos,YPos(a0,d0,d1) ;------------------------------------------------------------------------------ inl.SetScrPos move.w d0,inl_sc_LeftEdge(a0) move.w d1,inl_sc_TopEdge(a0) rts ;------------------------------------------------------------------------------ ; MoveScr Screen,dX,dY(a0,d0,d1) ;------------------------------------------------------------------------------ inl.MoveScr add.w d0,inl_sc_LeftEdge(a0) add.w d1,inl_sc_TopEdge(a0) rts ;------------------------------------------------------------------------------ ; SetScrOffs Screen,XOffs,YOffs(a0,d0,d1) ;------------------------------------------------------------------------------ inl.SetScrOffs move.w d0,inl_sc_HOffs(a0) move.w d1,inl_sc_VOffs(a0) rts ;------------------------------------------------------------------------------ ; RollScr Screen,dX,dY(a0,d0,d1) ;------------------------------------------------------------------------------ inl.RollScr add.w d0,inl_sc_HOffs(a0) add.w d1,inl_sc_VOffs(a0) rts ;------------------------------------------------------------------------------ ; ScrToFront Screen(a0) ;------------------------------------------------------------------------------ inl.ScrToFront rts ;------------------------------------------------------------------------------ ; ScrToBack Screen(a0) ;------------------------------------------------------------------------------ inl.ScrToBack rts ;------------------------------------------------------------------------------ ; Bright Screen,Palette(a0,a1) ;------------------------------------------------------------------------------ inl.Bright movem.l d0-d2/a0-a1,-(a7) lea inl_sc_Colors(a0),a0 address of CList moveq #31,d0 .Loop move.w (a0),d1 move.w (a1),d2 and.w #$f00,d1 and.w #$f00,d2 cmp.w d1,d2 beq.s .OkRed add.w #$100,(a0) .OkRed move.w (a0),d1 move.w (a1),d2 and.w #$0f0,d1 and.w #$0f0,d2 cmp.w d1,d2 beq.s .OkGreen add.w #$010,(a0) .OkGreen move.w (a0),d1 move.w (a1),d2 and.w #$00f,d1 and.w #$00f,d2 cmp.w d1,d2 beq.s .OkBlue add.w #$001,(a0) .OkBlue addq.l #2,a0 addq.l #2,a1 dbf d0,.Loop movem.l (a7)+,d0-d2/a0-a1 rts ;------------------------------------------------------------------------------ ; Dark Screen(a0) ;------------------------------------------------------------------------------ inl.Dark movem.l d0-d1/a0,-(a7) lea inl_sc_Colors(a0),a0 address of CList moveq #31,d0 .Loop move.w (a0),d1 and.w #$f00,d1 beq.s .OkRed sub.w #$100,(a0) .OkRed move.w (a0),d1 and.w #$0f0,d1 beq.s .OkGreen sub.w #$010,(a0) .OkGreen move.w (a0),d1 and.w #$00f,d1 beq.s .OkBlue sub.w #$001,(a0) .OkBlue addq.l #2,a0 dbf d0,.Loop movem.l (a7)+,d0-d1/a0 rts ;------------------------------------------------------------------------------ ; SetPalette Screen,Palette(a0,a1) ;------------------------------------------------------------------------------ inl.SetPalette movem.l d0/a1-a2,-(a7) lea inl_sc_Colors(a0),a2 address of CList moveq #31,d0 .Loop move.w (a1)+,(a2)+ --> COLOR dbf d0,.Loop movem.l (a7)+,d0/a1-a2 rts ;------------------------------------------------------------------------------ ; Remake NoOp ;------------------------------------------------------------------------------ inl.Remake movem.l d0-a6,-(a7) lea intuition.lib(pc),a5 bsr inl.SCRPOS bsr inl.VHEIGHT clr.l -(a7) mark begining of list move.l inl_FirstScreen(a5),d0 first screen exists ? beq.s .ListOK .List move.l d0,a0 move.l a0,-(a7) move.l inl_sc_Next(a0),d0 next screen bne.s .List .ListOK bsr cop.Reset reset copperlist move.w #$0106,d0 make CList move.w #$0000,d1 bsr cop.AddMove move.w #$01fc,d0 move.w #$0000,d1 bsr cop.AddMove bsr spr.InsertCL insert sprite clist .Loop move.l (a7)+,d1 add screen clists beq .End move.l d1,a1 clr.l inl_sc_CList(a1) tst.w inl_sc_VHeight(a1) visible ? beq.s .Loop bsr cop.AskAddress CLAddress in d0 move.l d0,inl_sc_CList(a1) lea inl.da.CList(pc),a0 empty clist move.l #inl_cl_SizeOf,d0 bsr cop.AddList move.l a1,a0 bsr inl.RefreshScr fill clist tst.l d0 error ? bne .FatalErr move.w #1,d0 wait top position move.w inl_sc_Top(a1),d1 bsr cop.AddWait move.w #$0100,d0 screen on move.w inl_sc_ViewMode(a1),d1 bsr cop.AddMove move.w #1,d0 wait bottom position move.w inl_sc_Top(a1),d1 add.w inl_sc_VHeight(a1),d1 bottom position bsr cop.AddWait move.w #$0100,d0 move.w #$0200,d1 bsr cop.AddMove bra .Loop .End moveq #-1,d0 copperlist end moveq #-1,d1 bsr cop.AddWait bsr cop.Set set copperlist movem.l (a7)+,d0-a6 rts .FatalErr move.l #inl_er_Remake,d0 jmp sys.FatalError ;------------------------------------------------------------------------------ ; RefreshScr Screen(a0) --> Error(d0) ;------------------------------------------------------------------------------ inl.RefreshScr bsr inl.CLCOLORS tst.l d0 bne.s .Error bsr inl.CLCTRL tst.l d0 bne.s .Error bsr inl.CLBPLPT tst.l d0 bne.s .Error moveq #0,d0 all right .Exit rts .Error moveq #1,d0 bra.s .Exit ;------------------------------------------------------------------------------ ; WaitBlank NoOp ;------------------------------------------------------------------------------ inl.WaitBlank move.l a5,-(a7) lea intuition.lib(pc),a5 .Loop tst.b inl_VBlank(a5) beq.s .Loop clr.b inl_VBlank(a5) move.l (a7)+,a5 rts ;------------------------------------------------------------------------------ ; SetPointer Sprite,SprS,X,Y,dX,dY,Ctrl,(d0,d1,d2,d3,d4,d5,d6) --> Error(d0) ;------------------------------------------------------------------------------ inl.SetPointer movem.l d4-d7/a0-a1/a5,-(a7) lea intuition.lib(pc),a5 move.b d0,d7 store Sprite move.w d4,inl_PointerdX(a5) store dX move.w d5,inl_PointerdY(a5) store dY move.w d6,inl_PointerCtrl(a5) store Ctrl moveq #0,d4 flags (no attach) moveq #0,d5 sprnum = 0 bsr spr.SetSprite btst #inl_pc_b_Attach,d6 attach ? beq.s .NoAtt move.b d7,d0 restore Sprite addq.b #1,d0 move.w #spr_fl_Attach,d4 flags (attach) moveq #1,d5 sprnum = 1 bsr spr.SetSprite .NoAtt bsr spr.RefreshCL movem.l (a7)+,d4-d7/a0-a1/a5 rts ;------------------------------------------------------------------------------ ; FreePointer NoOp ;------------------------------------------------------------------------------ inl.FreePointer movem.l d7/a5,-(a7) lea intuition.lib(pc),a5 move.w inl_PointerCtrl(a5),d7 clr.w inl_PointerCtrl(a5) moveq #0,d5 sprnum = 0 bsr spr.FreeSprite btst #inl_pc_b_Attach,d7 beq.s .NoAtt moveq #1,d5 sprnum = 1 bsr spr.FreeSprite .NoAtt bsr spr.RefreshCL movem.l (a7)+,d7/a5 rts ;------------------------------------------------------------------------------ ; GetPointer NoOp --> XPos,YPos,Control(d2,d3,d4) ;------------------------------------------------------------------------------ inl.GetPointer move.l a5,-(a7) lea intuition.lib(pc),a5 move.w inl_PointerXPos(a5),d2 move.w inl_PointerYPos(a5),d3 add.w inl_PointerdX(a5),d2 add.w inl_PointerdY(a5),d3 move.w inl_PointerCtrl(a5),d4 move.l (a7)+,a5 rts ;------------------------------------------------------------------------------ ; EnablePtr NoOp ;------------------------------------------------------------------------------ inl.EnablePtr movem.l d0/a5,-(a7) lea intuition.lib(pc),a5 move.w inl_PointerCtrl(a5),d0 pointer moving bset #inl_pc_b_Enable,d0 enabled move.w d0,inl_PointerCtrl(a5) movem.l (a7)+,d0/a5 rts ;------------------------------------------------------------------------------ ; DisablePtr NoOp ;------------------------------------------------------------------------------ inl.DisablePtr movem.l d0/a5,-(a7) lea intuition.lib(pc),a5 move.w inl_PointerCtrl(a5),d0 pointer moving bclr #inl_pc_b_Enable,d0 disabled move.w d0,inl_PointerCtrl(a5) movem.l (a7)+,d0/a5 rts ;------------------------------------------------------------------------------ ; SetGList Screen,GadgetList(a0,a1) ;------------------------------------------------------------------------------ inl.SetGList move.l a1,inl_sc_Gadgets(a0) rts ;------------------------------------------------------------------------------ ; ResetGList Screen(a0) ;------------------------------------------------------------------------------ inl.ResetGList clr.l inl_sc_Gadgets(a0) rts ;------------------------------------------------------------------------------ ; RefreshGads Screen(a0) ;------------------------------------------------------------------------------ inl.RefreshGads movem.l d1/d7/a1,-(a7) move.l inl_sc_Gadgets(a0),d1 gadlist in a1 beq.s .Exit move.l d1,a1 move.w (a1)+,d7 # of gadgets in list subq.w #1,d7 .Loop bsr inl.GADNORM draw normal lea inl_gg_SizeOf(a1),a1 dbf d7,.Loop .Exit movem.l (a7)+,d1/d7/a1 rts ;------------------------------------------------------------------------------ ; ModifyIDCMP Screen,IDCMPFlags(a0,d0) ;------------------------------------------------------------------------------ inl.ModifyIDCMP move.l d0,inl_sc_IDCMP(a0) rts ;------------------------------------------------------------------------------ ; IDCMPTest NoOp --> Class,Code,Qual,X,Y,Screen,IAddr(d0,d1,d2,d4,d5,a0,a1) ;------------------------------------------------------------------------------ inl.IDCMPTest move.l a5,-(a7) lea intuition.lib(pc),a5 bsr inl.ACTIVESCR activescreen in a0 bsr inl.GADGETTEST test gadgets tst.l d0 is there a message ? bne.s .Exit nop .Exit move.l (a7)+,a5 rts ;------------------------------------------------------------------------------ ; IDCMPWait NoOp --> Class,Code,Qual,X,Y,Screen,IAddr(d0,d1,d2,d4,d5,a0,a1) ;------------------------------------------------------------------------------ inl.IDCMPWait move.l a5,-(a7) lea intuition.lib(pc),a5 bsr inl.ACTIVESCR activescreen in a0 .Loop bsr inl.WaitBlank waitblank bsr inl.GADGETTEST test gadgets tst.l d0 is there a message ? bne.s .Exit nop bra.s .Loop .Exit move.l (a7)+,a5 rts ******************************************************************************* * Private routines ******************************************************************************* ;------------------------------------------------------------------------------ ; GADGETTEST Screen(a0) --> Class,Code,X,Y,IAddr(d0,d1,d4,d5,a1) ;------------------------------------------------------------------------------ inl.GADGETTEST movem.l d2-d3/d6-d7/a5,-(a7) lea intuition.lib(pc),a5 move.l inl_sc_IDCMP(a0),d0 idcmp classes in d0 btst #inl_ic_b_Gadget,d0 care for gadgets ? beq .No move.w inl_PointerXPos(a5),d4 move.w inl_PointerYPos(a5),d5 add.w inl_PointerdX(a5),d4 pointer coordinates add.w inl_PointerdY(a5),d5 sub.w inl_sc_Left(a0),d4 relative coordinates sub.w inl_sc_Top(a0),d5 move.l inl_sc_Gadgets(a0),d1 gadlist in a1 beq .No move.l d1,a1 move.w (a1)+,d7 # of gadgets in list subq.w #1,d7 .Loop move.w inl_gg_Flags(a1),d6 flags in d6 btst #inl_gf_b_Enable,d6 enabled ? beq.s .Next moveq #0,d1 move.w inl_gg_Code(a1),d1 code in d1 move.w inl_gg_XPos(a1),d2 check box move.w inl_gg_YPos(a1),d3 cmp.w d2,d4 blt.s .Next cmp.w d3,d5 blt.s .Next add.w inl_gg_Width(a1),d2 add.w inl_gg_Height(a1),d3 cmp.w d2,d4 bge.s .Next cmp.w d3,d5 bge.s .Next btst #inl_gf_b_Auto,d6 auto select ? bne.s .AutoSel btst #6,$bfe001 left mouse button ? beq.s .Selected btst #7,$bfe001 joy fire button ? beq.s .Selected movem.l d0-d2,-(a7) keyboard fire button ? bsr kbd.AskCrsrKeys movem.l (a7)+,d0-d2 cmpi.l #kbd_st_Pressed,d3 beq.s .Selected .Next lea inl_gg_SizeOf(a1),a1 next gadget dbf d7,.Loop .No moveq #0,d0 no event bra.s .Exit .Selected bsr inl.DisablePtr disable pointer bsr inl.WaitBlank wait blank bsr inl.GADSEL draw selected .Wait btst #6,$bfe001 left mouse button ? beq.s .Wait btst #7,$bfe001 joy fire button ? beq.s .Wait movem.l d0-d2,-(a7) keyboard fire button ? bsr kbd.AskCrsrKeys movem.l (a7)+,d0-d2 cmpi.l #kbd_st_Pressed,d3 beq.s .Wait .Released bsr inl.WaitBlank wait blank bsr inl.GADNORM draw normal bsr inl.EnablePtr enable pointer .AutoSel move.l #inl_ic_Gadget,d0 there is an event .Exit movem.l (a7)+,d2-d3/d6-d7/a5 rts ;------------------------------------------------------------------------------ ; GADSEL Screen,Gadget(a0,a1) --> Error(d0) ;------------------------------------------------------------------------------ inl.GADSEL movem.l d1-d3/a1-a2,-(a7) move.w inl_gg_XPos(a1),d2 xpos move.w inl_gg_YPos(a1),d3 ypos move.l inl_gg_SelObj(a1),d1 object beq.s .Exit move.l d1,a1 move.l a0,a2 screen bsr fnt.WriteObject write sel. object .Exit movem.l (a7)+,d1-d3/a1-a2 rts ;------------------------------------------------------------------------------ ; GADNORM Screen,Gadget(a0,a1) --> Error(d0) ;------------------------------------------------------------------------------ inl.GADNORM movem.l d1-d3/a1-a2,-(a7) move.w inl_gg_XPos(a1),d2 xpos move.w inl_gg_YPos(a1),d3 ypos move.l inl_gg_NormObj(a1),d1 object beq.s .Exit move.l d1,a1 move.l a0,a2 screen bsr fnt.WriteObject write norm. object .Exit movem.l (a7)+,d1-d3/a1-a2 rts ;------------------------------------------------------------------------------ ; SCRPOS NoOp ;------------------------------------------------------------------------------ inl.SCRPOS movem.l d0/a0/a5,-(a7) lea intuition.lib(pc),a5 move.l inl_FirstScreen(a5),a0 first screen .Loop cmpa.l #0,a0 end of list ? beq.s .Exit move.w inl_sc_LeftEdge(a0),d0 add.w inl_Left(a5),d0 move.w d0,inl_sc_Left(a0) --> abs. left position move.w inl_sc_TopEdge(a0),d0 add.w inl_Top(a5),d0 move.w d0,inl_sc_Top(a0) --> abs. top position move.l inl_sc_Next(a0),a0 next screen bra.s .Loop .Exit movem.l (a7)+,d0/a0/a5 rts ;------------------------------------------------------------------------------ ; VHEIGHT NoOp ;------------------------------------------------------------------------------ inl.VHEIGHT movem.l d0-d2/a0/a5,-(a7) lea intuition.lib(pc),a5 move.l inl_FirstScreen(a5),d0 first screen beq.s .Exit move.l d0,a0 move.w inl_sc_DHeight(a0),d0 move.w d0,inl_sc_VHeight(a0) move.w inl_sc_Top(a0),d2 last top position .Next subq.w #2,d2 .Loop move.l inl_sc_Next(a0),d0 end of list ? beq.s .Exit move.l d0,a0 clr.w inl_sc_VHeight(a0) move.w inl_sc_Top(a0),d1 cmp.w d2,d1 visible ? bge.s .Loop sub.w d1,d2 cmpi.w inl_sc_DHeight(a0),d2 bls.s .OK move.w inl_sc_DHeight(a0),d2 .OK move.w d2,inl_sc_VHeight(a0) --> visible height move.w d1,d2 bra.s .Next .Exit movem.l (a7)+,d0-d2/a0/a5 rts ;------------------------------------------------------------------------------ ; ACTIVESCR NoOp --> ActiveScreen(a0) ;------------------------------------------------------------------------------ inl.ACTIVESCR movem.l d0-d2/a5,-(a7) lea intuition.lib(pc),a5 move.w inl_PointerYPos(a5),d0 add.w inl_PointerdY(a5),d0 move.l inl_FirstScreen(a5),a0 first screen .Loop cmpa.l #0,a0 end of list ? beq.s .Exit tst.w inl_sc_VHeight(a0) visible ? beq.s .Next move.w inl_sc_Top(a0),d1 top move.w d1,d2 add.w inl_sc_VHeight(a0),d2 bottom cmp.w d1,d0 top OK ? blt.s .Next cmp.w d2,d0 bottom OK ? ble.s .Exit .Next move.l inl_sc_Next(a0),a0 next screen bra.s .Loop .Exit movem.l (a7)+,d0-d2/a5 rts ;------------------------------------------------------------------------------ ; CLCOLORS Screen(a0) --> Error(d0) ;------------------------------------------------------------------------------ inl.CLCOLORS movem.l a1-a2,-(a7) move.l inl_sc_CList(a0),d0 address of CList beq.s .Error move.l d0,a2 lea inl_cl_COLORS(a2),a2 color list lea inl_sc_Colors(a0),a1 moveq #31,d0 .Loop addq.l #2,a2 move.w (a1)+,(a2)+ --> COLOR dbf d0,.Loop moveq #0,d0 all right .Exit movem.l (a7)+,a1-a2 rts .Error moveq #1,d0 bra.s .Exit ;------------------------------------------------------------------------------ ; CLCTRL Screen(a0) --> Error(d0) ;------------------------------------------------------------------------------ inl.CLCTRL movem.l d1-d3/a1,-(a7) move.l inl_sc_CList(a0),d1 address of CList beq.w .Error move.l d1,a1 move.w inl_sc_ViewMode(a0),d2 btst #inl_wm_b_HIRES,d2 bne.w .HiRes move.w inl_sc_Left(a0),d1 DIWSTRT,DIWSTOP move.w #$0500,d0 move.b d1,d0 move.w d0,inl_cl_DIWSTRT+2(a1) --> DIWSTRT move.w inl_sc_DWidth(a0),d2 display width add.w d2,d1 move.w #$4000,d0 move.b d1,d0 move.w d0,inl_cl_DIWSTOP+2(a1) --> DIWSTOP move.w inl_sc_Left(a0),d0 DDFSTRT,DDFSTOP subq.w #1,d0 and.w #$000f,d0 dx=(LeftEdge-1) and $F move.w inl_sc_HOffs(a0),d1 and.w #$000f,d1 db=HOffs and $F sub.w d1,d0 d=dx-db add.w #16,d0 and.w #$000f,d0 scroll=(d+16) and $F move.w d0,d2 BPLCON1 lsl.w #4,d2 or.w d0,d2 move.w d2,inl_cl_BPLCON1+2(a1) --> BPLCON1 move.w inl_sc_Left(a0),d2 sub.w d0,d2 sub.w d1,d2 xs=x-scroll-db sub.w #17,d2 lsr.w #1,d2 DDFSTRT=(xs-17)/2 move.w d2,inl_cl_DDFSTRT+2(a1) --> DDFSTRT move.w inl_sc_DRawSize(a0),d0 lsl.w #2,d0 subq.w #8,d0 add.w d0,d2 DDFSTOP=STRT+w*4-8 tst.w d1 beq.s .LoRes.DDFOK addq.w #4,d2 .LoRes.DDFOK move.w d2,inl_cl_DDFSTOP+2(a1) --> DDFSTOP move.w inl_sc_Priority(a0),d0 BPLCON2 move.w d0,inl_cl_BPLCON2+2(a1) --> BPLCON2 move.w inl_sc_NextRaw(a0),d0 BPLMOD sub.w inl_sc_DRawSize(a0),d0 move.w inl_sc_HOffs(a0),d1 and.w #$000f,d1 db=HOffs and $f tst.w d1 beq.s .LoRes.MODOK subq.w #2,d0 .LoRes.MODOK move.w d0,inl_cl_BPL1MOD+2(a1) --> BPL1MOD move.w d0,inl_cl_BPL2MOD+2(a1) --> BPL2MOD bra .OK .HiRes move.w inl_sc_Left(a0),d1 DIWSTRT,DIWSTOP move.w #$0500,d0 move.b d1,d0 move.w d0,inl_cl_DIWSTRT+2(a1) --> DIWSTRT move.w inl_sc_DWidth(a0),d2 display width lsr.w #1,d2 width/2 add.w d2,d1 move.w #$4000,d0 move.b d1,d0 move.w d0,inl_cl_DIWSTOP+2(a1) --> DIWSTOP move.w inl_sc_Left(a0),d0 DDFSTRT,DDFSTOP subq.w #1,d0 and.w #$0007,d0 dx=(LeftEdge-1) and $7 move.w inl_sc_HOffs(a0),d1 and.w #$0007,d1 db=HOffs and $7 sub.w d1,d0 d=dx-db add.w #8,d0 and.w #$0007,d0 scroll=(d+8) and $7 move.w d0,d2 BPLCON1 lsl.w #4,d2 or.w d0,d2 move.w d2,inl_cl_BPLCON1+2(a1) --> BPLCON1 move.w inl_sc_Left(a0),d2 sub.w d0,d2 sub.w d1,d2 xs=x-scroll/2-db/2 sub.w #9,d2 lsr.w #1,d2 DDFSTRT=(xs-9)/2 move.w d2,inl_cl_DDFSTRT+2(a1) --> DDFSTRT move.w inl_sc_DRawSize(a0),d0 lsl.w #1,d0 subq.w #8,d0 add.w d0,d2 DDFSTOP=STRT+w*4-8 tst.w d1 beq.s .HiRes.DDFOK addq.w #4,d2 .HiRes.DDFOK move.w d2,inl_cl_DDFSTOP+2(a1) --> DDFSTOP move.w inl_sc_Priority(a0),d0 BPLCON2 move.w d0,inl_cl_BPLCON2+2(a1) --> BPLCON2 move.w inl_sc_NextRaw(a0),d0 BPLMOD sub.w inl_sc_DRawSize(a0),d0 move.w inl_sc_HOffs(a0),d1 and.w #$0007,d1 db=HOffs and $7 tst.w d1 beq.s .HiRes.MODOK subq.w #4,d0 .HiRes.MODOK move.w d0,inl_cl_BPL1MOD+2(a1) --> BPL1MOD move.w d0,inl_cl_BPL2MOD+2(a1) --> BPL2MOD .OK moveq #0,d0 all right .Exit movem.l (a7)+,d1-d3/a1 rts .Error moveq #1,d0 bra.s .Exit ;------------------------------------------------------------------------------ ; CLBPLPT Screen(a0) --> Error(d0) ;------------------------------------------------------------------------------ inl.CLBPLPT movem.l d1-d2/a1-a2,-(a7) move.l inl_sc_CList(a0),d1 address of CList beq.s .Error move.l d1,a1 lea inl_cl_BPLPT(a1),a2 bitplane pointers move.l inl_sc_BitPlane(a0),d0 first bitplane moveq #0,d1 move.w inl_sc_NextRaw(a0),d1 offset of next raw mulu inl_sc_VOffs(a0),d1 * vertical offset add.l d1,d0 moveq #0,d1 move.w inl_sc_ViewMode(a0),d2 btst #inl_wm_b_HIRES,d2 bne.s .Hires move.w inl_sc_HOffs(a0),d1 horizontal offset lsr.w #4,d1 / 16 lsl.w #1,d1 * 2 add.l d1,d0 first bpl address bra.s .OK .Hires move.w inl_sc_HOffs(a0),d1 horizontal offset lsr.w #3,d1 / 8 lsl.w #1,d1 * 2 add.l d1,d0 first bpl address .OK move.l inl_sc_NextBPl(a0),d1 offset of next bpl move.w inl_sc_Depth(a0),d2 subq.w #1,d2 .Loop swap d0 addq.l #2,a2 move.w d0,(a2)+ --> BPLPTH swap d0 addq.l #2,a2 move.w d0,(a2)+ --> BPLPTL add.l d1,d0 next bpl dbf d2,.Loop moveq #0,d0 all right .Exit movem.l (a7)+,d1-d2/a1-a2 rts .Error moveq #1,d0 bra.s .Exit ******************************************************************************* * DataArea ******************************************************************************* inl.da.Palette DC.W $000,$eca,$e00,$a00 DC.W $d80,$fe0,$8f0,$080 DC.W $0b6,$0dd,$0af,$07c DC.W $00f,$70f,$c0e,$c08 DC.W $620,$e52,$a52,$fca DC.W $333,$444,$555,$666 DC.W $777,$888,$999,$aaa DC.W $ccc,$ddd,$eee,$fff inl.da.CList DC.W $180,0,$182,0,$184,0,$186,0 DC.W $188,0,$18a,0,$18c,0,$18e,0 DC.W $190,0,$192,0,$194,0,$196,0 DC.W $198,0,$19a,0,$19c,0,$19e,0 DC.W $1a0,0,$1a2,0,$1a4,0,$1a6,0 DC.W $1a8,0,$1aa,0,$1ac,0,$1ae,0 DC.W $1b0,0,$1b2,0,$1b4,0,$1b6,0 DC.W $1b8,0,$1ba,0,$1bc,0,$1be,0 DC.W $8e,0,$90,0 DC.W $92,0,$94,0 DC.W $102,0,$104,0 DC.W $108,0,$10a,0 DC.W $e0,0,$e2,0,$e4,0,$e6,0 DC.W $e8,0,$ea,0,$ec,0,$ee,0 DC.W $f0,0,$f2,0,$f4,0,$f6,0 ENDM