
COLBIT0	equ	$018
COLBIT1	equ	$01A
COLBIT2	equ	$01C
COLBIT3	equ	$01E
LSTLIN	equ	$020
LNMASK	equ	$022
WMODE	equ	$024
X1		equ	$026
Y1		equ	$028
X2		equ	$02A
Y2	 	equ	$02C
PATPTR 	equ	$02E
PATMSK	equ	$032
MFILL	equ	$034

;------------------------------------------
;
; _drawicon(X,Y)
; WORD	X1 		4(sp)
; WORD	Y1 		6(sp)
; draw a icon in the point of (X,Y)


		.globl	_drawicon

_drawicon:

	move.w 	4(sp), d0
	move.w 	6(sp), d1
	move.w 	d0, d2
	addi.w 	#10, d2 
	move.w 	d2, -(sp)
	move.w 	d1, -(sp)
	move.w 	d0, -(sp)
	jsr		_horiline
	addq.l	#$6, sp
	move.w 	4(sp), d0
	move.w 	6(sp), d1
	addi.w 	#10, d1
	move.w	d0,d3
	subq.w	#5,d0
	move.w 	d3, -(sp)
	move.w 	d1, -(sp)
	move.w 	d0, -(sp)
	jsr		_horiline
	addq.l	#$6, sp
	move.w 	4(sp), d0
	move.w 	6(sp), d1
	move.w 	d0, d2
	addi.w	#10, d0
	addi.w	#10, d1
	addi.w	#15, d2
	move.w 	d2, -(sp)
	move.w 	d1, -(sp)
	move.w 	d0, -(sp)
	jsr		_horiline
	addq.l	#$6, sp
	move.w 	4(sp), d0
	move.w 	6(sp), d1
	move.w 	d0, d2
	subq.w 	#5, d0
	addi.w	#15, d2
	addi.w	#20, d1
	move.w 	d2, -(sp)
	move.w 	d1, -(sp)
	move.w 	d0, -(sp)
	jsr		_horiline
	addq.l	#$6, sp

	;do the vertical lines

	move.w 	4(sp), d0
	move.w 	6(sp), d1
	move.w 	d1, d2
	addi.w 	#10, d2 
	move.w 	d2, -(sp)
	move.w 	d0, -(sp)
	move.w 	d1, -(sp)
	move.w 	d0, -(sp)
	jsr		_vertline
	addq.l	#$8, sp
	move.w 	4(sp), d0
	move.w 	6(sp), d1
	move.w	d1,	d2
	addi.w 	#10, d2
	addi.w 	#10, d0
	move.w 	d2, -(sp)
	move.w 	d0, -(sp)
	move.w 	d1, -(sp)
	move.w 	d0, -(sp)
	jsr		_vertline
	addq.l	#$8, sp
	move.w 	4(sp), d0
	move.w 	6(sp), d1
	subq.w	#5, d0
	move.w	d1,	d2
	addi.w	#10, d1
	addi.w 	#20, d2
	move.w 	d2, -(sp)
	move.w 	d0, -(sp)
	move.w 	d1, -(sp)
	move.w 	d0, -(sp)
	jsr		_vertline
	addq.l	#$8, sp
	move.w 	4(sp), d0
	move.w 	6(sp), d1
	move.w 	d1, d2
	addi.w	#15, d0
	addi.w	#10, d1
	addi.w	#20, d2
	move.w 	d2, -(sp)
	move.w 	d0, -(sp)
	move.w 	d1, -(sp)
	move.w 	d0, -(sp)
	jsr		_vertline
	addq.l	#$8, sp
	rts

;------------------------------------------
;
; _vhline(X1,Y1,X2,Y2, X3)
; WORD	X1 		4(sp)
; WORD	Y1 		6(sp)
; WORD	X2 		8(sp)
; WORD	Y2 		a(sp)
; WORD	X3 		c(sp)
;
; draw a solid vertical line form (X1,Y1) to (X2,Y2)
; draw a solid horizontal line form (X1,Y1) to (X3,Y1)


		.globl	_vertline

_vertline:

		dc.w 	$A000				; Make line a Init call
		move.w	#1, COLBIT0(a0)		; set COLBIT variables
		move.w	#1, COLBIT1(a0)
		move.w	#1, COLBIT2(a0)
		move.w	#1, COLBIT3(a0)
		move.w	#0, LSTLIN(a0)		; draw last pixel of line
		move.w	#$FFFF, LNMASK(a0)	; line style mask
		move.w	#2, WMODE(a0)		; writing mode (replace)
		move.w 	4(sp), X1(a0)			; (x1,y1) and (x2, y2) into
		move.w 	6(sp), Y1(a0)			; appropriate variables
		move.w 	8(sp), X2(a0)
		move.w 	$a(sp), Y2(a0)
		dc.w	$A003				; Arbitrary Line
		rts

		.globl	_horiline

_horiline:

		dc.w 	$A000				; Make line a Init call
		move.w	#1, COLBIT0(a0)		; set COLBIT variables
		move.w	#1, COLBIT1(a0)
		move.w	#1, COLBIT2(a0)
		move.w	#1, COLBIT3(a0)
		move.w	#2, WMODE(a0)		; writing mode (replace)
		move.w 	4(sp), X1(a0)			; (x1,y1) and (x2, y2) into
		move.w 	6(sp), Y1(a0)			; appropriate variables
		move.w 	8(sp), X2(a0)
		move.l	#pat, PATPTR(a0)	; pattern pointer
		move.w 	#0,PATMSK(a0)		; Pattern length n-1=0
		move.w 	#0,MFILL(a0)		; Multiple Plane fill off
		dc.w	$A004				; Arbitrary Line
		rts

.data
pat: 	dc.w	$FFFF				; Pattern for line.



