EASy68K  
It is currently Thu Dec 05, 2019 5:33 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Mon Oct 28, 2019 1:44 am 
Offline

Joined: Sat May 03, 2008 7:32 pm
Posts: 3
Location: Washington State, USA
Doc bug
On the doc page titled "Effective Addressing," under Jimmy Mandell's 68000 Reference Guide, the example under item 11 (Program Counter with Index) has a typo. In the syntax block it describes 'x' as the displacement byte, but the example shows
Code:
MOVE.L $1010(PC, A1.L), DO


The explanation assumes that both the current PC value and A1 are $1000, and says that the calculated address is PC + A1 + $10 = $2010. This is at odds with the displacement "byte" being $1010, so I think whoever made the example accidentally typed 10 twice instead of once.

Assembler bug?
If I assume that the instruction above is actually MOVE.L $10(PC, A1.L) D0, I can't for the life of me find some combination that doesn't produce a syntax error of one sort or another.
What I've tried:
MOVE.L #$10(PC,A0.L),D0 -- syntax error
MOVE.L $10(PC,A0.L),D0 -- displacement out of range
MOVE.L 10(PC, A0.L),D0 -- displacement out of range

From a PDF from a university in Milan, Italy, I found some code that is doing what the docs are describing.
Code:
START   ORG $1000
    JMP TABLE_END
TABLE: DC.B $20
           DC.B $32
           DC.B $64
TABLE_END:
    MOVE #0,A0                 * use A0 as index register
    MOVE.B TABLE(A0),D0   * read TABLE[0] into D0
    ADD #1,A0                   * use A0 as index register
    MOVE.B TABLE(A0),D1  * read TABLE[1] into D1
    STOP #$2000
    END START


Is the code in Example 11 of the doc page something that you can actually run, or am I doing something wrong?
Thanks in advance.


Top
 Profile  
 
PostPosted: Sat Nov 09, 2019 1:07 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1107
The assembler calculates the displacement byte (x) relative to the current program counter location.

Code:
00001000 Starting Address
Assembler used: EASy68K Editor/Assembler v5.16.01
Created On: 11/9/2019 8:06:10 AM

00000000                             1  *-----------------------------------------------------------
00000000                             2  * Title      :
00000000                             3  * Written by :
00000000                             4  * Date       :
00000000                             5  * Description:
00000000                             6  *-----------------------------------------------------------
00001000                             7      ORG    $1000
00001000                             8  START:                  ; first instruction of program
00001000  203B 980E                  9      MOVE.L  $1010(PC,A1.L),D0
00001004  4E71                      10      NOP
00001006                            11     
00001006                            12  * Put program code here
00001006                            13 
00001006  FFFF FFFF                 14      SIMHALT             ; halt simulator
0000100A                            15 
00001010                            16      ORG     $1010
00001010                            17  * Put variables and constants here
00001010= 12345678                  18  table   dc.l    $12345678
00001014                            19         
00001014                            20      END    START        ; last line of source

No errors detected
No warnings generated

_________________
Prof. Kelly


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group