flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Macroinstructions > load from store at

Author
Thread Post new topic Reply to topic
Mike Gonta



Joined: 26 Dec 2010
Posts: 189
load from store at
convert.asm

Code:
btimes size db 0
a:
  file "a.bin"
  size = $ - a

source = a
destination = b
repeat size
  load x BYTE from source
  ; conversion goes here
  store BYTE x at destination
  source = source + 1
  destination = destination + 1
end repeat


The generated file however contains b and a.

trim.asm

Code:
virtual
  file "a.bin"
  size = $
end virtual
  file "convert.bin"0size

trim.bin is the file that I want. I've tried using virtual in convert.asm to eliminate trim.asm, but the result is either a file of zero's or a value out of range error.
Is it possible to convert one file to the other using only one asm file?

_________________
Mike Gonta
look and see - many look but few see

http://mikegonta.com
Post 18 Mar 2017, 19:08
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6357
Location: Kraków, Poland
LOAD/STORE operate on target addresses, not the file offsets. So if your source contains multiple addressing spaces, like the ones started with ORG directive, you have to make a "::" label for each one of them and then use these labels to bytes from consecutive spaces. You may need to overload ORG with a macro and maintain a symbolic list with labels of all the addressing spaces and their corresponding address ranges.
Post 18 Mar 2017, 19:29
View user's profile Send private message Visit poster's website Reply with quote
Mike Gonta



Joined: 26 Dec 2010
Posts: 189

Tomasz Grysztar wrote:
LOAD/STORE operate on target addresses, not the file offsets. So if your source contains multiple addressing
spaces, like the ones started with ORG directive, you have to make a "::" label for each one of them and then
use these labels to bytes from consecutive spaces. You may need to overload ORG with a macro and maintain
a symbolic list with labels of all the addressing spaces and their corresponding address ranges.

I had tried that, but it doesn't work on my beloved version 1.67.22 (with the listing facility) and I didn't
investigate it further.
It does of course work fine with the latest FASM version.

Code:
btimes size db 0

virtual at 0
a::
  file "a.bin"
  size = $
end virtual

destination = b
repeat size
  load x BYTE from a:(% - 1)
  ; conversion goes here
  store BYTE x at destination
  destination = destination + 1
end repeat


[edit]To clean up repeat with % instead of separate index variable.[/edit]

_________________
Mike Gonta
look and see - many look but few see

http://mikegonta.com


Last edited by Mike Gonta on 18 Mar 2017, 22:25; edited 1 time in total
Post 18 Mar 2017, 20:38
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6357
Location: Kraków, Poland

Mike Gonta wrote:
I had tried that, but it doesn't work on my beloved version 1.67.22 (with the listing facility) and I didn't
investigate it further.

Such an old version does not support "::" so this definitely won't work there. But if this is the listing extension that keeps you using such an ancient version, please note that you can use "-s" output of newer fasm versions (since 1.67.29 actually) and create the listing out of it with the LISTING tool that is included in all fasm packages.
Post 18 Mar 2017, 20:48
View user's profile Send private message Visit poster's website Reply with quote
Mike Gonta



Joined: 26 Dec 2010
Posts: 189

Tomasz Grysztar wrote:

Mike Gonta wrote:
I had tried that, but it doesn't work on my beloved version 1.67.22 (with the listing facility) and I didn't
investigate it further.

Such an old version does not support "::" so this definitely won't work there. But if this is the listing extension
that keeps you using such an ancient version, please note that you can use "-s" output of newer fasm versions
(since 1.67.29 actually) and create the listing out of it with the LISTING tool that is included in all fasm packages.

Done.
Now I have my beloved version 1.71.60.

_________________
Mike Gonta
look and see - many look but few see

http://mikegonta.com
Post 18 Mar 2017, 22:18
View user's profile Send private message 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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.