Advertisement
Guest User

Untitled

a guest
May 7th, 2017
583
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MPASM 6.87 KB | None | 0 0
  1. Return-Path: gnupic-return-7143-ralph=inputplus.co.uk@linuxhacker.org
  2. Delivery-Date: Sun Jun  7 12:29:16 2009
  3. Return-Path: <gnupic-return-7143-ralph=inputplus.co.uk@linuxhacker.org>
  4. X-Original-To: ralph@localhost
  5. Delivered-To: ralph@localhost
  6. Received: from blake.inputplus.co.uk (localhost.localdomain [127.0.0.1])
  7.     by blake.inputplus.co.uk (Postfix) with ESMTP id 2EA55449D
  8.     for <ralph@localhost>; Sun,  7 Jun 2009 12:29:16 +0100 (BST)
  9. Delivered-To: inputplu-inputplus:co:uk-ralph@inputplus.co.uk
  10. X-Envelope-To: ralph@inputplus.co.uk
  11. Received: from ruis.pair.com [209.68.1.63]
  12.     by blake.inputplus.co.uk with IMAP (fetchmail-6.3.8)
  13.     for <ralph@localhost> (single-drop); Sun, 07 Jun 2009 12:29:16 +0100 (BST)
  14. Received: (qmail 76788 invoked from network); 7 Jun 2009 11:26:51 -0000
  15. Received: from mailwash26.pair.com (66.39.2.26)
  16.   by ruis.pair.com with SMTP; 7 Jun 2009 11:26:51 -0000
  17. Received: from localhost (localhost [127.0.0.1])
  18.     by mailwash26.pair.com (Postfix) with SMTP id 8A60AFFA33
  19.     for <ralph@inputplus.co.uk>; Sun,  7 Jun 2009 07:26:51 -0400 (EDT)
  20. X-Spam-Check-By: mailwash26.pair.com
  21. X-Spam-Status: No, hits=-2.6 required=4.0 tests=BAYES_00 autolearn=ham version=3.002005
  22. X-Spam-Flag: NO
  23. X-Spam-Level:
  24. X-Spam-Filtered: 52d0813afd638bc4ffa68db06ca49a29
  25. Received: from linuxhacker.org (troy.alexholden.net [82.70.130.131])
  26.     by mailwash26.pair.com (Postfix) with ESMTP id BD38DFFA53
  27.     for <ralph@inputplus.co.uk>; Sun,  7 Jun 2009 07:26:42 -0400 (EDT)
  28. Received: (qmail 20215 invoked by uid 101); 7 Jun 2009 12:25:30 +0100
  29. Received: from 192.168.43.2 by troy (envelope-from <gnupic-return-7143-ralph=inputplus.co.uk@linuxhacker.org>, uid 0) with qmail-scanner-1.25
  30.  (clamdscan: 0.87.1/1168.  
  31.  Clear:RC:1(192.168.43.2):.
  32.  Processed in 0.556871 secs); 07 Jun 2009 11:25:30 -0000
  33. X-Qmail-Scanner-Mail-From: gnupic-return-7143-ralph=inputplus.co.uk@linuxhacker.org via troy
  34. X-Qmail-Scanner: 1.25 (Clear:RC:1(192.168.43.2):. Processed in 0.556871 secs)
  35. Received: from bender.nelson (192.168.43.2)
  36.   by troy.alexholden.net with SMTP; 7 Jun 2009 12:25:29 +0100
  37. Received: (qmail 864 invoked by alias); 7 Jun 2009 11:25:13 -0000
  38. Mailing-List: contact gnupic-help@linuxhacker.org; run by ezmlm
  39. Precedence: bulk
  40. X-No-Archive: yes
  41. list-help: <mailto:gnupic-help@linuxhacker.org>
  42. list-unsubscribe: <mailto:gnupic-unsubscribe@linuxhacker.org>
  43. list-post: <mailto:gnupic@linuxhacker.org>
  44. Reply-To: gnupic@linuxhacker.org
  45. Delivered-To: mailing list gnupic@linuxhacker.org
  46. Received: (qmail 852 invoked by uid 0); 7 Jun 2009 11:25:13 -0000
  47. X-Qmail-Scanner-Mail-From: HolgerRapp@gmx.net via troy
  48. X-Qmail-Scanner: 1.25 (Clear:RC:0(213.165.64.20):. Processed in 0.064161 secs)
  49. X-Authenticated: #565844
  50. X-Provags-ID: V01U2FsdGVkX18+WARH7fg+BL9+leE/EnVAcS2xUxKx1+5WWQKVFv
  51.     XHqyJ56qY+QeSz
  52. Message-Id: <705B9F99-3E7C-40DF-A9BA-36210557F430@gmx.net>
  53. From: Holger Rapp <HolgerRapp@gmx.net>
  54. To: gnupic@linuxhacker.org
  55. In-Reply-To: <492f1420906070305x3887424cy780dbced35c0010@mail.gmail.com>
  56. Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
  57. Content-Transfer-Encoding: 7bit
  58. Mime-Version: 1.0 (Apple Message framework v935.3)
  59. Date: Sun, 7 Jun 2009 13:25:09 +0200
  60. References: <3AE07D7E-6D3B-4942-B404-54A0B1F20343@gmx.net> <4d52f78b0906061403w1d09b7f0i1d48630bd92cca72@mail.gmail.com> <20090606235836.GA29373@cs.wisc.edu> <4d52f78b0906061720heeced6bnb14d1ed62034c660@mail.gmail.com> <20090607065700.GA4598@cs.wisc.edu> <492f1420906070305x3887424cy780dbced35c0010@mail.gmail.com>
  61. X-Mailer: Apple Mail (2.935.3)
  62. X-Y-GMX-Trusted: 0
  63. X-FuHaFi: 0.53
  64. Subject: Re: [gnupic] SPASM - a MPASM behave alike
  65.  
  66. Hello,
  67.  
  68. Am 07.06.2009 um 12:05 schrieb Tamas Rudnai:
  69.  
  70. > On Sun, Jun 7, 2009 at 7:57 AM, Peter Keller <psilord@cs.wisc.edu>  
  71. > wrote:
  72. >
  73. >> What would the challenges be in writing a completely standalone
  74. >> preprocessor which just emits the processed assembly to be then fed
  75. >> into gpasm?
  76. >>
  77. >
  78. > Why would write the #define / #include style preprocessor at all? This
  79. > should be done by existing tools like the cpp instead of reinventing  
  80. > the
  81. > wheel. The "other preprocessor" used by MPASM which is involved by the
  82. > equ/macro style could be written as a separated preprocessor which  
  83. > would
  84. > make the remaining compiler fairly trivial in my opinion.
  85. I do not want to sound rude, but I think many people are not really  
  86. aware of what they
  87. are talking about in case of MPASM (the language, not the program).  
  88. #include #define and so
  89. on are not defined as preprocessor directives, they are part of the  
  90. language definition. Using a preprocessor
  91. like CPP is out of the game for example for this reason
  92.  
  93.     #define B 10
  94.  
  95.     A = 3 * B ; this is not a preprocessor variable; it must evaluate  
  96. expressions and know about the current radix (for example)
  97.    
  98.     while A > 0
  99.         #if A > 2
  100.             data A
  101.         #endif
  102.         A--
  103.     endw
  104.  
  105. Label#v(A*10+1) ; this will become Label1
  106.  
  107. The "preprocessor" must know about a lot of the current assembly state  
  108. like for example the current radix or the minimal or maximal values.
  109. It is therefore not a preprocessor in the C like sense, it is more an  
  110. integrated component of the assembler.
  111.  
  112. SPASM has to do a lot of error checking in the preprocessor too (for  
  113. example it gets handed down a list of opcode and pseudo opcode names
  114. to check for opcodes in the first colum and so on). Also it has to  
  115. check because some tokens must be interpreted from the context.
  116. This can't be avoided with MPASM. For example:
  117.  
  118. data abcdh  ; will write 0xabcd; the h suffix is a valid identifier  
  119. for hex values
  120. abcdh equ 0x1  ;  abcdh is also a valid identifier
  121. data abcdh ; will write 0x1
  122.  
  123. Now what? The lexer can't decide if it should return an identifer or a  
  124. hex-constant token. It therefore returns an "either-this-or-that"  
  125. token and the preprocessor
  126. decides from context before handing stuff to the parser.
  127.  
  128. <rant>
  129. Long story short: MPASM is a very undesigned language; it is not  
  130. trivial to write a "correct" assembler for it; people who consider it  
  131. "fairly trivial" should please make
  132. sure they know what they are talking about; most programmers are quite  
  133. lazy; we would not reinvent the wheel if there were tools who could do  
  134. our job in our environment.
  135. </rant>
  136.  
  137. >
  138. >
  139. > Is there a linker implemented in this SPASM with the MPASM style  
  140. > linker
  141. > scripts?
  142. No, as mentioned SPASM does not do relocatable code. I have never  
  143. worked with relocatable code on PICs and I doubt it is very useful to  
  144. have a macro assembler
  145. (as SPASM is) for that. That is, I only see the scenario of a c  
  146. compiler creating objects that need to be linked. You do not need  
  147. MACRO, #v() or #ifdefs for that. You would prefer a clever linker,  
  148. which is another cup of coffee.
  149.  
  150.  
  151. Cheers,
  152. Holger
  153.  
  154.  
  155. ---------------------------------------------------------------------
  156. To unsubscribe, e-mail: gnupic-unsubscribe@linuxhacker.org
  157. For additional commands, e-mail: gnupic-help@linuxhacker.org
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement