WTD : Well commented ASM6800x sources

Anything QL Software or Programming Related.
User avatar
Zarchos
Over Heated PSU
Posts: 143
Joined: Mon May 08, 2017 11:49 am

WTD : Well commented ASM6800x sources

Postby Zarchos » Sat Dec 16, 2017 8:59 am

Hi all.

I am looking for what the above details.
Be it string manipulations, graphics algo 2D or 3D, as long as it is very well commented.
I am a newbie to the 68000 assembly language, and let's be frank, I will save a lot of time to be familiar with this CPU with some very well commented source codes.
For the QL, of course.

Interfacing with Super BASIC too (meaning : I am able to load some assembled code from BASIC, then call asm code from BASIC, and return some results to use them in BASIC) ;
interrupts handling too.

Thanks in advance,
Xavier.

PS : I have started reading books ('Machine code programming on the Sinclair QL' is one of them, and I find it very good), but as you know, in most books there is too much about what is a computer, what is assembly language and so on.
Thanks but I know all this, I want to go into code, not into university litteracy, and background knowledge : well optimised algos coded in assembly on the QL is what I want to see now.
PS2 : Which assembler is best to use on the Q68 ?
Can it handle complex macros ?
Is it possible to redefine opcodes to have destination, source ... I am a bit confused with the way the 68000 works compared to what I am used too.
I'd like to redefine the ordering as I know it is where I am going to make too many errors.


Owner of various QLs including accelerated beasts, and also a happy Q68 owner ;)
User avatar
tofro
QL Wafer Drive
Posts: 1247
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: WTD : Well commented ASM6800x sources

Postby tofro » Sat Dec 16, 2017 9:39 am

Zarchos wrote:Hi all.

I am looking for what the above details.
Be it string manipulations, graphics algo 2D or 3D, as long as it is very well commented.
I am a newbie to the 68000 assembly language, and let's be frank, I will save a lot of time to be familiar with this CPU with some very well commented source codes.
For the QL, of course.

Interfacing with Super BASIC too (meaning : I am able to load some assembled code from BASIC, then call asm code from BASIC, and return some results to use them in BASIC) ;
interrupts handling too.

Thanks in advance,
Xavier.

PS : I have started reading books ('Machine code programming on the Sinclair QL' is one of them, and I find it very good), but as you know, in most books there is too much about what is a computer, what is assembly language and so on.
Thanks but I know all this, I want to go into code, not into university litteracy, and background knowledge : well optimised algos coded in assembly on the QL is what I want to see now.


You might want to have a look at the Minerva (QL OS replacement) source codes which are a bit of a masterpiece of 68k programming in terms of code density and performance optimization. Not extensively commented, but well commented. Should be available here: http://www.dilwyn.me.uk/qlrom/m198src.zip

Reading through this stuff will also help you understanding the system a bit better.

Zarchos wrote:PS2 : Which assembler is best to use on the Q68 ?
Can it handle complex macros ?
Is it possible to redefine opcodes to have destination, source ... I am a bit confused with the way the 68000 works compared to what I am used too.
I'd like to redefine the ordering as I know it is where I am going to make too many errors.


With regards to assemblers, there's two that leave nearly nothing to be desired: George Gwilt's gwasm and the Quanta/GST Macro assembler. Both have about the same features, the former supports (and runs only) on at least a 68020 CPU (but can produce pure 68000 code), so maybe not so suitable for the Q68. The GST assembler has some more features when it comes to producing linkable code. Complex macro programming is possible with both. I tend to use GST for this reason. What you definitely want to have is extend it with some utilities from the C68 package (even if you don't want to program in C), as this supplies you with a powerful standard make and some other tools.

With regards to redefining operand order: Would you rather un-confuse yourself (1 person) and confuse everyone else (many persons) or simply get used to a logical and straightforward left-to-right order that seems to work everywhere except in Arabic? 8-)

Tobias


User avatar
Zarchos
Over Heated PSU
Posts: 143
Joined: Mon May 08, 2017 11:49 am

Re: WTD : Well commented ASM6800x sources

Postby Zarchos » Sat Dec 16, 2017 9:52 am

Thanks for your help Tobias.

For your last remark, it is only a matter of parsing my source code (where destination will always be 1st, which to me is the logical way of writing.
Do you write, in everyday life
C= A + B
or
A + B -> C
?)

;-)

