Author Topic: Dyanamically renaming labels  (Read 15820 times)

Offline clone4crw

  • New Member
  • Posts: 1
Dyanamically renaming labels
« on: February 25, 2010, 05:18:33 AM »
So here's what I'm wondering: Is it at all possible to dynamically rename a label while a program is being executed? By this I mean treating it as a string and being able to be modified by the code itself? Just some idea that I had.

I guess if you're curious, I'm wasting my free time writing a 16-bit program that will render ASCII animations. Now, these animations for now are being declared as 'Frame001', 'Frame002', etc, and what I'm looking to do is have the program take a string "'Frame', 0x20, 0x20, 0x20, 0", and on the fly change the string accordingly to call up the next frame. (Rename it to 'Frame001', Frame002', etc)

Any ideas or anything?

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Dyanamically renaming labels
« Reply #1 on: February 25, 2010, 05:51:26 AM »
Think about what a "label" is at runtime - or even in the binary code. Modifying a string isn't going to help.

What you might want to do, if the "frames" are not equal size, is create a table ("array"!) and step through it...

frametable dw frame1, frame2, frame3, frame2, frame1

If they're of equal size, you can calculate the position of each...

Does that help any?

Best,
Frank