19 April 2024, 09:22 | #1 |
Registered User
Join Date: Nov 2019
Location: Celle / Germany
Posts: 147
|
Do these 2 asm-routines do exactly the same thing?
Hi guys,
when investigating the old blitzbasic2 compiler source, I found these two routines. I guess they do absolutly the same, except the second one being a bit more "smart". Both routines are used! What it does it to copy the data from adress in A0 until A1 to a destination pointer that is handled by the routine "writeword". Do you see any possible difference in the output? pokecode1: Code:
.pokecode: ;a0= start of code, a1=end of code MOVE.w (A0)+,D1 BSR.w writeword 'loop CMPA.l A1,A0 BCC.w 'done MOVE.w (A0)+,D1 BSR.w writeword BRA.w 'loop 'done RTS Code:
.pokecode2: MOVE.w (A0)+,D1 BSR.w writeword CMPA.l A1,A0 BCS.w pokecode2 RTS Last edited by Honitos; 19 April 2024 at 22:42. |
19 April 2024, 09:49 | #2 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,386
|
no. BTW those routines don't take into account that A1 could be equal or below A0, which is a big problem as zero byte memory range would still do something.
|
19 April 2024, 10:23 | #3 |
Registered User
Join Date: Nov 2019
Location: Celle / Germany
Posts: 147
|
Thanks jotd,
I - respectively the original coder - was aware of this and refrained from checking A1 in that routine for speed reasons, I guess. |
19 April 2024, 18:39 | #4 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,696
|
Well, the code already spends a bsr per read word, which should be costly. The second one is slightly faster.
Minimal change to solve the 0 length issue JOTD points out would be Code:
.pokecode2: bra.b .pokecode2check .pokecode2L: MOVE.w (A0)+,D1 BSR.w writeword .pokecode2check: CMPA.l A1,A0 BCS.w pokecode2L RTS |
19 April 2024, 20:13 | #5 |
Registered User
Join Date: Apr 2021
Location: Kingston / UK
Posts: 105
|
I don't think I've ever used BCC BCS on 68000.
Tell me why I'm wrong. |
19 April 2024, 20:39 | #6 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,068
|
I prefer BHS/BLO aliases unless I'm explicitely checking the C flag (rarely). I find them more self-explanatory (= fewer comments needed), but it also requires more discipline because if you happen to switch to signed, in some cases it's not as trivial as HS/LO -> GE/LT because of the V flag that is part of the signed combo.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
ASM: Asm-ONE or AsmPro - how to set a Hello amiga coders, I hope it is ok to hijack ? | Fireball | Coders. Asm / Hardware | 8 | 31 May 2024 10:22 |
Help with CanDo routines | fstltna | support.Apps | 2 | 10 March 2023 19:18 |
Tool to convert asm to gnu asm (gas) | Asman | Coders. Asm / Hardware | 13 | 30 December 2020 11:57 |
decompression routines | Toni Wilen | Coders. General | 12 | 17 May 2017 00:30 |
Checksum routines in games | Joejoe | Coders. Tutorials | 11 | 26 December 2009 20:24 |
|
|