It is currently Fri Sep 21, 2018 1:38 am

All times are UTC - 7 hours



Forum rules





Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Multiplication registers
PostPosted: Thu Apr 26, 2018 12:08 am 
Offline

Joined: Tue Feb 07, 2017 2:03 am
Posts: 579
Do the 420X registers only latch on the B param?
So if you set 4202 before 4203, it does not interfere with any ongoing multiplication?

Code:
00/85B7 E2 10       mull_16_16_32result              sep #$10 ;x,y 8 bit
00/85B9 A4 00                                        ldy j7E0000
00/85BB 8C 02 42                                     sty MultiplecandA
00/85BE A4 02                                        ldy a7E0002
00/85C0 8C 03 42                                     sty MultiplierB ;0*2  <start multiply
00/85C3 A4 01                                        ldy p7E0001
00/85C5 8C 02 42                                     sty MultiplecandA  < modifies before 7 clocks??
00/85C8 A4 03                                        ldy p7E0003
00/85CA AD 16 42                                     lda ProdRemainLo  < reads result
00/85CD 8C 03 42                                     sty MultiplierB ;1*3 < does this then latch both A and B and start the multiplication?
00/85D0 85 04                                        sta p7E0004 ;result 0*2
00/85D2 A4 02                                        ldy a7E0002
00/85D4 EA                                           nop 
00/85D5 AD 16 42                                     lda ProdRemainLo
00/85D8 8C 03 42                                     sty MultiplierB ;1*2
00/85DB 85 06                                        sta p7E0006 ;result 1*3
00/85DD A6 07                                        ldx p7E0007
00/85DF A5 05                                        lda p7E0005
00/85E1 18                                           clc 
00/85E2 6D 16 42                                     adc ProdRemainLo
00/85E5 85 05                                        sta p7E0005 ;5 += 1*2
00/85E7 90 01                                        bcc b0085EA
00/85E9 E8                                           inx 
00/85EA A4 00       b0085EA                          ldy j7E0000
00/85EC 8C 02 42                                     sty MultiplecandA
00/85EF A4 03                                        ldy p7E0003
00/85F1 8C 03 42                                     sty MultiplierB ;1*3
00/85F4 EA                                           nop 
00/85F5 A5 05                                        lda p7E0005
00/85F7 18                                           clc 
00/85F8 6D 16 42                                     adc ProdRemainLo ;5+=1*3
00/85FB 85 05                                        sta p7E0005
00/85FD 90 01                                        bcc b008600
00/85FF E8                                           inx 
00/8600 86 07       b008600                          stx p7E0007
00/8602 C2 10                                        rep #$10 ;x,y 16 bit
00/8604 60                                           rts 


Top
 Profile  
 
PostPosted: Thu Apr 26, 2018 12:30 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3600
Location: Mountain View, CA
Correct -- the multiplication process will start once a write to $4203 (multiplier MMIO register) happens. Multiplicand ($4202) can be changed while there's an existing multiplication operation happening ("A-REGISTER" means "MULTIPLICAND - A" = $4202).

While here: for division registers, the process will begin once a write to $4206 (divisor MMIO register) happens.

Attaching documentation confirming both statements; see bullet items for all of this, including for how many CPU cycles you must wait for a result.

(2018/08/29 Edit: attachments removed.)


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: Google [Bot] and 4 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