/[projet1]/public/pc/tools/osdk/main/compiler/sources/gen.c
Defence Force logotype

Diff of /public/pc/tools/osdk/main/compiler/sources/gen.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1526 by dbug, Sat May 4 10:00:50 2019 UTC revision 1527 by dbug, Sat Sep 7 09:16:40 2019 UTC
# Line 19  Line 19 
19   * the macros emitted by the backend. However, lcc's frontend was designed   * the macros emitted by the backend. However, lcc's frontend was designed
20   * for working straight forward with backends for RISC processors with   * for working straight forward with backends for RISC processors with
21   * a load/store architecture and many registers so that operations only take   * a load/store architecture and many registers so that operations only take
22   * registers operand. The 6502 instead has a single register that can be used   * register operands. The 6502 instead has a single register that can be used
23   * in operations whilst the second operand is in memory. So, I designed this   * in operations whilst the second operand is in memory. So, I designed this
24   * 6502 backend to use pseudo-registers in zero-page (this seems natural),   * 6502 backend to use pseudo-registers in zero-page (this seems natural),
25   * but also to propagate addressing-mode information in order to exploit   * but also to propagate addressing-mode information in order to exploit
# Line 29  Line 29 
29   */   */
30    
31    
32  char *version="/* 16-bit code V1.36 */\n";  char *version="/* 16-bit code V1.38 */\n";
33  #include "c.h"  #include "c.h"
34  #include <string.h>  #include <string.h>
35  #include <stdio.h>  #include <stdio.h>
# Line 302  void defconst(int ty, Value v) { Line 302  void defconst(int ty, Value v) {
302  void defstring(int len, char *s) {  void defstring(int len, char *s) {
303      if (graph_output) return;      if (graph_output) return;
304      while (len > 0) {      while (len > 0) {
305          if (s[0]==';' || s[0]<32 || s[0]==127) {          print("\tDB($%x)\n",(unsigned char)*s++);
306              print("\tDB($%x)\n",(unsigned char)*s++);          len--;
             len--;  
             while (len>0 && (s[0]==';' || s[0]<32 || s[0]==127)) {  
                 print("\tDB($%x)\n",(unsigned char)*s++);  
                 len--;  
             }  
             print("\n");  
         } else {  
             print("\tSTRING \"");  
             while (len>0 && s[0]!=';' && s[0]>=32 && s[0]!=127) {  
                 len--;  
                 if (s[0]=='"') print("\\\"");  
                 else if (s[0]=='\\') print("\\\\");  
                 else print("%c",s[0]);  
                 s++;  
             }  
             print("\"\n");  
         }  
307      }      }
308  }  }
309    

Legend:
Removed from v.1526  
changed lines
  Added in v.1527

  ViewVC Help
Powered by ViewVC 1.1.26