English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language

 
 
Thread Tools
Old 16 October 2014, 00:25   #1
JimDrew
Registered User
 
Join Date: Dec 2013
Location: Lake Havasu City, AZ
Posts: 741
Help with compile

Can you someone look at the attached code and tell me exactly what I need to compile it on an Amiga?

I know absolutely *nothing* about C code, except what it looks like when you disassemble the assembly code.

I need to compile the tester program, which is an instruction set tester that was written in C. I need to run this on an Amiga (and Amiga emulators) to test the instruction set accuracy. Thank you!!

Jim
Attached Files
File Type: zip portable68k_src.zip (81.4 KB, 219 views)
JimDrew is offline  
Old 16 October 2014, 00:39   #2
demolition
Unregistered User
 
demolition's Avatar
 
Join Date: Sep 2012
Location: Copenhagen / DK
Age: 43
Posts: 4,190
From looking inside the makefile, it looks to me like it is designed to be compiled with GCC on Windows or OSX.
demolition is offline  
Old 16 October 2014, 03:34   #3
JimDrew
Registered User
 
Join Date: Dec 2013
Location: Lake Havasu City, AZ
Posts: 741
Yes, but the docs in the github elude to the fact that it was created on an Amiga... the samples were for sure. I would assume that it can be compiled to run on an Amiga changing the make file. I installed gcc on the Amiga and tried to compile it, but got all kinds of errors about missing .h files. My goal is to turn this into 68K assembly that can be used on Amiga and Mac emulators to test the instruction set accuracy.
JimDrew is offline  
Old 16 October 2014, 14:05   #4
kamelito
Zone Friend
 
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 1,801
do you mean that they never were accurate in your past products?
kamelito is offline  
Old 16 October 2014, 14:43   #5
rkidd7952
Registered User
 
Join Date: Aug 2012
Location: Champaign IL USA
Posts: 22
Hi Jim,

Did you use gnu make along with gcc to compile? From a quick look a the source, it doesn't appear to use any exotic system include files, but it uses a gnu make extension to build the compiler options that specify where to find the .h files in the source tree.

I don't know much (anything, really) about the state of gcc/g++ on the Amiga, but the makefile refers to version 4.7 and lists a couple language options that may not be available on the Amiga (-std=gnu99, -std=gnu++0x). I'm not sure if the source actually uses new language features that require these options.

There are only a few source files in the base executable, so you could try compiling by hand rather than chasing down the correct version of make. Here are the compiler commands the makefile invokes when I run make DEBUG=1 on my mac.

g++ -I. -Ilib/ -O0 -g -Wall -c 68k/68k.cpp -o obj/68k.o
g++ -I. -Ilib/ -O0 -g -Wall -c 68k/exception.cpp -o obj/68kexception.o
g++ -I. -Ilib/ -O0 -g -Wall -c main.cpp -o obj/main.o
g++ -I. -Ilib/ -O0 -g -Wall -c results.cpp -o obj/results.o
g++ -I. -Ilib/ -O0 -g -Wall -c tester.cpp -o obj/tester.o
g++ -o out/portable68k obj/68k.o obj/68kexception.o obj/main.o obj/results.o obj/tester.o

I edited the makefile to remove the -std=gnu* options. I got a couple compiler warnings (signed vs unsigned comparison, recommended parentheses around an expression), but nothing too dire. I suspect the -std=gnu* options aren't needed, but I haven't tried to run the program to find out.

Those commands use unix syntax to refer to the current directory, so you'll need to change -I. appropriately. I think that'd be -I"" or -I "" on the Amiga.

Robert

Last edited by TCD; 18 October 2014 at 03:28. Reason: Back-to-back posts merged.
rkidd7952 is offline  
Old 16 October 2014, 18:25   #6
JimDrew
Registered User
 
Join Date: Dec 2013
Location: Lake Havasu City, AZ
Posts: 741
Quote:
Originally Posted by kamelito View Post
do you mean that they never were accurate in your past products?
Ha! No, that's not the case. I never saw any issues with the 68040 core I did for the PC based Mac emulation. I would like to check WinUAE and FPGA based Amiga emulations for instruction execution and timing accuracy - vs. a real Amiga.

Robert, can you attach the changes you made. I know absolutely nothing about C code. I couldn't write a 'hello world' program in C if my life depended on it. I could do it in a dozen different assembly languages, but not C. I have no use for portability so C has never been a requirement for me.

Last edited by TCD; 18 October 2014 at 03:29. Reason: Back-to-back posts merged.
JimDrew is offline  
Old 16 October 2014, 18:44   #7
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
I've cross-compiled it, but I don't think it runs well. (on emulated A1200)
It ends up with "Errors: 352".

If I compile it for linux, I get no error(s) on the output. "Errors: 0"
Is that supposed to happen?

Oh, and it's not C code. It's c++

Last edited by alkis; 16 October 2014 at 18:45. Reason: c++ remark
alkis is offline  
Old 16 October 2014, 20:25   #8
JimDrew
Registered User
 
Join Date: Dec 2013
Location: Lake Havasu City, AZ
Posts: 741
Are these compiler errors or is the results from running it? If from running it, can you attach the Amiga executable so I can disassemble it and check it? Thanks!

