Shop OBEX P1 Docs P2 Docs Learn Events
The @ — Parallax Forums

The @

LoopyBytelooseLoopyByteloose Posts: 12,537
edited 2006-10-17 15:42 in General Discussion
Apparently the @ sign is used by the compiler for a far call.

I have seen it often in code and it has taken me months [noparse][[/noparse]maybe years] to sort out that it is a particular compiler feature [noparse][[/noparse]I know, I should have just asked here].

It is not indexed into Guenther's book and Section 1.18.2·page 193 makes only one comment in passing about it.· I presume that the Senix-Ubicom documents explain it in mored detail and I will look there.· But, if ever Guenther has a second· third edition, it may be helpful to provide further discussion and index the feature.·

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"If you want more fiber, eat the package.· Not enough?· Eat the manual."········
···················· Tropical regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan

Post Edited (Kramer) : 10/18/2006 3:51:19 PM GMT

Comments

  • pjvpjv Posts: 1,903
    edited 2006-10-10 15:45
    Hi Kramer;

    The purpose of the @ is to cause the compiler to insert a "page" instruction referincing to page that the targeted code is located on.

    Cheers,

    Peter (pjv)
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-10-10 16:21
    Thanks,
    In concept it is quite simple.
    But I wasn't sure if the program author had a preference for odd names or what.

    I located the detailed discussion in the SX-Key manual which I intend to re-read tomorrow. And the old Ubicom SX Cross Assembler User's Manual mentions in Section 2.3.1 that the @ and the ! among the reserved symbols for the compiler. But oddly, it forgot the numerical zero. And, I cannot find any further discussion therein.

    At this point, it seems that I can use it with the Jump or Call instructions in lieu of a specific bank selection prior to these. Seems to be a question of style and I just got stumped with one example program that uses it extensively.

    I tend to depend heavily on Guenther's text because it does have an index and two good reference sections. The SX-key has discussion in Sections 15.2.14 and 15.2.16 , but also does not index it.

    I must admit that I hadn't looked at the SX-Key Develoment System Manual for quite some time.
    I still thnk that all odd ball reserved characters should be indexed. In this case they would be the @, the !, and the :.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "If you want more fiber, eat the package.· Not enough?· Eat the manual."········
    ···················· Tropical regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2006-10-10 16:56
    Hi Kramer,

    you are right - I missed to include the @ in the index - sorry for that. On the other hand, I have dedicated a special sub-chapter (1.15.1.2 "The @jmp and @call Options") to this magic character, and sub-chapters 1.15.1.3 and 1.18.2 also deal with it, so I think I have given this @ all the attention it deserves (except the index entry).

    BTW:

    Look at an instruction sequence like this:

    test Foo
    sz
    jmp @FarAway

    SASM converts this into

    test Foo
    sz
    page FarAway
    jmp FarAway

    At first glane, you might expect that the SX executing the "sz" instruction only skips the "page" instruction when the Z flag is set, and then always executes the "jmp FarAway" instruction which would not be what you have intended, and would also send program execution into "Nowhere Land", as the page instruction did not execute. Fortunately, the SX is clever enough to recognize this situation: All "page" instructions following a conditional skip instuction plus the first instruction following the last "page" instruction will be skipped, i.e. even a construct like this

    test Foo
    sz
    page FarAway
    page FarAway
    page FarAway
    page FarAway
    page FarAway
    jmp FarAway

    would work as expected at the cost of some extra instruction cycles.

    The same is true for the "bank" instruction, so in

    test Foo
    sz
    bank Serial
    mov Serial_TxData, w

    both instructions, the "bank Serial", and "mov Serial_TxData, w" will be skipped in case "test Foo" evaluates to zero.

    Another BTW: In Germany, we call the @ a "Genscher Ohr" (= "Genscher ear"), as it pretty much looks like the ears of our former state secretary Genscher who was in office during the German re-unification smile.gif .

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-10-11 08:25
    Thanks Guenther.
    I will take a look at Sec 1.15.1.3 and annotate my book's index.
    A good index is like gold.
    A good summary [noparse][[/noparse]which doesn't exist] of specifically restricted characters would be nice too.

    Your examples of the 'skip behavior' are quite helpful too. Learners [noparse][[/noparse]like myself] often don't know what they need to notice.

    In Taiwan, the @ is called the 'mouse tail', since the internet began, the @ symbol's name that other languages have adopted are quite diverse. There is something in linguistics about amusing names just get recognized and widely accepted.

    Very few Taiwanese understand that this symbol was created for simplifying writing price lists and invoices [noparse][[/noparse]4 items @ $1.50 = $6.00]

    Mainly, I now see that we have a compiler sub-catagory of 'lable prefixes' of three items: the @lable for far calls and far jumps, the :lable for localized lables, and the !lable for writing to mode registers. The behaviors and uses are quite different.

    All three should be indexed. The @lable·may be·the most obscure because it appears a lot of programers don't used it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "If you want more fiber, eat the package.· Not enough?· Eat the manual."········
    ···················· Tropical regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan

    Post Edited (Kramer) : 10/11/2006 3:05:08 PM GMT
  • John CoutureJohn Couture Posts: 370
    edited 2006-10-13 17:21
    Kramer and Guenther,

    That is Sooooooo Funny! I love little tidbits like that for my computer science classes. Thanks guys!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John J. Couture

    San Diego Miramar College
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2006-10-13 21:53
    John,

    I'm glad that you like it. This reminds me that I did not update the SX FAQ document since a long time - hope I'll have the necessary time soon.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • ellizardellizard Posts: 106
    edited 2006-10-14 17:01
    HI all,

    Taking the move from this subject i would raise a question for other symbols used in assembly programming that are not easy to find in the text (not only in Guenther's book) what's about ">>" or "|", I was not able to find a description of this in the literature.

    would not be possible to publish for the SX a note with the explanation for all the symbol and signs that are used in assembly for the SX?

    thanks

    Stefano

    P.S. may be I was only not able to find them?
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2006-10-14 23:22
    Stefano,

    please locate the "sticky" SX FAQ thread at the beginning of this forum section. The SX FAQ document you can download from there contains some explanations of these "magic" characters. I f you need more information, please let me know, and I'll cover them in the next update of the FAQ text, and in the next revision of my book.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • ellizardellizard Posts: 106
    edited 2006-10-15 07:56
    Guenther,

    I knew there where somewhere the informations,
    As you can easily understand I am less than an apprentice, and making clear every sign of a .src program is of capital importance.
    Thank you.

    Stefano
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-10-15 11:16
    Hi again,
    Ellizared - I think that Senix-Ubicom presumed a lot of these symbols were common knowledge and this somewhat carried over into Parallax documentation. After all, their documents were never meant for the complete begineer.

    Maybe one day there will be a 2nd 3rd edition of Guenther's text and a listing can be included in the Quick Reference section.

    I feel a bit foolish because I found the @ discussed quite plainly in Guenther's Table of Contents [noparse][[/noparse]which I failed to look at]. Guenther does a wonderful job and is by far the best resource due to the indexing, the quick reference section, and the reference section. And of course the Table of Contents.

    There are some odd ball items that may never be of use. Turning off the Turbo speed is the most obvious. Reserved words like ZSTR appearing in SASM and SX-KEY seem to have been of use it the past but are no longer in use. It would also be nice to know what is no longer supported.

    In sum, I still place Gunether's book as the best Primary Resource for learning the SX-28 nd SX-48. And, I believe it can only get better. For me, it has been an excellent enty into assembly language programing in one text.

    I guess it is time for me to re-read the SX FAQ too.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "If you want more fiber, eat the package.· Not enough?· Eat the manual."········
    ···················· Tropical regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan

    Post Edited (Kramer) : 10/18/2006 3:52:43 PM GMT
  • ellizardellizard Posts: 106
    edited 2006-10-15 16:59
    HI Kramer,

    I have a good practice with PBasic, and now to cover what it's not possible to do with Basic Stamps, I'm trying to learn assembler, so in this I'm less than an apprentice, but somewhere it as to be started, i started with the books and information on internet too, but there is so much to apprehend that sometime I am tempted to catch someone's program and analize it, this faces me with new sintax conventions and get me a bit confused, so in the run, may be I have not immediately in my mind the book and the page in wich that particular sign or formula is kept.
    Also I can only deserve to this hobby few hours a month, so the learning curve is very long..........

    Anyway thanks for the kind reply
    Regards
    Stefano

    P.S. All the different chips's assembler are similar and the notation is similar too, but not the same, and (my experience with PicBasic and PBasic teach) this has led me to very stupid situations..........

    Post Edited (ellizard) : 10/15/2006 5:04:15 PM GMT
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-10-17 15:42
    Elizard,

    I do understand.· Keep working on it.· At times, Wikipedia can be a good quick reference for computing.

    I have had to move back and forth between this hobby and my work responsiblities.· Living in Taiwan, I don't have much of an English library to work with.· At times, it seems there are not enough hours in a day to think about programing.· In the end, I am sure that many people would consider me a slow learner or at least a forgetful one.· But the thing is that I am making progress and am fully commited to mastering assembly language programing.·

    For myself, the RISC set has been idea and Guenther writes a good precise introduction.· Also, the fellowship here has really kept my goal from being a lonely isolated one.· People in general and Guenther in particular are very patient with being asked the same questions again and again.·

    I would stay with Guenther's text as your main resource.· Use the SX-Key manual as a backup.· The SXlist website at www.sxlist.com offers a wealth of examples and discussion that are often overlooked for study.· And Guenther's simulator is a wonderful tool for actually watching a program move through it's paces.

    At least at Parallax, there are no stupid questions - only dubious answers.· So when stuck, just ask.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "If you want more fiber, eat the package.· Not enough?· Eat the manual."········
    ···················· Tropical regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
Sign In or Register to comment.