Jump to content
IGNORED

GPLLNK issue


Vorticon

Recommended Posts

Hi. Would somehow activating the base CRU for the RS232 card or the TMS9901 affect the functionality of GPLLNK?

As I am putting the finishing touches on my latest interfacing project to be demo'ed at the upcoming Chicago Faire, I noticed that GPLLNK does not seem to work when these CRU's are active... Specifically, the accept tone (DATA >0034) does not work.

Any thoughts?

Link to comment
Share on other sites

Hi. Would somehow activating the base CRU for the RS232 card or the TMS9901 affect the functionality of GPLLNK?

As I am putting the finishing touches on my latest interfacing project to be demo'ed at the upcoming Chicago Faire, I noticed that GPLLNK does not seem to work when these CRU's are active... Specifically, the accept tone (DATA >0034) does not work.

Any thoughts?

 

I would not think so. The output is likely going out the active RS232 channel. <--Nothing to see here! See my next comment. :woozy:

 

...lee

Edited by Lee Stewart
Link to comment
Share on other sites

Does your code auto-run after loading? If so, GPLLNK apparently doesn't work (so maybe nothing to do with the CRU address?). But anyway, easy enough to play a tone using code from Thierry at [http://www.unige.ch/medecine/nouspikel/ti99/tms9919.htm#Programming]. The bad response tone is middle A - not sure what the accept tone is. The code I use is:

 

45 * Play middle "A" note on generator 1.
46
47 LI R0,>8E0F Frequency on generator 1.
48 MOVB R0,@>8400 Sound port address.
49 SWPB R0
50 MOVB R0,@>8400
51 LI R0,>9000 Volume: maximum.
52 MOVB R0,@>8400
53
54 * Delay for approx. 1/2 second.
55
56 LI R0,>4000
57 BDR1 DEC R0
58 JNE BDR1
59
60 * Turn sound off.
61
62 LI R0,>9F00
63 MOVB R0,@>8400

Link to comment
Share on other sites

Does your code auto-run after loading? If so, GPLLNK apparently doesn't work (so maybe nothing to do with the CRU address?). But anyway, easy enough to play a tone using code from Thierry at [http://www.unige.ch/medecine/nouspikel/ti99/tms9919.htm#Programming]. The bad response tone is middle A - not sure what the accept tone is. The code I use is:

 

45 * Play middle "A" note on generator 1.

46

47 LI R0,>8E0F Frequency on generator 1.

48 MOVB R0,@>8400 Sound port address.

49 SWPB R0

50 MOVB R0,@>8400

51 LI R0,>9000 Volume: maximum.

52 MOVB R0,@>8400

53

54 * Delay for approx. 1/2 second.

55

56 LI R0,>4000

57 BDR1 DEC R0

58 JNE BDR1

59

60 * Turn sound off.

61

62 LI R0,>9F00

63 MOVB R0,@>8400

 

Yes, the code does autorun, so that may be the issue then... But why???

And yes, I did end up generating sound the old fashioned way out of desperation as you stated, but still wanted to know why GPLLNK did not work :) All I needed was a simple tone, and it seemed like a lot of setting up just for that compared to GPLLNK!

Link to comment
Share on other sites

The GPL sound routines rely on an interrupt-driven sound list processing, so you must have interrupts enabled. Thus, don't you need a LIMI 2 before the GPLLNK call?

 

The EA manual doesn't mention that under the GPLLNK section and the examples given don't include LIMI 2's. I distinctly recall using it in the past for some of my programs without specifically enabling interrupts, but I can't seem to recall where... Worth a shot though.

Link to comment
Share on other sites

Maybe try fbForth---enabled interrupts is the normal state.

 

...lee

 

Unlike TurboForth. I could have easily done my project in Forth, except I wasn't sure if either version would have been fast enough for my purposes and I already had a lot of canned assembly code from my previous projects to cobble together the current one.

The project consists of autonomous control of a slot car on a track competing against a human player. Part of the process involves the very rapid powering on and off of the track to control the speed of the car (I call it pulse frequency modulation, something I used with my robotic arm project a couple of years ago) using the cassette motor control plug. I control various delay loops for that purpose in the format:

 

LOOP  LI  R1,10000
      DEC R1
      JNE LOOP

The value of R1 varies depending on where the car is on the track in order to prevent it from flying off it. Whether either Forth versions can handle such loops with enough speed remains to be seen...

Link to comment
Share on other sites

Enabling interrupts seems to be the key as people have suggested. Page 312 of the E/A manual says that interrupts need to be enabled "to start processing sound operation". No mention about this in the GPLLNK section covering the bad and accept tone responses.

