Author Topic: is there any trick to port easy68k assembly to gnu assembly/68k ?  (Read 4511 times)

0 Members and 1 Guest are viewing this topic.

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
hi guys
i like EhBasic-68K (1), unfortunately its site seems down, so i have got sources and stored them into a repo

Quote
git clone https://carlojpisani@code.google.com/p/m68k-basic/

i'd like to port these sources to gnu assembler m68k, they seem written in Easy68K assembly, so any trick to simplify the porting-task ?


(1) Copyright by Lee Davison 2002 - 2012, for educational purpose only
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4192
  • Country: us
Re: is there any trick to port easy68k assembly to gnu assembly/68k ?
« Reply #1 on: January 17, 2015, 01:43:55 am »
Probably not.  My general experience with translating code from one assembler to another, or from c to assembler (.h files to assembler equivalents) is that you can get pretty far, pretty fast, with an editor that has keyboard macros or some basic programability.   put colons after the labels, change the .equ-like statement formats, etc.

I use this as my basic 68k gas reference: http://tigcc.ticalc.org/doc/gnuasm.html
Fortunately, it doesn't look like the code is using the "advanced" features of Easy68k...
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4192
  • Country: us
Re: is there any trick to port easy68k assembly to gnu assembly/68k ?
« Reply #2 on: January 17, 2015, 07:01:06 am »
Hmm.  Your code is significantly different than http://www.easy68k.com/applications.htm (the original source?)

Is this really open source code from somewhere, or reverse-engineered source from questionable sources?
I mean, it's got comments and stuff, but it's also got ridiculous label names that look like they're from a disassembler:
Code: [Select]
LAB_15F6
BSR LAB_GBYT * get BASIC byte
BSR.s LAB_15FF * go interpret BASIC code from (a5)

* interpreter inner loop (re)entry point

LAB_15C2
BSR.s LAB_1629 * do CRTL-C check vector
TST.b Clinel(a3) * test current line #, is -ve for immediate mode
BMI.s LAB_15D1 * branch if immediate mode

MOVE.l a5,Cpntrl(a3) * save BASIC execute pointer as continue pointer
LAB_15D1
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4192
  • Country: us
Re: is there any trick to port easy68k assembly to gnu assembly/68k ?
« Reply #3 on: January 17, 2015, 09:05:39 am »
(it's REALLY annoying, isn't it?   Gnu got lazy on their argument parsing, and does ALL the addressing modes differently.
("-(sp)" becomes "%sp@-", for example.)  Lazy programmers :-( )

So.  the --mri switch helps A LOT.  Takes things from 10k+ of errors to less than a page worth.  It seems to still have some problems with "moveq" values and sign extension:
Code: [Select]
  moveq #$80, d1          ; error
  moveq #$FFFFFF80, d1 ; ok
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: is there any trick to port easy68k assembly to gnu assembly/68k ?
« Reply #4 on: January 17, 2015, 10:17:25 am »
Is this really open source code from somewhere, or reverse-engineered source from questionable sources?

i don't know  :-//

the author's site is down,  i have found this forum in where he was writing, but he is away, it's impossible to contact him by PM, or by email, so i asked around for sources and i was given with what i have simply pulled into a git repo in order to be useful for guys who are looking for such a sources, too
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: is there any trick to port easy68k assembly to gnu assembly/68k ?
« Reply #5 on: January 17, 2015, 10:19:52 am »
i was also looking at the v-asm project, it is an open source assembler that accepts the 68k motorola syntax. It seems better than gas/68k.

wandering if to use v-asm, or if to spend time trying to adapt sources to gas/68k  :palm:
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8232
Re: is there any trick to port easy68k assembly to gnu assembly/68k ?
« Reply #6 on: January 17, 2015, 04:55:26 pm »
In the x86 world we have the same problem - the GNU people thought making a totally different syntax from the official documentation was somehow a good idea...
http://x86asm.net/articles/what-i-dislike-about-gas/

For 68k I found this:
https://www.jankratochvil.net/project/mot2as/

But I agree that the best way forward is to use a different assembler that accepts the official syntax.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4192
  • Country: us
Re: is there any trick to port easy68k assembly to gnu assembly/68k ?
« Reply #7 on: January 17, 2015, 09:32:17 pm »
do try the "--mri" switch; it's like a whole different assembler.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf