Who's Online
149 user(s) are online (
144 user(s) are browsing
Forums )
Members: 0
Guests: 149
more...
Topic options
View mode
Newest First
Assembly: Paula sound?
Posted on:
2013/1/10 1:14
#1
Home away from home
Joined: 2006/11/20 16:26Last Login
: 11/3 19:40
From Norway
Group:
Registered Users
I have no clue what I'm doing wrong.
I'm trying to get some sound out of EUAE, I'm using the Amiga Hardware Reference Manual,
page 146, if I'm not mistaken audio has to be in chip memory? So it can't be part of program code?
So I have changed the example a tiny bit.
OldOpenLibrary EQU -$0198
WriteChars EQU -$ 03AE
CloseLibrary EQU -$019 E
ALLOCMEM EQU - 198
FREEMEM EQU - 210
HARDBASE EQU $DFF000
AUD0LCH EQU $ 0A0
AUD0LCL EQU $ 0A2
AUD0LEN EQU $ 0A4
AUD0VOL EQU $ 0A8
AUD0PER EQU $ 0A6
DMACON EQU $096
SECTION MAIN , CODE
MAIN :
LEA DOS ( pc ), A1
move . l 4.w , a6
jsr OldOpenLibrary ( a6 )
move . l d0 , DOSBASE
beq . s . Out
move . l #msg_start,d1
moveq #9,d2
JSR . Write
MOVE . l 4.w , a6
MOVE . l #100,D0 ; size
MOVE . l #2,D1 ; chip mem
JSR ALLOCMEM ( a6 )
MOVE . l d0 , SINDATA
BEQ . s . NOMEM
LEA . l HARDBASE , a0
MOVE . L SINDATA , a1
MOVE . L a1 , AUD0LCH ( a0 )
MOVE . W #4,AUD0LEN(a0)
MOVE . W #64,AUD0VOL(a0)
MOVE . W #447,AUD0PER(a0)
MOVE . W #8201,DMACON(a0)
MOVE . l 4.w , a6
MOVE . l SINDATA , a1
MOVE . b 0 , 0 ( a1 )
MOVE . b 90 , 1 ( a1 )
MOVE . b 127 , 2 ( a1 )
MOVE . b 90 , 3 ( a1 )
MOVE . b 0 , 4 ( a1 )
MOVE . b - 90 , 5 ( a1 )
MOVE . b - 127 , 6 ( a1 )
MOVE . b - 90 , 7 ( a1 )
MOVE . l #100,D0
JSR FREEMEM ( a6 )
move . l #msg_ok,d1
moveq #7,d2
JSR . Write
JMP . Out
. NOMEM :
move . l #msg_nomem,d1
moveq #13,d2
JSR . Write
JMP . Out
. Write :
move . l DOSBASE , A6
jsr WriteChars ( a6 )
RTS
. Out :
move . l DOSBASE , a1
move . l 4.w , a6
jsr CloseLibrary ( a6 )
RTS
DOS :
dc . b "dos.library" , 0
DOSBASE :
dc . l 0
SINDATA :
DC . L 0
msg_start :
dc . b "START!!!" , $A , 0
msg_ok :
dc . b "OK!!!!" , $A , 0
msg_nomem :
dc . b "AllocMem failed, no memory!" , $A , 0
Edited by LiveForIt on 2013/1/10 23:13:46
(NutsAboutAmiga) Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
Re: Paula sound?
Posted on:
2013/1/10 15:57
#2
Home away from home
Joined: 2006/11/20 16:26Last Login
: 11/3 19:40
From Norway
Group:
Registered Users
Ok, I did some thing stupid here, trying to play sound before I setup the sound wave. I will try to fix this when I get home.
Edited by LiveForIt on 2013/1/10 16:22:02
(NutsAboutAmiga) Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
Re: Paula sound?
Posted on:
2013/1/10 17:26
#3
Quite a regular
Joined: 2008/11/19 22:44Last Login
: 2016/7/10 17:28
From Tarsus IV
Group:
Registered Users
You're using Paula a custom hardware with its hardware registers, so yes it uses the chip memory. I've tried in the past to write 68k code under WinUAE or EUAE, but it's not the best. Better to write machine language programming in real classic hardware.
To Be A True Adventurer, You Ought To Play Real Text Adventures
Re: Paula sound?
Posted on:
2013/1/10 19:41
#4
Home away from home
Joined: 2006/11/20 16:26Last Login
: 11/3 19:40
From Norway
Group:
Registered Users
Don't have any hardware whit this chips anymore, anyway I find it interesting that CUSTUM or HARDBASE is constant that is often loaded in register, so it should relatively easy to move hardware from a fixed address to a PCI card, if you have the source code. I was thinking if I replaced MOVE.W #8201,DMACON(a0) Whit something like this MOVE DO,-(SP) MOVE #8201,D0 JSR .SET_DMACON MOVE.L (SP)+,D0 It might be simple to emulate DMACON on AHI, whit in an application.
(NutsAboutAmiga) Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
Re: Paula sound?
Posted on:
2013/1/10 23:11
#5
Home away from home
Joined: 2006/11/20 16:26Last Login
: 11/3 19:40
From Norway
Group:
Registered Users
EUAE does not make a peep, but I fixed a few mistakes, I hope some one can tell me what the problem is.
EXECBASE EQU 4
OldOpenLibrary EQU -$0198
WriteChars EQU -$ 03AE
CloseLibrary EQU -$019 E
Delay EQU - 198
ALLOCMEM EQU - 198
FREEMEM EQU - 210
CUSTOM EQU $DFF000
AUD0LCH EQU $ 0A0
AUD0LCL EQU $ 0A2
AUD0LEN EQU $ 0A4
AUD0VOL EQU $ 0A8
AUD0PER EQU $ 0A6
DMACON EQU $096
SECTION MAIN , CODE
MAIN :
LEA DOS ( pc ), A1
MOVE . l #0,D0
MOVE . l EXECBASE , a6
jsr OldOpenLibrary ( a6 )
move . l d0 , DOSBASE
beq . s . Out
move . l #msg_start,d1
moveq #9,d2
JSR . Write
; Alloc Sound wave
MOVE . l #100,D0 ; size
MOVE . l #2,D1 ; chip mem
MOVE . l EXECBASE , a6
JSR ALLOCMEM ( a6 )
MOVE . l d0 , SINDATA
BEQ . s . NOMEM
; Setup sound wave
MOVE . L SINDATA , a1
MOVE . b 0 , 0 ( a1 )
MOVE . b 90 , 1 ( a1 )
MOVE . b 127 , 2 ( a1 )
MOVE . b 90 , 3 ( a1 )
MOVE . b 0 , 4 ( a1 )
MOVE . b - 90 , 5 ( a1 )
MOVE . b - 127 , 6 ( a1 )
MOVE . b - 90 , 7 ( a1 )
; trun off audio , disable DMA
MOVE . W #0201,DMACON(a0)
; Play sound
LEA . l CUSTOM , a0
MOVE . l SINDATA , AUD0LCH ( a0 ) ; sound wave to play
MOVE . W #4,AUD0LEN(a0) ; length of sound wave
MOVE . W #64,AUD0VOL(a0) ; sound volume
MOVE . W #447,AUD0PER(a0) ; set audio period
; enable ( bit 15 ) dma ( bit 9 ), audio channel 0 ( bit 0 )
MOVE . W #8201,DMACON(a0)
; Wait for sound to be played
move . l DOSBASE , A6
move . l #20,D1
JSR Delay ( A6 )
; Free sound wave
MOVE . l #100,D0
MOVE . l SINDATA , a1
MOVE . l EXECBASE , a6
JSR FREEMEM ( a6 )
move . l #msg_ok,d1
moveq #7,d2
JSR . Write
JMP . Out
. NOMEM :
move . l #msg_nomem,d1
moveq #13,d2
JSR . Write
JMP . Out
. Write :
move . l DOSBASE , A6
jsr WriteChars ( a6 )
RTS
. Out :
move . l DOSBASE , a1
move . l EXECBASE , a6
jsr CloseLibrary ( a6 )
RTS
DOS :
dc . b "dos.library" , 0
DOSBASE :
dc . l 0
SINDATA :
DC . L 0
msg_start :
dc . b "START!!!" , $A , 0
msg_ok :
dc . b "OK!!!!" , $A , 0
msg_nomem :
dc . b "AllocMem failed, no memory!" , $A , 0
(NutsAboutAmiga) Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
Re: Paula sound?
Posted on:
2013/1/11 9:01
#7
Home away from home
Joined: 2006/11/20 16:26Last Login
: 11/3 19:40
From Norway
Group:
Registered Users
@flow
Nellepuh does not work whit AmigaOS4.1 only 4.0, it conflicts whit something AmigaOS4.1 does, maybe CUSTUM address is not reserved address space.
Anyway old software have number of problems, wrong timing, don't use timer.device but instead uses CIAA and CIAB timers, read joystick IO from fixed hardware addresses and so on, so if you really like something to work, you need to disassemble it, fix it and recompile it, then you create a binary patch.
On Aminet there is a package for disassemble Amiga executable hunk files.
http://aminet.net/package/dev/asm/ira you can then use 680x0 compiler like the one provided whit vbcc
http://lifeofliveforit.blogspot.no/20 ... opment-enviroment-on.html Nellepuh is not doing the same thing, Nellepuh is catching illegal read and write operations using the MMU, and then handles emulation whit interrupt routine. Nellepuh does not correct timing or make program more system friendly.
Edited by LiveForIt on 2013/1/11 9:43:52 Edited by LiveForIt on 2013/1/11 9:49:58 Edited by LiveForIt on 2013/1/11 9:50:36
(NutsAboutAmiga) Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
Re: Paula sound?
Posted on:
2013/1/11 9:10
#8
Home away from home
Joined: 2006/11/20 16:26Last Login
: 11/3 19:40
From Norway
Group:
Registered Users
Now back to topic way is it not playing sound?
(NutsAboutAmiga) Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
Re: Paula sound?
Posted on:
2013/1/11 14:29
#9
Just can't stay away
Joined: 2006/11/30 11:30Last Login
: 11/18 16:17
From Finland
Group:
Registered Users
@LiveForIt
Quote:
This value should be hexadecimal:
MOVE.W #$8201,DMACON(a0)
Re: Paula sound?
Posted on:
2013/1/11 21:42
#10
Home away from home
Joined: 2006/11/20 16:26Last Login
: 11/3 19:40
From Norway
Group:
Registered Users
Yes thats it, its always the simple stuff thats the most annoying.
(NutsAboutAmiga) Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
Currently Active Users Viewing This Thread:
1
(
0 members
and 1 Anonymous Users
)