Today 11:35
Forum: Proton Plus Compiler v3
Starter: crankshaft
Views: 0
Replies: 8
Today 11:13
Forum: Timer Modules
Starter: nemocapt
Views: 0
Replies: 1
Go to last post By: shantanu@india
Today 09:27
Forum: The Lounge
Starter: shantanu@india
Views: 0
Replies: 2
Today 09:19
Forum: Proton Plus Compiler v3
Starter: Dave-S
Views: 0
Replies: 13
Go to last post By: AlbertoFS
Today 09:04
Forum: The Lounge
Starter: fanie
Views: 0
Replies: 9
Go to last post By: charliecoultas
Today 08:29
Forum: Proton Plus Compiler v3
Starter: Dave-S
Views: 0
Replies: 4
Yesterday 23:57
Forum: The Lounge
Starter: Mark Rodgers
Views: 0
Replies: 2
Yesterday 23:44
Forum: The Lounge
Starter: Les
Views: 0
Replies: 5
Yesterday 23:42
Forum: The Lounge
Starter: Tim
Views: 0
Replies: 6
Go to last post By: towlerg
Yesterday 22:22
Forum: Proton Plus Compiler v3
Starter: Frizie
Views: 0
Replies: 3
Go to last post By: Dave-S
Yesterday 19:19
Forum: Proton Plus Compiler v3
Starter: Dave-S
Views: 0
Replies: 1
+ Reply to Thread
Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23

