EASy68K  
It is currently Wed Oct 17, 2018 1:45 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sat May 21, 2011 3:18 am 
Offline

Joined: Thu May 12, 2011 11:58 am
Posts: 4
hello everyone!i am new to 68k assembly language. :oops:

i have a lab work that required us to print integer in multi-digit hexadecimal by passing parameters on the stack.and i have totally no idea how to do. :(

hope that someone can teach me thanks a lot C:


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 21, 2011 6:25 am 
Offline

Joined: Mon Jul 26, 2010 11:43 pm
Posts: 198
Location: Aurora, IL
Code:
CR      EQU     $0D
LF      EQU     $0A

        ORG     $1000
START:
        MOVE.L  #$CAFECAFE,-(A7)
        BSR     OUTHEX8
        ADDA.L  #4,A7

        MOVE.L  #$12345678,-(A7)
        BSR     OUTHEX8
        ADDA.L  #4,A7

        MOVE.L  #$9ABCDEF0,-(A7)
        BSR     OUTHEX8
        ADDA.L  #4,A7

        MOVE.W  #CR,-(A7)
        BSR     OUTCHAR
        ADDA.L  #2,A7

        MOVE.W  #LF,-(A7)
        BSR     OUTCHAR
        ADDA.L  #2,A7

        MOVE.B  #9,D0
        TRAP    #15

OUTHEX8 LINK    A6,#0
        MOVEM.L D0-D2,-(A7)
        MOVE.L  8(A6),D0
        MOVE.W  #8-1,D1
NXTDIG  ROL.L   #4,D0
        MOVE.L  D0,D2
        AND.L   #$0F,D2
        CMP.B   #10,D2
        BCS     UNDER10
        ADD.W   #$07,D2
UNDER10 ADD.W   #$30,D2
        MOVE.W  D2,-(A7)
        BSR     OUTCHAR
        ADDA.L  #2,A7
        DBRA    D1,NXTDIG
        MOVEM.L (A7)+,D0-D2
        UNLK    A6
        RTS

OUTCHAR LINK    A6,#0
        MOVEM.L D0-D1,-(A7)
        MOVE.W  8(A6),D1
        MOVE.B  #6,D0
        TRAP    #15
        MOVEM.L (A7)+,D0-D1
        UNLK    A6
        RTS

        END     START


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 21, 2011 1:33 pm 
Offline

Joined: Thu May 12, 2011 11:58 am
Posts: 4
thanks clive :D


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 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