Assembling 68k lazarus / 68-Other OS ---------------------------------------------------------------------- polluks · 2020-04-26 12:59 Hi! How do you support a bigger displacement? error 2030 in line 140338 of "T:27B5522mp.s": displacement out of range >       mulu.l  -70768(%a5),%d0 Thanks, Stefan ---------------------------------------------------------------------- TRon · 2020-04-26 13:46 Quote from: polluks on April 26, 2020, 02:59:28 pmHow do you support a bigger displacement? You don't ?. It is a limitation of the processor, e.g. afaik displacement on a 68k can be 16 bit max. Are you addressing custom (f.e. fpga) hardware that offers such support ? ---------------------------------------------------------------------- polluks · 2020-04-26 15:40 Thanks for your quick reply The 68020 offers 32-bit displacement https://books.google.de/books?id=eVcEWDIeTYcC&pg=PA332&lpg=PA332&dq=32 -bit+displacement&source=bl&ots=kzktXlrZgr&sig=ACfU3U2vWwsCkgtgc2STL47 ji8LNWeRI_g&hl=de&sa=X&ved=2ahUKEwiPiqPTtIbpAhWRiqQKHTN0D4YQ6AEwAHoECA YQAQ#v=onepage&q=32-bit%20displacement&f=false By the way I'm counting thee errors Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Free Pascal Compiler version 3.2.0-beta [2019/12/14] for m68kCopyright (c) 1993-2018 by Florian Klaempfl and othersTarget OS: Commodore AmigaCompiling mp.pasmp.pas(346,51) Note: Values in enumeration types have to be ascendingmp.pas(1227,15) Warning: Local variable "best" of a managed type does not seem to be initializedmp.pas(1349,12) Warning: Local variable "l" of a managed type does not seem to be initializedmp.pas(2553,21) Warning: Local variable "stackBuf" of a managed type does not seem to be initializedmp.pas(19627,16) Note: Local variable "AllocElementType" is assigned but never usedmp.pas(19628,5) Note: Local variable "NumAllocElements" is assigned but never usedmp.pas(23719,5) Note: Local variable "NumAllocElements" is assigned but never usedmp.pas(23953,22) Note: Local variable "AllocElementType" is assigned but never usedmp.pas(26701,29) Warning: Local variable "CaseLabelArray" of a managed type does not seem to be initializedmp.pas(29733,21) Warning: Local variable "UnitList" of a managed type does not seem to be initializedmp.pas(29262,3) Note: Local variable "NumAllocTypes" not usedAssembling madpascal error 2030 in line 167386 of "T:2035BC7mp.s": displacement out of range>       mulu.l  -70804(%a5),%d0 error 2030 in line 167403 of "T:2035BC7mp.s": displacement out of range>       mulu.l  -70804(%a5),%d0 error 2030 in line 169829 of "T:2035BC7mp.s": displacement out of range>       mulu.l  -70804(%a5),%d0FreePascal:bin/m68k-amiga/vasmm68k_std fehlgeschlagen Rückgabewert 20Error: Error while assembling exitcode 20Fatal: There were 2 errors compiling module, stoppingFatal: Compilation aborted ---------------------------------------------------------------------- marcov · 2020-04-26 16:02 That's a message of the assembler, so which assembler do you use? FPC generates it, so it probably generates code for 68020 or higher. ---------------------------------------------------------------------- TRon · 2020-04-26 18:10 Quote from: polluks on April 26, 2020, 05:40:54 pmThanks for your quick reply You're more than welcome :-) QuoteThe 68020 offers 32-bit displacement Sorry, I still interpret the text differently. That link writes that it is a 16 bit displacement which is extended to 32 bit before doing the actual math. The motorola user manual has a table that writes: Addressing mode, Register indirect, Address with Displacement, Syntax: (d16, An) Which version of vasm are you using, as i have not encountered it it myself (just) yet. I have still to test fpc 3.2.0 rc1 @marcov: that is vasm: http://sun.hasenbraten.de/vasm/ If it is fpc generating the code then i do believe there could be something amiss ? PS @polluks Unfortunately  getting sources legitimate is a bit tricky. Try a search for the M68020 user manual (UM) (Motorola/NXP/freescale doesn't matter, any will do). Additionally you could download the datasheet for the 020 as well (you can find the table I referenced there as well) or try the M68000 Programmer's Manual (PRM) and take a peek here: https://www.cs.mcgill.ca/~cs573/fall2002/notes/lec273/lecture10/ where the motorola 'tech' syntax is more or less translated into actual asm instructions that you're probably more familiar with. Feel free to correct me in case i'm wrong. ---------------------------------------------------------------------- PascalDragon · 2020-04-27 07:37 Quote from: polluks on April 26, 2020, 02:59:28 pmHi! How do you support a bigger displacement? error 2030 in line 140338 of "T:27B5522mp.s": displacement out of range >       mulu.l  -70768(%a5),%d0 Is it Pascal code or inline assembler that leads to this? Can you provide a full, small, self contained example that demonstrates this? What did you set the processor to (option -CpXXX)? ---------------------------------------------------------------------- TRon · 2020-04-28 10:18 Sorry as i am not TS. I am able to reproduce using RC1 cross so am able to answer some of the questions. Quote from: PascalDragon on April 27, 2020, 09:37:33 amIs it Pascal code or inline assembler that leads to this? Although I have not checked all the code/includes, it seems to be Pascal. QuoteCan you provide a full, small, self contained example that demonstrates this? Unfortunately not (yet). (Somewhat large) project that is able to reproduce can be found at https://github.com/tebe6502/Mad-Pascal , where i downloaded release 1.6.3 QuoteWhat did you set the processor to (option -CpXXX)? -CP option does not seem to matter at all. I have also tried to cross-compile to MorphOS (also vasm, version 1.8h) which led to: Code: [Select]Free Pascal Compiler version 3.2.0rc1 [2020/04/28] for powerpc Copyright (c) 1993-2020 by Florian Klaempfl and others Target OS: MorphOS Compiling mp.pas mp.pas(349,51) Note: Values in enumeration types have to be ascending mp.pas(20092,16) Note: Local variable "AllocElementType" is assigned but never used mp.pas(20093,5) Note: Local variable "NumAllocElements" is assigned but never used mp.pas(24178,5) Note: Local variable "NumAllocElements" is assigned but never used mp.pas(24467,33) Note: Local variable "ParamIndex" not used mp.pas(24467,45) Note: Local variable "idx" not used mp.pas(29834,3) Note: Local variable "NumAllocTypes" not used Assembling madpascal Linking mp Fatal error 1: Out of memory. Aborting. Error: Error while linking Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted Error: ppcrossppc returned an error exitcode @TS. Were you able  to use the native compiler for the MOS release ? ---------------------------------------------------------------------- TRon · 2020-04-30 05:53 I'm a bit stuck. Having a closer look at the code I can see that it primarily consist out of basic Pascal functions. Some nested, some forwarded but that is about the most exiting bit in there. Only sysutils is used, and things are written for mode objfpc. Turning on overflow checking will get a bit further, but then the linker bails out again. Code: [Select]$ fpc -V3.2.0 -B -MOBJFPC -Co -Pm68k -Tamiga -XV -AVasm mp.pas -FD/home/ron/bin/binutils Free Pascal Compiler version 3.2.0rc1 [2020/04/30] for m68k Copyright (c) 1993-2020 by Florian Klaempfl and others Target OS: Commodore Amiga Compiling mp.pas mp.pas(357,51) Note: Values in enumeration types have to be ascending mp.pas(20100,16) Note: Local variable "AllocElementType" is assigned but never used mp.pas(20101,5) Note: Local variable "NumAllocElements" is assigned but never used mp.pas(24186,5) Note: Local variable "NumAllocElements" is assigned but never used mp.pas(24475,33) Note: Local variable "ParamIndex" not used mp.pas(24475,45) Note: Local variable "idx" not used mp.pas(29842,3) Note: Local variable "NumAllocTypes" not used Assembling madpascal Linking mp Fatal error 1: Out of memory. Aborting. Error: Error while linking Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted Error: /home/ron/bin/fpc/3.2.0/bin/arm-linux/ppcross68k returned an error exitcode I have run a couple of other tests against this setup and those seem to work ok so far (although I haven't actually tested the resulting execs from those tests) Is there anything else I can try with my limited knowledge on the asm/linker backend ? ---------------------------------------------------------------------- TRon · 2020-04-30 21:51 After a consult with ALB42, i realised that i had overlooked something and that is the fact that the code makes heavy use of static arrays. And those are simply too big (for the specific target). FPC produces code for it, but it is simply too much for the back-end to chew on. Converting some of those static arrays into dynamic ones then the code starts to compile without errors. That leaves the question if there should be a more meaningful error and if such situation occurs that FPC should even produce ('faulty') code for it to being with. Right now I am unsure whether it is FPC or the asm/linker which is 'at fault' so that i don't even know if it would be helpful to submit a bugreport.