Hello,
most likely there is a gap in my knowledge or my understanding about gforth, but maybe there is a bug. I want to write assembler routines for the AMD64 platform. My computer is Intel 64 bit and the used operating system is openSUSE 15.2 64 bit.

I installed gforth_0.7.3 and read the manuals. Advised was to use ABI-CODE and END-CODE for assembly programs. These words were not available in the dictionary.

Then I installed snapshot 0.7.9_2020013. Now ABI-CODE was available, but I had still assembler problems and wanted the assembler to test against arch/amd64/testasm.fs.
Unfortunately testasm.fs for AMD64 was not available in this package.

Then I installed the git version, fortunately this included testasm.fs.But it also gave me assembler errors:
$ cd arch/amd64/
$ ../../gforth testasm.fs

in file included from *the terminal*:0:-21242127:
in file included from *the terminal*:-1:1:
testasm.fs:7:1: error: Control structure mismatch
>>>end-code<<<
Backtrace:
kernel/cond.fs:114:26                    0 $7F75E6785200 throw
code.fs:96:14                            1 $7F75E67B9248 ?struc

I edited and reduced testasm.fs until it contained only:

abi-code ssedup
   \ SP passed in di, returned in ax,  address of FP passed in si
   -16 di d) ax lea        \ compute new sp in result reg
   di )  xmm0 movupd
   xmm0 ax )  movups
   ret
end-code

including and loading testasm.fs again gave the same error.
Then I commented out  line 3:

abi-code ssedup
   \ SP passed in di, returned in ax,  address of FP passed in si
\   -16 di d) ax lea        \ compute new sp in result reg
   di )  xmm0 movupd
   xmm0 ax )  movups
   ret
end-code

Now the assembler accepted the file with no error.
My conclusion is an incompatibility with

  -16 di d) ax lea

as this gives the error message : Control structure mismatch
This line has the same signature as where I had my initial problems.
I hope you can reproduce it and have a suggestion how to solve it.

Thanks, Anthony Vogelaar


Reply via email to