Commit | Line | Data |
---|---|---|
a63d483c ML |
1 | /* Copyright (c) 1982 Regents of the University of California */ |
2 | ||
2fd0f574 SL |
3 | static char sccsid[] = "@(#)asm.c 1.2 12/15/82"; |
4 | ||
5 | static char rcsid[] = "$Header: asm.c,v 1.3 84/03/27 10:19:36 linton Exp $"; | |
a63d483c ML |
6 | |
7 | /* | |
8 | * Assembly language dependent symbol routines. | |
9 | */ | |
10 | ||
11 | #include "defs.h" | |
12 | #include "symbols.h" | |
13 | #include "asm.h" | |
14 | #include "languages.h" | |
15 | #include "tree.h" | |
16 | #include "eval.h" | |
17 | #include "operators.h" | |
18 | #include "mappings.h" | |
19 | #include "process.h" | |
20 | #include "runtime.h" | |
21 | #include "machine.h" | |
22 | ||
23 | #define isdouble(range) ( \ | |
24 | range->symvalue.rangev.upper == 0 and range->symvalue.rangev.lower > 0 \ | |
25 | ) | |
26 | ||
27 | /* | |
28 | * Initialize assembly language information. | |
29 | */ | |
30 | ||
31 | public asm_init() | |
32 | { | |
33 | Language lang; | |
34 | ||
35 | lang = language_define("assembler", ".s"); | |
36 | language_setop(lang, L_PRINTDECL, asm_printdecl); | |
37 | language_setop(lang, L_PRINTVAL, asm_printval); | |
38 | language_setop(lang, L_TYPEMATCH, asm_typematch); | |
2fd0f574 SL |
39 | language_setop(lang, L_HASMODULES, asm_hasmodules); |
40 | language_setop(lang, L_PASSADDR, asm_passaddr); | |
a63d483c ML |
41 | } |
42 | ||
43 | /* | |
44 | * Test if two types are compatible. | |
45 | */ | |
46 | ||
47 | public Boolean asm_typematch(type1, type2) | |
48 | Symbol type1, type2; | |
49 | { | |
50 | Boolean b; | |
51 | ||
52 | b = false; | |
53 | return b; | |
54 | } | |
55 | ||
56 | public asm_printdecl(s) | |
57 | Symbol s; | |
58 | { | |
59 | switch (s->class) { | |
60 | case VAR: | |
61 | case REF: | |
62 | printf("&%s = 0x%x", symname(s), s->symvalue.offset); | |
63 | break; | |
64 | ||
65 | case PROC: | |
66 | case FUNC: | |
67 | printf("%s (0x%x):", symname(s), codeloc(s)); | |
68 | break; | |
69 | ||
70 | default: | |
71 | error("class %s in c_printdecl", classname(s)); | |
72 | } | |
73 | putchar('\n'); | |
74 | } | |
75 | ||
76 | /* | |
77 | * Print out the value on the top of the expression stack | |
78 | * in the format for the type of the given symbol. | |
79 | */ | |
80 | ||
81 | public asm_printval(s) | |
82 | register Symbol s; | |
83 | { | |
84 | register Symbol t; | |
85 | register Integer len; | |
86 | ||
87 | switch (s->class) { | |
88 | case ARRAY: | |
89 | t = rtype(s->type); | |
90 | if (t->class == RANGE and istypename(t->type, "$char")) { | |
91 | len = size(s); | |
92 | sp -= len; | |
93 | printf("\"%.*s\"", len, sp); | |
94 | } else { | |
95 | printarray(s); | |
96 | } | |
97 | break; | |
98 | ||
99 | default: | |
100 | printf("0x%x", pop(Integer)); | |
101 | break; | |
102 | } | |
103 | } | |
2fd0f574 SL |
104 | |
105 | public boolean asm_hasmodules () | |
106 | { | |
107 | return false; | |
108 | } | |
109 | ||
110 | public boolean asm_passaddr (param, exprtype) | |
111 | Symbol param, exprtype; | |
112 | { | |
113 | return false; | |
114 | } |