Changes from Nigel Hall

This commit is contained in:
ceriel 1988-08-19 16:46:22 +00:00
parent 6246c6fc9e
commit f3a780ecec

View file

@ -10,10 +10,44 @@
* Mostek 6500 parsing tables. * Mostek 6500 parsing tables.
*/ */
/* From the READ_ME file - translation by Albert Koelmans:
* ________________
*
* De .h en .l extensions van expressies zijn hard nodig.
* Ze zorgen er echter ook voor dat er geen relocatable code geproduceerd
* kan worden. Beschouw het volgende voorbeeld:
*
* The .h and .l extensions of expressions are vital. However, they prevent
* relocatable code from being generated. Consider the following example:
*
* (file 1)
* .sect .text ! 1
* lda #[endbss].l ! 2
* ldx #[endbss].h ! 3
*
* (file 2)
* .sect .bss ! 4
* endbss: ! 5
*
* Wat voor relocation struct moet er nu voor de instructie in regel 3
* worden geproduceerd?
*
* What kind of relocation structure needs to be generated for the instruction
* in line 3?
*/
expr expr
: expr EXTENSION : expr EXTENSION
{ $$.val = ($1.val >> $2) & 0xFF; { $$.val = ($1.val >> $2) & 0xFF;
#ifdef RELOCATION
$$.typ = combine($1.typ, S_ABS, '&'); $$.typ = combine($1.typ, S_ABS, '&');
/* This will generate an 'invalid operator' */
/* error if $1.typ is not absolute after pass 1. */
#else
$$.typ = $1.typ; /* Even if $1.typ is relocatable, it should be */
/* absolute by the final pass. */
#endif RELOCATION
} }
; ;
operation operation
@ -47,7 +81,7 @@ operation
#ifdef RELOCATION #ifdef RELOCATION
newrelo($3.typ, RELO1); newrelo($3.typ, RELO1);
#endif #endif
emit1($3); emit1($3.val);
} }
| LDXOP expr | LDXOP expr
{ code($2,0xA6,0xAE); } { code($2,0xA6,0xAE); }
@ -58,7 +92,7 @@ operation
#ifdef RELOCATION #ifdef RELOCATION
newrelo($3.typ, RELO1); newrelo($3.typ, RELO1);
#endif #endif
emit1($3); emit1($3.val);
} }
| LDYOP expr | LDYOP expr
{ code($2,0xA4,0xAC); } { code($2,0xA4,0xAC); }
@ -88,7 +122,7 @@ operation
#ifdef RELOCATION #ifdef RELOCATION
newrelo($3.typ, RELO1); newrelo($3.typ, RELO1);
#endif #endif
emit1($3); emit1($3.val);
} }
| addop expr | addop expr
{ code($2,$1+0x05,$1+0x0D); } { code($2,$1+0x05,$1+0x0D); }
@ -130,7 +164,7 @@ operation
#ifdef RELOCATION #ifdef RELOCATION
newrelo($3.typ, RELO1); newrelo($3.typ, RELO1);
#endif #endif
emit1($3); emit1($3.val);
} }
| CPXOP expr | CPXOP expr
{ code($2,$1+0x04,$1+0x0C); } { code($2,$1+0x04,$1+0x0C); }