+ Reply to Thread
Page 5 of 43 FirstFirst 12345678915 ... LastLast
Results 81 to 100 of 851

Thread: Download PropBASIC here... 00.01.14 LAST VERSION FOR BST

  1. #81
    StefanL38's Avatar
    Location
    northern part of Hessen (Germany)
    Posts
    2,154

    Default

    I guess this is very hard to do

    PropBasic is compiled to PASM. I remember somebody did work on how to call SPIN from PASM.
    But I think you have to fiddle around with pointers each time you change a single byte in the SPIN-files.

    So it will be much easier to learn SPIN than learning how startadresses of spin-methods were changed by the SPIN-bytecode-compiler

    best regards

    Stefan
    Last edited by ForumTools; 09-30-2010 at 06:19 AM. Reason: Forum Migration

  2. #82

    Default

    kuroneko said...
    Out of curiosity, what's the rationale behind using cogstart instead of cognew and swapping the parameters for RDxxx/WRxxx (compared to their PASM equivalents)? Regarding the latter, not that I mind that much but people starting with BASIC and going for PASM later might find this confusing.
    Well, COGSTART started life as TASKSTART, but was changed because it really is starting a COG with a specific task.

    RDxxxx and WRxxxx allow multiple values to be read or written with one command. This would have been a strange syntax if the address wasn't first. Plus it is a more consistant syntax.

    Bean.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.

    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134·
    Last edited by ForumTools; 09-30-2010 at 06:19 AM. Reason: Forum Migration

  3. #83

    Default

    PropBASIC/ASM query

    Hi experts,

    I've spent the day trying to work out how to run some Assembler within PropBASIC, in my continuing efforts to translate Rayman's fabulous PSM_ToneGenerator into PropBASIC.

    My thinking is that once I can do this for a single driver, then I should have learned enough to attempt one or two of the others; thus enabling easy use of Rayman's PSM to PropBASIC users.

    Appended below is my current test-stub.

    It fails gloriously where I try and pass a VAR from PropBASIC into the cog, using a Spin command within the ASM-ENDASM;
    I have studied the different COG commands within Spin, PASM and PropBASIC and am none the wiser.
    You will see that I have not even called the SUB Tonegen; just including the asterisked line kills everything!

    It seems unlikely that I will stumble on the solution without some help from my friends ...



    Code:
    DEVICE          P8X32A, XTAL1, PLL16X
    XIN             5_000_000
    
    ToneNumberSteps       VAR LONG
    ToneLeftPhaseStep     VAR LONG
    ToneRightPhaseStep    VAR LONG
    ToneLeftAttenuation   VAR LONG
    ToneRightAttenuation  VAR LONG
    ToneLeftPin           VAR LONG
    ToneRightPin          VAR LONG
    ToneRunning           VAR LONG
    Frequency             VAR LONG
    Duration              VAR LONG
    Attenuation           VAR LONG
    LeftFrequency         VAR LONG
    RightFrequency        VAR LONG
    
    Tonegen               SUB  3,5
    GetToneNumberSteps    FUNC 1
    GetTonePhaseStep      FUNC 1
                                                        
    
    PROGRAM               Start                 'blinks LED as minimal healthcheck! 
    Start:
    LED PIN 0 LOW
      DO
        HIGH LED
        PAUSE 1000    
        TOGGLE LED
        PAUSE 1000     
      LOOP 
    END
    
    FUNC GetToneNumberSteps 
      ' use duration as __param1
      'lots more code here
      RETURN __param1
      ENDFUNC
    
    FUNC GetTonePhaseStep
      ' use Frequency as __param1 
      'lots more code here  
      RETURN __param1
      ENDFUNC
    
    SUB Tonegen (frequency,duration,attenuation)ŠLeftFrequency,RightFrequency)
        
      ToneNumberSteps=GetToneNumberSteps Duration
      ToneLeftPhaseStep=GetTonePhaseStep LeftFrequency
      ToneRightPhaseStep=GetTonePhaseStep RightFrequency 
      
      ToneRunning=1
     
    ASM
    
    pub spinstart
             
      cognew(@ToneStart,@ToneNumberSteps)                            '******************************************* 
    org 0                                                     
    ToneStart  'Beginning of assembly tone generator
    'lots of assembly code here
    ENDASM
      ENDSUB

    Post Edited (TonyWaite) : 1/4/2010 7:31:31 PM GMT
    Last edited by ForumTools; 09-30-2010 at 06:19 AM. Reason: Forum Migration

  4. #84

    Default

    Tony,
    I'm not quite following what you are trying to do ???

    Do you want the tone generator to run in a seperate cog ? If so, then use a TASK.
    If not, then just put
    ASM
    ' Your assembly instructions
    ENDASM

    It looks like you're making it harder than it is.

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.

    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134·
    Last edited by ForumTools; 09-30-2010 at 06:19 AM. Reason: Forum Migration

  5. #85

    Default

    PropBASIC/query re. swapping VAR/res info

    @Bean
    Thanks for all the advice!
    I am delving deeply into Spin, PropBASIC and PASM. Of course I'm completely out of my depth but have not yet
    given up hope of translating Rayman's Spin/PASM sound-driver into PropBASIC.

    Here's the latest code. I have taken your advice and have started a TASK for the ASM.

    I need to pass the 7 input parameters from the PropBASIC cog into the TASK cog, using the address TonenumberSteps.
    These seven then become appropriately equivalent RES's declared within the TASK cog.

    After much research, I am clearer about some of the memory issues; but no clearer on how to correct the code.
    However, it does get past the compiler and blink the two indicator LED's, which for me is progress.

    There is a great chunk of Rayman's self-contained ASM code to go back in; but I have reduced it to this stub in order
    to resolve the VAR/res issue first.

    Thank you, T o n y

    Code:
    
    DEVICE          P8X32A, XTAL1, PLL16X
    XIN             5_000_000
    
    'following 7 variables declared and used by first cog; trying to pass these to TASK cog ***
    ToneNumberSteps       VAR LONG
    ToneLeftPhaseStep     VAR LONG
    ToneRightPhaseStep    VAR LONG
    ToneLeftAttenuation   VAR LONG
    ToneRightAttenuation  VAR LONG
    ToneLeftPin           VAR LONG
    ToneRightPin          VAR LONG
    
    'other variables
    ToneRunning           VAR LONG               'set to 1 in Tonegen SUB; would like to set to 0 on exiting TASK ***
    Frequency             VAR LONG
    Duration              VAR LONG
    Attenuation           VAR LONG
    LeftFrequency         VAR LONG
    RightFrequency        VAR LONG
    
    'SUB, FUNCs and TASK 
    Tonegen               SUB  3,5
    GetToneNumberSteps    FUNC 1
    GetTonePhaseStep      FUNC 1
    TonegenAssembly       TASK                                                    
    
    PROGRAM               Start                  
    Start:
    LED PIN 0 LOW                               'prepares PropBASIC program indicator LED
      DO
        TOGGLE LED                              'blinks PropBASIC LED as minimal healthcheck 
        PAUSE 1000                              'aids debug by slowing things down 
        Tonegen 400,500,3                       'will eventually output test tone 400Hz, 500mS, attenuation level 3     
      LOOP 
    END
    
    FUNC GetToneNumberSteps 
      ' use duration as __param1
      ' converts the following Spin into PropBASIC: ToneNumberSteps:=(duration*(clkfreq/1000))/200)
      __param2 = clkfreq / 200_000
      __param1 = __param1 * __param2
      'return of __param1 required
      RETURN __param1                           'haven't yet managed to get rid of this line
      ENDFUNC
    
    FUNC GetTonePhaseStep
      ' use Left or Right Frequency passed as __param1 
      ' converts the following Spin into PropBASIC:  TonePhaseStep:=(L or R Frequency*(1<<15)/(clkfreq/200))*(1<<13)*(1<<4)
      __param2 = 1 << 15
      __param1 = __param1 * __param2
      __param2 = clkfreq / 200
      __param1 = __param1 / __param2
      __param2 = 1 << 13
      __param1 = __param1 * __param2
      __param2 = 1 << 4
      __param1 / __param1 * __param2
      'return of _param1 required  
      RETURN __param1                          'haven't yet managed to get rid of this line
      ENDFUNC
    
    SUB Tonegen (frequency,duration,attenuation)ŠLeftFrequency,RightFrequency)
      LED2 PIN 1 LOW                            'prepares sub-routine indicator LED
      ToneLeftPin=11
      ToneRightPin=10
      LeftFrequency=Frequency
      RightFrequency=Frequency
      
      ToneNumberSteps=GetToneNumberSteps Duration               '***ToneNumberSteps is value I would like to pass to TASK
      ToneLeftPhaseStep=GetTonePhaseStep LeftFrequency
      ToneRightPhaseStep=GetTonePhaseStep RightFrequency 
      
      ToneLeftAttenuation=Attenuation
      ToneRightAttenuation=Attenuation
      ToneRunning=1                                   
      COGSTART ToneGenAssembly                                                                             
      TOGGLE LED2
      PAUSE 1000
      ENDSUB
    
    TASK TonegenAssembly
    ASM
    DAT  'Assembly Tone Generator
    org 0
    Tonestart                                                   '***beginning of assembly tone generator 
                                                                '***load input parameters from first cog to par in
                                                                '***TASK cog, given address ToneNumberSteps from 
                                                                '***first cog; passed to par in TASK cog.
                                                                
                  movd      ar,#tNumberSteps        'copies 7 parameters to location starting with tNumberSteps  
                  mov       temp1,par
                  mov       temp2,#7                  'there are 7 input parameters
    ar          rdlong    0,temp1
                  add       ar,dlsb
                  add       temp1,#4
                  djnz      temp2,#ar
    'loads more code here
    'now closing code
                  'would like to set ToneRunning in first cog to 0 here!  ***
                  COGID     temp1                             
                  COGSTOP   temp1                              
    
    'setup parameters                           
    tCounterMode  long %00011000_00000000_00000000_00000000
    dlsb          long  1 << 9
    
    'phase accumulators
    LeftPhase     long  0
    RightPhase    long  0
    
    'main loop vars
    dcnt          long  200  '#clocks/main loop  --> gives 400kHz update rate
    offset        long  $8000_0000
    
    'Working variables
    temp1         res  1
    temp2         res  1          
    wait          res  1
    'Input Parameters
    tNumberSteps  res  1    'Determines tone duration (left and right)
    tLeftStep     res  1    'Determines left tone frequency 
    tRightStep    res  1    'Determines right tone frequency    
    tLeftAtten    res  1    'Determines left tone volume (0=loud, 8=soft)
    tRightAtten   res  1    'Determines right tone volume (0=loud, 8=soft) 
    tLeftPin      res  1    'Pin# for left audio output (negative number disables)
    tRightPin     res  1    'Pin# for right audio output (negative number disables)
         
    ENDASM
      ENDTASK
    Last edited by ForumTools; 09-30-2010 at 06:19 AM. Reason: Forum Migration

  6. #86

    Default

    Tony,
    · Could you provide a link to Rayman's code ?
    · I did a search but I couldn't find it.

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.

    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    Post Edited (Bean (Hitt Consulting)) : 1/5/2010 9:56:17 PM GMT
    Last edited by ForumTools; 09-30-2010 at 06:19 AM. Reason: Forum Migration

  7. #87

    Default

    Hi Bean,

    I'd have replied more quickly, but everything's come to a halt with just 1/2" of snow!
    (abandoned car last night; walked home; got it back at the midnight thaw; took 2 hours travelling 4 miles by train this morning)

    Rayman's sound-driver is PSM_ToneGenerator.spin from the PSM section of his Rayslogic website:

    http://rayslogic.com/Propeller/Products/PSM/Software/PSM_SerialControl - Archive [Date 2009.06.26 Time 16.54].zip

    And I have uploaded it with this post.

    Thanks,

    T o n y
    Attached Files Attached Files
    Last edited by ForumTools; 09-30-2010 at 06:19 AM. Reason: Forum Migration

  8. #88

    Default

    Kinda pathetic really isn't it how 1/2" of snow has caused the country to come to a stand still because they didn't prepare for it. lol

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
    Last edited by ForumTools; 09-30-2010 at 06:19 AM. Reason: Forum Migration

  9. #89

    Default

    now now Baggers, here in Buxton we have PLENTY of snow and everyone likes it!! (sorry to go so off-topic; what was this thread about again?)
    Last edited by ForumTools; 09-30-2010 at 06:19 AM. Reason: Forum Migration

  10. #90

    Default

    I have posted several updates today...

    Please download the latest version if you are using PropBASIC.

    Tony,
    · Here is my version of Raymans tone generator.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.

    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    Post Edited (Bean (Hitt Consulting)) : 1/7/2010 1:13:50 AM GMT
    Attached Files Attached Files
    Last edited by ForumTools; 09-30-2010 at 06:19 AM. Reason: Forum Migration

  11. #91

    Default

    Hi Bean,

    Thanks for the brilliant code: I'm studying it to learn how it works.

    I had to declare _Freq as VAR LONG to get it to run.

    The demonstration loop is very sci fi!

    In awe,

    T o n y
    Last edited by ForumTools; 09-30-2010 at 06:19 AM. Reason: Forum Migration

  12. #92

    Default

    Tony,
    Download version 00.00.58 that I just posted.

    That will leave _Freq alone so you don't have to declare it.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.

    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134·
    Last edited by ForumTools; 09-30-2010 at 06:19 AM. Reason: Forum Migration

  13. #93

    Default

    Thanks Bean!
    I'd been mistakenly updating from the www.PropBASIC website, thinking it the primary source.
    Now I know better.
    With the new version your demo file sounds like a car alarm as opposed to a monster
    hunting in the deep sometime in the future. I wondered about your musical tastes that you
    would choose such a rumbling, uneasy soundbite!
    It also explains some of the strange performance while I was playing with it ...
    T o n y
    Last edited by ForumTools; 09-30-2010 at 06:19 AM. Reason: Forum Migration

  14. #94

    Default

    Tony,
    Sorry about that. I haven't been updating the website.
    I just did now, but this post will always have the latest version first.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.

    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134·
    Last edited by ForumTools; 09-30-2010 at 06:19 AM. Reason: Forum Migration

  15. #95

    Default

    All--

    Reading this thread was like one of those books you just can't put down! The work Bean and JonnyMac are doing is beyond belief. I know it will pay off for Parallax and I sincerely hope it pays off for them, as well.

    --Bill

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
    Last edited by ForumTools; 09-30-2010 at 06:19 AM. Reason: Forum Migration

  16. #96

    Default

    Terry,

    Could you change the date in the title? It would be cruel to make us wait 11 months for the next installment

    Jim
    Last edited by ForumTools; 09-30-2010 at 06:19 AM. Reason: Forum Migration

  17. #97

    Default

    Jim,
    · Sorry about that. I'll get that fixed.

    To all forum members:
    · If you have some code you'd like to see converted (from PBASIC or SX/B specifically) just post it in this thread and I'll have a go at it.
    · I just ask that you have the propeller hardware to try the PropBASIC code on to see if it works.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.

    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134·
    Last edited by ForumTools; 09-30-2010 at 06:19 AM. Reason: Forum Migration

  18. #98

    Default

    @Bean, I noticed you cover NTSC, but, will you be creating any demo programs for VGA? To bad PropBasic does not have a .lib provision, could be a way of saving some time, instead of re-inserting all of the code all of the time.

    Ray
    Last edited by ForumTools; 09-30-2010 at 06:19 AM. Reason: Forum Migration

  19. #99

    Default

    @Ray
    There is the LOAD command within PropBASIC, which I believe would enable some of the functionality
    of the dot-LIB that you suggest ...
    @Bean
    ... except that I haven't yet fathomed out how to get it to work!
    Is there any chance of a working example of PropBASIC script that uses LOAD to call your tonegenerator.pbas code?
    T o n y
    Last edited by ForumTools; 09-30-2010 at 06:19 AM. Reason: Forum Migration

  20. #100

    Default

    TonyWaite said...
    @Bean
    ... except that I haven't yet fathomed out how to get it to work!
    Is there any chance of a working example of PropBASIC script that uses LOAD to call your tonegenerator.pbas code?
    T o n y
    Tony,
    · The only "trick" is that you need two files. One for the definitions at the beginning of the program. And another for the actual code at the end of the program.

    · Here I have put the instructions into one file named "ToneGen.hdr" for the header. And "ToneGen.cod" for the code. You can use whatever extension works best for you.

    Bean.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.

    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134
    Attached Files Attached Files
    Last edited by ForumTools; 09-30-2010 at 06:19 AM. Reason: Forum Migration

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts