Jump to content
  • entries
    4
  • comments
    2
  • views
    657

Day 3 (copied from status update on 7/26/2021)


RetroSonicHero

333 views

Well, now I've got some new instructions under my belt. It's still the really basic stuff mind you (add, sub, swap, clr, exg etc.), but now I've got a decent handle on what it's like to move memory around. Right now I'm trying to memorize the technicalities (like how you cannot move word or long-word sized data in and out of memory if the address is an odd number, as the 68k will crash with an "address error"), and tomorrow I'll probably dip my toes into bit-specific instructions such as not.

 

The tutorial I've been using online has little things at the end of each section to test your knowledge. Here's the last one I went through:

 

move.w    #$0010,d0       
move.w    d0,$00000040     
move.w    d0,d1            
add.w     d1,d1            
add.w     d0,d1            
sub.w     $00000040,d1     
swap      d1               
move.w    d0,d1            
movea.l   #$00000040,a4    
add.w     (a4),d1          
move.w    d1,(a4)          
exg.l     d1,d0            
swap      d0               
clr.w     d0               


Basically, each data register had the value of 00000000 to start with, and I needed to figure out what d0 contained after all of this information was processed.

 

Here's my work:
 

move.w    #$0010,d0        (d0 now has 00000010)
move.w    d0,$00000040     (offset 00000040 and 00000041 have byte 00 and 10 respectively)
move.w    d0,d1            (d1 now has 00000010)
add.w     d1,d1            (d1 now has 00000020)
add.w     d0,d1            (d1 now has 00000030)
sub.w     $00000040,d1     (d1 now has 00000020)
swap      d1               (d1 now has 20000000)
move.w    d0,d1            (d1 now has 20000010)
movea.l   #$00000040,a4    (a4 now has $00000040, #$00000010)
add.w     (a4),d1          (d1 now has 20000020)
move.w    d1,(a4)          (a4 now has $00000040, #$20000020)
exg.l     d1,d0            (d1 now has 000000010, d0 now has 20000020)
swap      d0               (d0 now has 00202000
clr.w     d0               (d0 now has 00200000)      

I came to the conclusion that d0 had 00200000 in memory, which was correct!

  • Like 1

2 Comments


Recommended Comments

That's quite impressive. As I said before, I look forward to what you make, be it on the Genesis/Mega Drive, Amiga, ST/TT/Falcon, Jaguar, or Neo Geo.

  • Like 1
Link to comment
4 hours ago, SlidellMan said:

That's quite impressive. As I said before, I look forward to what you make, be it on the Genesis/Mega Drive, Amiga, ST/TT/Falcon, Jaguar, or Neo Geo.

Thank you! I'll try to make something worthwhile. 

  • Thanks 1
Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...