English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 04 April 2016, 14:56   #1
h0ffman
Registered User
 
Join Date: Aug 2008
Location: Salisbury
Posts: 763
narrator.device via assembly

I'm poking around with the narrator.device from workbench 1.3 and am looking to communicate with it via assembly. I've already got some code which opens and closes the device, although it was actually written for the audio.device I can see the request block is being populated with the default values.

What I can't seem to work out is how to write to the device. I have to send it a CMD_WRITE but the examples and structures are all in C, which while I understand (to a low degree) have no idea how to translate that into workable assembly.

I kinda understand the request block but can see where I put my pointer to the text and length parameter.

Is there a working example in asm somewhere?

Any help would be super awesome!

http://wiki.amigaos.net/wiki/Narrato...arrator_Device
h0ffman is online now  
Old 04 April 2016, 16:49   #2
davideo
Amiga Tomcat
 
davideo's Avatar
 
Join Date: Sep 2007
Location: Boston Lincs
Posts: 1,501
the book "Amiga Machine Language" by "Abacus" includes a section on the Narrator.device.

Have a look on Bombjack for the book.
davideo is offline  
Old 04 April 2016, 16:53   #3
h0ffman
Registered User
 
Join Date: Aug 2008
Location: Salisbury
Posts: 763
oh my word! I downloaded almost every book from that page to look for narrator examples! except that one! Thanks sooo much pal this is gonna be fuuuun!
h0ffman is online now  
Old 04 April 2016, 16:55   #4
davideo
Amiga Tomcat
 
davideo's Avatar
 
Join Date: Sep 2007
Location: Boston Lincs
Posts: 1,501
Lol - Same here. It's a good resource.
davideo is offline  
Old 04 April 2016, 20:44   #5
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 722
Starting from this: http://amigadev.elowar.com/read/ADCD.../node01A9.html

I wrote this:

Code:
	incdir '/usr/local/amiga/m68k-amigaos/asm/Include/'
	include exec/exec_lib.i
	include devices/narrator.i

	XDEF	_SysBase

	move.l 	$4.w,d0
	move.l 	d0,_SysBase
	move.l 	d0,a6

	moveq.l #0,d0
	move.l 	d0,-(sp)
	move.l 	d0,-(sp)
	jsr	_CreatePort
	addq	#8,sp
	move.l 	d0,VoicePort
	beq	noVoicePort
	
	move.l 	#NDI_SIZE,d1
	move.l 	d1,-(sp)
	move.l 	d0,-(sp)
	jsr	_CreateExtIO
	addq.l	#8,sp
	move.l	d0,VoiceIO
	beq	noVoiceIO

	move.l	d0,a0
	move.l	d0,a5		; save a copy of VoiceIO to a5 (to survive OS calls)
	lea.l	chans,a1
	move.l	a1,NDI_CHMASKS(a0)
	move.w	#4,NDI_NUMMASKS(a0)
	move.w	#CMD_WRITE,IO_COMMAND(a0)
	move.b	#NDB_NEWIORB,NDI_FLAGS(a0)

	lea.l	narDev,a0	;device name
	moveq.l	#0,d0		;unit number
	move.l	d0,d1		;flags
	move.l	a5,a1		;iORequest
	jsr	_LVOOpenDevice(a6)
	tst.b	d0
	bne	noOpenDevice


	lea.l	PhonStr,a0
	move.l	a0,IO_DATA(a5)
	move.l	#(narDev-PhonStr),IO_LENGTH(a5)
	move.b	#NDB_NEWIORB,NDI_FLAGS(a5)

	move.l	a5,a1
	jsr	_LVODoIO(a6)


	move.l	a5,a1
	jsr	_LVOCloseDevice(a6)
noOpenDevice:	
	move.l	a5,a0
	move.l	a0,-(sp)
	jsr	_DeleteExtIO
	addq	#4,sp
noVoiceIO:	
	move.l	VoicePort,a0
	move.l	a0,-(sp)
	jsr	_DeletePort
	addq	#4,sp
	
noVoicePort:
	moveq	#0,d0
	rts
	

	section data
PhonStr:	dc.b 'KAA1RDIYOWMAYAA5PAXTHIY.  AY /HAED NEH1VER /HER4D AXV IHT BIXFOH5R.'
narDev:		dc.b 'narrator.device',0
	even
chans:	dc.b	3,5,10,12
	
	section bss
_SysBase:	ds.l	1
VoicePort:	ds.l	1
VoiceIO:	ds.l	1
To assemble and link:
vasmm68k_mot -Fhunk -o foo.o foo.asm
vlink -bamigahunk -o foo foo.o /home/alex/Documents/FS-UAE/Hard\ Drives/AmigaHD/SC/lib/amiga.lib

Change paths accordingly.
alkis is offline  
Old 05 April 2016, 00:21   #6
h0ffman
Registered User
 
Join Date: Aug 2008
Location: Salisbury
Posts: 763
Nice one, cheers alkis. Will give this a blast. Once it's working, next step it to resource the device!
h0ffman is online now  
Old 30 July 2016, 19:50   #7
absence
Registered User
 
Join Date: Mar 2009
Location: moon
Posts: 373
Quote:
Originally Posted by h0ffman View Post
next step it to resource the device!
Nice, I wanted to do that a few years ago, but the whole limited spare time thing got in the way. Did you get anywhere with it?
absence is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
K13 asm example of gameport.device and keyboard.device redblade Coders. General 29 20 January 2011 18:32
uaehf.device and HDToolbox: Error 224 reading device description Ebster support.WinUAE 3 16 September 2008 09:24
Narrator.device thinlega request.Apps 2 31 May 2004 06:37
narrator.device? th4t1guy support.WinUAE 4 23 April 2004 15:27
assembly TV L8-X Amiga scene 2 04 August 2002 02:36

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 22:40.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.10018 seconds with 13 queries