I had a little play with the code below. Without the LIMI 2 and LIMI 0 in the loop, the tone starts but never ends. With the LIMI's, the tone plays for 1/2 a second or so as expected. BUT I couldn't get the code to autorun from the E/A option 3 to test - what am I doing wrong?

       DEF START
       REF GPLLNK
 
START  LWPI WS
 
       CLR  R1
       MOVB R1,@>837C
       BLWP @GPLLNK
       DATA >0034        ACCEPT TONE.
 
       LI   R2,>FFFF
LOOP1  LIMI 2
       LIMI 0
       DEC  R2
       JNE  LOOP1
 
       JMP  START
 
WS     BSS  32           WORKSPACE.
 
       END START
Link to comment
Share on other sites

Looking at Thierry's pages, the normal load-and-run process calls the loader to load your code then calls the linker to run the program. If you do autorun, it is the loader that runs the program - the linker is not used. The linker sets up some stuff in the VDP (to give the green screen) and *maybe* also sets some stuff that GPLLNK relies on. If you don't go through the linker, GPLLNK won't work.

Link to comment
Share on other sites

Looking at Thierry's pages, the normal load-and-run process calls the loader to load your code then calls the linker to run the program. If you do autorun, it is the loader that runs the program - the linker is not used. The linker sets up some stuff in the VDP (to give the green screen) and *maybe* also sets some stuff that GPLLNK relies on. If you don't go through the linker, GPLLNK won't work.

 

Makes sense, although it would be nice to specifically understand the exact "stuff" GPLLNK relies on.

Link to comment
Share on other sites

The GPLLNK call just sets up the sound list. You still need to let the interrupt run for the list to be processed - GPL doesn't wait for it to finish. Frankly it's a lot more efficient if you just want the beep to copy the sound list into VRAM yourself and set the pointer. ;)

 

As for the GPLLNK failing... it's a simple enough tool so I stepped into it... the E/A utilities are properly set up (and linked), so it's not that.

 

In the autostart case it gets this:

 

   A00A  0420  blwp @>2100                 (62)
         2100
   21C4  D060  movb @>8373,R1              (38)
         8373
   21C8  0981  srl  R1,8                   (40)
   21CA  C87E  mov  *R14+,@>8304(R1)       (54)
         8304
   21CE  F820  socb @>20fc,@>8349          (46)
         20FC
         8349
   21D4  02E0  lwpi >83e0                  (18)
         83E0
   21D8  C2E0  mov  @>2030,R11             (34)
         2030
   21DC  045B  b    *R11                   (16)
   061C  10E3  jmp  >05e4                  (10)
   05E4  0460  b    @>0070                 (16)
         0070
At that point it's back in the GPL interpreter... didn't seem to set the address?

 

Without the autostart, just running START, it looks like this:

 

   A00A  0420  blwp @>2100                 (62)
         2100
   21C4  D060  movb @>8373,R1              (38)
         8373
   21C8  0981  srl  R1,8                   (40)
   21CA  C87E  mov  *R14+,@>8304(R1)       (54)
         8304
   21CE  F820  socb @>20fc,@>8349          (46)
         20FC
         8349
   21D4  02E0  lwpi >83e0                  (18)
         83E0
   21D8  C2E0  mov  @>2030,R11             (34)
         2030
   21DC  045B  b    *R11                   (16)
   061C  10E3  jmp  >05e4                  (10)
   05E4  0460  b    @>0070                 (16)
         0070
>  0070  0300  limi >0002   
So the same sequence, but this time it works.

 

There's no difference in the registers, although the VDP address is different and the GROM address is different (to be expected). A quick hack says it's all down to the GROM address (which is >6893 when the program starts normally and >6830 when auto-started.) In Classic99 I breakpointed at the BLWP and before it jumped, I changed the GROM address to >6893 (by setting >6892 with two writes to >9c02 - remember the auto-increment), then continued, and the beep happened.

 

It's not clear to me looking at Thierry's disassembly why that might be... but as a quick test, I set the GPL address in the code itself, and that made auto-start appear to work. ;)

 

       DEF START
       REF GPLLNK
 
START  LWPI WS
 
* set the GROM address to make GPLLNK work from E/A auto-start
  LI R0,>6892
  MOVB R0,@>9c02
  SWPB R0
  MOVB R0,@>9C02
 
       CLR  R1
       MOVB R1,@>837C
       BLWP @GPLLNK
       DATA >0034        ACCEPT TONE.
 
       LI   R2,>FFFF
LOOP1  LIMI 2
       LIMI 0
       DEC  R2
       JNE  LOOP1
 
       JMP  START
 
WS     BSS  32           WORKSPACE.
 
       END START
  • Like 2
Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...