newline();
return HL_REG;
} else {
- output_line("leay ");
+ output_with_tab("leay ");
output_number(sym->offset - stkp);
output_string(",s");
newline ();
* @param typeobj
*/
void gen_put_indirect(char typeobj) {
- /* pop ? */
- output_line("tfr d,y");
+ output_line("puls d");
if (typeobj & CCHAR) {
output_line("stb ,y");
} else {
* @param typeobj object type
*/
void gen_get_indirect(char typeobj, int reg) {
- if (typeobj == CCHAR) {
- if (reg & DE_REG) {
- gen_swap();
+ if (typeobj == CCHAR || typeobj == UCHAR) {
+ if (reg & DE_REG)
+ output_line("ldb ,x");
+ else {
+ /* TODO work out what we can damage here */
+ output_line("tfr d,u");
+ output_line("ldb ,u");
}
- output_line("loadbs r1 (r1)");
- } else if (typeobj == UCHAR) {
- if (reg & DE_REG) {
- gen_swap();
- }
- //gen_call("cguchar");
- output_line("loadbu r1 (r1)");
+ if (typeobj == CCHAR)
+ output_line("sex");
} else { // int
- output_line("load r1 (r1)");
+ if (reg & DE_REG)
+ output_line("ldd ,x"); /* Can't happen ?? */
+ else {
+ output_line("tfr d,u");
+ output_line("ldd ,u");
+ }
}
}
{
int idx;
SYMBOL *symbol;
+ char an[NAMESIZE];
fexitlab = getlabel();
} else {
// K&R style argument declaration
while (!match(")")) {
- if (symname(n)) {
- if (find_locale(n) > -1)
- multidef(n);
+ if (symname(an)) {
+ if (find_locale(an) > -1)
+ multidef(an);
else {
- add_local(n, 0, 0, argstk, AUTO);
+ add_local(an, 0, 0, argstk, AUTO);
argstk = argstk + INTSIZE;
}
} else {
*/
void parse(void) {
while (!input_eof) {
- if (amatch("extern", 6))
+ if (match("#")) {
+ if (match("asm"))
+ doasm();
+ else if (match("include"))
+ doinclude();
+ else if (match("define"))
+ dodefine();
+ else if (match("undef"))
+ doundef();
+ }
+ else if (amatch("extern", 6))
do_declarations(EXTERN, NULL_TAG, 0);
else if (amatch("static", 6))
do_declarations(STATIC, NULL_TAG, 0);
- else if (do_declarations(PUBLIC, NULL_TAG, 0));
- else if (match("#asm"))
- doasm();
- else if (match("#include"))
- doinclude();
- else if (match("#define")) {
- dodefine();
- }
- else if (match("#undef"))
- doundef();
+ else if (do_declarations(PUBLIC, NULL_TAG, 0))
+ ;
else {
newfunc();
}