flat assembler
Message board for the users of flat assembler.

Index > Windows > Storing data in code segment

Author
Thread Post new topic Reply to topic
prino



Joined: 24 Jun 2004
Posts: 20
prino 01 Nov 2008, 18:50
Busy converting old 16-bit code. Uses this construction:

Code:
  mov   cx, offset @1
  call  cs_2_line

  db    $00
  db    " +-----+-----+-----+-----+"
@1:
    


with 'cs_2_line' moving the data following the call to a variable and returning to the '@1' label. I can (obviously) change this to 32-bit, but would it be better (performance-wise) to move the strings to a more appropriate location, i.e. the data segment?

Robert
Post 01 Nov 2008, 18:50
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20451
Location: In your JS exploiting you and your system
revolution 01 Nov 2008, 19:09
There may be a small improvement in performance if you match the call and ret into natural pairs (the modern CPUs have special circuitry to make call-ret pairs quite efficient). Also if the data are all grouped into one location you may get a small improvement because of cache locality. Although, these potential performance improvements would be quite minor for most applications so don't expect too much.
Post 01 Nov 2008, 19:09
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 02 Nov 2008, 12:24
On my machine, mismatched call/ret take about 18 cycles, and matched 1-2 cycles, so that is IMO really not worth of special care.
Post 02 Nov 2008, 12:24
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.