flat assembler
Message board for the users of flat assembler.
Index
> Main > FASMG and namespace Goto page Previous 1, 2, 3, 4 Next |
Author |
|
Calanor 14 Jan 2021, 09:31
Fulgurance: Actually, "match , var" should work. Macro arguments that aren't used are still considered to be locally defined, so the aforementioned match should report those as empty. For instance, this works fine here:
Code: macro hello var match , var display "Empty", 13, 10 end match end macro hello |
|||
14 Jan 2021, 09:31 |
|
Fulgurance 14 Jan 2021, 12:03
Calanor wrote: Fulgurance: Actually, "match , var" should work. Macro arguments that aren't used are still considered to be locally defined, so the aforementioned match should report those as empty. For instance, this works fine here: Okay, but if you see my code I just posted before, the arguments I test with match are all already defined, you have just some optional arguments, but they are all already defined. But if I don't use the optionals arguments, match test don't work (my sentence is clear ?) |
|||
14 Jan 2021, 12:03 |
|
Calanor 14 Jan 2021, 12:21
I'm not sure where/when you're encountering problems. I did copy & paste your code and compiled it (after commenting away any references to "Data.UEFI.SystemTable" and similar, I'm too lazy to define all of those ). As far as I can tell, the code produces the results I'd expect, including recognising unused arguments as empty.
|
|||
14 Jan 2021, 12:21 |
|
Fulgurance 14 Jan 2021, 12:30
Do you want I upload my project for you ?
|
|||
14 Jan 2021, 12:30 |
|
Calanor 14 Jan 2021, 12:35
Sure, go ahead!
|
|||
14 Jan 2021, 12:35 |
|
Fulgurance 14 Jan 2021, 12:41
I give you two things into the archive, my actual project, and the project with fasm 1 (before the migration). You have some changes.
The version with fasm 1 work, you can test the .efi file with the UEFI shell. The second work only with the clearscreen function, if you try to call functions with more arguments, they don't work. (play with the code commented to see the problem, if you test the actual executable, you can see OutputString function don't work) I hope my code is acceptable for you x) I'm not virtuoso in assembly at the moment Thanks you for your help
|
|||||||||||
14 Jan 2021, 12:41 |
|
Calanor 14 Jan 2021, 13:46
I have absolutely no experience with EFI, so I'd rather not mess around with any executable. However, when I compile the code I received no error messages, not even when uncommenting all of those macro calls. I added some "display"-lines to your Call macro and it seems like it's detecting the unused arguments correctly, though my extra lines caused a tremendous spam, so I might have missed something. I have to admit that I've got no idea why it doesn't work on your end
|
|||
14 Jan 2021, 13:46 |
|
Fulgurance 14 Jan 2021, 14:06
Me too, I don't know why this don't work x)
If somebody have an idea ... |
|||
14 Jan 2021, 14:06 |
|
Calanor 14 Jan 2021, 14:25
Fulgurance: Bear in mind though that your "Potatoes" test will fail because Potatoes does not exist. Thus (if I understand things correctly) fasmg will treat the name literally and the text "Potatoes" is not considered to be empty. If the line would read "match =Potatoes, Potatoes", you'd get a match if Potatoes hasn't been defined (or if it actually contains the value "Potatoes").
|
|||
14 Jan 2021, 14:25 |
|
Fulgurance 14 Jan 2021, 16:00
Oh okay... finally I don't have any idea how to solve my problem now
Tomasz ? |
|||
14 Jan 2021, 16:00 |
|
Tomasz Grysztar 14 Jan 2021, 16:17
I would need specifics of what the problem is. Do you have a working binary to compare with? If you look at disassembly, do you see instructions that are assembled incorrectly?
I can help you with the use of fasmg's facilities, but you need to debug and isolate the actual problem first. |
|||
14 Jan 2021, 16:17 |
|
Fulgurance 14 Jan 2021, 18:16
Yes, I already upload just 2 posts before.
You have in the archive, the old version with fasm 1 of the macro and this macro work, and the migrated project with the fasmg https://board.flatassembler.net/download.php?id=8306 |
|||
14 Jan 2021, 18:16 |
|
Tomasz Grysztar 14 Jan 2021, 18:41
Did you try comparing them at disassembly level? What are the differences?
|
|||
14 Jan 2021, 18:41 |
|
Fulgurance 15 Jan 2021, 00:31
It's very strange, I tested, and I have this strange result:
Code: macro Call Entry*,Interface*,Function*,ParametersNumber*,Type1*,Argument1,Type2,Argument2,Type3,Argument3,Type4,Argument4,Type5,Argument5,Type6,Argument6,Type7,Argument7,Type8,Argument8,Type9,Argument9,Type10,Argument10 macro show description,value repeat 1, d:value display description,`d,13,10 end repeat end macro ArgumentsNumber = 10 match , Argument10 ArgumentsNumber = ArgumentsNumber-1 end match match , Argument9 ArgumentsNumber = ArgumentsNumber-1 end match match , Argument8 ArgumentsNumber = ArgumentsNumber-1 end match match , Argument7 ArgumentsNumber = ArgumentsNumber-1 end match match , Argument6 ArgumentsNumber = ArgumentsNumber-1 end match match , Argument5 ArgumentsNumber = ArgumentsNumber-1 end match match , Argument4 ArgumentsNumber = ArgumentsNumber-1 end match match , Argument3 ArgumentsNumber = ArgumentsNumber-1 end match match , Argument2 ArgumentsNumber = ArgumentsNumber-1 end match match , Argument1 ArgumentsNumber = ArgumentsNumber-1 end match show "ArgumentsNumber: ",ArgumentsNumber if ParametersNumber > 4 sub rsp,ParametersNumber*8 else sub rsp,0x20 end if show "ParametersNumber: ",ParametersNumber mov rdx,[Data.UEFI.SystemTable] mov rcx,[rdx+Virtual.UEFI.SystemTable.#Entry] mov rax,[rcx+Virtual.UEFI.#Interface#.#Function] if ArgumentsNumber > 0 match , Argument1 if Virtual.UEFI.ArgumentTypes.#Type1 != Virtual.UEFI.ArgumentTypes.InstancePointer xor rcx,rcx display "Arg1 not Instance Pointer" end if else if Virtual.UEFI.ArgumentTypes.#Type1 = Virtual.UEFI.ArgumentTypes.InstancePointer display "Arg1 is a Instance Pointer" mov rcx,[rdx+Virtual.UEFI.SystemTable.#Entry] else if Virtual.UEFI.ArgumentTypes.#Type1 = Virtual.UEFI.ArgumentTypes.Address display "Arg1 is an address" lea rcx,Argument1 else display "Arg1 is a value" mov rcx,Argument1 end if end if end match end if if ArgumentsNumber > 1 match =0?,Argument2 display "Arg2 = 0" xor rdx,rdx else if Virtual.UEFI.ArgumentTypes.#Type2 = Virtual.UEFI.ArgumentTypes.Address display "Arg2 is an address" lea rdx,Argument2 else display "Arg2 is a value" mov rdx,Argument2 end if end match end if show "Entry: ",Entry show "Interface: ",Interface show "Fonction: ",Fonction show "Type1: ",Type1 show "Arg1: ",Argument1 show "Type2: ",Type2 show "Arg2: ",Argument2 The parameters passed: Code: Code.UEFI.Call ConOut,SimpleTextOutputProtocol,OutputString,2, \ InstancePointer,0, \ Address,[text4] And the output: Code: zohran@msi-gs73vr-6rf ~/Documents/Programmation/OS $ fasmg BOOTX64.fasm flat assembler version g.j5ii ArgumentsNumber: 2 ParametersNumber: 2 Arg1 is a Instance PointerArg2 is an addressEntry: 64 Interface: 0 Fonction: 0 Type1: 0 Arg1: 0 Type2: 0 Arg2: 1 Why arg2 have the value 1 ??? |
|||
15 Jan 2021, 00:31 |
|
Tomasz Grysztar 15 Jan 2021, 10:23
Fulgurance wrote: Why arg2 have the value 1 ??? Code: macro show description,value repeat 1, d:value display description,`d,13,10 end repeat end macro show "Arg2: ",[text4] Code: flat assembler version g.j6a0 Arg2: 1 test.asm [7]: show 'Arg2: ',[text4] macro show [1]: repeat 1, d:value Processed: repeat 1, d:[text4] Error: invalid expression. |
|||
15 Jan 2021, 10:23 |
|
Fulgurance 15 Jan 2021, 11:22
Okay...
Now I don't know where is the problem after the migration, I'm lost.Yesterday I took 1 hours to check all files one by one, and I don't know where is the problem... I will check the binary output But Tomasz, just one question, is it possible because I use namespace this can affect my code? What namespace do exactly? For example, namespace can impact address of data or something else? I have an idea. I will perform a test while put all of my implementation in one single file, and remove all namespace, and change one by one to see where the problem come from |
|||
15 Jan 2021, 11:22 |
|
Fulgurance 15 Jan 2021, 23:24
During my check, something intrigue me with fasm 1. In the manual I see DW and DU instructions do the same, they define 2 bytes data BUT if I remove DU to change with DW, I have an error, why ? And why fasmg use only DW ?
Code: zohran@msi-gs73vr-6rf ~/Downloads/OS-master $ fasm BOOTX64.fasm flat assembler version 1.73.25 (16384 kilobytes memory, x64) BOOTX64.fasm [70]: text4: dw "UEFI OutputString:",0xD,0xA,0x0 processed: text4:dw 'UEFI OutputString:',0xD,0xA,0x0 error: value out of range. Thomasz, I think this problem happen in my code because FASMG don't use DU directive. I read in the fasm 1 manual that: Quote: The db and du directives also accept the quoted string values of any length, which will be converted into chain of bytes when db is used and into chain of words with zeroed high byte when du is used. For example db 'abc' will define the three bytes of values 61, 62 and 63. |
|||
15 Jan 2021, 23:24 |
|
Fulgurance 15 Jan 2021, 23:37
I can confirm !!! The bug come from missing directive into FASMG ! This don't come from my code
I perform test with custom string, byte by byte, and my macro work: Code: text4: db 'A',0,0xD,0,0xA,0,0x0,0 Is it possible you implement that plz in you next fasmg version ? Or include the possibility for DW to check if the user pass a string or a value ? |
|||
15 Jan 2021, 23:37 |
|
Tomasz Grysztar 15 Jan 2021, 23:55
Yes, you should not have converted DU into DW, they are not equivalent.
To have DU available you need to include one of the encoding headers. Similarly to anonymous labels, this is something that is provided automatically by the compatibility Win32/Win64 headers, but since you are not using them, you need to include various things manually. |
|||
15 Jan 2021, 23:55 |
|
Goto page Previous 1, 2, 3, 4 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.