WTF asm68k?

Talk about development tools here

Moderator: BigEvilCorporation

Post Reply
User avatar
Sik
Very interested
Posts: 712
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

WTF asm68k?

Post by Sik » Sun Jun 26, 2016 9:59 pm

I typo'd something in my source code (as usual) and accidentally got this to build:

Code: Select all

    lsl.w   d7
It seemed to behave the same as this:

Code: Select all

    lsl.w   #1, d7
WTF? Is this some obscure syntax I wasn't aware of or just a bug in asm68k?
Sik is pronounced as "seek", not as "sick".

User avatar
BigEvilCorporation
Very interested
Posts: 202
Joined: Sat Sep 08, 2012 10:41 am
Contact:

Re: WTF asm68k?

Post by BigEvilCorporation » Tue Jun 28, 2016 3:40 pm

Valid:
Syntax:
LSL Dx,Dy
LSR Dx,Dy
LSL #<data>,Dy
LSR #<data>,Dy
LSL <ea>
LSR <ea>


Attributes: Size = byte, word, longword
Description: Logically shift the bits of the operand in the specified direction (i.e., left or right). A zero is shifted into the input position and the bit shifted out is copied into both the C- and the X-bit of the CCR. The shift count may be specified in one of three ways. The count may be a literal, the contents of a data register, or the value 1. An immediate count permits a shift of 1 to 8 places. If the count is in a register, the value is modulo 64 — from 0 to 63. If no count is specified, one shift is made (e.g., LSL <ea> shifts the word at the effective address one position left).
Doesn't make for very readable code, though :(
A blog of my Megadrive programming adventures: http://www.bigevilcorporation.co.uk

User avatar
Sik
Very interested
Posts: 712
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: WTF asm68k?

Post by Sik » Wed Jun 29, 2016 5:48 am

Well, good to know.

Caught this because I wrote lsl.w d7 when I meant lsl.w #3, d7... luckily it was just a string array so it was offseting in steps of two characters instead of eight instead of crashing (which made this easier to tell apart) but that caught me off guard. Normally typos result in an assembly error instead >=/
Sik is pronounced as "seek", not as "sick".

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests