Amiga - programowanie w assemblerze

Under construction...

 


	INCDIR		"DH1:Includes/"
	INCLUDE 	"LVO/Exec_lib.i"
	INCLUDE 	"LVO/Graphics_lib.i"
	INCLUDE 	"LVO/Expansion_lib.i"
	INCLUDE 	"LVO/Intuition_lib.i"

ExecBase = 4

	lea	dosname(pc),a1
	moveq	#0,d0 
	move.l	ExecBase,a6
	jsr	OpenLibrary(a6)
	move.l	d0,dosbase

	lea	intname(pc),a1
	moveq	#0,d0  
	jsr	OpenLibrary(a6) 
	move.l	d0,intbase

	lea	gfxname(pc),a1
	moveq	#0,d0  
	jsr	OpenLibrary(a6)
	move.l	d0,gfxbase

	lea	expname(pc),a1
	moveq	#0,d0  
	jsr	OpenLibrary(a6)
	move.l	d0,expbase

	lea	NewWindow(PC),a0 
	move.l	intbase(pc),a6 
	jsr	OpenWindow(a6) 
	move.l	d0,window
	beq	Exit

	lea	Font(PC),a0
	move.l	gfxbase(pc),a6 
	jsr	OpenFont(a6)
	move.l	window(pc),a1 
	move.l	$32(a1),a1
	move.l	d0,a0
	jsr	SetFont(a6)

	move.l	gfxbase(pc),a6
	move.l	window(pc),a4
	move.l	$32(a4),a4

	move.l	gfxbase(pc),a6 
	moveq	#1,d0
	move.l	a4,a1
	jsr	SetAPen(a6)

	moveq	#$2e,d1 
	move.w	d1,Posit

MainLoop:
	move.l 	expbase,a6
	clr.l 	d0
	sub.l 	#1,D0 			;-1L any manufacturer
	move.l 	d0,d1 			;-1L any product
	move.l 	ConfigDevp,a0 		;
	jsr	FindConfigDev(a6)	;Find expansion boards
	tst.l 	d0
	beq	Error
	move.l 	d0,ConfigDevp

	move.l	d0,A1
	move.l	32(a1),d2		;er_Manufacturer
	bsr	InsertValue		;Convert to HEX

	moveq	#$32,d0 
	move.w	Posit,d1
	add.w	#10,d1
	move.w	d1,Posit
	move.l 	#8,d2
	lea	ValueBuff(pc),a0 
	bsr	Print

	bra	MainLoop

Error:
	move.l	window(pc),a0
	move.l	$56(a0),a0
	move.l	ExecBase,a6
	jsr	WaitPort(a6)

	move.l	window(pc),a0
	move.l	$56(a0),a0
	move.l	ExecBase,a6
	jsr	GetMsg(a6)

	move.l	d0,a1
	move.l	ExecBase,a6
	jsr	ReplyMsg(a6)
	
	move.l  window(pc),a0
	move.l	intbase(pc),a6
	jsr	CloseWindow(a6)

Exit:
	moveq	#0,d0
	rts


Print:
	movem.l	d2/a0,-(sp)
	move.l	gfxbase(pc),a6
	move.l	a4,a1
	jsr	Move(a6)
	movem.l	(sp)+,d0/a0
	move.l	a4,a1
	jsr	Text(a6)
	rts
	
Lenght:
	movem.l d1/a0,-(sp)
count:
	move.b	(a0)+,d1
	add.w	#1,d2
	tst.b	d1
	bne	count
	
	movem.l (sp)+,d1/a0
	sub.w	#1,d2
	rts

InsertValue:
	lea	ValueBuff(pc),a0
	moveq	#7,d0
HEX_loop:
	rol.l	#4,d2
	move.l	d2,d1
	and.w	#$F,d1
	add.b	#'0',d1
	cmp.b	#$3A,d1
	bcs.s	HEX_ok
	addq.b	#7,d1
HEX_ok:
	move.b	d1,(a0)+
	dbf	d0,HEX_loop
	rts



window:		dc.l 0 
dosbase: 	dc.l 0 
gfxbase: 	dc.l 0 
intbase:	dc.l 0
expbase:	dc.l 0

NewWindow:
	dc.w 0
	dc.w 0 
	dc.w $1A1
	dc.w $250
	dc.w 1 
	dc.w 0 
	dc.w $200
	dc.w 0 
	dc.w $100E
	dc.l 0
	dc.l 0 
	dc.l Title
	dc.l 0 
	dc.l 0 
	dc.w 0 
	dc.w 0 
	dc.w 0 
	dc.w 0 
	dc.w 1


Name:	dc.b 'DH0:',0

Title:	dc.b 'DirList (Directory Lister) V1.0A',0

Posit:	dc.w 0

ValueBuff:
	ds.b 10

Font:	dc.l Topaz
	dc.l $80001
Topaz:	dc.b 'topaz.font',0

dosname: dc.b 'dos.library',0
gfxname: dc.b 'graphics.library',0
intname: dc.b 'intuition.library',0
expname: dc.b 'expansion.library',0



	Section DirList,data_c

ConfigDevp:	dcb.l 1,0