ExecMenu


execbase     = 4
OpenLib      = -408
CloseWindow  = -72 
OpenWindow   = -204
CloseLibrary = -414
OpenScreen   = -198
CloseScreen  = -66
ExeCute      = -222	
SetMenuStrip = -264
ClearMenuStrip = -54
GetMsg = -372

start:
	bsr   	libsopen
	bsr	screenopen	
	bsr	winopen
	bsr	setmenu
	bsr   	loop
	




libsopen: 
	move.l execbase,a6
	lea dosname,a1
	jsr OpenLib(a6)
	move.l d0,dosbase
	move.l execbase,a6
	lea intname,a1
	jsr OpenLib(a6)
	rts

dosname:	
	dc.b   'dos.library',0
	even

dosbase: 
	dc.l 0

intname:
	dc.b   'intuition.library',0
	even

intbase:
	dc.l 0


screenopen:
	move.l d0,intbase
	move.l intbase,a6
	lea screen_defs,a0
	jsr openscreen(a6)
	rts

winopen:
	move.l d0,screenhd
	move.l	intbase,a6
	lea windowdef,a0
	jsr OpenWindow(a6)
	move.l d0,windowhd
	rts
	 
setmenu:
	move.l	intbase,a6
	move.l	windowhd,a0
	lea	menu,a1
	jsr	SetMenuStrip(a6)
	rts


loop:
	move.l	execbase,a6
	move.l	windowhd,a0
           move.l	86(a0),a0
	jsr 	GetMsg(a6)
	tst.l	d0
	beq	loop
	move.l	d0,a0
	move.l	$14(a0),d6
	move $18(a0),d7
	move	d7,d6
	lsr	#8,d7
	lsr	#3,d7
	clr.l	d5
	roxr	#1,d6
	roxl	#2,d5
	and.l	#$7f,d6
	cmp	#$7f,d6
	beq	loop
	lsr	#4,d6
	cmp	#0,d5
	beq	menu1loop
	cmp	#1,d5
	bne	menu2loop
	rts




menu1loop:
	cmp	#0,d6
	beq	seka
	cmp	#1,d6
	beq	ced
	cmp	#2,d6
	beq	dm
	cmp	#3,d6
	beq	slut
	rts


menu2loop:
	cmp	#0,d6
	beq 	dpaint
	cmp	#1,d6
	beq	conv
	rts


slut:
	bsr clearmenu	
	bsr windclose	
           bsr closescr
	bsr closeint
	bsr closedos

	

clearmenu:
	move.l	intbase,a6
	move.l	windowhd,a0
	jsr	ClearMenuStrip(a6)
	rts

closedos:
	move.l execbase,a6
	move.l dosbase,a1
	jsr CloseLibrary(a6)
	rts

closeint:
	move.l execbase,a6
	move.l intbase,a1
	jsr CloseLibrary(a6)
	rts

windclose:
	move.l	intbase,a6
	move.l windowhd,a0
	jsr    CloseWindow(a6)	
	rts

closescr:
	move.l intbase,a6
	move.l screenhd,a0
	jsr  CloseScreen(a6)
	rts


even
screen_defs:
	x_pos:	dc.w 0
	y_pos:	dc.w 0
	width:	dc.w 640
	height:	dc.w 400
	depth:	dc.w 2
	detail_pen:  dc.b 2
	block_pen: dc.b 1
	view_modes: dc.w $8000
	screen_type: dc.w 15
	font:	dc.l 0
	title:  dc.l   titel
	gadgets: dc.l 0
	bitmap: dc.l 0

	

titel:  dc.b   'WorkDisc One  by Henrik Stolpe',0
	even	        
even
windowdef:

	dc.w	10
	dc.w	20
	dc.w	250
	dc.w	100
	dc.b	2
	dc.b	1
	dc.l	$100
	dc.l	$100f
	dc.l	0
	dc.l	0
	dc.l	windowname
	
screenhd:
	
	dc.l	0
	dc.l	0
	dc.w	150
	dc.w	50
	dc.w	320
	dc.w	200
	dc.w	15

windowname:
	dc.b	'CLI',0
	even
	
windowhd:
	dc.l	0
        even

menu:
	dc.l	menu2
	dc.w	10,30
	dc.w	80,30
	dc.w	1
	dc.l	menynamn
	dc.l	menuitem01
	dc.w	0,0,0,0

