mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Make it possible to disable emitting nop after halt.
This commit is contained in:
@@ -154,7 +154,12 @@ z80_ex : T_Z80_EX T_MODE_HL comma T_MODE_SP_IND
|
|||||||
;
|
;
|
||||||
|
|
||||||
z80_halt: T_Z80_HALT
|
z80_halt: T_Z80_HALT
|
||||||
{ out_AbsByte(0x76); out_AbsByte(0x00); }
|
{
|
||||||
|
out_AbsByte(0x76);
|
||||||
|
if (haltnop) {
|
||||||
|
out_AbsByte(0x00);
|
||||||
|
}
|
||||||
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
z80_inc : T_Z80_INC reg_r
|
z80_inc : T_Z80_INC reg_r
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -29,6 +30,8 @@ void setuplex(void);
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
bool haltnop;
|
||||||
|
|
||||||
clock_t nStartClock, nEndClock;
|
clock_t nStartClock, nEndClock;
|
||||||
SLONG nLineNo;
|
SLONG nLineNo;
|
||||||
ULONG nTotalLines, nPass, nPC, nIFDepth, nErrors;
|
ULONG nTotalLines, nPass, nPC, nIFDepth, nErrors;
|
||||||
@@ -238,7 +241,8 @@ PrintUsage(void)
|
|||||||
{
|
{
|
||||||
printf("RGBAsm v" ASM_VERSION " (part of ASMotor " ASMOTOR_VERSION
|
printf("RGBAsm v" ASM_VERSION " (part of ASMotor " ASMOTOR_VERSION
|
||||||
")\n\n");
|
")\n\n");
|
||||||
printf("Usage: rgbasm [-b chars] [-g chars] [-i path] [-o outfile] [-p pad_value] file\n");
|
printf("Usage: rgbasm [-h] [-b chars] [-g chars] [-i path] [-o outfile] [-p pad_value]\n"
|
||||||
|
" file\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@@ -258,6 +262,8 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
char *tzMainfile;
|
char *tzMainfile;
|
||||||
|
|
||||||
|
haltnop = true;
|
||||||
|
|
||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
PrintUsage();
|
PrintUsage();
|
||||||
|
|
||||||
@@ -275,7 +281,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
newopt = CurrentOptions;
|
newopt = CurrentOptions;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "b:g:i:o:p:")) != -1) {
|
while ((ch = getopt(argc, argv, "b:g:hi:o:p:")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'b':
|
case 'b':
|
||||||
if (strlen(optarg) == 2) {
|
if (strlen(optarg) == 2) {
|
||||||
@@ -299,6 +305,9 @@ main(int argc, char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'h':
|
||||||
|
haltnop = false;
|
||||||
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
fstk_AddIncludePath(optarg);
|
fstk_AddIncludePath(optarg);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
.Nd Game Boy assembler
|
.Nd Game Boy assembler
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm rgbasm
|
.Nm rgbasm
|
||||||
|
.Op Fl h
|
||||||
.Op Fl b Ar chars
|
.Op Fl b Ar chars
|
||||||
.Op Fl g Ar chars
|
.Op Fl g Ar chars
|
||||||
.Op Fl i Ar path
|
.Op Fl i Ar path
|
||||||
@@ -24,6 +25,17 @@ The defaults are 01.
|
|||||||
.It Fl g Ar chars
|
.It Fl g Ar chars
|
||||||
Change the four characters used for binary constants.
|
Change the four characters used for binary constants.
|
||||||
The defaults are 0123.
|
The defaults are 0123.
|
||||||
|
.It Fl h
|
||||||
|
By default,
|
||||||
|
.Nm
|
||||||
|
inserts a
|
||||||
|
.Sq nop
|
||||||
|
instruction immediately after any
|
||||||
|
.Sq halt
|
||||||
|
instruction.
|
||||||
|
The
|
||||||
|
.Fl h
|
||||||
|
option disables this behavior.
|
||||||
.It Fl i Ar path
|
.It Fl i Ar path
|
||||||
Add an include path.
|
Add an include path.
|
||||||
.It Fl o Ar outfile
|
.It Fl o Ar outfile
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
%{
|
%{
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -15,6 +16,8 @@
|
|||||||
#include "asm/main.h"
|
#include "asm/main.h"
|
||||||
#include "asm/lexer.h"
|
#include "asm/lexer.h"
|
||||||
|
|
||||||
|
extern bool haltnop;
|
||||||
|
|
||||||
char *tzNewMacro;
|
char *tzNewMacro;
|
||||||
ULONG ulNewMacroSize;
|
ULONG ulNewMacroSize;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user