![]() |
![]() |
#21 | |
Registered User
Join Date: Mar 2018
Location: Hastings, New Zealand
Posts: 2,862
|
Quote:
|
|
![]() |
![]() |
#22 |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,934
|
What Bruce said. A lot of compilers have intrinsics to support C language features that are quite easy to spot once you've seen them before.
|
![]() |
![]() |
#23 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,664
|
ok.. so the answer is "no" when using the qualifiers "generally" and "reliably", but f/a 18 is probably compiled using some well-known compiler :-)
|
![]() |
![]() |
#24 |
Registered User
Join Date: Sep 2009
Location: Norway
Posts: 1,725
|
|
![]() |
![]() |
#25 |
Registered User
Join Date: Mar 2018
Location: Hastings, New Zealand
Posts: 2,862
|
F/A 18 appears to be ~1/3rd C and 2/3rds assembler. The C code looks like Lattice, which would make sense since it was the official compiler for the Amiga. To prove it I would have to compile some code with an early version of Lattice C and see what it produced.
|
![]() |
![]() |
#26 |
Registered User
Join Date: Jun 2017
Location: Finland
Posts: 381
|
This discussion is very intriguing, like watching a detective story of sorts
![]() |
![]() |
![]() |
#27 |
Registered User
Join Date: Oct 2009
Location: Belgium
Age: 50
Posts: 42
|
I found a function in the binary that is only called when some bytes are set to 1. I don't see them being written anywhere in the code, so I guess it's a function meant for debugging.
The attached picture shows the result. The small diagonal line in the top left corner is drawn every odd frame. The three-digit number is the frame rate (but not in fps, the base seems to be 800000). The other two numbers are the x and y input of the input controller. Last edited by ara; 23 May 2023 at 00:53. |
![]() |
![]() |
#28 |
Registered User
Join Date: May 2005
Location: Cheshire, UK
Age: 57
Posts: 322
|
I recall when you look at code made in pure assembler in a decompiler, it looks "clean" in comparison for want of a better word. I seemed to remember encountering BCD more frequently in non-ASM compiled code.
Also, there's frequently obvious bloat in higher level compilers. I expect that the exec stub would have some kind of uniqueness, as well as what sort of mem alloc pieces there are. I expect one of the number of ex-crackers on here would recognise code structure from their typical tracing experiences. |
![]() |
![]() |
#29 |
Registered User
Join Date: Oct 2009
Location: Belgium
Age: 50
Posts: 42
|
The compilers in the 1980s were not as much optimizing as the modern ones. For example, I don't remember to have ever seen loop unrolling in old compiled code. In addition, in code written in assembly language you can find structures that don't appear in compiled code. Typical example: code shared between several functions, like this:
Code:
function1: some instructions function: some instructions rts Do you know which game was written almost entirely in C? Populous. The code is very easy to read. I started translating it to Java and actually finished the game initialization and rendering part (see the attached picture), but at some point implementing all the game logic became too boring (so many "if"s....) |
![]() |
![]() |
#30 |
Registered User
Join Date: Oct 2022
Location: Shelby Township
Posts: 86
|
Doesn’t IDA Pro decompile nowadays? Last time I looked at it about 10+ years ago I thought it did?
|
![]() |
![]() |
#31 |
Registered User
Join Date: Jun 2017
Location: Finland
Posts: 381
|
Theoretically speaking, would this mean that the game could be further optimized at least to a modestly significant degree by hand-written assembler? I'm assuming here that the compiled C code from 1991 is not as efficient. |
![]() |
![]() |
#32 | |
Registered User
Join Date: Oct 2009
Location: Belgium
Age: 50
Posts: 42
|
Quote:
Here is a fragment of C code that I reverse-engineered with the help of Ghidra. It comes from a function that flattens a 9x9 patch of land for the AI player: Code:
(player->action).id = 2; // land lowering action (player->action).x = x; (player->action).y = y; player->moveDone = 1; Code:
movea.l (-0xe,A5),A0 move.b #0x2,(A0) movea.l (-0xe,A5),A0 move.b d4,(0x1,A0) movea.l (-0xe,A5),A0 move.b d5,(0x2,A0) movea.l (-0xe,A5),A0 move.w #0x1,(0x8,A0) ![]() |
|
![]() |
![]() |
#33 | |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,934
|
Quote:
|
|
![]() |
![]() |
#34 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,458
|
okay but do you really need more speed on that game? Our elders knew that compilers were crap, so they wrote critical parts in assembly already.
if so, I suppose that one could disassemble, remove the useless instructions / write more efficient code, reassemble. But first, you'd have to profile the code to see where you'd have the best gain, else it's a lot of work for unguaranteed results. PS: great job with the RE of Populous nevertheless. Granted, re-making those games for modern platform has little interest as those modern platforms can already emulate the real game. Unless you add features (HD, extensions...) which is another story... |
![]() |
![]() |
#35 |
Registered User
Join Date: Oct 2009
Location: Belgium
Age: 50
Posts: 42
|
True. For me, it's just a leisure activity and a kind of archeology. It's fun to see how much game play they could squeeze into a few kbytes of code. If a remake or extended version were the goal, it would be more interesting to directly start from Populous 2.
|
![]() |
![]() |
#36 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,458
|
Another useful thing when resourcing is you can figure out how data is done and create level editors for the original engine.
|
![]() |
![]() |
#37 |
Registered User
Join Date: Jun 2024
Location: Bogotá, Colombia
Age: 49
Posts: 25
|
Here's my own ellipse algorithm (filled and outline) which I basically implemented to avoid layers.library's buggy clipping.
Code:
SUB DrwEll(BYVAL x,BYVAL y,BYVAL r1,BYVAL r2, BYVAL f) STATIC STATIC x1,x2,ax,bx,xa0,xb0,cy,y1,a,a!,b!,p1,p2,p3,r12!,r1i!,r2i!,x2! r12!=r1^2 r1i!=1/r12! r2i!=1/r2^2 x2!=x^2 a!=x2!*r1i! IF a!+y^2*r2i!<=1 AND a!+(255-y)^2*r2i!<=1 AND (639-x)^2*r1i!+y^2*r2i!<=1 AND (639-x)^2*r1i!+(255-y)^2*r2i!<=1 THEN IF f THEN ' Ellipse bedeckt kompletten Bildschirm? SetRast sRastPort&,GetAPen(sRastPort&) ' --> wenn Parameter "f": Bildschirm füllen END IF ' sonst: gar nichts tun ELSEIF x+r1>-1 OR x-r1<640 OR y+r2>-1 OR y-r2<256 THEN ' Ellipse potentiell sichtbar? b!=-2*x*r1i! p1=MAX(f-1,y-r2) p2=MIN(255,y) p3=1 xa0=-2-f iter: FOR cy=p1 TO p2 STEP p3 IF cy=y-r2 OR cy=y+r2 THEN ' erste und letzte Zeile der Ellipse a=SQR(r1*(r1/r2))>>1 x1=MAX(f-1,x-a) x2=MIN(640-f,x+a) ELSEIF cy=y THEN ' Zeile auf Höhe des Mittelpunktes x1=MAX(f-1,x-r1) x2=MIN(640-f,x+r1) ELSE ' alle anderen Zeilen x1=(b!+SQR(b!*b!-4*r1i!*(a!+(cy-y)^2*r2i!-1)))*-r12!>>1 x2=MIN(640-f,x+(x-x1)) x1=MAX(f-1,x1) END IF IF xa0=-2 THEN ' Startpunkt für Outline setzen xa0=x2 xb0=x1 END IF IF x2>-1 AND x1<640 THEN y1=y*2-cy IF f THEN ' ausfüllen Move sRastPort&,x1,cy Draw sRastPort&,x2,cy IF p3 AND y1<256 THEN ' nach unten spiegeln Move sRastPort&,x1,y1 Draw sRastPort&,x2,y1 END IF ELSE ' Konturlinien ax=MIN(639,MAX(0,xa0)) ' links bx=MAX(0,x1) IF cy>-1 AND cy<256 AND (ax<>bx OR xa0>-1) THEN Move sRastPort&,ax,cy Draw sRastPort&,bx,cy IF p3 AND y1<256 THEN ' nach links unten spiegeln Move sRastPort&,ax,y1 Draw sRastPort&,bx,y1 END IF END IF ax=MIN(639,MAX(0,xb0)) ' rechts bx=MIN(639,x2) IF cy>-1 AND cy<256 AND (ax<>bx OR xb0<640) THEN Move sRastPort&,ax,cy Draw sRastPort&,bx,cy IF p3 AND y1<256 THEN ' nach rechts unten spiegeln Move sRastPort&,ax,y1 Draw sRastPort&,bx,y1 END IF END IF xa0=x1 xb0=x2 END IF END IF NEXT cy IF p3=1 AND y-r2<0 AND y+r2>-1 THEN ' wegen Clipping nicht gespiegelten Rest rendern p1=MIN(256-f,y+r2) p2=MAX(0,y*2+1) p3=-1 xa0=-2-f GOTO iter ' 2. Durchgang END IF END IF END SUB |
![]() |
![]() |
#38 |
Coder/webmaster/gamer
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,715
|
Which version of layers.library? IIRC ThoR has already fixed all the known bugs in it.
|
![]() |
![]() |
#39 | |
Registered User
Join Date: Jun 2017
Location: Finland
Posts: 381
|
Quote:
Well, when I run the game on a stock A500, the title screen animation (where pieces of the landscape fall from the sky) could use a few more frames to make it appear a little less jerky ![]() |
|
![]() |
![]() |
#40 |
Registered User
Join Date: Jun 2024
Location: Bogotá, Colombia
Age: 49
Posts: 25
|
Code:
6.Workbench> version layers.library full layers.library 40.1 (15.02.1993) |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Most advanced game by year? | rothers | Amiga scene | 51 | 15 April 2022 20:47 |
Best Game of Year 2021 | Solo Kazuki | Amiga scene | 13 | 28 February 2022 15:08 |
EAB Game of the year poll | mcgeezer | Amiga scene | 20 | 15 December 2021 08:05 |
From What year to what year You can use a stock Commodore Amiga 500? | The Brave Ant | Nostalgia & memories | 3 | 10 June 2014 18:34 |
AGTW game of the Year | Dizzy | project.EAB | 6 | 23 December 2006 17:58 |
|
|