yeah... this is how it looks on my machine :)
Вложение 76045
Вид для печати
yeah... this is how it looks on my machine :)
Вложение 76045
Ped7g, is it possible to save some area of RAM into the file? Looks like SAVEBIN works only at compile time, but I need to do this in runtime, i.e. load some block of code via INCBIN, do some conversions with it and save to the file? Obviously, it is not assembler's job, but who knows...
Something like
and I need to get in the file "file" value of 1, not 0.Код:ld hl, #E000
xor a
ld (hl), a
inc a
ld (hl), a
SAVEBIN "file",#E000,#1
ofc, I can save .sna, open it then with emulator, and save the block I need with TR-DOS, but it is not the straightforward way.
upd
ok, nevermind.
"-ms address size filename": Saves a memory dump to a file. The file is saved to the temp directory.
It is a command in debug console of DeZog extension for VSCode.
:v2_dizzy_heart:
But thanks in any case. :D
at runtime sjasmplus has no control over anything, it did already produce your machine code and exit, and that's all.
You could produce your own macros for common tasks under your OS, like TR-DOS calls, etc.. but that differs from every target platform (ZX/NextZXOS/TR-DOS/esxdos/MSX/...) and it all could be done in the form of Z80 source defining some macros or subroutines.
If the DeZog debugger command is enough for you, then even better.
Ped7g, One word about ABYTE(C|Z) pseudo-op.
Suddenly, if <bytes> argument enclosed in double quotes, it means in 99,99999% (if not 100%) just text, plain text. So, if I want to include in text some control characters, it works ok (mgs02). But, if I add an <offset> to ABYTE(C|Z), the control character gets same offset as text string (mgs01).
Why is it important (at least, for me)?
Imagine that we define some text string with ABYTEZ (wow) and print it out. As is known, ASCII codes in ZX font starts from 32d (space). So, if I want to calculate an 1st address of symbol's byte in font file, I need to subtract 32 from ASCII code of symbol being printed, then add this value to the start address of the font.
It can be done in two ways:
something like
and this takes some CPU cycles and memoryКод:ld a, (msg01)
sub 32
add a, l
ld l, a
jr nc, .skip
inc h
.skip
or by defining an offset like this:
msg0 abytez -32 "01234567"
But abytez with offset breaks control codes.
So, I suggest to skip processing offset (only for double quoted content) for escape sequences (maybe except \\ one) in ABYTE(C|Z) pseudo-op.
http://i.piccy_.info/i9/c223189d23cc...8_13_52_51.png
p.s.
Don't tell me about LUA :-)
I think, LUA-script for EACH text string is an overhead, overkill and over-whatever-else in this simple case.
I'm afraid that would cause too much confusion with other users of previous versions.
I guess you can eventually patch your own sjasmplus to do this, or I could maybe add something like this under some extra option.
But I'm confused by your example reason:
That's usually not done this way, but you instead have the font address already pointing to virtual char zero, ie. like ZX ROM has font address $3C00 (the sysvar CHARS at $5C36), and the actual data starts at $3D00 with space char, because 32 * 8 = 256 and $3C00 + 256 is $3D00
Similarly if you are fetching something from byte array for indices 4..7, you don't start with `ld hl,array` and do the full `array+index-4` math, but you start with `ld hl,array-4` already, adding only the index to it.
Maybe check first if you can simplify your code?
If you want to try your idea by patching sjasmplus, then in reader.cpp in `template <class strT> int GetCharConstAsString(char* & p, strT e[], int & ei, int max_ei, int add) {` (line 623 in v1.18.3 source) modify this part:
to something like this I guess:Код:while (ei < max_ei && (quotes ? GetCharConstInDoubleQuotes(p, val) : GetCharConstInApostrophes(p, val))) {
e[ei++] = (val + add) & 255;
}
(but using patched version of sjasmplus will probably complicate things later, so I would first check if you can avoid it by some simple way)Код:while (ei < max_ei && (quotes ? GetCharConstInDoubleQuotes(p, val) : GetCharConstInApostrophes(p, val))) {
const int ascii_add = (' ' <= val && val < 0x80) ? add : 0; // use "add" value only for ASCII chars
e[ei++] = (val + ascii_add) & 255;
}
(edit: no lua suggested, as you requested, instead we landed in the land of C++ :) )
- - - Updated - - -
actually, my confusion just adds up... imagine this:
The current sjasmplus will produce bytes: 0A EA 00Код:ABYTEZ -32 "*\n"
If I would add your idea to the sjasmplus, the produced bytes would be: 0A 0A 00
How do you plan in your code to know which 0A is the newline and which is the asterisk character? (and similar collisions for other control codes).
I'm afraid your proposal is too complicated and fragile for general-purpose directive like ABYTE, not planning to add it, sorry.
I know about this. But imagine a KOI-8 font, containing english and russian characters, where, for example, char "D" has code 65 and corresponding to it russian char "Д" has code 132?
Russian-speaking progammers often use transliteration from english in their code, because KOI8, CP866 and such not supported by software or/and hardware e.g., if you actually need to print string "Привет, как дела", you would define string "Privet, kak dela", and print it, using font, where code "P" corresponds to image of char "П", and so on - for readability.
The initial idea was to reach string behavior like in Java/C++/C#. But Spectrum is not PC, and assembler is not Java, everyone has their own print, draw, plot, beep... routines.Код:lat_string abyte -32 "Hello\n how are you?"
rus_string abyte 32 "<what should I write here to keep \n value and get readable string?>"
The sjasmplus does process source files as 8bit extended ASCII (except when you use `--dos866` option), so you can put in quotes anything except 0, 10 and 13. (those need to be replaced by \0,\n,\r.
So you can put the 132 for Д directly into string. The question is, how to edit such file conveniently, if you are using some common encoding like KOI-8 and your text editor understands different encodings, you can use it directly and write `DB "новые\nзабавы"`
Example from listing file (I did edit source in Kate switching to KOI8-R encoding):
If you insist on using ABYTE with some +- offset, you also do it in a bit more-typing way: ABYTEZ -32 "Ahoy*",10+32,"world" adjusting control codes by +32Код:22 8284 CE CF D7 D9 DZ "новые\nзабавы"
22 8288 C5 0A DA C1
22 828C C2 C1 D7 D9
22 8290 00
23 8291
This still of course doesn't solve the collisions:
Or you can abuse it the other way, just checking in char table what is the control code with offset, and using '*' instead of \n in text to get value 10 after -32.Код:23 8291 21 48 4F 59 ABYTEZ -32 "Ahoy*",10+32,"world"
23 8295 0A 0A 57 4F ; notice 2x 0A here, one is asterisk, other is "control code" 10+32
23 8299 52 4C 44 00
If your print routine is aware of the offset used to process the text, like -32, it could also check for modified control codes, ie. looking for $EA instead of $0A, which is probably the more correct way, as it does resolve the control-codes value collisions with offset characters.
If you have custom encoding, then it may be difficult to edit the file in text editor (I guess if I would define my own Locale in linux, the Kate editor would be maybe able to use it for editing, but I'm not sure, and I have no idea how much work it is). Then you can hypothetically have full 0..255 encoding exactly as you want it, including both English and Cyrillic characters in the font, or special symbols, etc... while being able to edit it conveniently in text form in some regular text editor.
But with some standard like KOI-8 and similar, you can mostly avoid these extra features by editing the text directly in target encoding.
Ped7g, hello
i have little problem
i make program and it will work from #0000 to #ffff
and labellist not created correctly
what can i do?
ok.
i compile this code.Вложение 76141
labelslist "D:\_work\dropbox\_sources\___stoneage\user.l"
Цитата:
Сообщение от user.l
there is more labels but i see only this