with a small utility (I guess not more than 100 lines in BASIC) before sending it to people for review, so that they get it in the 'normal' 68000 order (Which, to me, is not
the 'logical and straightforward left-to-right order' for maths. In maths, left is always destination result, and never ever source).
I agree if you understand MOVE as moving something from one place to another one, then yes it makes sense.
If you read it like for maths, where it becomes something like SET, or LET, it is different.

I will utimately aadopt the Motorola order, but I know I will need some time, and I know very well it will generate too many errors for me as a newbie.


Owner of various QLs including accelerated beasts, and also a happy Q68 owner ;)
User avatar
tofro
QL Wafer Drive
Posts: 1247
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: WTD : Well commented ASM6800x sources

Postby tofro » Sat Dec 16, 2017 10:16 am

I'm actually not even willing to discuss this, as I find it ridiculous, but:

I am writing assembler programs for the m68k and the Z80 occasionally and don't see any problems therein that

"Load x with y" (LD A,(BC) has a clear right-to-left order and
"Move x to y" (MOVE.W (a7)+,d0) an obvious left-to-right movement.

And also see no problems whatsoever in changing between the CPUs and the models on the fly.

Both are easy to memorize and intuition always helps me. Turning around the latter to "move.w d0,(a7)+" is entirely confusing because it's entirely against any expectation and ends up with something like the completely messed-up opcodes of the Intel 8080 (which did the same by "MVI target,source" and soon died out in favor of the more logical Z80 mnemonics).

Better start adapting to that now than adopt some ridiculous habit isolating your code from everything else.

Tobias


User avatar
Zarchos
Over Heated PSU
Posts: 143
Joined: Mon May 08, 2017 11:49 am

Re: WTD : Well commented ASM6800x sources

Postby Zarchos » Sat Dec 16, 2017 10:47 am

I come from the ARM world.
I am not a computer scientist. (Carrier made in real estate : use 5% of your brain it will be enough).
I am 44. Plasticity of brain isn't the same, unfortunately.
Please just understand easing things, for me, at the beginning, as a transition, is what will best suit my needs, before I manage to adapt my brain to some times thinking the ARM way, and some times the 68000 way.
It is as simple as that.
I don't say I am right, I just say I know myself well enough ; in no case I want to impose my views to others.
Please just, simply agree to do the same.
Peace (and love).


Owner of various QLs including accelerated beasts, and also a happy Q68 owner ;)
User avatar
pjw
Trump Card
Posts: 246
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway

Re: WTD : Well commented ASM6800x sources

Postby pjw » Sat Dec 16, 2017 11:01 am

While I agree with Tobias that the Minerva sources are an excellent guide to QL assembler, one should not forget the SMSQ/E sources, available here: http://www.wlenerz.com/smsqe/, which also contain all the stuff (assembler, linker, etc) you need to get going. I recommend you download the WIN container file. As youre just starting out with MC68 assembler, you may find this Editor/Simulator/Assembler useful too: http://www.easy68k.com/index.html. While not QL-specific, it allows you to easily watch your code in action..


Per
Assumptions should only be a first resort when the cost of being wrong is less than the trouble of finding out the facts! - pjw, 2016
User avatar
Zarchos
Over Heated PSU
Posts: 143
Joined: Mon May 08, 2017 11:49 am

Re: WTD : Well commented ASM6800x sources

Postby Zarchos » Sat Dec 16, 2017 11:38 am

Thanks all.
That will help me a lot, for sure.


Owner of various QLs including accelerated beasts, and also a happy Q68 owner ;)
User avatar
NormanDunbar
Gold Card
Posts: 335
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: WTD : Well commented ASM6800x sources

Postby NormanDunbar » Sat Dec 16, 2017 6:21 pm

Plenty well commented mc6800x code in my book at http://qdosmsq.dunbar-it.co.uk/download ... sembly.pdf if you want it. Chapters on extending SuperBASIC too.

Cheers,
Norm.


Why do they put lightning conductors on churches?
How come Tarzan never grew a beard?
User avatar
tofro
QL Wafer Drive
Posts: 1247
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: WTD : Well commented ASM6800x sources

Postby tofro » Sat Dec 16, 2017 6:39 pm

Right, nearly forgot to mention your excellent work!

Thanks again, Norman.

Tobias



Return to “Software & Programming”

Who is online

Users browsing this forum: No registered users and 3 guests