refactored the disassembler. :) #18

Merged
merged 8 commits into from Apr 27, 2012

Projects

None yet

2 participants

@robey
robey commented Apr 26, 2012

No description provided.

Owner
deNULL commented Apr 26, 2012

The disassembler seems to work worse than it was working before...

For example, the disassembler should be able to parse this code:

8b82 
7c61 
7c61 8000 
8b83

Into this:

ADD PC, 1
DAT 0x7c61
SET X, 0x8000
SUB PC, 1

But your version produces

ADD PC, 1
SET X, 0x7c61
??? -1
SUB PC, 1

(i.e. it doesn't understand that after ADD PC, 1 there is an unreachable word and thus it must be treated as DAT until the next reachable block will be found)

robey commented Apr 26, 2012

oops, sorry, missed your comment last night.

hmm. i see. one fix might be to notice if an opcode is crossing into a target, and stop (just display DAT) in that case. i'll try that.

robey commented Apr 26, 2012

ok, it now disassembles to:

0000:   BRA label0
0001:   DAT 0x7c61
      :label0
0002:   SET X, 0x8000
      :label1
0004:   BRA label1
@deNULL deNULL merged commit d8af46a into deNULL:master Apr 27, 2012
Owner
deNULL commented Apr 27, 2012

Still wasn't totally happy with your way of disassembling code... Restored much of the refactored code to its initial state.

The idea is to disassemble only the chunks of code that are actually could be accessible (based on jumps, jsr's, ias'es and other manipulations on PC). Source code shouldn't be used at all (or else disassembler will be totally useless in case of self-modifying code or for disassembling someone else's binaries).

robey commented Apr 27, 2012

i'll work on this more on a branch. i think i see what the intent was, now, and why it wasn't working for me.

i think it would be cool if the disassembly was automatic -- you didn't need the button. as you edit in the assembler, it compiles all the time, then when you go to the disassembly tab, it disassembles whatever is in memory, and you can edit the memory, changing the disassembly.

it's kinda like the memory dump should be a 3rd tab, and be editable.

i'm trying to get the html/css bootstrapped, so maybe i'll fiddle with that too.

Owner
deNULL commented Apr 27, 2012

The problem with disassembling current memory is, it's too much work to do (for the disassembler). For example, I don't want to display all memory dump in one large textarea (and disassemble every word of it) - it'll make page too heavy.

And I already have an image of the new page layout in my mind - please keep that in mind when you'll make any serious changes to the interface.

robey commented Apr 27, 2012

i'll post a merge request that splits out the html, css, and ui js so that it's at least easier to hack on the ui incrementally.

i didn't get bootstrap finished yet, but it keeps your design, just using bootstrap divs instead of manual layout. you can see what it looks like (but doesn't scroll right) here: http://www.lag.net/dcpu/play.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment