flat assembler
Message board for the users of flat assembler.

Index > Main > Hi,Man! Please help compile: \fasmg\examples\avr\counter.ASM

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
uor99



Joined: 04 Dec 2014
Posts: 42
uor99 02 Jan 2016, 13:29
When i compiled it, I got the below tips :

C:\fasmg\examples\avr>..\..\fasmg counter.asm counter.hex
flat assembler g version 0.96.1449399753
counter.asm [40] macro ? [21] macro RET [1]
Error: invalid number.
Post 02 Jan 2016, 13:29
View user's profile Send private message ICQ Number Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc 02 Jan 2016, 13:55
I'm not much into fasmg, but it seems to be a bug. fasmg has stopped being able to process single quotes as a part of a number.

While checking this I noticed another bug. fasmg is unable to process OS-specific paths correctly: in order to compile counter.asm in linux one needs to replace backslashes with forward slashes in the include argument.

_________________
Faith is a superposition of knowledge and fallacy
Post 02 Jan 2016, 13:55
View user's profile Send private message Reply with quote
uor99



Joined: 04 Dec 2014
Posts: 42
uor99 03 Jan 2016, 06:59
Thanks for your reply.

FASMG.EXE also failed to compile :
;=============================
format ELF executable
entry start
segment readable executable
start: mov r0,0
add r1,pc,hello-$-8
mov r2,hello_len
swi 0x900004
mov r0,6
swi 0x900001
hello: db 'Hello world',10
hello_len=$-hello
segment writeable
;=============================
Post 03 Jan 2016, 06:59
View user's profile Send private message ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 03 Jan 2016, 16:15
l_inc wrote:
I'm not much into fasmg, but it seems to be a bug. fasmg has stopped being able to process single quotes as a part of a number.
I removed that feature temporarily (it was and is still undocumented anyway) when I was working on the floating point parser because this made my job easier at the time. I'm bringing it back with today's update.

l_inc wrote:
While checking this I noticed another bug. fasmg is unable to process OS-specific paths correctly: in order to compile counter.asm in linux one needs to replace backslashes with forward slashes in the include argument.
I've added the path "adapter" for Linux and libc versions in today's update as well.
Post 03 Jan 2016, 16:15
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 03 Jan 2016, 16:19
uor99 wrote:
Thanks for your reply.

FASMG.EXE also failed to compile :
;=============================
format ELF executable
entry start
segment readable executable
start: mov r0,0
add r1,pc,hello-$-8
mov r2,hello_len
swi 0x900004
mov r0,6
swi 0x900001
hello: db 'Hello world',10
hello_len=$-hello
segment writeable
;=============================
There are no ARM-related macro packages for fasm g yet. Since fasmarm was also not created by me, I hoped that someone else might do it some day. Wink
Post 03 Jan 2016, 16:19
View user's profile Send private message Visit poster's website Reply with quote
uor99



Joined: 04 Dec 2014
Posts: 42
uor99 04 Jan 2016, 07:36
Thanks for Tomasz Grysztar !