menynamn:
	dc.b	"Programm.",0
	even

menu2:
	dc.l	0
	dc.w	120,0
	dc.w	90,30
	dc.w	1
	dc.l	menynamn2
	dc.l	menuitem11
	dc.w	0,0,0,0

menynamn2:
	dc.b	"Graphics",0
	even





menuitem01:
	dc.l	menuitem02
	dc.w	0,0
	dc.w	160,10
	dc.w	%001111110
	dc.l	0
	dc.l	text01
	dc.l	0
	dc.b	"a"
	even
	dc.l	0
	dc.w	0

text01:
	dc.b	2,1
	dc.b	0
	even
	dc.w	5,0
	dc.l	0
	dc.l	text01txt
	dc.l	0

text01txt:
	dc.b	" Seka Assemb",0
	even	

menuitem02:
	dc.l	menuitem03
	dc.w	0,12
	dc.w	160,10
	dc.w	%001111110
	dc.l	0
	dc.l	text02
	dc.l	0
	dc.b	"b"
	even
	dc.l	0
	dc.w	0

text02:
	dc.b	2,1
	dc.b	0
	even
	dc.w	5,0
	dc.l	0
	dc.l	text02txt
	dc.l	0

text02txt:
	dc.b	" Cygnus ED",0
	even


menuitem03:
	dc.l	menuitem04
	dc.w	0,24
	dc.w	160,10
	dc.w	%001111110
	dc.l	0
	dc.l	text03
	dc.l	0
	dc.b	"c"
	even
	dc.l	0
	dc.w	0

text03:
	dc.b	2,1
	dc.b	0
	even
	dc.w	5,0
	dc.l	0
	dc.l	text03txt
	dc.l	0

text03txt:
	dc.b	" DMaster 2.0",0
	even



menuitem04:

	dc.l	0
	dc.w	0,36
	dc.w	160,10
	dc.w	%001111110
	dc.l	0
	dc.l	text04
	dc.l	0
	dc.b	"d"
	even
	dc.l	0
	dc.w	0

text04:
	dc.b	2,1
	dc.b	0
	even
	dc.w	5,0
	dc.l	0
	dc.l	text04txt
	dc.l	0

text04txt:
	dc.b	" Quit",0
	even




menuitem11:
	dc.l	menuitem12
	dc.w	0,0
	dc.w	190,10
	dc.w	%001111110
	dc.l	0
	dc.l	text11
	dc.l	0
	dc.b	"e"
	even
	dc.l	0
	dc.w	0

text11:
	dc.b	2,1
	dc.b	0
	even
	dc.w	5,0
	dc.l	0
	dc.l	text11txt
	dc.l	0

text11txt:
	dc.b	" DPaint 4",0
	even	
          

menuitem12:
	dc.l	0
	dc.w	0,12
	dc.w	190,10
	dc.w	%001111110
	dc.l	0
	dc.l	text12
	dc.l	0
	dc.b	"f"
	even
	dc.l	0
	dc.w	0

text12:
	dc.b	2,1
	dc.b	0
	even
	dc.w	5,0
	dc.l	0
	dc.l	text12txt
	dc.l	0

text12txt:
	dc.b	" Deluxe Conv.",0
	even	


;routines


dm:
	move.l	dosbase,a6
	move.l	#command0,d1
	clr.l	d2
	clr.l   d3
	jsr	ExeCute(a6)
	bsr	loop	
	rts        

ced:
	move.l	dosbase,a6
	move.l	#command1,d1
	clr.l	d2
	clr.l   d3
	jsr	ExeCute(a6)
	bsr	loop
	rts        




seka:
	move.l	dosbase,a6
	move.l	#command2,d1
	clr.l	d2
	clr.l   d3
	jsr	ExeCute(a6)
	bsr	loop
	rts        



dpaint:
	move.l	dosbase,a6
	move.l	#command3,d1
	clr.l	d2
	clr.l   d3
	jsr	ExeCute(a6)
	bsr	loop
	rts        
	
conv:
	move.l	dosbase,a6
	move.l	#command4,d1
	clr.l	d2
	clr.l   d3
	jsr	ExeCute(a6)
	bsr	loop
	rts        



command0:
	dc.b	"16",0
	even

command1:
	dc.b	"14",0
	even

command2:
        dc.b    "1",0
	even 

command3:
	dc.b	"dpaint",0
	even

command4:
	dc.b	"4",0
	even