EASy68K  
It is currently Thu Aug 22, 2019 8:56 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed Apr 24, 2019 2:10 am 
Offline

Joined: Wed Apr 24, 2019 1:30 am
Posts: 2
I'm using EASy68K to learn about homebrew on the Sega Mega Drive (Genesis). In this format, the game's header must begin at address $100, immediately following the interrupt vector table.

Initially, I simply used the ORG directive to ensure the header started at the correct position, e.g.:

Code:
    ORG $100
    DC.B    'SEGA MEGA DRIVE '  ; $100: System Name: trailing space to align on 16 bytes
    DC.B    '(C)2WG  2019.APR'  ; $110: Copyright/Date: empirically no space after (C)


However, looking at the list file, I realized I had mistakenly made the preceding vector table too short, and that there was a gap between the end of the table and the start of the game header, meaning I had missed some entries in the table.

So I felt the ORG shouldn't be used, and I should instead just have the assembly fail if the current position *isn't* what I specify.
Basically, I want to assert that the current position is an expected address.

I've tried using the various IF directives but haven't had success. For example:

Code:
    ORG $100                   
                           
IFEQ *-$100
    FAIL    "Genesis Header must start at $100"
ENDI


My goal is to use a construct similar to this and assemble without error, because the position is set to $100 by the ORG directive, so the current position (*) minus $100 should be equal to 0.
I would then remove the ORG directive, allowing the assertion code to actually check that the preceding content lines up with what I expect.

However, in this example, the assembler fails with the "Genesis Header must start at $100", even when the ORG directive is left in.

Is there a way to use the current position of the assembler in conditional comparisons like this?


Top
 Profile  
 
PostPosted: Fri May 03, 2019 1:55 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1101
Hmm, while looking into this I may have discovered a bug in conditional assembly. I'll try to look at the problem this weekend.

_________________
Prof. Kelly


Top
 Profile  
 
PostPosted: Mon May 06, 2019 9:13 am 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1101
My mistake, there is no error in EASy68K. The code to do what you want is something like this:
Code:
    ORG    $1000
START:
    dc.b 'stuff'
    ifne *-$1000
    FAIL "address not $1000"
    endc
    SIMHALT             ; halt simulator

    END    START        ; last line of source
ifne executes FAIL if the current location does not equal $1000.
endc is the last line of the conditional directive.

_________________
Prof. Kelly


Top
 Profile  
 
PostPosted: Sat Jun 01, 2019 4:41 pm 
Offline

Joined: Wed Apr 24, 2019 1:30 am
Posts: 2
Great, thanks. Sorry for the late response.


Top
 Profile  
 
PostPosted: Wed Jul 17, 2019 3:49 pm 
Offline
User avatar

Joined: Wed Jan 06, 2016 9:24 am
Posts: 14
Interesting stuff 2WaterGuns, as a fellow Megadrive programmer please keep us updated with your progress.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


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 post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group