+Vorticon Posted October 12, 2016 Share Posted October 12, 2016 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? Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted October 12, 2016 Share Posted October 12, 2016 (edited) 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. ...lee Edited October 12, 2016 by Lee Stewart Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted October 12, 2016 Author Share Posted October 12, 2016 I would not think so. The output is likely going out the active RS232 channel. ...lee Hmmm... Not sure what you mean by that. Quote Link to comment Share on other sites More sharing options...
+mizapf Posted October 12, 2016 Share Posted October 12, 2016 Masked interrupts? Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted October 12, 2016 Share Posted October 12, 2016 Hmmm... Not sure what you mean by that. Sorry, I was thinking of the video out; but, even that would be software controlled. My comment is, therefore, irrelevant. ...lee Quote Link to comment Share on other sites More sharing options...
Stuart Posted October 12, 2016 Share Posted October 12, 2016 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 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted October 12, 2016 Author Share Posted October 12, 2016 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! Quote Link to comment Share on other sites More sharing options...
+mizapf Posted October 12, 2016 Share Posted October 12, 2016 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? Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted October 12, 2016 Author Share Posted October 12, 2016 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. Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted October 12, 2016 Author Share Posted October 12, 2016 Sorry, I was thinking of the video out; but, even that would be software controlled. My comment is, therefore, irrelevant. ...lee Wasn't your birthday a few days ago??? See you on Friday! Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted October 12, 2016 Share Posted October 12, 2016 Maybe try fbForth---enabled interrupts is the normal state. ...lee Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted October 12, 2016 Share Posted October 12, 2016 Wasn't your birthday a few days ago??? See you on Friday! Yup---73 solar circuits! See you Friday, indeed! ...lee 1 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted October 12, 2016 Author Share Posted October 12, 2016 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... Quote Link to comment Share on other sites More sharing options...
Stuart Posted October 12, 2016 Share Posted October 12, 2016 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 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted October 12, 2016 Author Share Posted October 12, 2016 There does not seem to be anything wrong with it... I tested the code in Classic99 and it refuses to autostart. Have you tried it on real iron by any chance? Quote Link to comment Share on other sites More sharing options...
+mizapf Posted October 12, 2016 Share Posted October 12, 2016 It does autostart - but it returns to Editor/Assembler again. I just tried it in MAME. Insert a JMP $ before the BLWP @GPLLNK to verify. Quote Link to comment Share on other sites More sharing options...
Stuart Posted October 12, 2016 Share Posted October 12, 2016 Yes, it looks as if the BLWP @GPLLNK is returning to the E/A. Comment out that line and the DATA line and it autostarts (meaning it doesn't return to E/A, just sits there in the continual loop in the code). Quote Link to comment Share on other sites More sharing options...
Willsy Posted October 12, 2016 Share Posted October 12, 2016 One guy in the states is using TF to sample and play audio via a home made sampler card. He did all the code in Forth. 1 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted October 12, 2016 Author Share Posted October 12, 2016 It does autostart - but it returns to Editor/Assembler again. I just tried it in MAME. Insert a JMP $ before the BLWP @GPLLNK to verify. So why it this happening? Quote Link to comment Share on other sites More sharing options...
Stuart Posted October 12, 2016 Share Posted October 12, 2016 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. Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted October 13, 2016 Author Share Posted October 13, 2016 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. Quote Link to comment Share on other sites More sharing options...
Tursi Posted October 13, 2016 Share Posted October 13, 2016 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 2 Quote Link to comment Share on other sites More sharing options...
+mizapf Posted October 13, 2016 Share Posted October 13, 2016 Really an ugly one! In some sense it's similar to what we know from malware - pretending not being executed, everything looks normal, except that it seemingly did not start. Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted October 14, 2016 Author Share Posted October 14, 2016 Thanks Tursi! At least now we can get it to work with autostart... Quote Link to comment Share on other sites More sharing options...
Gary from OPA Posted October 31, 2016 Share Posted October 31, 2016 Needing interrupts is very good infact, it allows you to play a long sound sample, without stopping the rest of your assembly code from running! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.