Bug 182 - ds.X slightly inconsistent behaviour? (discuss!)
Summary: ds.X slightly inconsistent behaviour? (discuss!)
Status: RESOLVED FIXED
Alias: None
Product: RMAC
Classification: Unclassified
Component: Core (show other bugs)
Version: unspecified
Hardware: PC Linux
: Normal enhancement
Assignee: Shamus Hammons
URL:
Depends on:
Blocks:
 
Reported: 2021-03-06 12:18 CST by ggn
Modified: 2022-05-30 12:39 CDT (History)
1 user (show)

See Also:


Attachments
The patches! (1019 bytes, patch)
2021-03-06 12:19 CST, ggn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ggn 2021-03-06 12:18:06 CST
Consider the following program:

    nop

    dc.w $1000-*
    ds.b $1000-$
    moveq #0,d0

Assembling this, the dc.w will produce what's expected, i.e. subtract 2 from $1000 for a result of $ffe. The ds.b on the other hand will fail with the error "Error: illegal relative address". "Why's that?" I wondered.

Taking a peek at the source, I saw that the implementation of d_ds() makes a call to abs_expr() to calculate the value. This has a clause that makes it fail if the expression is in a TEXT/DATA/BSS segment (which is considered relative). I think this check was there due to ds.X in the past being legal only in the BSS segment, or something close to that.

I think that we can replace that to a plain call to expr() so it can be more flexible.

I'll attach a patch in a bit, let me know if you can think of any reasons why we shouldn't do this!
Comment 1 ggn 2021-03-06 12:19:50 CST
Created attachment 159 [details]
The patches!
Comment 2 Shamus Hammons 2022-05-30 12:39:42 CDT
Thanks for the patch!  :-)