OK. I will try to implement some macroes to compile it by myself.
Post 04 Jan 2016, 07:36
View user's profile Send private message ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 04 Jan 2016, 15:49
uor99 wrote:
OK. I will try to implement some macroes to compile it by myself.
If you try to create ARM instruction set macros, you may need to use some trick to solve the "oscillator problem" because in case of ARM architecture this problem may arise more easily than in case of x86 (that's why revolution asked about this, even though his sample could be applied to x86 as well, but this almost never happens in real applications). I still plan to try out my "stability counter" idea for an additional operator that could help in such cases, but simple local variable inside a macro should work out in case instructions implemented as macros.

As for the "format ELF executable", you could re-use the ELF executable formatter macros I created for x86 (I used them for fasmg Linux version self-hosting). They reside in fasmg/examples/x86/elfexe.inc - to adapt them to ARM at least the contents of "e_machine" field would need to be changed (creating another property in ELF.Settings for this purpose might be a good idea - I think I may add it myself). And this is only for direct ELF executable output, I haven't yet made macros for ELF object formatting (but I may do it so that I can make libc version self-hosting too).
Post 04 Jan 2016, 15:49
View user's profile Send private message Visit poster's website Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc 04 Jan 2016, 17:35
Tomasz Grysztar
Quote:
I still plan to try out my "stability counter" idea for an additional operator

I don't think there's a necessity in a special operator. If I understand this correctly you want to provide an operator, which would bring up internal operation details of the assembler (multiple passes and value prediction/stabilization algorithms) to the interface instead of creating high-level rules that would persist independently on the ways the assembler finds the solution.

This is pretty much what I've been talking about in the topic you referenced, and what you subsequently elaborated by showing an extended condition to be satisfied by the assembler that guarantees no infinite oscillation. I see the problem as being just about finding a good high-level condition. It doesn't need explicit intra-pass specific checking and pass count control that you wanna legitimize by providing the additional special-purpose operator.

_________________
Faith is a superposition of knowledge and fallacy
Post 04 Jan 2016, 17:35
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 04 Jan 2016, 18:21
l_inc wrote:
Tomasz Grysztar
Quote:
I still plan to try out my "stability counter" idea for an additional operator

I don't think there's a necessity in a special operator. If I understand this correctly you want to provide an operator, which would bring up internal operation details of the assembler (multiple passes and value prediction/stabilization algorithms) to the interface instead of creating high-level rules that would persist independently on the ways the assembler finds the solution.

This is pretty much what I've been talking about in the topic you referenced, and what you subsequently elaborated by showing an extended condition to be satisfied by the assembler that guarantees no infinite oscillation. I see the problem as being just about finding a good high-level condition. It doesn't need explicit intra-pass specific checking and pass count control that you wanna legitimize by providing the additional special-purpose operator.
You are perfectly right. As I mentioned earlier, for instructions implemented in form of macros local variables should be enough to solve such problems. I planned the feature like stability counter for the purpose of built-in instruction handlers, for the "assembler construction kit" I would like to base on fasmg (because this would be less resource-hungry solution if it worked). I planned to make this feature available in the macro language so that it could be tested and experimented with in macros - but I can make this an auxiliary feature, undocumented or even turned off in the standard fasmg release if it turns out to be too implementation-specific. You may be right that any such feature would automatically be narrowing down the general concepts of fasm's language to specific implementation.
Post 04 Jan 2016, 18:21
View user's profile Send private message Visit poster's website Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc 04 Jan 2016, 20:56
Tomasz Grysztar
Quote:
You may be right that any such feature would automatically be narrowing down the general concepts of fasm's language to specific implementation.

Well, I have the opposite opinion on the number formats. Especially with respect to the floating point numbers, when supported and acceptable precision ranges constrain the way a programmer carries out the calculation.

_________________
Faith is a superposition of knowledge and fallacy
Post 04 Jan 2016, 20:56
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 04 Jan 2016, 22:28
As opposed to binary integers, with floating point numbers I cannot have unlimited precision, so that created a real problem in defining the feature. As it was in fasm 1 the internal precision is chosen so that it is larger that any of the supported formats that the number can be converted to, but in case of fasm g it is no longer transparent as it was in fasm 1 where no operations on such numbers could be performed. But as I'm not aware whether the floating point calculations of fasm g may actually be useful for anything other than basic purposes, I decided to stick to the "precision and range at least as high as" declaration in manual and nothing more. You can also adjust the precision by altering the single constant in fasm g sources.
Post 04 Jan 2016, 22:28
View user's profile Send private message Visit poster's website Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc 04 Jan 2016, 22:58
Tomasz Grysztar
Quote:
But as I'm not aware whether the floating point calculations of fasm g may actually be useful for anything other than basic purposes

I think it is if you add some more operations including exponentiation and co, as well as the trigonometry. First thing coming to mind is then precomputation of constant tables, such as the md5 lookup table. Another (probably less serious) thing I though of was bitmap generation. Like plotting functions or fractals. I saw here and had my own little implementation of the Mandelbrot fractal that could be made simpler with proper support for floating point calculations.
Quote:
You can also adjust the precision by altering the single constant in fasm g sources.

Well, that's a nice thing to have. The implementation is then probably not as trivial.

_________________
Faith is a superposition of knowledge and fallacy
Post 04 Jan 2016, 22:58
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 05 Jan 2016, 17:51
BTW, l_inc, are you still interested in proofreading the fasm g documentation, as you once declared?
Post 05 Jan 2016, 17:51
View user's profile Send private message Visit poster's website Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc 05 Jan 2016, 20:42
Tomasz Grysztar
I am. As you are bringing this up, I conclude, you are going to make the 1.0 release soon. So what's the deadline?

_________________
Faith is a superposition of knowledge and fallacy
Post 05 Jan 2016, 20:42
View user's profile Send private message Reply with quote
uor99



Joined: 04 Dec 2014
Posts: 42
uor99 06 Jan 2016, 07:39
I implemented the BIT as EQU. But I wonder there must be a better way.

;MY.INC
struc BIT? value
. = value
end struc
;
P00 EQU P0+0
P01 EQU P0+1
P02 EQU P0+2
P03 EQU P0+3
P04 EQU P0+4
P05 EQU P0+5
P06 EQU P0+6
P07 EQU P0+7
;===========

;TEST.ASM
LED BIT P02
Post 06 Jan 2016, 07:39
View user's profile Send private message ICQ Number Reply with quote
uor99



Joined: 04 Dec 2014
Posts: 42
uor99 06 Jan 2016, 07:48
Tomasz Grysztar

Did you have some macros to compile MSP430/MSP432 in FASM ?
Post 06 Jan 2016, 07:48
View user's profile Send private message ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 06 Jan 2016, 10:59
uor99 wrote:
I implemented the BIT as EQU. But I wonder there must be a better way.

You can define it as a symbolic constant with fasm's DEFINE directive (also the built-in EQU directive defines symbol of this kind, but 8051.INC redefines EQU to work like =, to make it work similar to classic assemblers). Such declaration defines a text that is substituted for the variable when it is used.
Code:
struc BIT? value
        define . value
end struc 

LED BIT P0.2

CLR LED    

If you wanted to make BIT with more rigorous syntax checking, you could use the construction similar to "bitaddr" macro used internally by 8051 example macros:
Code:
struc BIT? value
        match any., value
                err "syntax error"
        else match base.index, value
                match any.other, base index
                        err "syntax error"
                else
                        define . base.index
                end match
        else match .any, value
                err "syntax error"
        else
                . = value
        end match
end struc 

LED BIT P0.2    
Post 06 Jan 2016, 10:59
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 06 Jan 2016, 11:04
uor99 wrote:
Tomasz Grysztar

Did you have some macros to compile MSP430/MSP432 in FASM ?
I do not yet have macros for any other architecture than the ones included in fasmg package. But I'm thinking about starting some kind of collaborative space, like public repository, where other people could contribute their own macros packages and examples. For instance I know that shoorick was working on a set of AVR macros that would be more powerful than the simple example I created (he wanted to make them process the standard AVR headers and source without modifications) - if we had some shared space where such projects would be made public, perhaps they would become more alive.
Post 06 Jan 2016, 11:04
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 06 Jan 2016, 11:10
l_inc wrote:
Tomasz Grysztar
I am. As you are bringing this up, I conclude, you are going to make the 1.0 release soon. So what's the deadline?
The end of March will mark one year since I released the first preview and I think of it as a good date for the 1.0 release.
In addition to the syntax reference I also plan to write something like readme.txt that would explain contents of the package and how the fasmg can be re-assembled (including self-hosting).
Post 06 Jan 2016, 11:10
View user's profile Send private message Visit poster's website Reply with quote
uor99



Joined: 04 Dec 2014
Posts: 42
uor99 12 Jan 2016, 08:43
How simple but powerful the fasmg is to implement BIT !

I do expect the shared space for macros .

A new problem need your help :
;test.asm
INCLUDE '8051.INC'
RR A
DA A


flat assembler g version 0.97.1452517066
1.asm (89) macro RR [0]
Error: extra characters on line.
Post 12 Jan 2016, 08:43
View user's profile Send private message ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.