flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2, 3 ... 24, 25, 26 ... 31, 32, 33 Next |
Author |
|
Picnic 16 Mar 2015, 12:34
Oh, sorry my bad, i'm refering to directives such as .if .while .repeat etc.
Code: .while r0 .endw Last edited by Picnic on 16 Mar 2015, 12:45; edited 1 time in total |
|||
![]() |
|
revolution 16 Mar 2015, 12:42
Those are not assembler directives. They are macros defined by IF.INC. If you want to use those in fasmarm then some changes would be necessary to account for the different instruction and register sets.
|
|||
![]() |
|
Picnic 16 Mar 2015, 12:57
I know, just wondering so. I was hoping for some 'official' changes. It would be a nice add on for lazy programmers such myself.
![]() Well, as fasmarm becomes more popular every day you will have such requests more often. Nevertheless, a great job fasmarm is. |
|||
![]() |
|
revolution 16 Mar 2015, 13:13
I made a quick untested edit. Let me know if it blows up.
Code: ; Macroinstructions for HLL-style conditional operations macro .if [arg] { common __IF equ local ..endif __ENDIF equ ..endif local ..else __ELSE equ ..else BNCOND __ELSE,arg } macro .else { b __ENDIF __ELSE: restore __IF __IF equ , } macro .elseif [arg] { common b __ENDIF __ELSE: restore __ELSE local ..else __ELSE equ ..else BNCOND __ELSE,arg } macro .endif { if __IF eq __ELSE: end if __ENDIF: restore __ELSE restore __ENDIF restore __IF } macro .while [arg] { common local ..while __WHILE equ ..while local ..endw __ENDW equ ..endw __WHILE: BNCOND __ENDW,arg } macro .endw { b __WHILE __ENDW: restore __ENDW restore __WHILE } macro .repeat { local ..repeat __REPEAT equ ..repeat __REPEAT: } macro .until [arg] { common BNCOND __REPEAT,arg restore __REPEAT } bneq equ bne bnne equ beq bncs equ bcc bncc equ bcs bnmi equ bpl bnpl equ bmi bnvs equ bvc bnvc equ bvs bnhi equ bls bnls equ bhi bnge equ blt bnlt equ bge bngt equ ble bnle equ bgt bnhs equ blo bnlo equ bhs macro BNCOND label,v1,c,v2 { match any,c \{ cmp v1,v2 bn\#c label \} match ,c \{ PARSECOND parsed@cond,v1 match cond,parsed@cond \\{ BNCONDEXPR label,cond \\} \} } gt equ > lt equ < macro PARSECOND parsed,cond { define parsed define neg@cond define status@cond define nest@cond irps symb,cond \{ define symb@cond symb match >,symb \\{ define symb@cond gt \\} match <,symb \\{ define symb@cond lt \\} current@cond equ status@cond match ,current@cond \\{ match ~,symb \\\{ neg@cond equ neg@cond ~ match ~~,neg@cond \\\\{ define neg@cond \\\\} define symb@cond \\\} match (,symb \\\{ parsed equ parsed neg@cond,< define nest@cond + define symb@cond define neg@cond \\\} match any,symb@cond \\\{ parsed equ parsed neg@cond,symb@cond define status@cond + \\\} \\} match status,current@cond \\{ match &,symb \\\{ parsed equ parsed,&, define status@cond define symb@cond define neg@cond \\\} match |,symb \\\{ parsed equ parsed,|, define status@cond define symb@cond define neg@cond \\\} match (,symb \\\{ define nest@cond ( \\\} match ),symb \\\{ match +,nest@cond \\\\{ parsed equ parsed> define symb@cond \\\\} restore nest@cond \\\} match any,symb@cond \\\{ parsed equ parsed symb@cond \\\} \\} \} } macro define_BNCONDEXPR { macro BNCONDEXPR elabel,[mod,cond,op] \{ \common \local ..t,..f define t@cond ..t define f@cond ..f \forward match ,op \\{ match ,mod \\\{ BNCONDEL elabel,<cond> \\\} match ~,mod \\\{ BCONDEL elabel,<cond> \\\} \\} match &:flabel:tlabel, op:f@cond:t@cond \\{ match ,mod \\\{ BNCONDEL flabel,<cond> \\\} match ~,mod \\\{ BCONDEL flabel,<cond> \\\} tlabel: \\local ..tnew restore t@cond define t@cond ..tnew \\} match |:flabel:tlabel, op:f@cond:t@cond \\{ match ,mod \\\{ BCONDEL tlabel,<cond> \\\} match ~,mod \\\{ BNCONDEL tlabel,<cond> \\\} flabel: \\local ..fnew restore f@cond define f@cond ..fnew \\} \common label f@cond at elabel t@cond: restore t@cond restore f@cond \} } macro define_BCONDEXPR { macro BCONDEXPR elabel,[mod,cond,op] \{ \common \local ..t,..f define t@cond ..t define f@cond ..f \forward match ,op \\{ match ,mod \\\{ BCONDEL elabel,<cond> \\\} match ~,mod \\\{ BNCONDEL elabel,<cond> \\\} \\} match |:flabel:tlabel, op:f@cond:t@cond \\{ match ,mod \\\{ BCONDEL flabel,<cond> \\\} match ~,mod \\\{ BNCONDEL flabel,<cond> \\\} tlabel: \\local ..tnew restore t@cond define t@cond ..tnew \\} match &:flabel:tlabel, op:f@cond:t@cond \\{ match ,mod \\\{ BNCONDEL tlabel,<cond> \\\} match ~,mod \\\{ BCONDEL tlabel,<cond> \\\} flabel: \\local ..fnew restore f@cond define f@cond ..fnew \\} \common label f@cond at elabel t@cond: restore t@cond restore f@cond \} } macro define_BNCONDEL { macro BNCONDEL label,cond \{ \local COND match car=,cdr,:cond \\{ define_BNCONDEXPR define_BCONDEXPR define_BCONDEL define_BNCONDEL BNCONDEXPR label,cond purge BNCONDEXPR,BCONDEXPR,BCONDEL,BNCONDEL define COND \\} match c,cond ; replace gt and lt \\{ match =COND =signed v1>==v2, COND c \\\{ cmp v1,v2 blt label define COND \\\} match =COND =signed v1<==v2, COND c \\\{ cmp v1,v2 bgt label define COND \\\} match =COND v1>==v2, COND c \\\{ cmp v1,v2 blo label define COND \\\} match =COND v1<==v2, COND c \\\{ cmp v1,v2 bhi label define COND \\\} match =COND v1==v2, COND c \\\{ cmp v1,v2 bne label define COND \\\} match =COND v1<>v2, COND c \\\{ cmp v1,v2 beq label define COND \\\} match =COND =signed v1>v2, COND c \\\{ cmp v1,v2 ble label define COND \\\} match =COND =signed v1<v2, COND c \\\{ cmp v1,v2 bge label define COND \\\} match =COND v1>v2, COND c \\\{ cmp v1,v2 bls label define COND \\\} match =COND v1<v2, COND c \\\{ cmp v1,v2 bhs label define COND \\\} match =COND =ZERO?, COND c \\\{ bne label define COND \\\} match =COND =CARRY?, COND c \\\{ bcc label define COND \\\} match =COND =OVERFLOW?, COND c \\\{ bvc label define COND \\\} match =COND =SIGN?, COND c \\\{ bpl label define COND \\\} match =COND v, COND c \\\{ if v eqtype 0 if ~ v b label end if else cmp v,0 beq label end if \\\} \\} \} } macro define_BCONDEL { macro BCONDEL label,cond \{ \local COND match car=,cdr,:cond \\{ define_BNCONDEXPR define_BCONDEXPR define_BCONDEL define_BNCONDEL BCONDEXPR label,cond purge BNCONDEXPR,BCONDEXPR,BCONDEL,BNCONDEL define COND \\} match c,cond ; replace gt and lt \\{ match =COND =signed v1>==v2, COND c \\\{ cmp v1,v2 bge label define COND \\\} match =COND =signed v1<==v2, COND c \\\{ cmp v1,v2 ble label define COND \\\} match =COND v1>==v2, COND c \\\{ cmp v1,v2 bhs label define COND \\\} match =COND v1<==v2, COND c \\\{ cmp v1,v2 bls label define COND \\\} match =COND v1==v2, COND c \\\{ cmp v1,v2 beq label define COND \\\} match =COND v1<>v2, COND c \\\{ cmp v1,v2 bne label define COND \\\} match =COND =signed v1>v2, COND c \\\{ cmp v1,v2 bgt label define COND \\\} match =COND =signed v1<v2, COND c \\\{ cmp v1,v2 blt label define COND \\\} match =COND v1>v2, COND c \\\{ cmp v1,v2 bhi label define COND \\\} match =COND v1<v2, COND c \\\{ cmp v1,v2 blo label define COND \\\} match =COND =ZERO?, COND c \\\{ beq label define COND \\\} match =COND =CARRY?, COND c \\\{ bcs label define COND \\\} match =COND =OVERFLOW?, COND c \\\{ bvs label define COND \\\} match =COND =SIGN?, COND c \\\{ bmi label define COND \\\} match =COND v, COND c \\\{ if v eqtype 0 if v b label end if else cmp v,0 bne label end if \\\} \\} \} } define_BNCONDEXPR define_BCONDEXPR define_BNCONDEL define_BCONDEL Last edited by revolution on 16 Mar 2015, 23:28; edited 1 time in total |
|||
![]() |
|
Picnic 16 Mar 2015, 22:31
Amazing, thanks!
Few jmp instructions have remained and need to be changed, here's one, Code: ; no pass .while r0 sub r0, r0, 2 .endw c:\fasmarm\include\macro\armif.inc [57] .endw [1]: jmp __WHILE error: illegal instruction. Afterwards, here are few tests that pass. Code: ; pass .if r0 <= 100 & ( r1 | r2 ) .endif ; pass .repeat add r0, r0, 2 .until r0>100 ; pass .while r0 sub r0, r0, 2 .endw ; pass .if r0 .elseif r1 .else .endif |
|||
![]() |
|
revolution 16 Mar 2015, 23:30
I edited the post above to replace the three "jmp" with "b".
|
|||
![]() |
|
nmyo 25 Apr 2015, 20:23
Using apostrophes inside numbers is possible in FASM but not in FASMARM. I was wondering if the removal of this feature is intentional since it's not documented, at least in FASM.PDF.
For example, these lines assemble in FASM: Code: db 1'2'3 dw 00001111'11000000b dd 100F'F001h But these do not in FASMARM: Code: db 1'2'3 dh 00001111'11000000b dw 100F'F001h EDIT: Thanks for the reply ↓, I didn't know about underscore. Last edited by nmyo on 27 Apr 2015, 02:44; edited 1 time in total |
|||
![]() |
|
revolution 25 Apr 2015, 23:39
Use the underscore. This is the normal ARM code format.
Code: db 1_2_3 dh 00001111_11000000b dw 100F_F001h Quote: v1.15 2010-Apr-21 ... |
|||
![]() |
|
den_po 27 May 2015, 14:51
flat assembler for ARM version 1.71.31 (1048576 kilobytes memory)
test.asm [4]: mrc p15, 0, r15, c7, c10, 3 error: PC (R15) not valid as third parameter. http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0198e/I1014942.html Quote: The test and clean DCache instruction, MRC p15, 0, r15, c7, c10, 3, is a special encoding that uses r15 as a destination operand. However, the PC is not changed by using this instruction. This MRC instruction also sets the condition code flags. _________________ JUST_DAn_PO |
|||
![]() |
|
revolution 28 May 2015, 01:55
den_po wrote: flat assembler for ARM version 1.71.31 (1048576 kilobytes memory) Quote: Specifies the destination ARM register for the instruction. If R15 is specified for <Rd>, the condition code flags are updated instead of a general-purpose register. |
|||
![]() |
|
revolution 28 May 2015, 01:59
Version 1.33 now available:
Quote: v1.33 2015-May-28 Note that this release also adds an additional file SYSTEMARM.INC to accommodate the on demand memory allocation in the WIN32 command line fasmarm.exe. This reduces memory usage for small files and allows for larger files to be assembled, but can be overridden by using the command line -m switch. This does not affect the IDE memory allocation. |
|||
![]() |
|
den_po 18 Jun 2015, 12:50
E:\>FASMARM.EXE change_AT_CLCC.asm
flat assembler for ARM version 1.71.39 (1572672 kilobytes memory) error: out of memory. Windows XP x86
|
|||||||||||
![]() |
|
revolution 18 Jun 2015, 14:34
Version 1.34 now available:
Quote: v1.34 2015-Jun-18 Quote: >fasmarm -m 11 change_AT_CLCC.asm |
|||
![]() |
|
den_po 18 Jun 2015, 14:52
Thank you
|
|||
![]() |
|
revolution 18 Jun 2015, 14:53
den_po wrote: Windows XP x86 ![]() |
|||
![]() |
|
Andrew Martin 30 Sep 2015, 08:59
Possibly invalid symbols table in ELF DWARF format
![]()
|
|||||||||||||||||||||
![]() |
|
revolution 01 Oct 2015, 00:24
Andrew Martin wrote: Possibly invalid symbols table in ELF DWARF format |
|||
![]() |
|
revolution 01 Oct 2015, 00:29
Version 1.35 now available:
Quote: v1.35 2015-Oct-01 |
|||
![]() |
|
Andrew Martin 01 Oct 2015, 08:29
Please look to the symbols names in the symbols table. There must be the names of labels, names of sections, etc. but not ASCII garbage.
|
|||||||||||
![]() |
|
Goto page Previous 1, 2, 3 ... 24, 25, 26 ... 31, 32, 33 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.