disclaims liability for changes, errors or omissions.*
-*Copyright © 2011-2020, Reboot*
+*Copyright © 2011-2022, the rmac authors*
*All rights reserved.*
-*Reboot Document number F00000K-001 Rev. A.*
-
Contents
========
+o\ *0-30*/*p* Enable specific optimisation
~o\ *0-30*/*p* Disable specific optimisation
- `0: Absolute long adddresses to word (on by default)`
+ `0: Absolute long adddresses to word`
- `1: move.l #x,Dn/An to moveq (on by default)`
+ `1: move.l #x,Dn/An to moveq`
- `2: Word branches to short (on by default)`
+ `2: Word branches to short`
`3: Outer displacement 0(An) to (An)`
`11: 56001 Auto convert short addressing mode to long (default: on)`
- `o30: Enforce PC relative (alternative name: op)`
+ `30: Enforce PC relative (alternative name: op)`
-p Produce an executable (**.prg**) output file.
-ps Produce an executable (**.prg**) output file with symbols.
a0 a1 a2 a3 a4 a5 a6 a7
Tom/Jerry:
r0 r1 r2 r3 r4 r5 r6 r7
- r8 r9 r10 r11 r12 rl3 r14 r15
+ r8 r9 r10 r11 r12 r13 r14 r15
6502:
x y a
DSP56001:
Therefore, to align GPU/DSP code, align the current section before and
after the GPU/DSP code.
- **.assert** *expression* [,\ *expression*...]
+**.align** *expression*
+
+ A generalised version of the above directives, this will align the program
+ counter to the boundary of the specified value. Note that there is not much
+ error checking happening (only values 0 and 1 are rejected). Also note that
+ in DSP56001 mode the align value is assumed to be in DSP words, i.e. 24 bits.
+
+**.assert** *expression* [,\ *expression*...]
Assert that the conditions are true (non-zero). If any of the comma-seperated
expressions evaluates to zero an assembler warning is issued. For example:
-@echo off
-REM Check for file dates and build .h files if needed
-
-SET FILE1=68k.mch
-SET FILE2=68ktab.h
-if not exist %FILE2% GOTO BUILD
-for /F %%i IN ('dir /b /OD %FILE1% %FILE2% ^| more +1') DO SET NEWEST=%%i
-if %NEWEST%==%FILE1% GOTO BUILD
-
-SET FILE1=direct.tab
-SET FILE2=mntab.h
-if not exist %FILE2% GOTO BUILD
-for /F %%i IN ('dir /b /OD %FILE1% %FILE2% ^| more +1') DO SET NEWEST=%%i
-if %NEWEST%==%FILE1% GOTO BUILD
-
-SET FILE1=kw.tab
-SET FILE2=kwtab.h
-if not exist %FILE2% GOTO BUILD
-for /F %%i IN ('dir /b /OD %FILE1% %FILE2% ^| more +1') DO SET NEWEST=%%i
-if %NEWEST%==%FILE1% GOTO BUILD
-
-SET FILE1=risc.tab
-SET FILE2=risckw.h
-if not exist %FILE2% GOTO BUILD
-for /F %%i IN ('dir /b /OD %FILE1% %FILE2% ^| more +1') DO SET NEWEST=%%i
-if %NEWEST%==%FILE1% GOTO BUILD
-
-SET FILE1=dsp56k.mch
-SET FILE2=dsp56ktab.h
-if not exist %FILE2% GOTO BUILD
-for /F %%i IN ('dir /b /OD %FILE1% %FILE2% ^| more +1') DO SET NEWEST=%%i
-if %NEWEST%==%FILE1% GOTO BUILD
-
-SET FILE1=6502.tab
-SET FILE2=6502kw.h
-if not exist %FILE2% GOTO BUILD
-for /F %%i IN ('dir /b /OD %FILE1% %FILE2% ^| more +1') DO SET NEWEST=%%i
-if %NEWEST%==%FILE1% GOTO BUILD
-
-SET FILE1=op.tab
-SET FILE2=opkw.h
-if not exist %FILE2% GOTO BUILD
-for /F %%i IN ('dir /b /OD %FILE1% %FILE2% ^| more +1') DO SET NEWEST=%%i
-if %NEWEST%==%FILE1% GOTO BUILD
-
-SET FILE1=68kregs.tab
-SET FILE2=68kregs.h
-if not exist %FILE2% GOTO BUILD
-for /F %%i IN ('dir /b /OD %FILE1% %FILE2% ^| more +1') DO SET NEWEST=%%i
-if %NEWEST%==%FILE1% GOTO BUILD
-
-SET FILE1=56kregs.tab
-SET FILE2=56kregs.h
-if not exist %FILE2% GOTO BUILD
-for /F %%i IN ('dir /b /OD %FILE1% %FILE2% ^| more +1') DO SET NEWEST=%%i
-if %NEWEST%==%FILE1% GOTO BUILD
-
-SET FILE1=6502regs.tab
-SET FILE2=6502regs.h
-if not exist %FILE2% GOTO BUILD
-for /F %%i IN ('dir /b /OD %FILE1% %FILE2% ^| more +1') DO SET NEWEST=%%i
-if %NEWEST%==%FILE1% GOTO BUILD
-
-SET FILE1=riscregs.tab
-SET FILE2=riscregs.h
-if not exist %FILE2% GOTO BUILD
-for /F %%i IN ('dir /b /OD %FILE1% %FILE2% ^| more +1') DO SET NEWEST=%%i
-if %NEWEST%==%FILE1% GOTO BUILD
-
-SET FILE1=unary.tab
-SET FILE2=unarytab.h
-if not exist %FILE2% GOTO BUILD
-for /F %%i IN ('dir /b /OD %FILE1% %FILE2% ^| more +1') DO SET NEWEST=%%i
-if %NEWEST%==%FILE1% GOTO BUILD
-
-GOTO END
+rem @echo off
+rem Check for file dates and build .h files if needed
+
+call :CHECK_OUT_OF_DATE 68k.mch 68ktab.h
+call :CHECK_OUT_OF_DATE direct.tab mntab.h
+call :CHECK_OUT_OF_DATE kw.tab kwtab.h
+call :CHECK_OUT_OF_DATE risc.tab risckw.h
+call :CHECK_OUT_OF_DATE dsp56k.mch dsp56ktab.h
+call :CHECK_OUT_OF_DATE 6502.tab 6502kw.h
+call :CHECK_OUT_OF_DATE op.tab opkw.h
+call :CHECK_OUT_OF_DATE 68kregs.tab 68kregs.h
+call :CHECK_OUT_OF_DATE 56kregs.tab 56kregs.h
+call :CHECK_OUT_OF_DATE 6502regs.tab 6502regs.h
+call :CHECK_OUT_OF_DATE riscregs.tab riscregs.h
+call :CHECK_OUT_OF_DATE unary.tab unarytab.h
+
+GOTO NOGEN
:BUILD
kwgen regrisc <riscregs.tab >riscregs.h
kwgen unary <unary.tab >unarytab.h
-rem touch files that include these header files so they'll recompile
+rem Touch timestamps of files that include these header files so they'll recompile
echo Generating tables...
copy /b amode.c +,, >NUL
copy /b direct.c +,, >NUL
copy /b riscasm.c +,, >NUL
copy /b token.c +,, >NUL
copy /b dsp56k_mach.c +,, >NUL
+copy /b eagen.c +,, >NUL
+goto :END
-:END
+:NOGEN
-REM If eagen0.c is newer than eagen.c then "touch" eagen.c so that visual studio will recompile both.
+REM If eagen0.c is newer than eagen.c then "touch" eagen.c so that visual studio will recompile oth.
REM Same for amode.c / parmode.h and mach.c / 68ktab.h
+call :CHECK_AND_TOUCH eagen0.c eagen.c
+call :CHECK_AND_TOUCH parmode.h amode.c
+call :CHECK_AND_TOUCH 68ktab.h mach.c
-SET FILE1=eagen0.c
-SET FILE2=eagen.c
-for /F %%i IN ('dir /b /OD %FILE1% %FILE2% ^| more +1') DO SET NEWEST=%%i
-if %NEWEST%==%FILE2% GOTO CHECK2
-Echo touching eagen0.c...
-copy /b eagen.c +,, >NUL
+:END
+exit /b
-:CHECK2
-SET FILE1=parmode.h
-SET FILE2=amode.c
+rem Check if second passed file is older compared to the first, or doesn't exist, or is zero size. In which case go generate everything just to be sure
+:CHECK_OUT_OF_DATE
+SET FILE1=%1
+SET FILE2=%2
+if not exist %FILE2% GOTO BUILD
+FOR /F "usebackq" %%A IN ('%FILE2%') DO set size=%%~zA
+if "%size%"=="0" GOTO BUILD
for /F %%i IN ('dir /b /OD %FILE1% %FILE2% ^| more +1') DO SET NEWEST=%%i
-if %NEWEST%==%FILE2% GOTO CHECK3
-Echo touching amode.c...
-copy /b amode.c +,, >NUL
+if %NEWEST%==%FILE1% GOTO BUILD
-:CHECK3
-SET FILE1=68ktab.h
-SET FILE2=mach.c
-for /F %%i IN ('dir /b /OD %FILE1% %FILE2% ^| more +1') DO SET NEWEST=%%i
-if %NEWEST%==%FILE2% GOTO END
-Echo touching mach.c...
-copy /b mach.c +,, >NUL
+exit /b
-:END
+rem Check if second passed file is older compared to the first, and "touch" the file stamp of hat file if yes
+:CHECK_AND_TOUCH
+SET FILE1=%1
+SET FILE2=%2
+for /F %%i IN ('dir /b /OD %FILE1% %FILE2% ^| more +1') DO SET NEWEST=%%i
+if %NEWEST%==%FILE2% GOTO :CHECK_AND_TOUCH_END
+Echo touching %2...
+copy /b %2 +,, >NUL
+:CHECK_AND_TOUCH_END
+exit /b