home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
dev
/
barflydemo-1.10.lha
/
BarflyDemo
/
Source
/
Demo.S
< prev
next >
Wrap
Text File
|
1994-08-21
|
34KB
|
1,870 lines
;-----------------------------------------------------------------------------
; FUNCTION: NONE
;
; INPUT: NONE
;
; OUTPUT: NONE
;
; REQUIREMENT:
; - V2.x : Because 1.x is a pain
; - 020+ : Because I wanted too
;
; NOTE: - There was no point to make this code resident, so the program
; variables are in the XDATA to save us from an Allocmem.
; - Because the code require a bit of CPU power there was no point
; to take the time to make it 68000 compatible.
; - I removed the 3.x WB support, cause I was not happy with it.
; - On my basic 3.1 A3000 blitting the image to the window take ~50%
; of the machine time, the C2P ~20%.Think what you want of this fact.
; - All drawing routines are custom but use bltbitmap to display
; the result in a window.(With a prior c2p pass is needed)
;
;-----------------------------------------------------------------------------
; ADDSYM
MC68020
OUTPUT T:DEMO
BOPT x+,O+,wo- ;,OG+
;--------------------------------------
INCDIR "includes:"
INCLUDE "exec/execbase.i"
INCLUDE "exec/memory.i"
INCLUDE "intuition/intuition.i"
INCLUDE "all_lvo.i" ;File auto created with LK FDINCLUDE option
;-----------------------------------------------------------------------------
GSTRING MACRO ;This macro should be SECTION based
bsr.b \@
db "\1",0
EVEN
\@ movea.l (sp)+,\2
ENDM
TRUE = 1
FALSE = 0
RSRESET ;Program Variable
DEMO_Stack RS.L 1
DEMO_EBase RS.L 1
DEMO_DBase RS.L 1
DEMO_IBase RS.L 1
DEMO_GBase RS.L 1
DEMO_Error RS.L 1
DEMO_Screen RS.L 1
DEMO_WindowXPos RS.W 1
DEMO_WindowYPos RS.W 1
DEMO_PolyWindow RS.L 1
DEMO_BoxWindow RS.L 1
DEMO_PixelWindow RS.L 1
DEMO_FireWindow RS.L 1
DEMO_RingWindow RS.L 1
DEMO_WeirdWindow RS.L 1
DEMO_ZoomWindow RS.L 1
DEMO_DiscWindow RS.L 1
DEMO_RND RS.L 1
DEMO_WBVP RS.L 1
DEMO_ColorMap RS.L 1
DEMO_HScroll RS.L 1
DEMO_HSize RS.W 1
DEMO_VSize RS.W 1
DEMO_MouseX RS.W 1
DEMO_MouseY RS.W 1
DEMO_Dist RS.L 1
DEMO_Chunky1 RS.L 1
DEMO_Chunky2 RS.L 1
DEMO_SinTable RS.L 1
DEMO_Pens RS.B 16
DEMO_AvailPens RS.B 16
DEMO_BitMap RS.B bm_SIZEOF
DEMO_Maping RS.B 256
DEMO_Points RS.W 32*3*2
DEMO_SIZEOF RS.L 0
; SECTION DEMOCode,CODE ;Read ONLY
;--------------------------------------
DEMO_Startup
lea (DEMO_BSS,pc),a4
ml a7,(DEMO_Stack,a4)
bsr DEMO_AllocLib
beq DEMO_Exit
mw (DEMO_EBase,a4,),a0
mw (AttnFlags,a0),d0
btst #AFB_68020,d0
beq DEMO_Exit
DEMO_Main
GSTRING <Demo Screen>,a0
bsr DEMO_AllocScreen
ml d0,(DEMO_Screen,a4)
beq DEMO_Quit
movea.l d0,a0
mq #0,d0
mb (sc_BarHeight,a0),d0
add.b (sc_BarVBorder,a0),d0
mw d0,(DEMO_WindowYPos,a4)
GSTRING <Fire>,a0
bsr DEMO_AllocWindow
ml d0,(DEMO_FireWindow,a4)
beq DEMO_Quit
GSTRING <Zoom>,a0
bsr DEMO_AllocWindow
ml d0,(DEMO_ZoomWindow,a4)
beq DEMO_Quit
GSTRING <Poly>,a0
bsr DEMO_AllocWindow
ml d0,(DEMO_PolyWindow,a4)
beq DEMO_Quit
GSTRING <Box>,a0
bsr DEMO_AllocWindow
ml d0,(DEMO_BoxWindow,a4)
beq DEMO_Quit
GSTRING <Pixel>,a0
bsr DEMO_AllocWindow
ml d0,(DEMO_PixelWindow,a4)
beq DEMO_Quit
GSTRING <Disc>,a0
bsr DEMO_AllocWindow
ml d0,(DEMO_DiscWindow,a4)
beq DEMO_Quit
GSTRING <Weird>,a0
bsr DEMO_AllocWindow
ml d0,(DEMO_WeirdWindow,a4)
beq DEMO_Quit
GSTRING <Ring>,a0
bsr DEMO_AllocWindow
ml d0,(DEMO_RingWindow,a4)
beq DEMO_Quit
movea.l (DEMO_Screen,a4),a0
movea.l (DEMO_IBase,a4),a6
jsr (_LVOScreenToFront,a6) ;Show screen with all window opened
.Loop pea .Loop(pc)
mq #0,D0
lea (DEMO_FireWindow,a4),a0
bsr .SetBit
lea (DEMO_WeirdWindow,a4),a0
bsr .SetBit
lea (DEMO_PolyWindow,a4),a0
bsr .SetBit
lea (DEMO_BoxWindow,a4),a0
bsr .SetBit
lea (DEMO_PixelWindow,a4),a0
bsr .SetBit
lea (DEMO_DiscWindow,a4),a0
bsr .SetBit
lea (DEMO_ZoomWindow,a4),a0
bsr .SetBit
lea (DEMO_RingWindow,a4),a0
bsr .SetBit
beq DEMO_Quit
movea.l (DEMO_EBase,a4),a6
jsr (_LVOWait,a6) ;Wait on any window left opened
ml #IDCMP_ACTIVEWINDOW,d2
lea (DEMO_RingWindow,a4),a0
bsr DEMO_GetWindowInput
cmp.l d2,d0
beq DEMO_Ring
lea (DEMO_FireWindow,a4),a0
bsr DEMO_GetWindowInput
cmp.l d2,d0
beq DEMO_Fire
lea (DEMO_WeirdWindow,a4),a0
bsr DEMO_GetWindowInput
cmp.l d2,d0
beq DEMO_Weird
lea (DEMO_ZoomWindow,a4),a0
bsr DEMO_GetWindowInput
cmp.l d2,d0
beq DEMO_Zoom
lea (DEMO_PolyWindow,a4),a0
bsr DEMO_GetWindowInput
cmp.l d2,d0
beq DEMO_Poly
lea (DEMO_BoxWindow,a4),a0
bsr DEMO_GetWindowInput
cmp.l d2,d0
beq DEMO_Box
lea (DEMO_PixelWindow,a4),a0
bsr DEMO_GetWindowInput
cmp.l d2,d0
beq DEMO_Pixel
lea (DEMO_DiscWindow,a4),a0
bsr DEMO_GetWindowInput
cmp.l d2,d0
beq DEMO_Disc
rts
.SetBit ml (a0),d1
beq.b .TstBit
movea.l d1,a0
mb ([wd_UserPort,a0],MP_SIGBIT),d1
bset d1,d0
.TstBit tst.l d0
rts
DEMO_Quit
ml (DEMO_Screen,a4),d0
beq.b DEMO_Exit
movea.l d0,a0
movea.l (DEMO_IBase,a4),a6
jsr (_LVOScreenToBack,a6)
bsr DEMO_FreeBuffer
lea (DEMO_FireWindow,a4),a0
bsr DEMO_FreeWindow
lea (DEMO_RingWindow,a4),a0
bsr DEMO_FreeWindow
lea (DEMO_ZoomWindow,a4),a0
bsr DEMO_FreeWindow
lea (DEMO_WeirdWindow,a4),a0
bsr DEMO_FreeWindow
lea (DEMO_PolyWindow,a4),a0
bsr DEMO_FreeWindow
lea (DEMO_BoxWindow,a4),a0
bsr DEMO_FreeWindow
lea (DEMO_PixelWindow,a4),a0
bsr DEMO_FreeWindow
lea (DEMO_DiscWindow,a4),a0
bsr DEMO_FreeWindow
bsr DEMO_FreeScreen
DEMO_Exit
bsr DEMO_FreeLib
ml (DEMO_Stack,a4),a7
ml (DEMO_Error,a4),d0
rts
;--------------------------------------
DEMO_AllocLib
ml ($4).w,(DEMO_EBase,a4)
movea.l (DEMO_EBase,a4),a6
lea (DName,pc),a1
mq #0,d0
jsr (_LVOOpenLibrary,a6)
ml d0,(DEMO_DBase,a4)
beq.b .Fail
lea (IName,pc),a1
mq #37,d0
jsr (_LVOOpenLibrary,a6)
ml d0,(DEMO_IBase,a4)
beq.b .Fail
lea (GName,pc),a1
mq #37,d0
jsr (_LVOOpenLibrary,a6)
ml d0,(DEMO_GBase,a4)
beq.b .Fail
.Exit mq #TRUE,d0
rts
.Fail mq #FALSE,d0
rts
DEMO_FreeLib
lea (DEMO_IBase,a4),a0
bsr.b .Close
lea (DEMO_GBase,a4),a0
bsr.b .Close
lea (DEMO_DBase,a4),a0
.Close ml (a0),d0
beq.b .Rts
clr.l (a0)
movea.l d0,a1
movea.l (DEMO_EBase,a4),a6
jmp (_LVOCloseLibrary,a6)
.Rts rts
IName DC.B "intuition.library",0
GName DC.B "graphics.library",0
DName DC.B "dos.library",0
EVEN
;--------------------------------------
DEMO_AllocScreen
ml a7,d2
ml #-1,-(sp)
ml a7,d3
ml #TAG_END,-(sp)
ml #5,-(sp)
ml #SA_Depth,-(sp)
ml a0,-(sp)
ml #SA_Title,-(sp)
ml #CUSTOMSCREEN,-(sp)
ml #SA_Type,-(sp)
ml #TRUE,-(sp)
ml #SA_Behind,-(sp)
ml d3,-(sp)
ml #SA_Pens,-(sp)
suba.l a0,a0
movea.l a7,a1
movea.l (DEMO_IBase,a4),a6
jsr (_LVOOpenScreenTagList,a6)
ml d2,a7
rts
DEMO_FreeScreen
lea (DEMO_Screen,a4),a0
.Close ml (a0),d0
beq .Rts
clr.l (a0)
movea.l d0,a0
movea.l (DEMO_IBase,a4),a6
jmp (_LVOCloseScreen,a6)
.Rts rts
;--------------------------------------
DEMO_AllocWindow
ml a7,d2
mq #0,d0
ml #TAG_END,-(sp)
mw (DEMO_WindowYPos,a4),d0
ml d0,-(sp)
ml #WA_Top,-(sp)
mw (DEMO_WindowXPos,a4),d0
ml d0,-(sp)
ml #WA_Left,-(sp)
ml #256,-(sp)
ml #WA_MaxWidth,-(sp)
ml #200,-(sp)
ml #WA_MaxHeight,-(sp)
ml #32,-(sp)
ml #WA_InnerWidth,-(sp)
ml #32,-(sp)
ml #WA_InnerHeight,-(sp)
ml #IDCMP_CLOSEWINDOW!IDCMP_NEWSIZE!IDCMP_ACTIVEWINDOW!IDCMP_INACTIVEWINDOW,-(sp)
ml #WA_IDCMP,-(sp)
ml #WFLG_SIZEGADGET!WFLG_CLOSEGADGET!WFLG_DRAGBAR!WFLG_DEPTHGADGET,-(sp)
ml #WA_Flags,-(sp)
ml a0,-(sp)
ml #WA_Title,-(sp)
ml (DEMO_Screen,a4),-(sp)
ml #WA_CustomScreen,-(sp)
suba.l a0,a0
movea.l a7,a1
movea.l (DEMO_IBase,a4),a6
jsr (_LVOOpenWindowTagList,a6)
ml d2,a7
tst.l d0
beq.b .Rts
movea.l d0,a0
mw (wd_Width,a0),d1
add.w d1,(DEMO_WindowXPos,a4)
cmpi.w #256,(DEMO_WindowXPos,a4)
ble.b .Rts
clr.w (DEMO_WindowXPos,a4)
mw (wd_TopEdge,a0),d1
add.w (wd_Height,a0),d1
mw d1,(DEMO_WindowYPos,a4)
.Rts rts
DEMO_FreeWindow
.Close ml (a0),d0
beq .Rts
clr.l (a0)
movea.l d0,a0
movea.l (DEMO_IBase,a4),a6
jmp (_LVOCloseWindow,a6)
.Rts rts
;--------------------------------------
DEMO_GetWindowInput
ml (a0),d0
beq.b .Rts
movea.l d0,a0
movem.l d2-d3,-(a7)
movea.l (DEMO_EBase,a4),a6
movea.l (wd_UserPort,a0),a0
mq #0,d2
jsr (_LVOGetMsg,a6)
tst.l d0
beq.b .Done
movea.l d0,a1
ml (im_Class,a1),d2
mw (im_Code,a1),d3
jsr (_LVOReplyMsg,a6)
.Done ml d2,d0
mw d3,d1
.Exit movem.l (a7)+,d2-d3
.Rts rts
;----------------------------------