Re: [Tuxnes-devel] more help w/ asm
Brought to you by:
tmmm
|
From: Rigel <ri...@an...> - 2001-04-12 15:28:13
|
-- On Wed, 11 Apr 2001 19:40:40 Eric Jacobs wrote: >"Rigel" <ri...@an...> tapped some keys and produced: > > >> all right, I think I've got it (all) figured out now (haha). I >> understood mov all along (promise), just not lea. I do like Intel >> syntax much better though, as it's a little more like other *real* >> (RISC) assembly languages. >> >> This whole gaffe of mine just illustrates another reason I don't like >> x86 asm, which is that the instructions are misnamed. I would have >> called lea, cea, for calculate effective addr. or maybe just wpos for >> weird piece of sh**. > >The way I think about it is that lea is like taking a C "&" operator >of the corresponding mov > >> > movl 4(%ebx),%edi is like edi = *(ebx+4) > >> > leal 4(%ebx),%edi is like edi = &(*(ebx+4)) > or edi = ebx+4 > >(Or, perhaps a more exact analogy is that the target register is a >reference variable, C++ style, if you understand that sort of thing.) > >BTW, lea exists in Motorola 68K, and is used in much the same way. > > >> >> I'll definitely look up that Art of Assembly stuff. It should be a good >> reference. >> >> Okay, with the zero and sign flag (edi) you just give it the latest >> result from the ALU, right? But what about the carry flag (ebp) ? do I >> just set it to 1 if there was a carry involved in the most recent >> instruction? > >You set it the way that a 6502 would set it, as you should do with Z, >N and V as well. You don't have to set up the register mapping the >same way as it is for the x86; you should use whatever mapping is the >most efficient for your architecture. The 6502 instructions that modify >the carry flag are ADC, SBC, ASL, LSR, ROL, ROR, CMP, CPX, CPY, PLP, >SEC, CLC. (Did I miss any?) You're right, I don't *have* to keep similar reg mapping, but it will be much easier to code, as I will have to rewrite less of dynrec.c (which, as mentioned before, is quite complex). heads up here. I don't understand the implementation in table.x86. So on all these listed instructions I set carry flag if there was a carrry (and clear it otherwise)? Yes I am trying to port the sucker to mips. Wouldn't it be best though, to write the linkage (x86.S) in C? Has anyone noticed that most of the jumps are given as offsets, not labels? Also that it's almost completely undocumented? I'm not relishing the thought of translating that to mips. I'm beginning to see a conspiracy. Who does this Quor guy work for? I may have to mail him, eh? Whoever it was who said they could get me a cheesy rom (I forget who) that would be quite nice, though I need to get this all running on the SGI first. Who needs Cupid? Matchmaker.com is the place to meet somebody. FREE Two-week Trial Membership at http://www.matchmaker.com/home?rs=200015 |