p2asm

124»

Comments

  • "We suspect that ALMA will allow us to observe this rare form of CO in many other discs.
    By doing that, we can more accurately measure their mass, and determine whether
    scientists have systematically been underestimating how much matter they contain."
  • @evanh

    I am getting used to your code and am now understanding it.
    Got a question.
    Added a string to print. It looks identical to the others but I now get the following error message:

    cog label must be long aligned.
    If I comment out one of the strings the error goes away.
    Do I have to change from bytes to longs?

    Thanks.
    “Light thinks it travels faster than anything but it is wrong. No matter how fast light travels, it finds the darkness has always got there first, and is waiting for it.”
    “You only live twice:
    Once when you are born
    And once when you look death in the face”
  • evanhevanh Posts: 8,105
    edited 2019-04-28 - 02:32:21
    Cool, I did some learning myself while writing those routines.

    Okay, I'm going to give you two answers for that error. First answer is for making the #puts routine work: #puts expects the string to be located in hubram. For that you should use a single ORGH directive ahead of the strings as a group. No need for a specific address, just "ORGH" sorts it. As a side effect, this makes the error go away.

    As a side note, it wouldn't be too hard to make a #cogputs routine as well.


    Second answer is a fix the error with byte data in cogram (This is not for #puts routine). You can either use ALIGNL directives for every string or hand pad the data to multiples of four bytes, eg:
    str1		byte    " test",13,10,0[1]     '8 bytes
    str2            byte   " sucess",13,10,0[3]     '12 bytes
    str3            byte   " working",13,10,0[2]     '12 bytes
    
    
    "We suspect that ALMA will allow us to observe this rare form of CO in many other discs.
    By doing that, we can more accurately measure their mass, and determine whether
    scientists have systematically been underestimating how much matter they contain."
  • PS: The reason why #puts would have been printing correct strings without a ORGH is because the way the first cog is booted. When the program is loaded from serial port it is placed in hubram starting from address zero. Once the loading is finished a COGINIT is executed to copy the first 2kB of hubram into cogram and then starts executing from zero in cogram.

    At this point there is duplicate copies of the downloaded program in the Prop2. So you can reference the data in either hubram or cogram and see the same. That's what is happening with the #puts routine, it's reading the hubram data that just happens to be identical to the cogram data.
    "We suspect that ALMA will allow us to observe this rare form of CO in many other discs.
    By doing that, we can more accurately measure their mass, and determine whether
    scientists have systematically been underestimating how much matter they contain."
  • @evanh

    Thanks for the help. I am now able to get the multiple strings to work.
    Now attempting to get the decimal stuff to work . Using itod??
    Please see attached.

    Your help has been great. I never understood fullduplexserial until now. Just trying to get the bugs out of my brain and tidy up the code. Wonderful learning experience.
    “Light thinks it travels faster than anything but it is wrong. No matter how fast light travels, it finds the darkness has always got there first, and is waiting for it.”
    “You only live twice:
    Once when you are born
    And once when you look death in the face”
  • Yep, itod is for printing the decimal representaion of integer in the PA register. It's not any sort of floating-point, in case you may have thought so.

    In terms of the way I've written the routine, I didn't look up any known methods so it may well be long winded in the way it converts from lsb first into a complete string of BCD digits before transmitting as human readable msb ordered.
    "We suspect that ALMA will allow us to observe this rare form of CO in many other discs.
    By doing that, we can more accurately measure their mass, and determine whether
    scientists have systematically been underestimating how much matter they contain."
  • ok thanks
    “Light thinks it travels faster than anything but it is wrong. No matter how fast light travels, it finds the darkness has always got there first, and is waiting for it.”
    “You only live twice:
    Once when you are born
    And once when you look death in the face”
  • Hi Dave

    Found another issue with p2asm - the "IF_XX" and "IF_NOT_XX" style of instruction prefixes compile ok with PNUT, but they don't compile properly in p2asm - but they also don't give an error.

    For example, try
    DAT
    
    ' these should be the same ...
    
     IF_X0        mov 0,0 
     if_nz        mov 0,0
    
    ' and these ...
    
     IF_00        mov 0,0 
     if_nz_and_nc mov 0,0
    
    ' and these ...
    
     IF_NOT_10    mov 0,0 
     if_nc_or_z   mov 0,0
    
    ' etc ...
    
    Catalina - a FREE ANSI C compiler for the Propeller.
    Download it from http://catalina-c.sourceforge.net/
Sign In or Register to comment.