huguesjohnson / RetailClerk89

A short casual adventure game for the Sega Genesis written in 68000 assembly
https://www.huguesjohnson.com/rc89/
Other
58 stars 5 forks source link

Problems assembling with latest vasm #4

Closed dafyddcrosby closed 4 years ago

dafyddcrosby commented 4 years ago

Thanks for the guide and the source! I'm using it to help along my own little Genesis project :-) Seeing this issue on both macOS and Linux with the latest stable vasm (v1.8h)

vasm 1.8h (c) in 2002-2020 Volker Barthelmann
vasm M68k/CPU32/ColdFire cpu backend 2.3k (c) 2002-2020 Frank Wille                                  
vasm motorola syntax module 3.14 (c) 2002-2020 Frank Wille                                           
vasm binary output module 1.9a (c) 2002-2009,2013-2020 Volker Barthelmann                            

error 2029 in line 820 of "actionscript/ActionScriptDay04.X68": branch destination out of range      
        included from line 76 of "actionscript/ActionScript.X68"                                     
        included from line 139 of "RetailClerk89.X68"                                                
>       beq.s   DialogTextCNowStaffDefaultTalk  ; not started, branch                                

error 2029 in line 822 of "actionscript/ActionScriptDay04.X68": branch destination out of range      
        included from line 76 of "actionscript/ActionScript.X68"                                     
        included from line 139 of "RetailClerk89.X68"                                                
>       bne.s   DialogTextCNowStaffDefaultTalk  ; npc found, branch                                  

error 2029 in line 1036 of "actionscript/ActionScriptDay04.X68": branch destination out of range     
        included from line 76 of "actionscript/ActionScript.X68"                                     
        included from line 139 of "RetailClerk89.X68"                                                
>       beq.s   DialogTextFCBFishingStaffDefaultTalk    ; not started, branch                        

error 2029 in line 1038 of "actionscript/ActionScriptDay04.X68": branch destination out of range     
        included from line 76 of "actionscript/ActionScript.X68"                                     
        included from line 139 of "RetailClerk89.X68"                                                
>       bne.s   DialogTextFCBFishingStaffDefaultTalk    ; npc found, branch  
huguesjohnson commented 4 years ago

I'll try to reproduce this locally. I'm using vasm 1.7c without any issue, although I'm not sure why the compiler version would matter here. Changing beq.s/bne.s to beq.w/bne.w fixes branch destination out of range errors.

dafyddcrosby commented 4 years ago

I was able to build with 1.7c without issue as well, so does appear to be vasm-related

vasm 1.7c (c) in 2002-2015 Volker Barthelmann
vasm M68k/CPU32/ColdFire cpu backend 2.0f (c) 2002-2015 Frank Wille
vasm motorola syntax module 3.8 (c) 2002-2015 Frank Wille
vasm binary output module 1.8 (c) 2002-2009,2013,2015 Volker Barthelmann

CODE(acrx2):          121216 bytes
seg7a120(acrwx4):             469212 bytes
seg1fe793(acrwx1):              6253 bytes
seg200000(acrwx1):                 1 byte 
huguesjohnson commented 4 years ago

I see that the M68k/CPU32/ColdFire cpu backend was updated as well - I will look into what changed that might be causing this. In the meantime changing .s to .w would fix this - and will likely be what I do to fix it anyway.

huguesjohnson commented 4 years ago

OK, I found a ton of other problems after getting those errors to clear so it'll be a few days before I sort it all out.

huguesjohnson commented 4 years ago

OK, fixed for real. I believe the VASM change called "Reworked absolute ORG sections" is the culprit.

huguesjohnson commented 4 years ago

Last comment for real this time... after comparing syntax/mot/syntax.c in vasm 1.7 and 1.8 I figured out what changed in org handling. I'm not an expert on vasm internals but it appears the handle_org in 1.8 was changed in a way that causes it to ignore the first org statement it hits. This led to a ton of broken references in the code.