Bug 182

Summary: ds.X slightly inconsistent behaviour? (discuss!)
Product: RMAC Reporter: ggn <ggnkua>
Component: CoreAssignee: Shamus Hammons <jlhamm>
Status: RESOLVED FIXED    
Severity: enhancement CC: jlhamm
Priority: Normal    
Version: unspecified   
Hardware: PC   
OS: Linux   
Attachments: The patches!

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!  :-)