flat assembler
Message board for the users of flat assembler.
Index
> Programming Language Design > Data directive with custom size Goto page 1, 2 Next |
Author |
|
zhak 19 Sep 2016, 15:00
what about naturally aligned data types?
dbx sounds good. but what about RB? to reserve data? do you plan to add it? rbx woudn't work then |
|||
19 Sep 2016, 15:00 |
|
Tomasz Grysztar 19 Sep 2016, 15:17
zhak wrote: what about naturally aligned data types? zhak wrote: dbx sounds good. but what about RB? to reserve data? do you plan to add it? rbx woudn't work then Code: struc rbx? unit*,count* label . : unit rb (unit) * (count) end struc |
|||
19 Sep 2016, 15:17 |
|
Tomasz Grysztar 19 Sep 2016, 15:29
I uploaded the fasmg package that has it implemented under the name DBX. I can still change the name (or add a synonym) later.
|
|||
19 Sep 2016, 15:29 |
|
revolution 19 Sep 2016, 15:43
DV - Define Variable sized value(s)
|
|||
19 Sep 2016, 15:43 |
|
Tomasz Grysztar 19 Sep 2016, 15:45
revolution wrote: DV - Define Variable sized value(s) |
|||
19 Sep 2016, 15:45 |
|
revolution 19 Sep 2016, 15:47
Tomasz Grysztar wrote:
DX - Define random sized value(s) |
|||
19 Sep 2016, 15:47 |
|
revolution 19 Sep 2016, 15:48
DS - Define Specified size value(s)
|
|||
19 Sep 2016, 15:48 |
|
revolution 19 Sep 2016, 19:15
DA - Define arbitrary size value(s)
|
|||
19 Sep 2016, 19:15 |
|
revolution 19 Sep 2016, 19:18
Actually if/when this is implemented then perhaps all other data directives should be eliminated. Since this would be the core definition that others can be derived from.
|
|||
19 Sep 2016, 19:18 |
|
revolution 19 Sep 2016, 19:25
D - Data
DATA - Data |
|||
19 Sep 2016, 19:25 |
|
revolution 19 Sep 2016, 20:01
Some more suggestions from one of my colleagues:
EMIT OUTPUT OUT PUT I'll try to stop spamming this topic now, sorry. |
|||
19 Sep 2016, 20:01 |
|
jmg 19 Sep 2016, 20:11
Tomasz Grysztar wrote: .... that would allow specify a size of data unit. My main aversion to dbx would be that intel code is already a sea of x's... I also dislike too-terse mnemonics, so 2 letters are out... Perhaps dbvw ? - Data Byte Variable Width dbfw ? - Data Byte Field/Fixed Width What else can this do ? Currently db 1,23,"hello",00 is allowed so, what about a variant syntax using : like dbfw 1: 1,2,3 ; 00 01 02 dbfw 2: 1,2,3 ; 0000 0001 0002 The colon now also allows this dbfw 3: 1,2,3, 2:0x55 ; 000000 000001 000002 0055 and even this... dbfw 9: "StrA","StringB","22" ; right justified strings, " " packed ? dbfw -9: "StrA","StringB","22" ; left justified strings, " " packed ? |
|||
19 Sep 2016, 20:11 |
|
Tomasz Grysztar 19 Sep 2016, 20:27
revolution wrote: Actually if/when this is implemented then perhaps all other data directives should be eliminated. Since this would be the core definition that others can be derived from. jmg wrote: My main aversion to dbx would be that intel code is already a sea of x's... jmg wrote: The colon now also allows this Code: macro dbfw? args& local unit unit = 1 iterate arg,args match size:value, arg unit = size dbx unit,value else dbx unit,arg end match end iterate end macro dbfw 3: 1,2,3, 2:0x55 jmg wrote: dbfw 9: "StrA","StringB","22" ; right justified strings, " " packed ? |
|||
19 Sep 2016, 20:27 |
|
jmg 19 Sep 2016, 20:39
Tomasz Grysztar wrote: The main point here is that everything can be redefined, and some symbols are there by default just to make the environment a bit more friendly to a fasm user coming to fasmg. I think it is a good idea to have "expected defaults" - ie that any ASM user would anticipate, but being able to overlay/redefine, covers all the bases... |
|||
19 Sep 2016, 20:39 |
|
bitRAKE 19 Sep 2016, 20:41
https://en.wikipedia.org/wiki/Word_(computer_architecture)
DWLD = data word length data, or just WLD (wild, lol) (I was thinking FASMG was a little too x86-centric when I was reading the manual. Even though this was the intent, it still feels odd.) |
|||
19 Sep 2016, 20:41 |
|
Tomasz Grysztar 19 Sep 2016, 20:53
bitRAKE wrote: (I was thinking FASMG was a little too x86-centric when I was reading the manual. Even though this was the intent, it still feels odd.) |
|||
19 Sep 2016, 20:53 |
|
jmg 19 Sep 2016, 20:54
Tomasz Grysztar wrote:
Yes, I am new to fasmg, but what can be done with macros is frankly amazing. I just tried the above (of course forgot I do not yet have dbx..) No surprise it gives this invert.asm [99] macro ? [1] macro dbfw [6] Error: illegal instruction. I'm guessing [99] is source line#, [1] is ? macro level ?, [6] is line# inside macro dbfw, but the following Error: illegal instruction. is rather terse, and could be clearer, & much easier to find if it also indicated the offending word ? - here, dbx Last edited by jmg on 19 Sep 2016, 20:56; edited 1 time in total |
|||
19 Sep 2016, 20:54 |
|
JohnFound 19 Sep 2016, 20:55
The name is not very important here. More important is that the suggested syntax does not distinguish between the data and the data size. In order to stay readable enough, it must separate the data size from the data values.
My suggestion is to use only "D" combined with the size of the data: Code: d1 1,2,3 ; same as db 1,2,3 d4 4,5,6 ; same as dd 4,5,6 Or if the single "d" is not enough, it can be "dv" from "define variable": Code: dv1 1,2,3 ; same as db 1,2,3 dv4 4,5,6 ; same as dd 4,5,6 Another approach is to use another separator for the size, like ":" Code: dbx 1: 1,2,3 ; same as db 1,2,3 dbx 4: 4,5,6 ; same as dd 4,5,6 |
|||
19 Sep 2016, 20:55 |
|
jmg 19 Sep 2016, 20:59
JohnFound wrote:
I thought of that, but that does not allow an equate to set the field width, which could be useful. JohnFound wrote:
I agree that is better, (now can be equate set) and as the macro example above hints, this Size: can also now be redefined along the line too. |
|||
19 Sep 2016, 20:59 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.