![]() |
|
|||||||
| Register | >> Amiga FAQ/Wiki << | Rules & Help | Members List / Moderators List | Search | Today's Posts | Mark Forums Read |
![]() |
|
|
Thread Tools |
|
|
#81 |
|
is long gone
Join Date: Apr 2007
Location: London
Posts: 1,590
|
Yes of course. Swapping adds for the lsl's is faster - in fact, I'd already mentioned that earlier in this thread
![]() |
|
|
|
|
|
#82 |
|
Registered User
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 216
|
|
|
|
|
|
|
#83 |
|
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 4,547
|
This will surely not corrupt the stack! Check the 68k manual to see why. It's an old trick to save a few cycles.
__________________
Makes me sick when I hear all the shit that you say So much crap coming out, it must take you all day There's a space kept in hell with your name on the seat With a spike in the chair just to make it complete |
|
|
|
|
|
#84 | |
|
Registered User
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 216
|
Quote:
![]() |
|
|
|
|
|
|
#85 | |
|
is long gone
Join Date: Apr 2007
Location: London
Posts: 1,590
|
Yes, as Sting says, on 68000 the stack always "auto aligns" to a word boundary when a byte is pushed on.
Quote:
![]() |
|
|
|
|
|
|
#86 |
|
Registered User
Join Date: Jun 2008
Location: Glasgow/Scotland
Posts: 209
|
|
|
|
|
|
|
#87 |
|
Registered User
Join Date: May 2011
Location: Cambridge
Posts: 86
|
|
|
|
|
|
|
#88 |
|
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 4,547
|
doesn't put garbage in the lower part of d0, it will be cleared.
see toni's reply.
__________________
Makes me sick when I hear all the shit that you say So much crap coming out, it must take you all day There's a space kept in hell with your name on the seat With a spike in the chair just to make it complete Last edited by StingRay; 16 July 2012 at 20:44. |
|
|
|
|
|
#89 |
|
is long gone
Join Date: Apr 2007
Location: London
Posts: 1,590
|
Kaffer: to get the answer to your question you should try running this kind of stuff in a debugger and watching the registers. You'll see the results and learn stuff directly
![]() |
|
|
|
|
|
#90 |
|
Registered User
Join Date: May 2011
Location: Cambridge
Posts: 86
|
Well I'm running in E-UAE on Linux and it doesn't clear the low byte. Nor do a couple of other emulators I've pulled source for. So to confirm it I'd need to dust down my Amiga. I'm interested for my own emulator is all...
Last edited by kaffer; 16 July 2012 at 21:24. |
|
|
|
|
|
#91 |
|
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 38
Posts: 11,944
|
No, it isn't cleared. EDIT: tested on real A500. EDIT2: 68060 tested: does not clear either.
Last edited by Toni Wilen; 16 July 2012 at 20:28. |
|
|
|
|
|
#92 |
|
Registered User
Join Date: May 2011
Location: Cambridge
Posts: 86
|
|
|
|
|
|
|
#93 |
|
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 4,547
|
I checked on my A4000 long ago and it was always cleared. Time to dig deeper I guess.
![]() Edit: checked again, lower byte is indeed not cleared. So apparently I I remembered it wrong.
__________________
Makes me sick when I hear all the shit that you say So much crap coming out, it must take you all day There's a space kept in hell with your name on the seat With a spike in the chair just to make it complete Last edited by StingRay; 16 July 2012 at 20:43. |
|
|
|
|
|
#94 |
|
Registered User
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 216
|
sounds reasonable since all that happens is that move.b d0,-(sp) decrements sp by two before storing, so whatever was on -1(sp) before will get into the low byte when doing move.w (sp)+,d0.
|
|
|
|
|
|
#95 |
|
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 4,547
|
Sure does.
Might be that I needed this behaviour once and my mind was playing tricks on me.
__________________
Makes me sick when I hear all the shit that you say So much crap coming out, it must take you all day There's a space kept in hell with your name on the seat With a spike in the chair just to make it complete |
|
|
|
|
|
#96 | |
|
Registered User
Join Date: Jun 2008
Location: Glasgow/Scotland
Posts: 209
|
Quote:
I tested using this code albeit on the Hatari emulator. d1 winds up being $ff00 Code:
oddsandends
move.l sp,d0
move.w #$3344,-(sp)
move.b #$ff,d1
move.b d1,-(sp)
move.w (sp)+,d1 ; shift by 8
move.l d0,sp
rts
Code:
oddsandends
move.l sp,d0
move.w #$3344,-(sp) ; set four bytes up with garbage
move.w #$1122,-(sp) ; " "
addq #2,sp ; point the stack at $1122
move.l sp,a1 ; stuff it in a1
move.b -1(a1),d2 ; we load $22
move.b #$ff,d1 ; then move shift value
move.b d1,-(sp) ; boom high byte is $22
move.w (sp)+,d1 ; shift by 8 and d1 is now $ff22
move.l d0,sp
rts
![]() Last edited by frank_b; 29 July 2012 at 13:04. Reason: Added code block around code. |
|
|
|
|
|
|
#97 |
|
Registered User
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 216
|
@frank: Yes, but your example doesn't prove anything, since you don't initialize the contents of -1(sp) with a known value before using the magic trick...
move.w #$BEEF,-(sp) move.w (sp)+,d0 ; sp back where we started, d0=$BEEF move.b d0,-(sp) move.w (sp)+,d0 ; d0 should now contain $EFEF if theory holds true and low byte is not cleared. edit: seems you corrected your example while i posted this :-) |
|
|
|
|
|
#98 | |
|
Registered User
Join Date: Jun 2008
Location: Glasgow/Scotland
Posts: 209
|
Quote:
Fired up Hatari and went straight into devpack to check if my assumption was incorrect.I then realised the missing piece of the puzzle I was thinking of something else too but then realised I was wrong about that ![]() Anything subtle like that that could require hours of debugging to find/fix is a worthwhile trick ![]() Last edited by frank_b; 16 July 2012 at 23:22. |
|
|
|
|
|
|
#99 |
|
68k wisdom
Join Date: Nov 2007
Location: Lyon (France)
Age: 40
Posts: 980
|
Something perhaps few people know : if A7 points to an odd address and you byte access it, it will still work !
This will just add/subtract 2 to it as usual, allowing you to read/write one byte out of two (this time at an odd address). But you must be *very* careful because no other stack access must be made while you do that ![]()
__________________
He who insults the other in a discussion is the one who's wrong. |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| New opcode for 68000 family | clenched | request.UAE Wishlist | 15 | 14 April 2009 15:02 |
| Looking for 68000 CPU Connector | BinoX | support.Hardware | 6 | 11 June 2007 13:01 |
| quitting on 68000? | Hungry Horace | project.WHDLoad | 60 | 19 December 2006 20:17 |
| 68000 Div/divu | dlfrsilver | support.WinUAE | 3 | 01 November 2005 11:31 |
| 3D code and/or internet code for Blitz Basic 2.1 | EdzUp | Retrogaming General Discussion | 0 | 10 February 2002 11:40 |