From: cuz Date: Mon, 18 Feb 2002 09:11:57 +0000 (+0000) Subject: Added .charmap X-Git-Tag: V2.12.0~2450 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=208090ea3646e214c7cf065262c2de1e5f2ab761;p=cc65 Added .charmap git-svn-id: svn://svn.cc65.org/cc65/trunk@1163 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/ca65/pseudo.c b/src/ca65/pseudo.c index 6e815c87a..e521fdbe9 100644 --- a/src/ca65/pseudo.c +++ b/src/ca65/pseudo.c @@ -6,7 +6,7 @@ /* */ /* */ /* */ -/* (C) 1998-2000 Ullrich von Bassewitz */ +/* (C) 1998-2002 Ullrich von Bassewitz */ /* Wacholderweg 14 */ /* D-70597 Stuttgart */ /* EMail: uz@musoftware.de */ @@ -373,6 +373,37 @@ static void DoCase (void) +static void DoCharMap (void) +/* Allow custome character mappings */ +{ + long Index; + long Code; + + /* Read the index as numerical value */ + Index = ConstExpression (); + if (Index < 1 || Index > 255) { + /* Value out of range */ + ErrorSkip (ERR_RANGE); + return; + } + + /* Comma follows */ + ConsumeComma (); + + /* Read the character code */ + Code = ConstExpression (); + if (Code < 1 || Code > 255) { + /* Value out of range */ + ErrorSkip (ERR_RANGE); + return; + } + + /* Set the character translation */ + TgtTranslateSet ((unsigned) Index, (unsigned char) Code); +} + + + static void DoCode (void) /* Switch to the code segment */ { @@ -1317,6 +1348,7 @@ static CtrlDesc CtrlCmdTab [] = { { ccNone, DoBss }, { ccNone, DoByte }, { ccNone, DoCase }, + { ccNone, DoCharMap }, { ccNone, DoCode }, { ccNone, DoUnexpected, }, /* .CONCAT */ { ccNone, DoConDes }, diff --git a/src/ca65/scanner.c b/src/ca65/scanner.c index cdf81932a..05e6820d0 100644 --- a/src/ca65/scanner.c +++ b/src/ca65/scanner.c @@ -133,6 +133,7 @@ struct DotKeyword { { ".BYT", TOK_BYTE }, { ".BYTE", TOK_BYTE }, { ".CASE", TOK_CASE }, + { ".CHARMAP", TOK_CHARMAP }, { ".CODE", TOK_CODE }, { ".CONCAT", TOK_CONCAT }, { ".CONDES", TOK_CONDES }, diff --git a/src/ca65/scanner.h b/src/ca65/scanner.h index f6fddc588..10a8c4e1d 100644 --- a/src/ca65/scanner.h +++ b/src/ca65/scanner.h @@ -6,7 +6,7 @@ /* */ /* */ /* */ -/* (C) 1998-2000 Ullrich von Bassewitz */ +/* (C) 1998-2002 Ullrich von Bassewitz */ /* Wacholderweg 14 */ /* D-70597 Stuttgart */ /* EMail: uz@musoftware.de */ @@ -118,9 +118,10 @@ enum Token { TOK_BLANK, TOK_BSS, TOK_BYTE, - TOK_CASE, + TOK_CASE, + TOK_CHARMAP, TOK_CODE, - TOK_CONCAT, + TOK_CONCAT, TOK_CONDES, TOK_CONST, TOK_CONSTRUCTOR,