It is currently Sat May 25, 2013 8:24 pm

 All times are UTC

 Page 1 of 1 [ 4 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: ABCD Inconsistency in simulator (v5.12.5)Posted: Wed May 30, 2012 8:49 pm

Joined: Mon Mar 19, 2012 9:11 pm
Posts: 17
In a previous thread (see below) it was conjectured that when the 68000
bcd HW sees a nibble > 9 it converts it to bcd (0xa = 10) before using it
which was consistent with the easy68k simulator. So the following snip of
code yields d0 = 15
move.l #\$0000000f, d1
move.l #\$00000000, d0
abcd.b d1,d0

And this next snip of code yields d0=19
move.l #\$0000000f, d1
move.l #\$00000004, d0
abcd.b d1,d0

But this next snip of code yields d0=1a rather than d0=20
move.l #\$0000000f, d1
move.l #\$00000005, d0
abcd.b d1,d0

I can't test real HW so I don't what it does, but these simulator results
are not self-consistent. Does anybody know what 68000 silicon does?

thanks,
Aaron Boxer
Millogic

http://www.easy68k.com/EASy68Kforum/vie ... php?t=1090

Top

 Post subject: Posted: Thu May 31, 2012 6:28 pm

Joined: Mon Jul 26, 2010 11:43 pm
Posts: 192
Location: Aurora, IL
Code:
>SM 2000 720F 7000 C101
>DI 2000 3
00002000  720F                              moveq.l  #\$F,d1
00002002  7000                              moveq.l  #\$0,d0
00002004  C101                              abcd.b   d1,d0
>SB 2006
>GO 2000
..Running Real-Time with Breakpoints

!BREAK! - Breakpoint at 00002006
>DR
D0 = 00000015 D1 = 0000000F D2 = 00000000 D3 = 00000000
D4 = 00000000 D5 = 00000000 D6 = 00000000 D7 = 00000000
A0 = 00000000 A1 = 00000000 A2 = 00000000 A3 = 00000000
A4 = 00000000 A5 = 00000000 A6 = 00000000 A7 = 00002000
USP = A228BB9F SSP*= 00002000 PC = 00002006 SR = 2000

>SM 2000 720F 7004 C101
>DI 2000 3
00002000  720F                              moveq.l  #\$F,d1
00002002  7004                              moveq.l  #\$4,d0
00002004  C101                              abcd.b   d1,d0
>GO 2000
..Running Real-Time with Breakpoints

!BREAK! - Breakpoint at 00002006
>DR
D0 = 00000019 D1 = 0000000F D2 = 00000000 D3 = 00000000
D4 = 00000000 D5 = 00000000 D6 = 00000000 D7 = 00000000
A0 = 00000000 A1 = 00000000 A2 = 00000000 A3 = 00000000
A4 = 00000000 A5 = 00000000 A6 = 00000000 A7 = 00002000
USP = A228BB9F SSP*= 00002000 PC = 00002006 SR = 2000

>SM 2000 720F 7005 C101
>DI 2000 3
00002000  720F                              moveq.l  #\$F,d1
00002002  7005                              moveq.l  #\$5,d0
00002004  C101                              abcd.b   d1,d0
>GO 2000
..Running Real-Time with Breakpoints

!BREAK! - Breakpoint at 00002006
>DR
D0 = 0000001A D1 = 0000000F D2 = 00000000 D3 = 00000000
D4 = 00000000 D5 = 00000000 D6 = 00000000 D7 = 00000000
A0 = 00000000 A1 = 00000000 A2 = 00000000 A3 = 00000000
A4 = 00000000 A5 = 00000000 A6 = 00000000 A7 = 00002000
USP = A228BB9F SSP*= 00002000 PC = 00002006 SR = 2000

Top

 Post subject: Posted: Thu May 31, 2012 8:05 pm

Joined: Mon Jul 26, 2010 11:43 pm
Posts: 192
Location: Aurora, IL
Here a little BIST across all combinations, D4 =2970 on real HW

Code:
ORG     \$2000

START:  MOVE.L  #\$FFFF,D4 ; CRC
MOVE.L  #\$FFFF,D2 ; Vector Length
MAIN:   MOVE.W  D2,D0
MOVE.W  D2,D1
ROR.W   #8,D1
ABCD.B  D1,D0
BSR     CRC16
DBRA    D2,MAIN

; Here D4 = 2970 on Real HW

MOVE.B  #9,D0
TRAP    #15             ; halt simulator

CRC16   ROL.W   #8,D0
CLR.B   D0
EOR.W   D0,D4
MOVEQ.L #7,D5
CRC_10  ROL.W   #1,D4
BCC     CRC_20
EOR.W   #\$1020,D4 ; 0x1021 ^ 0x0001
CRC_20  DBRA    D5, CRC_10
RTS

END     START

Code:
>DI 2000 19
00002000  283C0000FFFF                      move.l   #\$FFFF,d4
00002006  243C0000FFFF                      move.l   #\$FFFF,d2
0000200C  3002                              move.w   d2,d0
0000200E  3202                              move.w   d2,d1
00002010  E059                              ror.w    #\$8,d1
00002012  C101                              abcd.b   d1,d0
00002014  6100000C                          bsr.w    \$2022
00002018  51CAFFF2                          dbf      d2,\$200C
0000201C  103C0009                          move.b   #\$9,d0
00002020  4E4F                              trap     #\$F
00002022  E158                              rol.w    #\$8,d0
00002024  4200                              clr.b    d0
00002026  B144                              eor.w    d0,d4
00002028  7A07                              moveq.l  #\$7,d5
0000202A  E35C                              rol.w    #\$1,d4
0000202C  64000006                          bcc.w    \$2034
00002030  0A441020                          eori.w   #\$1020,d4
00002034  51CDFFF4                          dbf      d5,\$202A
00002038  4E75                              rts
>SB 201C
>GO 2000
..Running Real-Time with Breakpoints

!BREAK! - Breakpoint at 0000201C
>DR
D0 = 00000000 D1 = 00000000 D2 = 0000FFFF D3 = 00000000
D4 = 00002970 D5 = 0000FFFF D6 = 00000000 D7 = 00000000
A0 = 00000000 A1 = 00000000 A2 = 00000000 A3 = 00000000
A4 = 00000000 A5 = 00000000 A6 = 00000000 A7 = 00002000
USP = A228BB9F SSP*= 00002000 PC = 0000201C SR = 2000

Top

 Post subject: Posted: Fri Jun 01, 2012 1:03 pm

Joined: Mon Mar 19, 2012 9:11 pm
Posts: 17
Ah, I' guess the 68000 specs should say that the BCD arithmetic instructions produce undefined outputs for out-of-range inputs.

Thanks for checking the HW

Aaron Boxer
Millogic

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 4 posts ]

 All times are UTC

#### Who is online

Users browsing this forum: No registered users and 1 guest

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

Search for:
 Jump to:  Select a forum ------------------ EASy68K Forum    FAQ    Latest Features    EASy68K Questions    68000 Programming Questions    Wish List    Wishes Granted    Undocumented Features    Documented Features    General Discussion    EASy68K Projects