diff --git a/ugbc/makefile b/ugbc/makefile index 8586c30ca..61d087148 100755 --- a/ugbc/makefile +++ b/ugbc/makefile @@ -40,10 +40,11 @@ LIBXML2=../modules/libxml2/.libs/libxml2.a LIBXML2PATH=../modules/libxml2 endif +REVISION := "$(shell git describe --abbrev=9 --always)" FLEX_VERSION=$(shell flex --version) FLEX_OPTIONS=--8bit BISON_OPTIONS=--locations -d -CFLAGS=-O3 -fomit-frame-pointer -I $(LIBXML2PATH)/include -D LIBXML_STATIC +CFLAGS=-O3 -fomit-frame-pointer -I $(LIBXML2PATH)/include -D LIBXML_STATIC -DUGBASIC_REVISION=\"$(REVISION)\" LFLAGS= LIBS=-lm $(LIBXML2) BETA=$(shell cat ../.git/HEAD | grep beta) diff --git a/ugbc/src/hw/6847.c b/ugbc/src/hw/6847.c index 92d600e68..da5791f1b 100755 --- a/ugbc/src/hw/6847.c +++ b/ugbc/src/hw/6847.c @@ -1066,6 +1066,10 @@ void c6847_initialization( Environment * _environment ) { void c6847_finalization( Environment * _environment ) { + if (_environment->vestigialConfig.clsImplicit ) { + deploy( clsText, src_hw_6847_cls_text_asm ); + } + } void c6847_hscroll_line( Environment * _environment, int _direction ) { diff --git a/ugbc/src/hw/cpc.c b/ugbc/src/hw/cpc.c index 7e52d6c34..c8fa8d6dd 100755 --- a/ugbc/src/hw/cpc.c +++ b/ugbc/src/hw/cpc.c @@ -1201,6 +1201,10 @@ void cpc_initialization( Environment * _environment ) { void cpc_finalization( Environment * _environment ) { + if ( _environment->vestigialConfig.clsImplicit ) { + deploy( clsGraphic, src_hw_cpc_cls_graphic_asm ); + } + } void cpc_hscroll_line( Environment * _environment, int _direction ) { diff --git a/ugbc/src/hw/cpc/startup.asm b/ugbc/src/hw/cpc/startup.asm index efb36f309..3cfd09026 100755 --- a/ugbc/src/hw/cpc/startup.asm +++ b/ugbc/src/hw/cpc/startup.asm @@ -169,6 +169,10 @@ SYSCALLDONE: EXX EI +@IF vestigialConfig.clsImplicit + CALL CLSG +@ENDIF + RET @IF sysCallUsed diff --git a/ugbc/src/hw/ef9345.c b/ugbc/src/hw/ef9345.c index 7c98f4149..f2cbbb7c8 100755 --- a/ugbc/src/hw/ef9345.c +++ b/ugbc/src/hw/ef9345.c @@ -858,6 +858,10 @@ void ef9345_initialization( Environment * _environment ) { void ef9345_finalization( Environment * _environment ) { + if ( _environment->vestigialConfig.clsImplicit ) { + deploy( clsText, src_hw_ef9345_cls_asm ); + } + } void ef9345_hscroll_line( Environment * _environment, int _direction ) { diff --git a/ugbc/src/hw/ef9345/startup.asm b/ugbc/src/hw/ef9345/startup.asm index 7a46e6040..b277d6520 100755 --- a/ugbc/src/hw/ef9345/startup.asm +++ b/ugbc/src/hw/ef9345/startup.asm @@ -127,6 +127,10 @@ EF9345STARTUP: ; Re-enable interrupts. EI +@IF vestigialConfig.clsImplicit + CALL CLS +@ENDIF + RET EF9345CONFIG: diff --git a/ugbc/src/hw/ef936x.c b/ugbc/src/hw/ef936x.c index 7cb4c5d78..ee4d0304f 100755 --- a/ugbc/src/hw/ef936x.c +++ b/ugbc/src/hw/ef936x.c @@ -698,7 +698,7 @@ void ef936x_text( Environment * _environment, char * _text, char * _text_size, i void ef936x_initialization( Environment * _environment ) { deploy_preferred( ef936xvars, src_hw_ef936x_vars_asm ); - deploy( ef936xstartup, src_hw_ef936x_startup_asm ); + deploy_preferred( ef936xstartup, src_hw_ef936x_startup_asm ); variable_import( _environment, "CURRENTMODE", VT_BYTE, 0 ); variable_global( _environment, "CURRENTMODE" ); @@ -888,7 +888,12 @@ void ef936x_finalization( Environment * _environment ) { } } outline4("$%1.1x%1.1x%1.1x%1.1x", 0, EF936X_COMPONENT_BITMASK * 0x10 | ( ( palette[15].blue >> 4 ) & 0x0f ) , ( ( palette[15].green >> 4 ) & 0x0f ) , ( ( palette[15].red >> 4 ) & 0x0f ) ); - + + if ( _environment->vestigialConfig.clsImplicit ) { + deploy( clsGraphic, src_hw_ef936x_cls_asm ); + + } + } void ef936x_hscroll_line( Environment * _environment, int _direction ) { diff --git a/ugbc/src/hw/ef936x/startup.asm b/ugbc/src/hw/ef936x/startup.asm index 34a1d86da..9ffa7a508 100755 --- a/ugbc/src/hw/ef936x/startup.asm +++ b/ugbc/src/hw/ef936x/startup.asm @@ -60,6 +60,11 @@ EF936XSTARTUPL1 STA ,Y LEAX -1,X BNE EF936XSTARTUPL1 + +@IF vestigialConfig.clsImplicit + JSR CLS +@ENDIF + RTS ; ===========[ VERTICAL BLANK ]=========== diff --git a/ugbc/src/hw/gime.c b/ugbc/src/hw/gime.c index 98b3556fb..ca09a615f 100755 --- a/ugbc/src/hw/gime.c +++ b/ugbc/src/hw/gime.c @@ -1652,6 +1652,10 @@ void gime_initialization( Environment * _environment ) { void gime_finalization( Environment * _environment ) { + if ( _environment->vestigialConfig.clsImplicit ) { + deploy_preferred( clsText, src_hw_gime_cls_text_asm ); + } + } void gime_hscroll_line( Environment * _environment, int _direction ) { diff --git a/ugbc/src/hw/gime/startup.asm b/ugbc/src/hw/gime/startup.asm index cb14fc48b..4e166d727 100755 --- a/ugbc/src/hw/gime/startup.asm +++ b/ugbc/src/hw/gime/startup.asm @@ -256,6 +256,10 @@ GIMESTARTUP ; Turn on ROM/RAM JSR GIMEBANKROM +@IF vestigialConfig.clsImplicit + JSR CLST +@ENDIF + RTS ; Look for a specific (pen) color into the palette. diff --git a/ugbc/src/hw/gtia.c b/ugbc/src/hw/gtia.c index d4484e438..cc47eabb1 100755 --- a/ugbc/src/hw/gtia.c +++ b/ugbc/src/hw/gtia.c @@ -1632,9 +1632,7 @@ int gtia_screen_mode_enable( Environment * _environment, ScreenMode * _screen_mo outline0("STA LASTCOLOR"); } - if (_environment->vestigialConfig.clsImplicit ) { - gtia_cls( _environment ); - } + outline0("JSR GTIAAFTERINIT"); } @@ -2076,10 +2074,18 @@ void gtia_initialization( Environment * _environment ) { gtia_tilemap_enable( _environment, 40, 24, 1, 8, 8 ); + if (_environment->vestigialConfig.clsImplicit ) { + gtia_cls( _environment ); + } + } void gtia_finalization( Environment * _environment ) { - + + if (_environment->vestigialConfig.clsImplicit ) { + deploy( cls, src_hw_gtia_cls_asm ); + } + } void gtia_hscroll_line( Environment * _environment, int _direction ) { diff --git a/ugbc/src/hw/gtia/startup.asm b/ugbc/src/hw/gtia/startup.asm index e8f19fa1d..6ba10c81b 100755 --- a/ugbc/src/hw/gtia/startup.asm +++ b/ugbc/src/hw/gtia/startup.asm @@ -99,3 +99,8 @@ GTIASTARTUPDONE: SEI RTS +GTIAAFTERINIT: +@IF vestigialConfig.clsImplicit + JSR CLS +@ENDIF + RTS diff --git a/ugbc/src/hw/pc1403.c b/ugbc/src/hw/pc1403.c index 404f0856d..2655ded34 100755 --- a/ugbc/src/hw/pc1403.c +++ b/ugbc/src/hw/pc1403.c @@ -375,6 +375,10 @@ void pc1403_initialization( Environment * _environment ) { void pc1403_finalization( Environment * _environment ) { + // if (_environment->vestigialConfig.clsImplicit ) { + // pc1403_cls( _environment, NULL, NULL ); + // } + } void pc1403_screen_rows( Environment * _environment, char * _rows ) { diff --git a/ugbc/src/hw/ted.c b/ugbc/src/hw/ted.c index 491b1cb44..e53a3c0ad 100755 --- a/ugbc/src/hw/ted.c +++ b/ugbc/src/hw/ted.c @@ -1389,6 +1389,10 @@ void ted_finalization( Environment * _environment ) { outline0( "RTS" ); } + if ( _environment->vestigialConfig.clsImplicit ) { + deploy( clsText, src_hw_ted_cls_text_asm ); + } + } void ted_hscroll_line( Environment * _environment, int _direction ) { diff --git a/ugbc/src/hw/ted/startup.asm b/ugbc/src/hw/ted/startup.asm index e59374457..54997852f 100755 --- a/ugbc/src/hw/ted/startup.asm +++ b/ugbc/src/hw/ted/startup.asm @@ -115,6 +115,10 @@ TEDSTARTUP: STA $0315 CLI +@IF vestigialConfig.clsImplicit + JSR CLST +@ENDIF + RTS IMF_TOKEN_WAIT1 = $ff diff --git a/ugbc/src/hw/tms9918.c b/ugbc/src/hw/tms9918.c index de1f000c5..706186a8c 100755 --- a/ugbc/src/hw/tms9918.c +++ b/ugbc/src/hw/tms9918.c @@ -1445,7 +1445,7 @@ void tms9918_text( Environment * _environment, char * _text, char * _text_size, void tms9918_initialization( Environment * _environment ) { deploy( tms9918vars, src_hw_tms9918_vars_asm ); - deploy( tms9918startup, src_hw_tms9918_startup_asm ); + deploy_preferred( tms9918startup, src_hw_tms9918_startup_asm ); variable_import( _environment, "CURRENTWIDTH", VT_POSITION, 256 ); variable_global( _environment, "CURRENTWIDTH" ); @@ -1633,10 +1633,16 @@ void tms9918_initialization( Environment * _environment ) { _environment->currentRgbConverterFunction = rgbConverterFunction; _environment->screenShades = 16; + outline0("CALL TMS9918AFTERINIT"); + } void tms9918_finalization( Environment * _environment ) { + if ( _environment->vestigialConfig.clsImplicit ) { + deploy( clsText, src_hw_tms9918_cls_text_asm ); + } + } void tms9918_hscroll_line( Environment * _environment, int _direction ) { diff --git a/ugbc/src/hw/tms9918/startup.asm b/ugbc/src/hw/tms9918/startup.asm index af21cd225..3b0ac8fa5 100755 --- a/ugbc/src/hw/tms9918/startup.asm +++ b/ugbc/src/hw/tms9918/startup.asm @@ -545,6 +545,12 @@ TMS9918STARTUPL1: RET +TMS9918AFTERINIT: +@IF vestigialConfig.clsImplicit + CALL CLST +@ENDIF + RET + TMS9918SPRITEINIT: PUSH HL LD HL, (SPRITEAADDRESS) diff --git a/ugbc/src/hw/vdcz.c b/ugbc/src/hw/vdcz.c index 6639d8a80..283b0fc87 100755 --- a/ugbc/src/hw/vdcz.c +++ b/ugbc/src/hw/vdcz.c @@ -2362,7 +2362,7 @@ void vdcz_text( Environment * _environment, char * _text, char * _text_size, int void vdcz_initialization( Environment * _environment ) { deploy( vdczvars, src_hw_vdcz_vars_asm ); - deploy( vdczstartup, src_hw_vdcz_startup_asm ); + deploy_preferred( vdczstartup, src_hw_vdcz_startup_asm ); variable_import( _environment, "CURRENTWIDTH", VT_POSITION, 256 ); variable_global( _environment, "CURRENTWIDTH" ); @@ -2521,6 +2521,10 @@ static RGBi * multicolorSpritePalette[2]; void vdcz_finalization( Environment * _environment ) { + if ( _environment->vestigialConfig.clsImplicit ) { + deploy( clsText, src_hw_vdcz_cls_text_asm ); + } + } void vdcz_hscroll_line( Environment * _environment, int _direction ) { diff --git a/ugbc/src/hw/vdcz/startup.asm b/ugbc/src/hw/vdcz/startup.asm index 72a5fbc69..ac2c25dd6 100755 --- a/ugbc/src/hw/vdcz/startup.asm +++ b/ugbc/src/hw/vdcz/startup.asm @@ -187,6 +187,9 @@ VDCZGETCHAR: RET VDCZSTARTUP: +@IF vestigialConfig.clsImplicit + CALL CLST +@ENDIF RET VDCZVIDEOSTARTUP: diff --git a/ugbc/src/hw/vic1.c b/ugbc/src/hw/vic1.c index b09d05fab..cd8a0245e 100755 --- a/ugbc/src/hw/vic1.c +++ b/ugbc/src/hw/vic1.c @@ -802,6 +802,10 @@ void vic1_finalization( Environment * _environment ) { outline0( "RTS" ); } + if ( _environment->vestigialConfig.clsImplicit ) { + deploy( cls, src_hw_vic1_cls_asm ); + } + } void vic1_hscroll_line( Environment * _environment, int _direction ) { diff --git a/ugbc/src/hw/vic1/startup.asm b/ugbc/src/hw/vic1/startup.asm index d13665804..5ae9b029d 100755 --- a/ugbc/src/hw/vic1/startup.asm +++ b/ugbc/src/hw/vic1/startup.asm @@ -230,6 +230,10 @@ VIC1STARTUP: LDA #$0 STA YCURSYS +@IF vestigialConfig.clsImplicit + JSR CLST +@ENDIF + RTS IMF_TOKEN_WAIT1 = $ff diff --git a/ugbc/src/hw/vic2/cls_graphic.asm b/ugbc/src/hw/vic2/cls_graphic.asm index 1779d714a..d6c8475b4 100755 --- a/ugbc/src/hw/vic2/cls_graphic.asm +++ b/ugbc/src/hw/vic2/cls_graphic.asm @@ -62,6 +62,34 @@ CLSGY2: DEX BNE CLSGY2 + LDA COLORMAPADDRESS + STA COPYOFCOLORMAPADDRESS + LDA COLORMAPADDRESS+1 + STA COPYOFCOLORMAPADDRESS+1 + LDX #3 + LDY #0 + LDA _PEN + ASL A + ASL A + ASL A + ASL A + ORA _PAPER +CLGC: + STA (COPYOFCOLORMAPADDRESS),Y + INY + BNE CLGC + INC COPYOFCOLORMAPADDRESS+1 + CPX #1 + BNE CLGCNB +CLGC2: + STA (COPYOFCOLORMAPADDRESS),Y + INY + CPY #232 + BNE CLGC2 +CLGCNB: + DEX + BNE CLGC + @IF !vestigialConfig.screenModeUnique LDA CURRENTMODE CMP #3 diff --git a/ugbc/src/hw/vic2/startup.asm b/ugbc/src/hw/vic2/startup.asm index d7f587de3..979f44f11 100755 --- a/ugbc/src/hw/vic2/startup.asm +++ b/ugbc/src/hw/vic2/startup.asm @@ -171,6 +171,10 @@ VIC2STARTUPL1: CLI +@IF vestigialConfig.clsImplicit + JSR CLST +@ENDIF + RTS @IF vestigialConfig.doubleBufferSelected || vestigialConfig.doubleBuffer diff --git a/ugbc/src/hw/zx.c b/ugbc/src/hw/zx.c index f74694116..06fe882e8 100755 --- a/ugbc/src/hw/zx.c +++ b/ugbc/src/hw/zx.c @@ -121,6 +121,7 @@ void zx_text( Environment * _environment, char * _text, char * _text_size, int _ deploy( vars,src_hw_zx_vars_asm); deploy( vScroll, src_hw_zx_vscroll_asm ); deploy( textEncodedAt, src_hw_zx_text_at_asm ); + deploy( cls, src_hw_zx_cls_asm ); // z80_move_8bit( _environment, _tab, "TABCOUNT"); @@ -427,6 +428,10 @@ void zx_initialization( Environment * _environment ) { void zx_finalization( Environment * _environment ) { + if ( _environment->vestigialConfig.clsImplicit ) { + deploy( cls, src_hw_zx_cls_asm ); + } + } void zx_screen_rows( Environment * _environment, char * _rows ) { diff --git a/ugbc/src/hw/zx/startup.asm b/ugbc/src/hw/zx/startup.asm index ec54ecf6a..ff0a1d03d 100755 --- a/ugbc/src/hw/zx/startup.asm +++ b/ugbc/src/hw/zx/startup.asm @@ -154,6 +154,11 @@ ZXNTSC: JP ZXSTARTUPDONE ZXSTARTUPDONE: + +@IF vestigialConfig.clsImplicit + CALL CLS +@ENDIF + RET WAITTIMER: diff --git a/ugbc/src/targets/atari/_var.c b/ugbc/src/targets/atari/_var.c index 58e79de16..ee6a34412 100755 --- a/ugbc/src/targets/atari/_var.c +++ b/ugbc/src/targets/atari/_var.c @@ -114,6 +114,7 @@ static void variable_cleanup_entry( Environment * _environment, Variable * _firs break; case VT_TILE: case VT_SPRITE: + case VT_MSPRITE: case VT_TILESET: if ( variable->memoryArea ) { // outhead2("%s = $%4.4x", variable->realName, variable->absoluteAddress); @@ -314,6 +315,7 @@ static void variable_cleanup_memory_mapped( Environment * _environment, Variable case VT_STRING: break; case VT_DSTRING: + case VT_MSPRITE: case VT_SPRITE: case VT_TILE: case VT_TILESET: diff --git a/ugbc/src/targets/atari/random.c b/ugbc/src/targets/atari/random.c index 7f5d235b6..a9b93736e 100755 --- a/ugbc/src/targets/atari/random.c +++ b/ugbc/src/targets/atari/random.c @@ -46,13 +46,13 @@ Variable * random_value( Environment * _environment, VariableType _type ) { switch( VT_BITWIDTH( _type ) ) { case 8: - cpu6502_random_8bit( _environment, "$14", result->realName ); + cpu6502_random_8bit( _environment, "$D20A", result->realName ); break; case 16: - cpu6502_random_16bit( _environment, "$14", result->realName ); + cpu6502_random_16bit( _environment, "$D20A", result->realName ); break; case 32: - cpu6502_random_32bit( _environment, "$14", result->realName ); + cpu6502_random_32bit( _environment, "$D20A", result->realName ); break; } diff --git a/ugbc/src/targets/c128z/_var.c b/ugbc/src/targets/c128z/_var.c index 9b8bce2d8..3d06035ed 100755 --- a/ugbc/src/targets/c128z/_var.c +++ b/ugbc/src/targets/c128z/_var.c @@ -118,6 +118,7 @@ static void variable_cleanup_entry( Environment * _environment, Variable * _firs break; case VT_TILE: case VT_TILESET: + case VT_MSPRITE: case VT_SPRITE: if ( variable->memoryArea ) { outline2("%s: EQU $%4.4x", variable->realName, variable->absoluteAddress); @@ -417,6 +418,7 @@ void variable_cleanup( Environment * _environment ) { outhead0("JP CODESTART" ); deploy_inplace( startup, src_hw_c128z_startup_asm); + deploy_inplace_preferred( vdczstartup, src_hw_vdcz_startup_asm); deploy( startup, src_hw_c128z_startup2_asm); generate_cgoto_address_table( _environment ); diff --git a/ugbc/src/targets/coleco/_var.c b/ugbc/src/targets/coleco/_var.c index 6ae2121f8..89aa0ba8d 100755 --- a/ugbc/src/targets/coleco/_var.c +++ b/ugbc/src/targets/coleco/_var.c @@ -134,6 +134,7 @@ static void variable_cleanup_entry( Environment * _environment, Variable * _firs break; case VT_TILE: case VT_TILESET: + case VT_MSPRITE: case VT_SPRITE: if ( variable->memoryArea ) { outline2("%s: EQU $%4.4x", variable->realName, variable->absoluteAddress); diff --git a/ugbc/src/targets/common/_var.c b/ugbc/src/targets/common/_var.c index 0ef8559b3..f9b92b64f 100755 --- a/ugbc/src/targets/common/_var.c +++ b/ugbc/src/targets/common/_var.c @@ -53,8 +53,8 @@ void variable_on_memory_init( Environment * _environment, int _imported_too ) { switch( variable->type ) { case VT_STRING: case VT_DSTRING: - case VT_SPRITE: case VT_MSPRITE: + case VT_SPRITE: case VT_DOJOKA: case VT_TILESET: case VT_TILES: @@ -88,7 +88,6 @@ void variable_on_memory_init( Environment * _environment, int _imported_too ) { switch( variable->type ) { case VT_STRING: case VT_DSTRING: - case VT_SPRITE: case VT_MSPRITE: case VT_DOJOKA: case VT_TILESET: diff --git a/ugbc/src/targets/cpc/_var.c b/ugbc/src/targets/cpc/_var.c index e5c1450db..4e9eb1009 100755 --- a/ugbc/src/targets/cpc/_var.c +++ b/ugbc/src/targets/cpc/_var.c @@ -117,6 +117,7 @@ static void variable_cleanup_entry( Environment * _environment, Variable * _firs break; case VT_TILE: case VT_TILESET: + case VT_MSPRITE: case VT_SPRITE: if ( variable->memoryArea ) { outline2("%s: EQU $%4.4x", variable->realName, variable->absoluteAddress); diff --git a/ugbc/src/targets/d32/_optimizer.c b/ugbc/src/targets/d32/_optimizer.c index c19222a44..5941ae241 100755 --- a/ugbc/src/targets/d32/_optimizer.c +++ b/ugbc/src/targets/d32/_optimizer.c @@ -2121,6 +2121,85 @@ static void optim_remove_unused_temporary( Environment * _environment ) { optim( buf[2], RULE "unused temporary", "\tTST%s", v1->str ); ++_environment->removedAssemblyLines; } + + } else if ( + ( ( po_buf_match( buf[0], " LDA #*", v1 ) || po_buf_match( buf[0], " CLRA") ) && po_buf_match( buf[1], " STA *", v2 ) && po_buf_match( buf[2], " STD *", v3 ) ) || + ( ( po_buf_match( buf[0], " LDB #*", v1 ) || po_buf_match( buf[0], " CLRB") ) && po_buf_match( buf[1], " STB *", v2 ) && po_buf_match( buf[2], " STD *", v3 ) ) + ) { + + char * realVarName = strdup( v2->str ); + char * c = strstr( realVarName, "+" ); + if ( c ) { + *c = 0; + } + c = strstr( realVarName, "<(" ); + if ( c ) { + strcpy( c, c+2 ); + } + c = strstr( realVarName, ")" ); + if ( c ) { + *c = 0; + } + + // printf(" RULE #2 for [%s]\n", realVarName ); + + UnusedSymbol * tmp = currentlyUnusedSymbols; + while( tmp ) { + // printf(" - compare %s = %s\n", realVarName, tmp->realName ); + if ( strcmp( realVarName, tmp->realName ) == 0 ) { + // printf(" > found!\n" ); + break; + } + tmp = tmp->next; + } + // printf( "\n" ); + if ( tmp ) { + // printf(" APPLIED #2\n"); + // optim( buf[0], RULE "unused temporary bug", NULL ); + optim( buf[1], RULE "unused temporary", NULL ); + ++_environment->removedAssemblyLines; + ++_environment->removedAssemblyLines; + } + } else if ( + po_buf_match( buf[0], " DEC*", v1 ) && + po_buf_match( buf[1], "_*", v4 ) && + po_buf_match( buf[2], " ST* *", v3, v2 ) && + (po_buf_cmp( v1, v3 ) == 0) + ) { + + char * realVarName = strdup( v2->str ); + char * c = strstr( realVarName, "+" ); + if ( c ) { + *c = 0; + } + c = strstr( realVarName, "<(" ); + if ( c ) { + strcpy( c, c+2 ); + } + c = strstr( realVarName, ")" ); + if ( c ) { + *c = 0; + } + + // printf(" RULE #2 for [%s]\n", realVarName ); + + UnusedSymbol * tmp = currentlyUnusedSymbolsQ; + while( tmp ) { + // printf(" - compare %s = %s\n", realVarName, tmp->realName ); + if ( strcmp( realVarName, tmp->realName ) == 0 ) { + // printf(" > found!\n" ); + break; + } + tmp = tmp->next; + } + // printf( "\n" ); + if ( tmp ) { + // printf(" APPLIED #2\n"); + // optim( buf[0], RULE "unused temporary", NULL ); + optim( buf[2], RULE "unused temporary", "\tTST%s", v1->str ); + ++_environment->removedAssemblyLines; + } + } else if ( ( ( po_buf_match( buf[0], " LDA #*", v1 ) || po_buf_match( buf[0], " CLRA") ) && po_buf_match( buf[1], " STA *", v2 ) ) || ( ( po_buf_match( buf[0], " LDB #*", v1 ) || po_buf_match( buf[0], " CLRB") ) && po_buf_match( buf[1], " STB *", v2 ) ) || @@ -2155,7 +2234,7 @@ static void optim_remove_unused_temporary( Environment * _environment ) { // printf( "\n" ); if ( tmp ) { // printf(" APPLIED #2\n"); - // optim( buf[0], RULE "unused temporary", NULL ); + optim( buf[0], RULE "unused temporary bug", NULL ); optim( buf[1], RULE "unused temporary", NULL ); ++_environment->removedAssemblyLines; ++_environment->removedAssemblyLines; diff --git a/ugbc/src/targets/d32/_var.c b/ugbc/src/targets/d32/_var.c index 52ab2f9f6..c348a5f17 100755 --- a/ugbc/src/targets/d32/_var.c +++ b/ugbc/src/targets/d32/_var.c @@ -129,6 +129,7 @@ static void variable_cleanup_entry( Environment * _environment, Variable * _firs outhead1("%s rzb 1", variable->realName); } break; + case VT_MSPRITE: case VT_SPRITE: if ( variable->memoryArea ) { outhead2("%s equ $%4.4x", variable->realName, variable->absoluteAddress); diff --git a/ugbc/src/targets/d64/_var.c b/ugbc/src/targets/d64/_var.c index f1f98ce5a..6c6c9e711 100755 --- a/ugbc/src/targets/d64/_var.c +++ b/ugbc/src/targets/d64/_var.c @@ -129,6 +129,7 @@ static void variable_cleanup_entry( Environment * _environment, Variable * _firs outhead1("%s rzb 1", variable->realName); } break; + case VT_MSPRITE: case VT_SPRITE: if ( variable->memoryArea ) { outhead2("%s equ $%4.4x", variable->realName, variable->absoluteAddress); diff --git a/ugbc/src/targets/mo5/_var.c b/ugbc/src/targets/mo5/_var.c index 3632b5ad3..1285b2a94 100755 --- a/ugbc/src/targets/mo5/_var.c +++ b/ugbc/src/targets/mo5/_var.c @@ -129,6 +129,7 @@ static void variable_cleanup_entry( Environment * _environment, Variable * _firs outhead1("%s rzb 1", variable->realName); } break; + case VT_MSPRITE: case VT_SPRITE: if ( variable->memoryArea ) { outhead2("%s equ $%4.4x", variable->realName, variable->absoluteAddress); @@ -574,6 +575,7 @@ void variable_cleanup( Environment * _environment ) { } deploy_inplace_preferred( ef936xvars, src_hw_ef936x_vars_asm); + deploy_inplace_preferred( ef936xstartup, src_hw_ef936x_startup_asm); deploy_inplace_preferred( putimage, src_hw_ef936x_put_image_asm ); deploy_inplace_preferred( getimage, src_hw_ef936x_get_image_asm ); deploy_inplace_preferred( textEncodedAt, src_hw_ef936x_text_at_asm ); diff --git a/ugbc/src/targets/msx1/_var.c b/ugbc/src/targets/msx1/_var.c index 0df37180d..b33b3c291 100755 --- a/ugbc/src/targets/msx1/_var.c +++ b/ugbc/src/targets/msx1/_var.c @@ -131,6 +131,7 @@ static void variable_cleanup_entry( Environment * _environment, Variable * _firs outhead0("section code_user"); } break; + case VT_MSPRITE: case VT_SPRITE: if ( variable->memoryArea ) { outline2("%s: EQU $%4.4x", variable->realName, variable->absoluteAddress); @@ -557,6 +558,7 @@ void variable_cleanup( Environment * _environment ) { outline0("JMP CODESTART2"); deploy_inplace_preferred( startup, src_hw_msx1_startup_asm); + deploy_inplace_preferred( startup, src_hw_tms9918_startup_asm); buffered_prepend_output( _environment ); diff --git a/ugbc/src/targets/pc128op/_var.c b/ugbc/src/targets/pc128op/_var.c index 37efcad67..567615b45 100755 --- a/ugbc/src/targets/pc128op/_var.c +++ b/ugbc/src/targets/pc128op/_var.c @@ -814,6 +814,7 @@ void variable_cleanup( Environment * _environment ) { deploy_inplace_preferred( ef936xvars, src_hw_ef936x_vars_asm); deploy_inplace_preferred( startup, src_hw_pc128op_startup_asm); + deploy_inplace_preferred( ef936xstartup, src_hw_ef936x_startup_asm); deploy_inplace_preferred( putimage, src_hw_ef936x_put_image_asm ); deploy_inplace_preferred( getimage, src_hw_ef936x_get_image_asm ); if ( _environment->keyboardFullSupport ) { diff --git a/ugbc/src/targets/pc1403/_var.c b/ugbc/src/targets/pc1403/_var.c index 8d58fd5b4..8fea7bf6b 100755 --- a/ugbc/src/targets/pc1403/_var.c +++ b/ugbc/src/targets/pc1403/_var.c @@ -115,6 +115,7 @@ static void variable_cleanup_entry( Environment * _environment, Variable * _firs outline1("%s: db 0", variable->realName); } break; + case VT_MSPRITE: case VT_SPRITE: if ( variable->memoryArea ) { outline2("%s .equ 0x%4.4x", variable->realName, variable->absoluteAddress); diff --git a/ugbc/src/targets/plus4/_var.c b/ugbc/src/targets/plus4/_var.c index 667fb97e2..e5a237d3a 100755 --- a/ugbc/src/targets/plus4/_var.c +++ b/ugbc/src/targets/plus4/_var.c @@ -127,6 +127,7 @@ static void variable_cleanup_entry( Environment * _environment, Variable * _firs break; case VT_TILE: case VT_TILESET: + case VT_MSPRITE: case VT_SPRITE: if ( variable->memoryArea ) { // outhead2("%s = $%4.4x", variable->realName, variable->absoluteAddress); @@ -320,6 +321,7 @@ static void variable_cleanup_memory_mapped( Environment * _environment, Variable outhead2("%s = cstring%d", _variable->realName, _variable->valueString->id ); break; case VT_DSTRING: + case VT_MSPRITE: case VT_SPRITE: case VT_TILE: case VT_TILESET: diff --git a/ugbc/src/targets/sc3000/_var.c b/ugbc/src/targets/sc3000/_var.c index 91bfc2bea..a8f2ee2ef 100755 --- a/ugbc/src/targets/sc3000/_var.c +++ b/ugbc/src/targets/sc3000/_var.c @@ -131,6 +131,7 @@ static void variable_cleanup_entry( Environment * _environment, Variable * _firs outhead0("section code_user"); } break; + case VT_MSPRITE: case VT_SPRITE: if ( variable->memoryArea ) { outline2("%s: EQU $%4.4x", variable->realName, variable->absoluteAddress); diff --git a/ugbc/src/targets/sg1000/_var.c b/ugbc/src/targets/sg1000/_var.c index 1c661fcee..d24790eb9 100755 --- a/ugbc/src/targets/sg1000/_var.c +++ b/ugbc/src/targets/sg1000/_var.c @@ -131,6 +131,7 @@ static void variable_cleanup_entry( Environment * _environment, Variable * _firs outhead0("section code_user"); } break; + case VT_MSPRITE: case VT_SPRITE: if ( variable->memoryArea ) { outline2("%s: EQU $%4.4x", variable->realName, variable->absoluteAddress); diff --git a/ugbc/src/targets/to8/_var.c b/ugbc/src/targets/to8/_var.c index 858add757..2f518f300 100755 --- a/ugbc/src/targets/to8/_var.c +++ b/ugbc/src/targets/to8/_var.c @@ -319,6 +319,7 @@ static void variable_cleanup_entry_byte( Environment * _environment, Variable * outhead1("%s rzb 1", variable->realName); } break; + case VT_MSPRITE: case VT_SPRITE: if ( variable->memoryArea ) { outhead2("%s equ $%4.4x", variable->realName, variable->absoluteAddress); @@ -785,6 +786,7 @@ void variable_cleanup( Environment * _environment ) { outline0("fcb $ff"); deploy_inplace_preferred( ef936xvars, src_hw_ef936x_vars_asm); + deploy_inplace_preferred( ef936xstartup, src_hw_ef936x_startup_asm); deploy_inplace_preferred( putimage, src_hw_ef936x_put_image_asm ); deploy_inplace_preferred( getimage, src_hw_ef936x_get_image_asm ); deploy_inplace_preferred( scancode, src_hw_to8_scancode_asm ); diff --git a/ugbc/src/targets/vg5000/_var.c b/ugbc/src/targets/vg5000/_var.c index 0299365ac..6ffdbbfec 100755 --- a/ugbc/src/targets/vg5000/_var.c +++ b/ugbc/src/targets/vg5000/_var.c @@ -103,6 +103,7 @@ static void variable_cleanup_entry( Environment * _environment, Variable * _firs outline1("%s: db 0", variable->realName); } break; + case VT_MSPRITE: case VT_SPRITE: if ( variable->memoryArea ) { outline2("%s: EQU $%4.4x", variable->realName, variable->absoluteAddress); diff --git a/ugbc/src/targets/vic20/_var.c b/ugbc/src/targets/vic20/_var.c index b5a97f4fd..8920adb28 100755 --- a/ugbc/src/targets/vic20/_var.c +++ b/ugbc/src/targets/vic20/_var.c @@ -121,6 +121,7 @@ static void variable_cleanup_entry( Environment * _environment, Variable * _firs outhead1("%s: .res 1,0", variable->realName); } break; + case VT_MSPRITE: case VT_SPRITE: if ( variable->memoryArea ) { outhead2("%s = $%4.4x", variable->realName, variable->absoluteAddress); diff --git a/ugbc/src/targets/zx/_var.c b/ugbc/src/targets/zx/_var.c index a0cd3a7a3..46a863e96 100755 --- a/ugbc/src/targets/zx/_var.c +++ b/ugbc/src/targets/zx/_var.c @@ -88,6 +88,7 @@ static void variable_cleanup_entry( Environment * _environment, Variable * _firs case VT_DSTRING: outline1("%s: db 0", variable->realName); break; + case VT_MSPRITE: case VT_SPRITE: outline1("%s: db 0", variable->realName); break; diff --git a/ugbc/src/ugbc.embed.y b/ugbc/src/ugbc.embed.y index 3968a373e..f58322e6c 100755 --- a/ugbc/src/ugbc.embed.y +++ b/ugbc/src/ugbc.embed.y @@ -441,6 +441,8 @@ const_factor: $$ = ((struct _Environment *)_environment)->vestigialConfig.rchack_4gravity_1163; } else if ( strcmp( $3, "rchack_4gravity_1164" ) == 0 ) { $$ = ((struct _Environment *)_environment)->vestigialConfig.rchack_4gravity_1164; + } else if ( strcmp( $3, "clsImplicit" ) == 0 ) { + $$ = ((struct _Environment *)_environment)->vestigialConfig.clsImplicit; } else { $$ = 0; } diff --git a/ugbc/src/ugbc.y b/ugbc/src/ugbc.y index 0be5c9733..9dca138a2 100755 --- a/ugbc/src/ugbc.y +++ b/ugbc/src/ugbc.y @@ -11371,6 +11371,7 @@ program : %% char version[MAX_TEMPORARY_STORAGE] = UGBASIC_VERSION; +char revision[MAX_TEMPORARY_STORAGE] = UGBASIC_REVISION; void show_usage_and_exit( int _argc, char *_argv[] ) { @@ -11825,7 +11826,7 @@ int main( int _argc, char *_argv[] ) { _environment->profileCycles = atoi(optarg); break; case 'V': - fprintf(stderr, "%s", version ); + fprintf(stderr, "%s\n%s\n", version, revision ); exit(0); break; case '1':