Jump to content

Photo

Editor Assembler Sound examples question


9 replies to this topic

#1 TheBF OFFLINE  

TheBF

    Moonsweeper

  • 458 posts
  • Location:The Great White North

Posted Wed Jan 10, 2018 8:54 PM

Has anyone ever coded the example sound programs that begin on page 321?

 

I ran the CHIME sound list with my Forth language player and the data is fine.

 

Then realized it was not hard to make a sound list in VDP RAM and write to the PAD memory addresses in the examples.

 

I run my system with interrupts running most of the time, so I expected something to happen however nothing happened.

 

Things that make you say hmmm...

 

BF


  • RXB likes this

#2 adamantyr OFFLINE  

adamantyr

    Stargunner

  • 1,240 posts

Posted Wed Jan 10, 2018 9:12 PM

I've ran it before and it worked fine. What did you do differently?

If you are doing the direct sound method there is one strange thing... you have to store the contents of R11 somewhere or the method won't work. No idea why.

#3 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

  • 3,499 posts
  • Location:Silver Run, Maryland

Posted Wed Jan 10, 2018 9:40 PM

I’ve run those sound tables through the fbForth 2.0 sound system and it works fine there.  Post your code so we can pore over it with eagle eyes.  :P

 

...lee



#4 TheBF OFFLINE  

TheBF

    Moonsweeper

  • Topic Starter
  • 458 posts
  • Location:The Great White North

Posted Thu Jan 11, 2018 12:23 PM

As I mentioned, the sound tables work fine. I can play them with direct 9919 control.

 

I was curious what it takes to run them under ISR control. It looks simple in assembler.

 

I am trying it in Forth with no luck.

 

Here is the code:

\ ISR Sound player for Camel99 Forth   Jan 10, 2019 BJF

\ VDP RAM manager
VARIABLE VP    \ VDP memory pointer (4K block)

HEX 1000 VP !   \ start of free VDP RAM

: VHERE   ( -- addr) VP @ ;   \ FETCH the value in VDP pointer
: VALLOT ( n -- )    VP +! ;  \ add n to the value in VDP pointer

\ Compile a byte in the next available VDP memory location
: VC,    ( n -- )  VHERE VC!  1 VALLOT ;

: VCREATE  ( -- <text>)
            CREATE VHERE ,   \ compile VDP address in CPU RAM
            DOES> @  ;       \ run time: fetch the VDP address

\ setup ISR sound
: ISRPLAY ( vaddr -- )
            LIMI0                     \ interrupts off
            83CC !                    \ load sound table address
            01 83CE C!                \ trigger sound processing
            83FD C@  01 OR 83FD C!    \ set VDP flag
            LIMI2 ;                   \ interrupts on

\ VDP BYTE directive: read bytes and compile into VDP RAM
: VBYTE ( -- )  \ read input stream of bytes and compile to VDP mem.
         BEGIN
           [CHAR] , PARSE-NAME  DUP  ( -- adr len len )
         WHILE
            EVALUATE  DUP FF00 AND ABORT" Not a byte"
            VC,
         REPEAT
         2DROP ;

: /END   ( -- )  0 VC,  ;              \ compile a zero BYTE into VDP RAM

VCREATE PACMAN
       VBYTE 6,86,0D,97,AC,1A,B7,8
       VBYTE 2,8F,08,2
       VBYTE 2,AB,23,5
       VBYTE 2,86,0D,4
       VBYTE 1,BF,3
       VBYTE 2,8E,0B,8
       VBYTE 2,8A,0A,2
       VBYTE 3,AC,1A,B7,8
/END


#5 TheBF OFFLINE  

TheBF

    Moonsweeper

  • Topic Starter
  • 458 posts
  • Location:The Great White North

Posted Thu Jan 11, 2018 7:12 PM

Forgot to mention that the way it should work is you pass the sound table to ISRPLAY as an argument.

 

PACMAN ISRPLAY <enter>



#6 RXB OFFLINE  

RXB

    River Patroller

  • 2,870 posts
  • Location:Vancouver, Washington, USA

Posted Thu Jan 11, 2018 9:31 PM

Has anyone ever coded the example sound programs that begin on page 321?

 

I ran the CHIME sound list with my Forth language player and the data is fine.

 

Then realized it was not hard to make a sound list in VDP RAM and write to the PAD memory addresses in the examples.

 

I run my system with interrupts running most of the time, so I expected something to happen however nothing happened.

 

Things that make you say hmmm...

 

BF

I have run it from Assembly, GPL and RXB even has a demo using the same code.



#7 TheBF OFFLINE  

TheBF

    Moonsweeper

  • Topic Starter
  • 458 posts
  • Location:The Great White North

Posted Fri Jan 12, 2018 8:05 AM

Yup.  I am sure it works.  I just can't understand why, when I do the equivalent things with Forth that I see in Assembler in the book, it doesn't play the list. I even made some little routines in the kernel to start and stop interrupts like in the assembler code.

 

I will have to study Lee's code more closely.

 

It's funny cuz I made the TMS9919 direct sound driver very quickly. :-)

 

 I notice that the assembler code is in a loop.  Perhaps I am only running the first string of bytes?



#8 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

  • 3,499 posts
  • Location:Silver Run, Maryland

Posted Fri Jan 12, 2018 8:32 AM

Yup.  I am sure it works.  I just can't understand why, when I do the equivalent things with Forth that I see in Assembler in the book, it doesn't play the list. I even made some little routines in the kernel to start and stop interrupts like in the assembler code.

 

I will have to study Lee's code more closely.

 

It's funny cuz I made the TMS9919 direct sound driver very quickly. :-)

 

 I notice that the assembler code is in a loop.  Perhaps I am only running the first string of bytes?

 

I am not sure studying my code will help because it is talking directly to the sound chip just as your code does.  The ISR I wrote to do that does not involve the console ISR’s sound routine at all.  I will post the console ISR’s sound routine in a bit.

 

...lee



#9 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

  • 3,499 posts
  • Location:Silver Run, Maryland

Posted Fri Jan 12, 2018 9:26 AM

Here is the Assembler listing of the console ROM code:  Attached File  ROM-4A.lst   263.03KB   4 downloads

 

The ISR begins at “REMOTE” at line #1580 and the sound servicing section begins at “TSTSND” at line #1710.

 

...lee



#10 TheBF OFFLINE  

TheBF

    Moonsweeper

  • Topic Starter
  • 458 posts
  • Location:The Great White North

Posted Fri Jan 12, 2018 10:58 AM

Here is the Assembler listing of the console ROM code:  attachicon.gifROM-4A.lst

 

The ISR begins at “REMOTE” at line #1580 and the sound servicing section begins at “TSTSND” at line #1710.

 

...lee

 

Thanks Lee. This is wonderful to have.

 

Yes I noticed that your code talks to the chip and uses some of the same code as Turbo Forth too. 

I am swimming upstream here maybe but it's fun to try and craft these things in Forth to see what can be done.

 

Thanks again for the listing.  Will post what I find.

 

B






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users