Author Topic: "trunk/text_pixel.c" touble with the asm volatile syntax  (Read 2251 times)

0 Members and 1 Guest are viewing this topic.

Offline eldorico

"trunk/text_pixel.c" touble with the asm volatile syntax
« on: November 08, 2012, 12:13:43 AM »
Hello!


I'm triyng compiling simutrans on code:blocks, and have some trouble with the asm volatile synthax.


Code: [Select]
// 17% faster pixel setting for text ...
// helper for display_text_len_clip
asm volatile (
"jmp *JumpDC(,%2,4)\n\t"
"ud2\n\t"
".p2align 4\n"
"JumpDC:\n\t"
".long .DCende\n\t"
".long L9901\n\t"
".long L9902\n\t"
".long L9903\n\t"



...


Code: [Select]
"stosl\n\t"
"stosl\n\t"
"stosl\n\t"
".DCende:\n\t"
: "+D" (dst)
: "a" (color2), "r" (dat)
: "cc", "memory"
);

It reports me that a "(" was expetced before ":" token. I dont know what to do.

here is some documentation, but it is to complicateted for my level.

Does anyone could help?

Thanks


Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4870
  • Total likes: 202
  • Helpful: 108
  • Languages: EN, NO
Re: "trunk/text_pixel.c" touble with the asm volatile syntax
« Reply #1 on: November 08, 2012, 05:44:37 AM »
Are you trying to compile it as an independent file? Don't do that. simgraph16.c will include it and feed it what it needs.

Offline eldorico

Re: "trunk/text_pixel.c" touble with the asm volatile syntax
« Reply #2 on: November 09, 2012, 03:11:38 AM »
Oh thanks..


Yes, I realised that I was compiling file per file.  :-X


Do you know how I ask to code:blocks to compile from simmain.cc? Or should I creat a new main, and fetch it with simmain?








Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4870
  • Total likes: 202
  • Helpful: 108
  • Languages: EN, NO
Re: "trunk/text_pixel.c" touble with the asm volatile syntax
« Reply #3 on: November 09, 2012, 05:45:41 AM »
There is no "compile from simmain.cc". You add all the files that need to be compiled to the project, and then compile. The tricky part is figuring which files those are. You can figure out which those are by looking through the Makefile. It contains one big list of files that should always be compiled, but scattered about are references to some files that shall only be compiled when targetting certain platforms. Personally, I just added everything (except the makeobj directory), and then removed files I could tell I shouldn't have, before I tried compiling and removed file by file that didn't fit. That requires some experience, though, and it is possible that I still have too many files in the project, but the rest are harmless.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8823
  • Total likes: 323
  • Helpful: 229
  • Languages: De,EN,JP
Re: "trunk/text_pixel.c" touble with the asm volatile syntax
« Reply #4 on: November 09, 2012, 08:44:47 AM »
besch/writer director is not needed too. From the music/sound files use only one. same for the simsys_?.cc, only use one, and do not use simgraph0.cc. If you are on a non-intel/x64 machine you HAVE to define USE_C. You better also define DEBUG.

But why go through the hassle with that and not use make. It is so much easier to use.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4870
  • Total likes: 202
  • Helpful: 108
  • Languages: EN, NO
Re: "trunk/text_pixel.c" touble with the asm volatile syntax
« Reply #5 on: November 09, 2012, 03:59:28 PM »
But why go through the hassle with that and not use make. It is so much easier to use.

Make is just for compiling, not editing.

Offline kierongreen

Re: "trunk/text_pixel.c" touble with the asm volatile syntax
« Reply #6 on: November 09, 2012, 06:18:38 PM »
You can use your choice of text editor to edit code though (I use Leafpad at the moment for example). No IDE required!

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4870
  • Total likes: 202
  • Helpful: 108
  • Languages: EN, NO
Re: "trunk/text_pixel.c" touble with the asm volatile syntax
« Reply #7 on: November 09, 2012, 07:31:29 PM »
I've used Notepad for programming in the past, but intergrated debugging, context sensitive searching and a simple build-and-run button is nice. (Though Code:blocks is so crappy on some of this that it's worth is almost negative.)