edouardberge / rasm Goto Github PK
View Code? Open in Web Editor NEWRASM powerful Z80 assembler
RASM powerful Z80 assembler
In file included from rasm.c:96:
./apultra.h:1201:19: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (nResult < 0) return -1;
~~~~~~~ ^ ~
./apultra.h:1216:22: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (nResult < 0) return -1;
~~~~~~~ ^ ~
./apultra.h:1246:25: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (nResult < 0) return -1;
~~~~~~~ ^ ~
./apultra.h:1271:28: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (nResult < 0) return -1;
~~~~~~~ ^ ~
./apultra.h:1275:28: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (nResult < 0) return -1;
~~~~~~~ ^ ~
./apultra.h:1279:28: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (nResult < 0) return -1;
~~~~~~~ ^ ~
./apultra.h:1283:28: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (nResult < 0) return -1;
~~~~~~~ ^ ~
./apultra.h:1325:19: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (nResult < 0) return -1;
~~~~~~~ ^ ~
./apultra.h:1339:22: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (nResult < 0) return -1;
~~~~~~~ ^ ~
./apultra.h:1406:25: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (nResult < 0) return -1;
~~~~~~~ ^ ~
./apultra.h:1452:28: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (nResult < 0) return -1;
~~~~~~~ ^ ~
./apultra.h:1456:28: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (nResult < 0) return -1;
~~~~~~~ ^ ~
./apultra.h:1460:28: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (nResult < 0) return -1;
~~~~~~~ ^ ~
./apultra.h:1464:28: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (nResult < 0) return -1;
~~~~~~~ ^ ~
rasm.c:2738:10: warning: passing 'unsigned char *' to parameter of type 'char *' converts between pointers to integer types with different sign
[-Wpointer-sign]
strncpy(&HobetaHeader[0],trdos_name,8);
^~~~~~~~~~~~~~~~
/gg/include/string.h:65:29: note: passing argument to parameter here
char *strncpy __P((char *, const char *, size_t));
^
rasm.c:13238:14: warning: passing 'unsigned char [4]' to parameter of type 'const char *' converts between pointers to integer types with different sign
[-Wpointer-sign]
if (strncmp(wav_header->ChunkID,"RIFF",4)) {
^~~~~~~~~~~~~~~~~~~
/gg/include/string.h:64:35: note: passing argument to parameter here
int strncmp __P((const char *, const char *, size_t));
^
rasm.c:13239:15: warning: passing 'unsigned char [4]' to parameter of type 'const char *' converts between pointers to integer types with different sign
[-Wpointer-sign]
if (strncmp(wav_header->ChunkID,"RIFX",4)) {
^~~~~~~~~~~~~~~~~~~
/gg/include/string.h:64:35: note: passing argument to parameter here
int strncmp __P((const char *, const char *, size_t));
^
rasm.c:13246:14: warning: passing 'unsigned char [4]' to parameter of type 'const char *' converts between pointers to integer types with different sign
[-Wpointer-sign]
if (strncmp(wav_header->Format,"WAVE",4)) {
^~~~~~~~~~~~~~~~~~
/gg/include/string.h:64:35: note: passing argument to parameter here
int strncmp __P((const char *, const char *, size_t));
^
rasm.c:13255:14: warning: passing 'unsigned char [4]' to parameter of type 'const char *' converts between pointers to integer types with different sign
[-Wpointer-sign]
if (strncmp(wav_header->SubChunk1ID,"fmt",3)) {
^~~~~~~~~~~~~~~~~~~~~~~
/gg/include/string.h:64:35: note: passing argument to parameter here
int strncmp __P((const char *, const char *, size_t));
^
rasm.c:13264:17: warning: passing 'unsigned char *' to parameter of type 'const char *' converts between pointers to integer types with different sign
[-Wpointer-sign]
while (strncmp(subchunk,"data",4)) {
^~~~~~~~
/gg/include/string.h:64:35: note: passing argument to parameter here
int strncmp __P((const char *, const char *, size_t));
^
rasm.c:14477:32: warning: passing 'char [17]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign
[-Wpointer-sign]
InitAutomate(ae->AutomateHexa,AutomateHexaDefinition);
^~~~~~~~~~~~~~~~~~~~~~
rasm.c:1138:32: note: expanded from macro 'AutomateHexaDefinition'
#define AutomateHexaDefinition "0123456789ABCDEF"
^~~~~~~~~~~~~~~~~~
rasm.c:1682:55: note: passing argument to parameter 'def' here
void InitAutomate(char *autotab, const unsigned char *def)
^
rasm.c:14478:33: warning: passing 'char [12]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign
[-Wpointer-sign]
InitAutomate(ae->AutomateDigit,AutomateDigitDefinition);
^~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1137:33: note: expanded from macro 'AutomateDigitDefinition'
#define AutomateDigitDefinition ".0123456789"
^~~~~~~~~~~~~
rasm.c:1682:55: note: passing argument to parameter 'def' here
void InitAutomate(char *autotab, const unsigned char *def)
^
rasm.c:14479:38: warning: passing 'char [42]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign
[-Wpointer-sign]
InitAutomate(ae->AutomateValidLabel,AutomateValidLabelDefinition);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1136:38: note: expanded from macro 'AutomateValidLabelDefinition'
#define AutomateValidLabelDefinition "0123456789.ABCDEFGHIJKLMNOPQRSTUVWXYZ_@{}"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1682:55: note: passing argument to parameter 'def' here
void InitAutomate(char *autotab, const unsigned char *def)
^
rasm.c:14480:43: warning: passing 'char [30]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign
[-Wpointer-sign]
InitAutomate(ae->AutomateValidLabelFirst,AutomateValidLabelFirstDefinition);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1135:43: note: expanded from macro 'AutomateValidLabelFirstDefinition'
#define AutomateValidLabelFirstDefinition ".ABCDEFGHIJKLMNOPQRSTUVWXYZ_@"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1682:55: note: passing argument to parameter 'def' here
void InitAutomate(char *autotab, const unsigned char *def)
^
rasm.c:14481:55: warning: passing 'char [57]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign
[-Wpointer-sign]
InitAutomate(ae->AutomateExpressionValidCharExtended,AutomateExpressionValidCharExtendedDefinition);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1132:55: note: expanded from macro 'AutomateExpressionValidCharExtendedDefinition'
#define AutomateExpressionValidCharExtendedDefinition "0123456789.ABCDEFGHIJKLMNOPQRSTUVWXYZ_{}@+-*/~^$#%<A7><=>|&"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1682:55: note: passing argument to parameter 'def' here
void InitAutomate(char *autotab, const unsigned char *def)
^
rasm.c:14482:52: warning: passing 'char [44]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign
[-Wpointer-sign]
InitAutomate(ae->AutomateExpressionValidCharFirst,AutomateExpressionValidCharFirstDefinition);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1133:52: note: expanded from macro 'AutomateExpressionValidCharFirstDefinition'
#define AutomateExpressionValidCharFirstDefinition "#%0123456789.ABCDEFGHIJKLMNOPQRSTUVWXYZ_@${"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1682:55: note: passing argument to parameter 'def' here
void InitAutomate(char *autotab, const unsigned char *def)
^
rasm.c:14483:47: warning: passing 'char [43]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign
[-Wpointer-sign]
InitAutomate(ae->AutomateExpressionValidChar,AutomateExpressionValidCharDefinition);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1134:47: note: expanded from macro 'AutomateExpressionValidCharDefinition'
#define AutomateExpressionValidCharDefinition "0123456789.ABCDEFGHIJKLMNOPQRSTUVWXYZ_{}@$"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1682:55: note: passing argument to parameter 'def' here
void InitAutomate(char *autotab, const unsigned char *def)
^
rasm.c:15358:36: warning: passing 'unsigned char *' to parameter of type 'char *' converts between pointers to integer types with different sign
[-Wpointer-sign]
FileWriteBinary(TMP_filename,ae->mem[i]+offset,endoffset-offset);
^~~~~~~~~~~~~~~~~
./minilib.h:895:42: note: passing argument to parameter 'data' here
int FileWriteBinary(char *filename,char *data,int n)
^
rasm.c:19103:41: warning: passing 'unsigned char *' to parameter of type 'char *' converts between pointers to integer types with different sign
[-Wpointer-sign]
FileWriteBinary("autotest_include.raw",opcode,idx);
^~~~~~
./minilib.h:895:42: note: passing argument to parameter 'data' here
int FileWriteBinary(char *filename,char *data,int n)
^
29 warnings generated.
Hello Edouard, I have been using RASM for an MSX project and reached a point where a verbose listing of the assembly process would be very useful. I consulted the documentation and it shows that there is a number of options (item 2.7). However, the ones I need show as "deprecated" on screen and no listing is generated.
I can understand that these options are not used often, however it would have helped me a lot if they were still there.
What is the latest RASM version to have these options enabled?
I fully understand that you have a reason not to include them anymore, however... I'd like to ask you to re-enable these debug options.
Thank you in advance! Kudos for your amazing work!
In my main file main.asm, I include a file:
include "macros.asm"
The macros.asm file itself includes other files:
include "macros/video.asm"
include "macros/sound.asm"
If I don't add a new line at the end of the macros.asm file, compilation fails:
Pre-processing [./src/main.asm]
Error: [.\src\macros.asm:2] invalid char ';' (59) char 1
windows version is abnormally slow to find label case with huge project (13Mb sources)
I've experimented with several forms of syntax for macros (it seems there are a few in the RASM manual) and have been unsuccessful getting any of them to work.
For the sake of this discussion let's analyze this example:
; Define macro (from RASM manual)
macro LDIXREG register,dep
if dep<-128 || dep>127
push BC
ld BC,dep
add IX,BC
ld (IX+0),register
pop BC
else
ld (IX+dep),register
endif
mend
; Minimal program to repro error
org 0000h
ld sp,FFFFh
LDIXREG H,200
LDIXREG L,32
I am using this command line from Windows, working directory includes the RASM binary.
rasm_win64 "error_repro.z80asm" -ob "error_repro.bin"
And the following error occurs:
Pre-processing [error_repro.z80asm]
Assembling
Error: [error_repro.z80asm:18] expression [DEP<-128||DEP>127] keyword [DEP] not found in variables, labels or aliases
Error: [error_repro.z80asm:18] expression [DEP<-128||DEP>127] keyword [DEP] not found in variables, labels or aliases
Error: [error_repro.z80asm:19] expression [DEP<-128||DEP>127] keyword [DEP] not found in variables, labels or aliases
Error: [error_repro.z80asm:19] expression [DEP<-128||DEP>127] keyword [DEP] not found in variables, labels or aliases
Error: [error_repro.z80asm:18] expression [((0)+DEP)] keyword [DEP] not found in variables, labels or aliases
Error: [error_repro.z80asm:18] expression [REGISTER] keyword [REGISTER] not found in variables, labels or aliases
Error: [error_repro.z80asm:19] expression [((0)+DEP)] keyword [DEP] not found in variables, labels or aliases
Error: [error_repro.z80asm:19] expression [REGISTER] keyword [REGISTER] not found in variables, labels or aliases
Error: 8 errors
If I bracket the arguments or params it makes no difference. Changing tabbing of the macro or invocation thereof does not alter error behavior. If I replace the parameter comma with a space it concatenates them and I get:
Pre-processing [error_repro.z80asm]
Assembling
Error: [error_repro.z80asm:18] MACRO [LDIXREG] was defined with 1 parameter {REGISTERDEP}
Error: [error_repro.z80asm:19] MACRO [LDIXREG] was defined with 1 parameter {REGISTERDEP}
Error: 2 errors
I've been successful in assembling several binaries with no macros, even those with the repeat directive. Great tool! I would love to sort out this issue with macros, whether it's in better communicating an error I'm making, or if there's an error with the assembler. Thank you!
OS: Windows 10 x64 10.0.19041.928
RASM: v1.4, v1.3, v1.2, v1.1 win64; further errors with v1.0
Hello Edouard,
Are you planning on making a new release soon?
I can't get the files necessary to compile RASM without installing Visual Studio entirely and I'm low on disk space.
Hi,
I have 2 files: the main.asm file and an included file with a bunch of macros.
There is an error in one of my macros but assembler reports the line of the "call" to the macro instead of the line in the macro itself, making it impossible to know where the error actually is.
Am I missing something?
Output when assembling:
Pre-processing [./src/main.asm]
Assembling
Warning: [.\src\main.asm:140] Warning: truncating value #100 to #0
At line 140 in main.asm, there is:
runFrame (void) ; (runFrame is the name of the macro present in the included file)
I'm trying to write a macro that would work no matter passed value is a byte or a register.
I've tried this:
macro my_macro value
switch {value}
case 'a'
case 'd'
case 'e'
case 'h'
case 'l'
; Do something with the register.
break
default
; Do something with the byte.
endswitch
endm
But when I do my_macro a
, I get "cannot use register A in this context".
Is what I'm trying to achieve supported?
Is there a way to check whether a passed value is a register?
This makefile does not create an Mac binary.
I have a program using LD HL,DE
(nonexistent in Z80, verified in my favorite source: https://clrhome.org/table/) but it assembles successfully as op code 0x62
or LD H,D
. The bad op code is on me, but I don't think the assembler should have accepted it.
RASM v2.1.3 (build xx/10/2023) - Gerieh Yasmana
RASM v2.0 (build xx/07/2023) - Blue Hedgehog
Windows 11 Intel x64
Does this happen for compatibility reasons and is expected, or is this a problem? Thanks for checking, love the product!
I would like to be able to evaluate expressions like x^y (x raised to the power of y) or pow(x,y) in my source.
Hi,
Is there a way to align code on an odd address?
AFIK, there is no "Align odd".
I would need it for a self modifying code, e.g.:
my_smc: ld de,0x10F0 ; 11 F0 10
If this line was odd aligned, F0 10 would be even aligned,
and I could navigate between the 2 addresses with INC L/DEC L instead of INC HL/DEC HL.
ld hl,my_smc+1
ld a,(hl)
;;
;; Do sth.
;;
inc l
ld a,(hl)
;;
;; Do sth.
;;
dec l
;;
;; Do sth.
;;
inc l
;;
;; Etc.
Do you know a way to achieve that?
The following sample file illustrates a simple example that works properly with my toy assembler: https://github.com/cpcsdk/rust.cpclib/blob/master/cpclib-asm/tests/duration.asm and deserves to be available with rasm.
To add this function will allow people that write stable code to not search the execution time of an opcode.
Example:
defs 64 - duration(out (c), a) + duration(inc l) + duration(ld a, (hl))
Note that most complex cases would better fit with the TIMER
-like directives.
Maybe a function that takes a single line listing would be better:
defs 64 - duration(out (c), a : inc l : ld a, (hl))
Building with default procedure git clone ; make
fails.
git clone https://github.com/EdouardBERGE/rasm
cd rasm
# Read ReadMe, see no build instructions
make
cc rasm.c -lm -lrt -march=native -o rasm.exe -g -pthread -DRDD
rasm.c:84:10: fatal error: ../tools/library.h: Aucun fichier ou dossier de ce type
84 | #include"../tools/library.h"
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [makefile:10 : debug] Erreur 1
May I suggest to either make "prod" the default target, like this:
.PHONY: prod debug clean default
default: prod
...or add something in the ReadMe, like "to build, issue make prod
, as the default target debug
requires my local tools that are not distributed"?
I'd like to suggest that CHARSET could accept some alternative syntaxes:
(1) CHARSET 'string1','string2'
So that, provided both strings have the same number of characters:
char 1 in string 1 is replaced by char 1 in string 2
char 2 in string 1 is replaced by char 2 in string 2
...and so on until last character
example:
CHARSET "ABCDEFGHIJKLMNOPQRSTUVWXYZ","QWERTYUIOPASDFGHJKLZXCVBNM"
DEFB "THE QUICK BROWN FOX" ; "ZIT JXOEA WKGVF YGB"
(2) Add the possibility of executing a bitwise XOR of the resulting character with a constant value or the ASCII result of the previous character (of course the 1st character would need a "seed" or #00 by default). This would be nice in order to have an additional level of string obfuscation, combined with the character replacement :-)
Commit 496467d caused significant changes in the output binary when building PlayerAkmTester_CPC.asm, and the new binary doesn't work.
MD5sums for before and after the commit are below; it's a stepwise change and no other commits since v1.3 produce any differences in the output.
07da2b69ce681b5913c19141877f389c good.bin
7183ba06e706148513e890e492722ce6 bad.bin
Hi.
I have uploaded the latest english manual to archive.org in order to get it OCR'ed and make it possible to search in it.
https://archive.org/details/RASM_doc_en/
I got these warnings and error while compiling on Mac OS 10.15.5:
cc rasm.c -lm -lrt -march=native -o rasm.exe
rasm.c:3695:32: warning: unsequenced modification and access to 'idx' [-Wunsequenced]
while (oplist[idx]) oplist[idx++]=toupper(oplist[idx]);
^ ~~~
rasm.c:3738:32: warning: unsequenced modification and access to 'idx' [-Wunsequenced]
while (oplist[idx]) oplist[idx++]=toupper(oplist[idx]);
^ ~~~
rasm.c:13262:17: warning: passing 'unsigned char *' to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
while (strncmp(subchunk,"data",4)) {
^~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/string.h:84:26: note: passing argument to parameter '__s1' here
int strncmp(const char *__s1, const char *__s2, size_t __n);
^
rasm.c:14491:72: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
InitAutomate(ae->AutomateExpressionValidCharExtended,(unsigned char *)AutomateExpressionValidCharExtendedDefinition);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1132:106: note: expanded from macro 'AutomateExpressionValidCharExtendedDefinition'
#define AutomateExpressionValidCharExtendedDefinition "0123456789.ABCDEFGHIJKLMNOPQRSTUVWXYZ_{}@+-*/~^$#%<A7><=>|&"
^~~~
rasm.c:15382:36: warning: passing 'unsigned char *' to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
FileWriteBinary(TMP_filename,ae->mem[i]+offset,endoffset-offset);
^~~~~~~~~~~~~~~~~
./minilib.h:895:42: note: passing argument to parameter 'data' here
int FileWriteBinary(char *filename,char *data,int n)
^
rasm.c:19143:41: warning: passing 'unsigned char *' to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
FileWriteBinary("autotest_include.raw",opcode,idx);
^~~~~~
./minilib.h:895:42: note: passing argument to parameter 'data' here
int FileWriteBinary(char *filename,char *data,int n)
^
rasm.c:19825:36: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
printf(" * Inspired by cap by Sven-<C5>ke Dahl. https://github.com/svendahl/cap\n");
^~~~
7 warnings generated.
ld: library not found for -lrt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [prod] Error 1
Removing -lrt
from Makefile
seems to solve the compilation error.
Hi Roudoudou! Note that I just state the ideal case, I don't expect you to say you'll do anything about it!
In my "dreams", one could define common values (a.k.a. symbols) including constants, values compiled from other values, possibly with formulas, etc, and use them in all source code involved in a project, whatever their source language (C, ASM, others), and get final binaries incorporating everything cleanly, for example laying out everything in memory as needed.
Rasm allows to define symbols, compute values from one another with formulas, this is nice, though currently works only with ASM code in RASM syntax.
Also, rasm doesn't compile C. That's fine, I don't expect rasm to compile all languages of this planet! ;-)
Is there any plan for RASM to be able to:
sdcc
compiler, sdasz80
assembler, sdld
linker, sdcpp
preprocessor and a few others) is a complete toolchain similar to those are used to build executables for modern OSesOf particular interest is SDCC, a solid C compiler (it even does most of C11 including generics), can generate several formats :
.asm
(example ld -4 (ix), a
)..rel
(ascii-based format with in and out symbol information, area/sections, actual bytes in hexa, and byte-by-byte relocation information).lib
, traditionally used as intermediate format by many compilation toolchains (assembler, compiler, linker), it is mostly text, with .rel
files embedded, and an optional common binary header (not sure it's necessary to parse it in the case here)ld (ix-4),a
not ld -4(ix),a
..lib
files is especially interesting. SDCC linker is smart enough to pick only modules that have at least one symbol referenced in other code. This allows to keep precompiled libraries of Z80 code, link them at will without recompiling any of the original code, knowing that no useless byte gets into the final binary.Preprocess .asm
files to generate (kind-of readable) asm source code with rasm syntax, feed that to rasm.
Preprocess .rel
files to generate (unreadable) asm source code with rasm syntax, feed that to rasm.
Modify rasm so that it can consume .asm
, .rel
or .lib
(would that be more flexible?).
Modify rasm so that it can pick only "modules" (or whatever it's named) that are actually referenced by code, so that we get again the "generated binary only contains actually used stuff" nice behavior. This is mostly independent of the rest and could be implemented independently.
What do you think?
Again, note that I just state the ideal case, I don't expect you to say you'll do anything about it!
Hi,
I've tried to include Arkos Tracker 2's PlayerAKM.asm into my project.
When compiling, I get error : cannot create variable [COUNTER] as there is already a label with the same name
My project has indeed a counter
label and Arkos declares a counter
variable.
Obviously if I rename my label, the problem is solved.
But I was wondering if there was a way to "encapsulate" the included file so that this kind of clash could be avoided.
Or to automatically add a suffix to a variable name when a label with the same name already exists.
I've searched through the documentation without success.
Thank you in advance for your help.
TinyBasic will not compile with RASM.
TinyBasic 2.5g source : http://retrodepot.net/wp-content/uploads/2017/12/tinybasic_2_5g.txt
(supposedly this is valid GNU Z80Asm source code).
RASM 1.6 used
> rasm tinybasic_2_5g.txt
Pre-processing [tinybasic_2_5g.txt]
Assembling
[tinybasic_2_5g.txt:407] STOP assembling requested
Error: [tinybasic_2_5g.txt:127] expression [INIT] keyword [INIT] not found in variables, labels or aliases
Error: [tinybasic_2_5g.txt:140] expression [OUTC] keyword [OUTC] not found in variables, labels or aliases
Error: [tinybasic_2_5g.txt:142] expression [EXPR2] keyword [EXPR2] not found in variables, labels or aliases
Error: [tinybasic_2_5g.txt:144] expression [EXPR1] keyword [EXPR1] not found in variables, labels or aliases
Error: [tinybasic_2_5g.txt:163] expression [FIN] keyword [FIN] not found in variables, labels or aliases
Error: [tinybasic_2_5g.txt:164] expression [QWHAT] keyword [QWHAT] not found in variables, labels or aliases
Error: [tinybasic_2_5g.txt:172] expression [PARN] keyword [PARN] not found in variables, labels or aliases
Error: [tinybasic_2_5g.txt:177] expression [SIZE] keyword [SIZE] not found in variables, labels or aliases
Error: [tinybasic_2_5g.txt:179] expression [ASORRY] keyword [ASORRY] not found in variables, labels or aliases
Error: [tinybasic_2_5g.txt:180] expression [VARBGN] keyword [VARBGN] not found in variables, labels or aliases
Error: [tinybasic_2_5g.txt:181] expression [SUBDE] keyword [SUBDE] not found in variables, labels or aliases
Error: [tinybasic_2_5g.txt:190] expression [VARBGN] keyword [VARBGN] not found in variables, labels or aliases
Error: [tinybasic_2_5g.txt:252] expression [ERROR_ROUTINE] keyword [ERROR_ROUTINE] not found in variables, labels or aliases
Error: [tinybasic_2_5g.txt:299] expression [PRTSTG] keyword [PRTSTG] not found in variables, labels or aliases
Error: [tinybasic_2_5g.txt:310] expression [GETLN] keyword [GETLN] not found in variables, labels or aliases
Error: [tinybasic_2_5g.txt:312] expression [BUFFER] keyword [BUFFER] not found in variables, labels or aliases
Error: [tinybasic_2_5g.txt:318] expression [DIRECT] keyword [DIRECT] not found in variables, labels or aliases
Error: [tinybasic_2_5g.txt:331] expression [FNDLN] keyword [FNDLN] not found in variables, labels or aliases
Error: [tinybasic_2_5g.txt:335] expression [FNDNXT] keyword [FNDNXT] not found in variables, labels or aliases
Error: Too many errors!
Weird thing is, these labels do exist...
it seems that directive are executed in branches that correspond to the wrong case of if/else/endif directive.
For example, this piece of code
USE_EXO = 0
IF USE_EXO
ld de, CURRENT_LEVEL_UNCRUNCH_ZONE
call deexo
ret
include 'deexo.asm'
deexo Mizoumizeur (void)
endif
fails because the deexo.asm
file is not present.
The appropriate behavior would be to do nothing
I seem to be having trouble using BUILDSNA V2 and breakpoints at the same time.
In my entry file I've got:
BUILDSNA V2
BANKSET 0
ORG #4000
RUN #4000
and the the CLI
-sw -sl -sq -sb
SNA file is generated but no breakpoints are present in WinApe
If I remove V2 the breakpoints load, but I'd like the firmware present for this particular thing. Not a huge problem, just reporting
Rasm already has 2 directives that can control some snapshot flags (the crtc and the type of CPC).
I suggest to add a universal directive that can control ANY snapshot flags.
The current workaround is to use rasm to generate the snapshot then an additional tool to modify the snapshot flags. It is error prone and slower even if automated.
The syntax could be: SETSNA <FLAG> <VALUE>
where <FLAG>
represents the flag to modify and <VALUE>
its value. SETCRTC
and SETCPC
could be deprecated with such universal directive.
I have validated such approach with my own playground assembler where this test file is properly assembled while modifying some z80, crtc, and ga registers:
https://github.com/cpcsdk/rust.cpclib/blob/master/cpclib-asm/tests/snapshot.asm
A limit of this approach is met when modifying the palette :
SNASET GA_PAL:0 30
is not very much intuitive because of the ink numbering based on hardware color.
The addition of additional functions to make conversions could be useful, such as:
SNASET GA_PAL:0 SOFT2HARD_INK(12)
Currently this is how I give a label to a placeholder (self-modifying code):
subroutine1
;
; Some code
;
myval = $+1 : ld a,0
;
; Some code
;
ld hl,myval
inc (hl)
;
; Some code
;
ret
The problem is that myval here is not a proximity label but a global variable.
I would like to give a proximity label to my placeholder.
Obviously I could do something like:
.myval ld a,0
;
ld hl,.myval+1
or
defb 0x3E ; Opcode for LD A,n
.myval defb 0
;
ld hl,.myval
But none of these solutions satisfies me.
Maybe there's a way to do what I want but I couldn't figure it out. Any idea?
The following sample file illustrates a simple example that works properly with by toy assembler: https://github.com/cpcsdk/rust.cpclib/blob/master/cpclib-asm/tests/opcode.asm and deserves to be available with rasm.
To add this function will allow people that write self-modifying code to not search by which value an opcode is supposed to be replaced:
ld a, opcode(pop hl)
ld (myroutine.regpop), a
instead of
OPCODE_POP_HL equ 0xe1
...
ld a, OPCODE_POP_HL
ld (myroutine.regpop), a
I think such function should return a 32bit value in order to properly manage 4 bytes opcodes
opcode_dec_hl EQU 0x2b
opcode_dec_hl EQU 0x35
Sorry to use it to contact you, but I really want this software but im trying ours and cant install it. Could you help me?
email: [email protected]
On win64, versions 1.4 and 1.5 at least, I can execute an include -I
with -I"."
for current dir, and it works fine. Finds include files. If I put anything else there, such as -I"C:\Users\username\git\project.git\source" I get an often confusing error message. It doesn't help if I omit the drive letter or reverse my slashes to unix style.
Examples:
rasm_win64 "emulator_main.asm" -I"." -I"C:\Users\username\git\project.git\source" -ob "emulator_main.bin"
Result: Cannot find file [≡╛v ☺]
rasm_win64 "emulator_main.asm" -I"C:\Users\username\git\project.git\source" -ob "emulator_main.bin"
Result: Cannot find file [emulator_main]
The assembly file doesn't need to include anything from source for this to happen, simply by including this -I
it breaks and I can't sort out why. It's entirely possible I'm misusing -I
but the error message isn't directing me towards the cause. I have also included longer files where the file name in the error is truncated, not at the ends, but in the middle, and placed in this error message. I'm having trouble reproing that 3rd case with my example at the moment. Let me know if I can provide any more examples or assist in finding the cause in any way, thanks!
Environment:
Windows 10 x64
RASM 1.5 x64
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.