A.D.A. Amiga Demoscene Archive

        Welcome guest!

  

  

  

log in with SceneID

  

Demos Amiga Demoscene Archive Forum / Coding / Vlink warning and exe fails to load

 

Author Message
faaret
Member
#1 - Posted: 26 Sep 2011 00:15 - Edited
Reply Quote
Hi all.

I am trying to join the bandwagon mixing C with asm and cross-compiling/assembling on Windows using vbcc/vasm/vlink and ultimately start making some demos using this setup.

1. I am using an asm demo-framework by Blueberry, which I am able to mix with C functions and compile/assemble using vbcc/vasm/vlink. This runs fine except when quitting the demo a guru comes with error code: 8000006 (CHK instruction trap?). I am not sure how to fix this..

2. I have also found Kalms' ADPCM sources and I am able to assemble the player example program using vasm, which works fine.
I have then tried to add the adpcm playback to the demoframework. This should not be difficult as Kalms' adpcm player is used very similar to how ThePlayer is used in Blueberry's demoframework. Everything assembles fine and also links with no errors after making necessary symbols 'public'. However, vlink still gives this warning:
vlink -L./ -L"C:\VBCC/targets/m68k-amigaos/lib" "C:\VBCC/targets/m68k-amigaos/lib/startup.o" -lamiga -lvc  -Bstatic -bamigahunk -Cvbcc  -s -lmieee -o src  C2P1x1x8Small.o  Framework.o StartUp.o  Example.o main.o  AdpcmSource.o  PaulaOutput.o
Warning 58: Relative references between code section "CODE" and bss section "bss_c" (Example.o) force a combination of the two.
Warning 22: Attributes of section CODE were changed from r-x- in main.o to rwx- in Example.o.


When I try to run the program I get this error messagebox:
Program failed (error #80000004)
Suspend Reboot

which has to do with an illegal instruction. Has anybody had similar problems? I don't know enough about Amiga executables and m68k assembler to deduce what is going wrong and how to fix it... Help or hints highly appreciated..
faaret
Member
#2 - Posted: 26 Sep 2011 00:30
Reply Quote
I have found hitchikr's post here, and as a longshot tried removing all pc-relative references, but I still get the same warnings.

I am using vlink 0.13 if that's relevant.
Vektor
Member
#3 - Posted: 28 Sep 2011 22:49
Reply Quote
The PC instruction is a possible issue if you are using two segments / sections. Memory for both hunks / sections is allocated independent of eacht other. To use pc relative memory distance should not be more than +/- 32kb

Could it be that you are accessing your data section at an odd adress?

eg. if you have defined a byte variable and directly after it a word or a longword you get an error

Variable1:
dc.b 0
Variable2:
dc.w 0

To fix this you add in most assemblers the "even" command

Variable1:
dc.b 0
even
Variable2:
dc.w 0
faaret
Member
#4 - Posted: 29 Sep 2011 18:47
Reply Quote
I'll try and have a look at stuff like that hopefully during the weekend. Might be something like that that's troubling..
Regarding the 2nd issue, I guess it also should be possible to disassemble the exe and see what's going on, but I'm not not sure I could recognize an illegal instruction if I saw one.. :)

Thank you for your input.

 

  Please log in to comment

  

  

  

 

A.D.A. Amiga Demoscene Archive, Version 3.0