flat assembler
Message board for the users of flat assembler.
Index
> Programming Language Design > On my new assembler Goto page Previous 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 Next |
Author |
|
Tomasz Grysztar 01 Sep 2015, 10:56
I updated the package to a new version that supports INCLUDE environment variable.
|
|||
01 Sep 2015, 10:56 |
|
Tomasz Grysztar 03 Sep 2015, 19:29
shoorick wrote: i'm not able to use it... |
|||
03 Sep 2015, 19:29 |
|
shoorick 03 Sep 2015, 21:16
thanks! now it works
i found that file-roller i was using to unpack zip did not overwrite existing files without any notification |
|||
03 Sep 2015, 21:16 |
|
shoorick 06 Sep 2015, 20:56
I have noticed that multyline implementation of the opcode inside the macros may shift value of "$" placeholder.
In this case the usage of such trivial constructions like this: Code: Jcc $ ; infinite loop waiting for event becomes not trivial and may lead to inexpective behavior _________________ UNICODE forever! |
|||
06 Sep 2015, 20:56 |
|
Tomasz Grysztar 07 Sep 2015, 10:30
It is one of the reasons why I use the "proxy" variables for the instruction arguments in my examples - the value is then evaluated before instruction encoding starts.
As a side note: the primary function of these proxies is to sanitize macro parameters. Let me show this on a sample from the AVR macroinstruction set: Code: macro DES? K local value value = +K if value >= 0 & value <= 0x0F dw 1011b + value shl 4 + 10010100b shl 8 else err 'value out of range' end if end macro |
|||
07 Sep 2015, 10:30 |
|
revolution 07 Sep 2015, 10:36
Do brackets achieve the same effect?
Code: if (K) >= 0 & (K) <= 0x0F |
|||
07 Sep 2015, 10:36 |
|
Tomasz Grysztar 07 Sep 2015, 10:39
I think you could fool brackets by passing a malformed expression like "1) & (0".
|
|||
07 Sep 2015, 10:39 |
|
shoorick 07 Sep 2015, 18:57
Tomasz Grysztar wrote: It is one of the reasons why I use the "proxy" variables for the instruction arguments in my examples thanks! i have to update 8048 support in this manner... _________________ UNICODE forever! |
|||
07 Sep 2015, 18:57 |
|
Treant 08 Sep 2015, 18:40
I propose to add 'union' into tables.inc.
now union can be realized through virtual directive ... https://en.wikipedia.org/wiki/Turing_tarpit |
|||
08 Sep 2015, 18:40 |
|
Tomasz Grysztar 08 Sep 2015, 22:10
I think of an 'union' syntax as a HLL concept that does not really fit the assembly language well. It obfuscates the size of the underlying memory area and at a quick peek it can also be easily confused with a sequential data structure. In assembly language, where you need to be much more aware of the structure of your data, the VIRTUAL syntax for the so-called 'union' has an advantage. If you feel the other way, it may be because of your habits from other programming languages - but that is the case with many features of assembly language.
|
|||
08 Sep 2015, 22:10 |
|
Tomasz Grysztar 30 Oct 2015, 18:21
I have updated the package with a small change to LOAD/STORE directives - now when size of loaded/stored data is not explicitly specified, the size associated with the address is used (so if you defined "a dd ?" then "store -1 at a" is going to fill 4 bytes). I think this is a nice feature that could also be applied to fasm 1, but I did not want to break the backward-compatibility there.
|
|||
30 Oct 2015, 18:21 |
|
shoorick 24 Nov 2015, 14:51
Code: show "high -1 = ",-1 shr 8 displays: Code: high -1 = 0 -- is it correct? |
|||
24 Nov 2015, 14:51 |
|
l_inc 24 Nov 2015, 15:00
shoorick
The operator shr has higher precedence than the unary + and - . You should use parentheses. _________________ Faith is a superposition of knowledge and fallacy |
|||
24 Nov 2015, 15:00 |
|
shoorick 24 Nov 2015, 15:06
thanks
parentheses gave me: Code: Error: value out of allowed range. this works: Code: ((-1) shr 8) and 255 |
|||
24 Nov 2015, 15:06 |
|
l_inc 24 Nov 2015, 15:36
shoorick
Quote: thanks That's because fasmg loops are incompatible with fasm's rept . The latter is able to work with negative counter values. I suppose the author might consider changing that. I mean extending the allowed range for fasmg, not reducing it for fasm, obviously. _________________ Faith is a superposition of knowledge and fallacy |
|||
24 Nov 2015, 15:36 |
|
shoorick 01 Dec 2015, 05:43
From time to time I wish to know exact value of a label or numeric variable, calculated while assembling source. As there is no regular listing support, I usually store it somewhere and then look for it in the dump. It's really not handy It would be not bad to be able to display those values as message. Macro show from fasmg doc works, but it is a trick and still is not handy
I would suggest a feature for this: label shownum var [, [H][U] ] flags: H - hex U - unsigned Code: VV = 0x777 AA shownum VV, HU display "value = ",`AA,"h" -- this should output: Code: value = 777h any other more clever keyword can be used instead of shownum |
|||
01 Dec 2015, 05:43 |
|
Tomasz Grysztar 01 Dec 2015, 09:02
While the "show" macro in the manual is just a simple trick that is there to demonstrate some of the features of fasm g, any of the various macros that have been written for this purpose for fasm 1 could probably be easily converted to fasm g syntax. Or you could just write a new one from scratch and be able to use some of the added features of fasm g:
Code: struc shownum value,base:10 local x,sgn,dgt,txt x = value sgn = 0 if x < 0 x = -x sgn = 1 end if txt = '' while x | ~txt dgt = x mod base x = x / base if dgt < 10 dgt = '0' + dgt else dgt = 'A' + dgt - 10 end if txt = txt shl 8 + dgt end while if sgn txt = txt shl 8 + '-' end if . = string txt end struc A shownum 1234567890 B shownum 65535, 16 C shownum 3003, 2 display 'A = ',A,13,10 display 'B = ',B,'h',13,10 display 'C = ',C,'b',13,10 D shownum 1 shl 512 display 'D = ',D,13,10 |
|||
01 Dec 2015, 09:02 |
|
shoorick 01 Dec 2015, 09:34
thanks a lot!
i thinks this should be enough for me |
|||
01 Dec 2015, 09:34 |
|
Tomasz Grysztar 02 Dec 2015, 12:31
I played with the macro a bit more and created a variant that displays floating-point decimal numbers. I have no idea if this might become useful for anything in the actual applications (this is something that fasm 1 never had), but for now it allows to test some of the new features.
Code: struc showfloat value,precision:2 local x,i,pos,sgn,dgt,txt x = value x = x * 1e#precision sgn = 0 if x < 0 x = -x sgn = 1 end if i = trunc x if x - i >= float 1/2 i = i + 1 end if pos = 0 txt = '' while i | pos <= precision dgt = i mod 10 i = i / 10 txt = txt shl 8 + '0' + dgt pos = pos + 1 if pos = precision txt = txt shl 8 + '.' end if end while if sgn txt = txt shl 8 + '-' end if . = string txt end struc f = 1 e = f repeat 33 f = f * % e = e + 1f/f end repeat out showfloat e, 37 display out |
|||
02 Dec 2015, 12:31 |
|
Goto page Previous 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.