Thread: Help with Macros10 days old

  1. #11
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    562
    Thumbs Up
    Received: 72
    Given: 2
    Total Downloaded
    1.93 GB

    1 Not allowed!

    Default Re: Help with Macros

    Hi George,
    You can find information about the pre-processor on page 412 of the manual. I know it is not enough to know everything concerning the use of macros by the pre-processor.
    I have had to learn by reading and studying all the macros written by Les. Sometimes you can merge the pre-processor with a macro in assembler to get a particular application. You can find many examples in the Les's libraries or reading my projects/libraries that I wrote on the wiki.

    Sorry for not understanding your request earlier. Sometimes I find it difficult to understand some questions. I do not speak english.
    Regards
    Alberto
    [U]73's de Alberto ea3agv[/U]

  2. #12
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,248
    Thumbs Up
    Received: 47
    Given: 112
    Total Downloaded
    2.36 GB

    0 Not allowed!

    Default Re: Help with Macros

    Thanks Alberto. No worries about you're English, you seem to manage just fine.
    George

  3. #13
    Administrator John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,882
    Thumbs Up
    Received: 73
    Given: 25
    Total Downloaded
    1.37 GB

    0 Not allowed!

    Default Re: Help with Macros

    You're not alone George. I'm also totally confused. We really need an article in the WIKI or a new section in the manual. Maybe Les's new book will.
    John

  4. #14
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,248
    Thumbs Up
    Received: 47
    Given: 112
    Total Downloaded
    2.36 GB

    0 Not allowed!

    Default Re: Help with Macros

    Right, having dealt with the strings distraction (thanks again Alberto) I return to my "macro" issue.

    So I know now that I can't use an assembler macro (thanks again John).

    The Proton preprocessor will let me copy a parameter into a string variable and run a sub, as in
    Code:
    $define SomeMacroName(NameOfQuotedString) '
        StringVariable= NameOfQuotedString'
        GoSub PerformSomeFunction
    to be used as

    SomeMacroName("arbitrary string of text")

    and the net result will be that StringVariable = arbitrary string of text and PerformSomeFunction is called.

    so far so good

    but what if I don't want to use memory for a temporary buffer. Can I access the string in ROM?

    Looking at the .lst file looks like its not possible. The compiler creates the string/strings inside its runtime, accessed by its/their label.

    BTW Alberto, this is the reason I wanted a pointer and a length.

    Looks like I'm s**t out of luck. Anyone?
    Last edited by towlerg; 14th September 2017 at 14:47.
    George

  5. #15
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    562
    Thumbs Up
    Received: 72
    Given: 2
    Total Downloaded
    1.93 GB

    0 Not allowed!

    Default Re: Help with Macros

    Hi George,
    Exactly, everything I comented you, the "Strings" were loaded in RAM memory in runtime.

    I began to understand your question and it is not possible because you can not know the Label names in ROM in advance.
    Would not it be easier to write the Strings in ROM with Cdata and then load the Strings Buffers into RAM with the ROM strings?
    It is easy.
    Regards
    Alberto
    P.S. Maybe if you explained the application, we could help you in another way.
    Please send me an e-mail. (possible solution)
    Last edited by AlbertoFS; 14th September 2017 at 16:03.
    [U]73's de Alberto ea3agv[/U]

  6. #16
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,248
    Thumbs Up
    Received: 47
    Given: 112
    Total Downloaded
    2.36 GB

    0 Not allowed!

    Default Re: Help with Macros

    Alberto, if it were possible to get a pointer to the string in ROM, I would send it a byte at a time to a PC via serial, so no temporary buffer and no RAM used. The app I'm working on is here
    George

  7. #17
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    562
    Thumbs Up
    Received: 72
    Given: 2
    Total Downloaded
    1.93 GB

    0 Not allowed!

    Default Re: Help with Macros

    Hi George,
    I downloaded the project (VarDispSerDemo.bas) and I compiled it.
    I found only one single String, defined as: Dim String_Var As String * 10. Is it right?
    You have written the line: String_Var = "some strin" and you wanted to know the address and length of the String in the ROM, is it correct?

    I can see some things.
    - The length of the String in the ROM will depend on the length of the string of characters you are going to load into the RAM at run time, for example:
    If "Dim String_Var As String * 25" and "String_Var = "some string", only 11 characters will be written in the ROM. Then the lenght of the String is easy to know: LenghtString = Len(String_Var). These infos written in RAM would never be lossed because there are loaded again in RAM after every Reset.

    - Because of the program, if the number of characters loaded in the RAM String varies, it is of no use reading the ROM because it will always be false.

    - Yes, the string address in the ROM could be found with a lot of code and some tricks.

    - But I do not see any utility because you are already using RAM (It is more easy).

    - The correct solution is to use Cdata and I can make a macro to send by RS232 the String/lenght/Address. (No RAM used)

    String1: Cdata "Some Strings",0 ' Written in ROM.
    String2: Cdata "More others Strings",0 ' Written in ROM.

    Could you give me more information?
    Regards
    Alberto
    Last edited by AlbertoFS; 14th September 2017 at 18:20.
    [U]73's de Alberto ea3agv[/U]

  8. #18
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,248
    Thumbs Up
    Received: 47
    Given: 112
    Total Downloaded
    2.36 GB

    0 Not allowed!

    Default Re: Help with Macros

    Alberto
    I found only one single String, defined as: Dim String_Var As String * 10. Is it right?
    You have written the line: String_Var = "some strin" and you wanted to know the address and length of the String in the ROM, is it correct?
    No, thats just a test of strings and unrelated to this issue.

    Depending on which version you downloaded, in either VarDispSer.inc or SnapShotInc.inc you will see two macros Dump and DumpW. The first will dump RAM (among other things) and continue, the second will dump RAM and wait for a key press on the PC. Now I want to add another option to send an arbitary message to the PC, which for now I'm calling Message("bla bla").

    The length of the String in the ROM will depend on the length of the string of characters you are going to load into the RAM
    I'm trying to minimize the use of RAM so I'm loath to create a temporary RAM buffer unless I have to.

    Yes, the string address in the ROM could be found with a lot of code and some tricks.
    I can't see how, bear in mind there could be many uses of Message("bla bla") so many _STRLB__n's

    The correct solution is to use Cdata and I can make a macro to send by RS232 the String/lenght/Address. (No RAM used)
    An option, but more complicated. I need something that you can quickly add to the source, recompile and run.
    Last edited by towlerg; 15th September 2017 at 00:15.
    George

  9. #19
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    562
    Thumbs Up
    Received: 72
    Given: 2
    Total Downloaded
    1.93 GB

    0 Not allowed!

    Default Re: Help with Macros

    Hi George,
    Now I understand your need, although I do not fully understand their use, but this does not matter to me.

    Preamble:
    1- Detect the label of the first String defined by the label (_STRLB__1) generated by the compiler in the ASM file but invisible in ROM.
    2- Detect the final label of the last string defined by the label (_STRLB__X) generated by the compiler in the ASM file but invisible in ROM.
    3- Determine the address and length of each String that will give us the format of each String.

    In my opinion, the system could work as follows:
    - Determine the beginning of the Strings in ROM.
    - Calculate the beginning and lenght of each String.
    - Send the ASCII characters already formatted to the terminal if needed. In other words, send a Carriage Return + Line Feed to the end of each string.
    - Determine the end of the Strings in ROM.

    At the moment I can see one possibility:
    - Place a special String at the beginning of the source program to start the strings list. (Any String you want)
    - Place a special String at the end of the source program to finish the strings list. (Any String you want)

    Depending on how the compiler works the strings of synchronization should be 6 characters to be placed in the same conditions, for example:
    Code:
        Dim MyString0 As String * 6
        Dim EndString As String * 6
    
    Main:
        MyString0 = "000000"
    
        Code...
        MyString1 = "Hello World"
        Code...
        Hrsout "Hellow World",13
        Code...
        Print At 1,1, "Some Strings"
        Code...
        MyString2 = "Testing a string"
        Code...
        MyString3 = "Macro for Strings"
        Code...
        Code...
    
        ' Final of the program.
        EndString = "999999"
        End
    You should read the ROM from address 0 and detect 6 times the character 0 in ASCII (48 in decimal) + 0 for the end, for the header.
    Read the ROM until you find and detect 6 times the 9 character in ASCII (57 in decimal) + 0 for the ending to finish.
    You have to be careful with the Config Fuses, which is allowed to read the ROM.

    ASM file:
    Code:
    _STRLB__1
        db 48,48,48,48,48,48
        db 0
    _STRLB__2
        db 72,101,108,108,111,32
        db 87,111,114,108,100,0
    _STRLB__3
        db 84,101,115,116,105,110
        db 103,32,97,32,115,116
        db 114,105,110,103,0
    _STRLB__4
        db 77,97,99,114,111,32
        db 102,111,114,32,83,116
        db 114,105,110,103,115,0
    _STRLB__5
        db 57,57,57,57,57,57
        db 0
    proton#main#start
    In my Bootloader article on the wiki, you can find all the codes to read the ROM.

    I hope that this solution may suit you. I do not see another solution for the moment. You have posed a very difficult problem.
    Regards
    Alberto
    Last edited by AlbertoFS; 15th September 2017 at 08:46.
    [U]73's de Alberto ea3agv[/U]

  10. #20
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    562
    Thumbs Up
    Received: 72
    Given: 2
    Total Downloaded
    1.93 GB

    0 Not allowed!

    Default Re: Help with Macros

    You have to be careful in reading the strings. As the ROM is formatted in Words, if the string has a even number of characters the end will be 0 + 0 (binary). If the string has an odd number of characters the end would be Ascii character + 0.
    Alberto
    [U]73's de Alberto ea3agv[/U]

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Timer Macros
    By johngb in forum Proton Plus Compiler v3
    Replies: 1
    Last Post: 30th December 2011, 19:01
  2. MACROS - Please be gentle
    By Barry in forum Proton Plus Compiler v3
    Replies: 3
    Last Post: 29th January 2010, 00:14
  3. SD Macros
    By Mike B in forum Proton Plus Compiler v3
    Replies: 8
    Last Post: 17th October 2008, 00:53
  4. Help with macros
    By the.fox in forum Proton Plus Compiler v3
    Replies: 4
    Last Post: 14th April 2005, 19:55

Members who have read this thread since 20th September 2017, 05:01 : 3

Actions :  (Set Date)  (Clear Date)

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

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