C/C++/C#/C!/CC = it all equals some form for C.
JimDrew is offline  
Old 16 October 2014, 20:45   #9
ajk
Registered User
 
ajk's Avatar
 
Join Date: May 2010
Location: Helsinki, Finland
Posts: 1,341
The "Errors: xxx" is output from the compiled program after running all the individual tests.
ajk is offline  
Old 16 October 2014, 20:50   #10
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
Those were results from running it.

It's in the zone for you. (portable68k.zip)

Needs ixemul.library and a pretty huge stack.
I was getting crashes with 50k stack. So I went 'stack 2000000' (2mil) and got it running.
alkis is offline  
Old 17 October 2014, 02:08   #11
JimDrew
Registered User
 
Join Date: Dec 2013
Location: Lake Havasu City, AZ
Posts: 741
Thanks... I will check it out!

Yeah, there is definitely something wrong with the compiled code. A real Amiga shows 352 errors as well.

Last edited by TCD; 18 October 2014 at 03:30. Reason: Back-to-back posts merged.
JimDrew is offline  
Old 17 October 2014, 10:42   #12
Hewitson
Registered User
 
Hewitson's Avatar
 
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 41
Posts: 3,771
Quote:
Originally Posted by JimDrew View Post
I couldn't write a 'hello world' program in C if my life depended on it.
Writing simple C programs isn't difficult.

Code:
#include <stdio.h>

main() {
printf("Hello World!\n");
}
Hewitson is offline  
Old 18 October 2014, 01:45   #13
JimDrew
Registered User
 
Join Date: Dec 2013
Location: Lake Havasu City, AZ
Posts: 741
Code:
#include system.gs

Main:  lea HelloString(pc),a0
       CALLFUNC OutputString
       rts

HelloString .db "Hello World!",LF
That makes way more sense to me... and it's smaller code and faster!


I am still stuck trying to get the portable68k code to work on an Amiga. Anyone have any ideas? Thanks!!

Last edited by JimDrew; 18 October 2014 at 01:51.
JimDrew is offline  
Old 27 October 2014, 08:12   #14
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
I am wondering how a compiled program can test cpu compatibility... Hum... Isn't this the task for pure asm instead ?
meynaf is offline  
Old 27 October 2014, 10:03   #15
demolition
Unregistered User
 
demolition's Avatar
 
Join Date: Sep 2012
Location: Copenhagen / DK
Age: 43
Posts: 4,190
I haven't looked into the source, but it could be using some inline asm at critical points?
demolition is offline  
Old 27 October 2014, 13:45   #16
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
The 68k subdirectory contains a simple 68k emulator.

So I doubt the program makes any sense for the original poster, as just the emulator will be tested.
phx is offline  
Old 27 October 2014, 13:47   #17
demolition
Unregistered User
 
demolition's Avatar
 
Join Date: Sep 2012
Location: Copenhagen / DK
Age: 43
Posts: 4,190
In that case, you might as well run the program on a PC rather than try to make it run on Amiga?
demolition is offline  
Old 27 October 2014, 15:42   #18
JimDrew
Registered User
 
Join Date: Dec 2013
Location: Lake Havasu City, AZ
Posts: 741
The goal is to remove the "tester" portion so that it will run on a real 68K, not through the emulator. A bunch of us are after a means to test 68k CPU cores (software and FPGA based). This is the only thing I can find that will test all of the 68K instructions. If I can get this compiled to run on an Amiga, I can disassemble it and turn it into a 68K hunk that can be inc'd into any test code.
JimDrew is offline  
Old 27 October 2014, 16:58   #19
demolition
Unregistered User
 
demolition's Avatar
 
Join Date: Sep 2012
Location: Copenhagen / DK
Age: 43
Posts: 4,190
But testing an emulator and the real thing are very different tasks. With the emulator, the testing software can control the time stepping in the emulator and log all required data from the outside. It needs to run much faster than the system it is testing. This is somewhat equivalent to hooking up a digital analyzer to a real Amiga and logging all relevant signals.

I don't see how it is possible to reliably test the system you're running on, at least not if you're going for clock accurate timings.
demolition is offline  
Old 27 October 2014, 17:13   #20
JimDrew
Registered User
 
Join Date: Dec 2013
Location: Lake Havasu City, AZ
Posts: 741
We don't care about clock cycle accuracy. We are after something that will test every instruction with every possible addressing mode, and compare the results to what a real 68K would have. There are several bugs in the TG68K code for example with certain instructions being used in certain ways.

There are tons of testers for Z80, 6502, 6809, etc. but nothing we can find (other than this program) that will test the 68K series.
JimDrew is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile issues using PhxAss NovaCoder Coders. Asm / Hardware 51 30 December 2014 22:52
How compile WinUAE... WCoder support.WinUAE 57 17 April 2014 17:42
Heart of the Alien: How to compile. XDelusion support.Apps 10 28 December 2011 01:54
GFA compile xc8 Coders. General 31 19 May 2009 18:21
Compile WinUAE ????? Myriel support.WinUAE 14 10 January 2004 17:06

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 15:50.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.12023 seconds with 14 queries