mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Merge pull request #114 from Ben10do/fix-asm-tests
Fix issues in rgbasm raised by the tests
This commit is contained in:
@@ -142,8 +142,9 @@ void copyrept( void )
|
|||||||
{
|
{
|
||||||
SLONG level=1, len, instring=0;
|
SLONG level=1, len, instring=0;
|
||||||
char *src=pCurrentBuffer->pBuffer;
|
char *src=pCurrentBuffer->pBuffer;
|
||||||
|
char *bufferEnd = pCurrentBuffer->pBufferStart + pCurrentBuffer->nBufferSize;
|
||||||
|
|
||||||
while( *src && level )
|
while( src < bufferEnd && level )
|
||||||
{
|
{
|
||||||
if( instring==0 )
|
if( instring==0 )
|
||||||
{
|
{
|
||||||
@@ -221,8 +222,9 @@ void copymacro( void )
|
|||||||
{
|
{
|
||||||
SLONG level=1, len, instring=0;
|
SLONG level=1, len, instring=0;
|
||||||
char *src=pCurrentBuffer->pBuffer;
|
char *src=pCurrentBuffer->pBuffer;
|
||||||
|
char *bufferEnd = pCurrentBuffer->pBufferStart + pCurrentBuffer->nBufferSize;
|
||||||
|
|
||||||
while( *src && level )
|
while( src < bufferEnd && level )
|
||||||
{
|
{
|
||||||
if( instring==0 )
|
if( instring==0 )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -316,6 +316,9 @@ rpn_DIV(struct Expression * expr, struct Expression * src1,
|
|||||||
struct Expression * src2)
|
struct Expression * src2)
|
||||||
{
|
{
|
||||||
joinexpr();
|
joinexpr();
|
||||||
|
if (src2->nVal == 0) {
|
||||||
|
fatalerror("division by zero");
|
||||||
|
}
|
||||||
expr->nVal = (expr->nVal / src2->nVal);
|
expr->nVal = (expr->nVal / src2->nVal);
|
||||||
pushbyte(expr, RPN_DIV);
|
pushbyte(expr, RPN_DIV);
|
||||||
}
|
}
|
||||||
@@ -325,6 +328,9 @@ rpn_MOD(struct Expression * expr, struct Expression * src1,
|
|||||||
struct Expression * src2)
|
struct Expression * src2)
|
||||||
{
|
{
|
||||||
joinexpr();
|
joinexpr();
|
||||||
|
if (src2->nVal == 0) {
|
||||||
|
fatalerror("division by zero");
|
||||||
|
}
|
||||||
expr->nVal = (expr->nVal % src2->nVal);
|
expr->nVal = (expr->nVal % src2->nVal);
|
||||||
pushbyte(expr, RPN_MOD);
|
pushbyte(expr, RPN_MOD);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user