/* */
/* */
/* (C) 1998-2003 Ullrich von Bassewitz */
-/* Römerstrasse 52 */
+/* Römerstraße 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
-void Emit3b (unsigned char OPC, ExprNode* Expr, ExprNode* Bank)
-/* Emit an instruction with a three byte argument and separate bank */
-{
- Emit0 (OPC);
- EmitWord (Expr);
- EmitByte (Bank);
-}
-
-
-
void EmitSigned (ExprNode* Expr, unsigned Size)
/* Emit a signed expression with the given size */
{
void EmitByte (ExprNode* Expr)
/* Emit one byte */
{
- if (IsConstExpr (Expr)) {
- /* Constant expression, emit literal byte */
- long Val = GetExprVal (Expr);
- FreeExpr (Expr);
- if ((Val & ~0xFF) != 0) {
- Error (ERR_RANGE);
- }
- Emit0 (Val & 0xFF);
- } else {
- /* Create a new fragment */
- Fragment* F = GenFragment (FRAG_EXPR, 1);
+ /* Create a new fragment */
+ Fragment* F = GenFragment (FRAG_EXPR, 1);
- /* Set the data */
- F->V.Expr = Expr;
- }
+ /* Set the data */
+ F->V.Expr = Expr;
}
void EmitWord (ExprNode* Expr)
/* Emit one word */
{
- if (IsConstExpr (Expr)) {
- /* Constant expression, emit literal byte */
- long Val = GetExprVal (Expr);
- FreeExpr (Expr);
- if ((Val & ~0xFFFF) != 0) {
- Error (ERR_RANGE);
- }
- Emit0 (Val & 0xFF);
- Emit0 ((Val >> 8) & 0xFF);
- } else {
- /* Create a new fragment */
- Fragment* F = GenFragment (FRAG_EXPR, 2);
+ /* Create a new fragment */
+ Fragment* F = GenFragment (FRAG_EXPR, 2);
- /* Set the data */
- F->V.Expr = Expr;
- }
+ /* Set the data */
+ F->V.Expr = Expr;
}
void EmitFarAddr (ExprNode* Expr)
/* Emit a 24 bit expression */
{
- if (IsConstExpr (Expr)) {
- /* Constant expression, emit literal byte */
- long Val = GetExprVal (Expr);
- FreeExpr (Expr);
- if ((Val & ~0xFFFFFF) != 0) {
- Error (ERR_RANGE);
- }
- Emit0 (Val & 0xFF);
- Emit0 ((Val >> 8) & 0xFF);
- Emit0 ((Val >> 16) & 0xFF);
- } else {
- /* Create a new fragment */
- Fragment* F = GenFragment (FRAG_EXPR, 3);
+ /* Create a new fragment */
+ Fragment* F = GenFragment (FRAG_EXPR, 3);
- /* Set the data */
- F->V.Expr = Expr;
- }
+ /* Set the data */
+ F->V.Expr = Expr;
}
void EmitDWord (ExprNode* Expr)
/* Emit one dword */
{
- if (IsConstExpr (Expr)) {
- /* Constant expression, emit literal byte */
- long Val = GetExprVal (Expr);
- FreeExpr (Expr);
- Emit0 (Val & 0xFF);
- Emit0 ((Val >> 8) & 0xFF);
- Emit0 ((Val >> 16) & 0xFF);
- Emit0 ((Val >> 24) & 0xFF);
- } else {
- /* Create a new fragment */
- Fragment* F = GenFragment (FRAG_EXPR, 4);
+ /* Create a new fragment */
+ Fragment* F = GenFragment (FRAG_EXPR, 4);
- /* Set the data */
- F->V.Expr = Expr;
- }
+ /* Set the data */
+ F->V.Expr = Expr;
}