Author Topic: 68K ASM Help  (Read 14570 times)

0 Members and 1 Guest are viewing this topic.

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: 68K ASM Help
« Reply #15 on: January 31, 2012, 07:55:07 am »
While we've got you here, do you know of any good books for learning m68k asm, in French or English?

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: 68K ASM Help
« Reply #16 on: January 31, 2012, 08:17:30 am »
I don't know of any books besides the reference manual (M68000PRM) and user manual (68000UM or equivalent).
I take it that you're looking for information which is neither in TI-68k tutorials, nor in GCC4TI's documentation, nor in the reference manuals... but what type of information is it ? :)

In the sibling topic at Cemetech ( http://cemetech.net/forum/viewtopic.php?t=7249 ), I linked to GoldenCrystal's (from yAronet) a quick reference card for the 68000 opcodes: http://bit.ly/M68kOpcodes .
« Last Edit: January 31, 2012, 08:17:48 am by Lionel Debroux »
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: 68K ASM Help
« Reply #17 on: January 31, 2012, 08:25:46 am »
I have TI-Emu and TIGCC, but they seemed to cause some conflicts with a few other programs (Wabbit seemed to get buggy, but that may have been fixed). TIGCC has an issue where if I get any warnings or errors, it uses up all of my system resources available (so it makes my computer lag), and I have to press F10 about 5 times and click okay for each pop up error :/ And if I click outside the IDE, it does this too.

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: 68K ASM Help
« Reply #18 on: January 31, 2012, 08:29:20 am »
Which OS (flavor and version) is your computer running ?
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: 68K ASM Help
« Reply #19 on: January 31, 2012, 08:31:55 am »
Windows 7 (64-bit)

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: 68K ASM Help
« Reply #20 on: January 31, 2012, 08:37:52 am »
There haven't been many changes in the IDE, but well, as the maintainer of GCC4TI, I can only suggest switching to GCC4TI, instead of sticking to the unmaintained 5-year-old TIGCC ;)
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: 68K ASM Help
« Reply #21 on: January 31, 2012, 08:38:43 am »
Yes, I have now downloaded GCC4TI :) Thanks!

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: 68K ASM Help
« Reply #22 on: January 31, 2012, 08:51:02 am »
I mean books that introduce you to good programming practices for 68k asm, for the z80 there are tons (http://www.z80.info/z80books.htm), it seems that the 68k isn't quite as accessible as the z80.

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: 68K ASM Help
« Reply #23 on: January 31, 2012, 09:03:48 am »
Does "good programming practices", in your mind, encompass optimization tips and tricks ?
I'm asking because optimization isn't necessarily considered good practice, as it has / can have negative impact on portability, maintainability, reusability, etc. :)
« Last Edit: January 31, 2012, 09:04:49 am by Lionel Debroux »
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: 68K ASM Help
« Reply #24 on: January 31, 2012, 09:16:12 am »
Basically how to program/organize your code, an introduction to programming under the 68k, like the tutorials but more in-depth/more complete. Anyway, it's not a big deal, i'll play with what i've got, check out the documentation/source i can find, and see where to go from there :)

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: 68K ASM Help
« Reply #25 on: January 31, 2012, 09:34:25 am »
Quote
Basically how to program/organize your code (snip) like the tutorials but more in-depth/more complete
For this part, software engineering books focusing on C programming (therefore, probably old books, as newer books tend to focus on C++ or Java) may do the job. I believe that the 68000 ASM was designed with C programming in mind. For instance, instructions such as lea and pea, or the fact that mem |= operand, mem &= operand , mem ^= operand can often be translated to a single instruction.

Software engineering books can contain advice such as, but not limited to:
* limiting the size of functions to one/several screens: in ASM, one line contains much less information than in C, so functions can become large monsters even more easily;
* splitting the code across multiple source files (grouped by family of functions, etc.): 4000-line source files are bad, I can tell you :D
* inlining trivial computations unless it blows size up too much.


There are few higher-level constructs usable in pure ASM, but one which really should be used, if applicable, are macros. Failing to do so, even in the presence of multiple files which share some common code, increases bugginess and reduces maintainability (due to copy, paste and forget to modify all occurrences) - that's a real problem with ExtGraph :)
« Last Edit: January 31, 2012, 09:38:16 am by Lionel Debroux »
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: 68K ASM Help
« Reply #26 on: February 01, 2012, 06:24:53 pm »
I've been playing a little with 68k assembly and to be honest i like the A68k format better than the GNU one (it reminds me more of z80, i don't need to precede registers with %, hex numbers start with $, etc.). What are the reasons for using the GNU one? I remember reading in the GCC4TI documentation that the A68k assembler was included just for compatibility...

EDIT: Also, for the A68k i see the "dc.b" directive to insert bytes into the program (like dc.b "Hello World",0). The GNU assembler has the .string directive, which i think automatically adds a 0 to the end. Is there another way to insert a string of characters? What if i don't want the string to end in a 0? The .byte directive doesn't seem to like the string format. Thanks again!

EDIT2: Found this: http://tigcc.ticalc.org/doc/gnuasm.html#SEC67 :)

EDIT3: Another question:
Is there a difference between "movea.l 4*ClrScr(%a5),%a0" and "move.l 4*ClrScr(%a5),%a0"? Or does the assembler simply convert the move.l into a movea.l?
« Last Edit: February 01, 2012, 07:40:22 pm by chickendude »

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: 68K ASM Help
« Reply #27 on: February 02, 2012, 01:30:47 am »
A68k has quite a few bugs, such as trying to do something (wrong) with the invalid "moveq.w"; and its output format is AmigaOS object files, which are not supported by the BFD (foundation of GNU binutils). This is one of the reasons why TIGCC/GCC4TI have a specific linker.
For GNU as to accept a syntax closer to that of A68k, try the --register-prefix-optional and --mri-compat switches :)

For strings in GNU as, there's .ascii and .asciiz, indeed.

IIRC / AFAICT, move and movea are the same instruction, see the 68000 Programmers Reference Manual and the quick cheat sheet at http://bit.ly/M68kOpcodes :)
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: 68K ASM Help
« Reply #28 on: February 02, 2012, 06:38:05 am »
The --register-prefix-optional switch works great, but the --mri-compat switch isn't recognized. Ah! It looks like it's just --mri. Thanks :)