diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2018-08-16 16:05:07 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2018-08-16 16:05:07 +0200 |
commit | ef905e956911d0010532ee8348c144474ce8f1d6 (patch) | |
tree | 19c624b5efcbcae1423ba5b2754e29805dabba12 /crenshaw | |
parent | e010c35dd67d24a6bbf1acd5ae0ed1d64d0d905d (diff) | |
download | compilertests-ef905e956911d0010532ee8348c144474ce8f1d6.tar.gz compilertests-ef905e956911d0010532ee8348c144474ce8f1d6.tar.bz2 |
crenshaw: started to implement functions, added a todo
Diffstat (limited to 'crenshaw')
-rw-r--r-- | crenshaw/README | 46 | ||||
-rw-r--r-- | crenshaw/TODOS | 8 | ||||
-rwxr-xr-x | crenshaw/build.sh | 1 | ||||
-rw-r--r-- | crenshaw/docs/stackoverflow_what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm.txt | 820 | ||||
-rw-r--r-- | crenshaw/docs/tutor3-wp_examples_relative.txt | 391 | ||||
-rw-r--r-- | crenshaw/emul.c | 8 | ||||
-rw-r--r-- | crenshaw/main.pas | 62 | ||||
-rw-r--r-- | crenshaw/test.prog | 2 |
8 files changed, 1314 insertions, 24 deletions
diff --git a/crenshaw/README b/crenshaw/README index b2414fc..0aaffcb 100644 --- a/crenshaw/README +++ b/crenshaw/README @@ -22,6 +22,10 @@ fpc main.pas nasm -o test.bin -f bin test.asm ./emul test.bin +TODO: kapstone to actually assemble the code, currently +we use nasm to produce a binary and we use capstone to decode +it. What's better? + links ----- @@ -39,7 +43,12 @@ findings tutor2: the expression and data stacks should be better explained and -linked to the abstract description of the algorithm. +linked to the abstract description of Dijkstra's Two-Stack Algorithm. +The trick is here that one stack representing the operators is the +function call stack of the recursive descent parser and the other one +lives on the stack (or could live in registers, if you have many of them +or mixed - registers for < 8 operands, rest onto stack) - but +conceptually a stack of operands. tutor3, local variables: @@ -49,6 +58,7 @@ compiler merely adds [X] references and X: dw 0 labels and data initializers. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm +(stackoverflow_what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm.txt) emulate the (PC) relative addressing of the MIPS: @@ -60,11 +70,41 @@ x: ; Now we can do (pseudo-)PC-Relative addressing: MOV EAX,[EDI+1234] -but we still have to calculate relative addresses. +but we still have to calculate relative addresses. On the +other hand we loose a register as sort of an address base +register. + +PC-relative adressig is a good thing, as it makes +code relocatable for free. + +Some survey on which CPUs have/had PC-relative adressing: + +https://www10.dict.cc/wp_examples.php?lp_id=1&lang=en&s=relative +(tutor3-wp_examples_relative.txt) There is no initializer yet, so we can just address the initialized variable in the expression for now. => there is a tradeoff here, how much do we do in the compiler, how much in the assember, linker - + +=> security comes into play later: we don't want code and variables + to mix! We don't want constants (like string literals, variable + constants) to be in the same segment as mutable variables. So + PC-relative adressing is something from the past for this point of + view. + +tutor3, functions + +We could make the parser deterministic by having one special +character, for instance: + +4 digits +Vxxx variables +Fxxx functions + +then we could decide on the LookAhead character. But that's +hardly a benefit for the people using the language. + +The approach here is that 'x' is the variable and 'x()' is the function +call. diff --git a/crenshaw/TODOS b/crenshaw/TODOS new file mode 100644 index 0000000..f1cc928 --- /dev/null +++ b/crenshaw/TODOS @@ -0,0 +1,8 @@ +- emul: + - subroutine don't work with cs_disasm_iter, as this one moves + sequentially through the code, so we have to disassemble up + the current position of the EIP. We could also just decode + the whole thing. +- main.pas: + - generated code for functions should not intermix with space + for variables diff --git a/crenshaw/build.sh b/crenshaw/build.sh index 5373e01..6c166f8 100755 --- a/crenshaw/build.sh +++ b/crenshaw/build.sh @@ -1,5 +1,6 @@ fpc main.pas ./main < test.prog > test.asm +cat test.asm nasm -o test.bin -f bin test.asm #nasm -f elf32 test.asm #gcc -m32 -march=i486 -ffreestanding -o test test.o diff --git a/crenshaw/docs/stackoverflow_what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm.txt b/crenshaw/docs/stackoverflow_what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm.txt new file mode 100644 index 0000000..e7636f2 --- /dev/null +++ b/crenshaw/docs/stackoverflow_what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm.txt @@ -0,0 +1,820 @@ + #[1]Stack Overflow [2]Feed for question 'What is PC-relative addressing + and how can I use it in MASM?' + + [3]Stack Overflow + ____________________ (BUTTON) + 1. + 2. + 3. + 4. + 5. + 6. [4]Log In [5]Sign Up + 7. + +[6]current community + + Stack Overflow + [7]help [8]chat + + Meta Stack Overflow + +your communities + [9]Sign up or [10]log in to customize your list. + +[11]more stack exchange communities + [12]company blog + + [13]Tour Start here for a quick overview of the site + + [14]Help Center Detailed answers to any questions you might + have + + [15]Meta Discuss the workings and policies of this site + + [16]About Us Learn more about Stack Overflow the company + + [17]Business Learn more about hiring developers or posting ads + with us + + This site uses cookies to deliver our services and to show you relevant + ads and job listings. By using our site, you acknowledge that you have + read and understand our [18]Cookie Policy, [19]Privacy Policy, and our + [20]Terms of Service. Your use of Stack Overflow's Products and + Services, including the Stack Overflow Network, is subject to these + policies and terms. + + Join us in building a kind, collaborative learning community via our + updated [21]Code of Conduct. + + Join Stack Overflow to learn, share knowledge, and build your career. + [22]Email Sign Up Sign Up or sign in with + Google + Facebook + + 1. + 2. [23]Home + 3. + 1. Public + 2. [24]Stack Overflow + 3. [25]Tags + 4. [26]Users + 5. [27]Jobs + 4. + 1. Teams Q&A for work [28]Create Team + +[29]What is PC-relative addressing and how can I use it in MASM? + + [30]Ask Question + up vote 2 down vote [31]favorite + + I'm following Jack Crenshaw's compiler tutorial (If you look at my + profile, that's what all my questions are about lol) and it just got to + the point where variables are introduced. He comments that the 68k + requires everything to be "position-independent" which means it's + "PC-relative". I get that PC is the program counter, and on x86 it's + EIP. But he uses syntax like MOVE X(PC),D0 where X is a variable name. + I've read a little ahead and it says nothing later about declaring a + variable in .data. How does this work? To make this work in x86, what + would I replace X(PC) with in MOV EAX, X(PC)? + + To be honest I'm not even sure this is supposed to output working code + yet, but up to this point it has and I've added code to my compiler + that adds the appropriate headers etc and a batch file to assemble, + link and run the result. + [32]assembly [33]x86 [34]masm [35]68000 [36]addressing + [37]share|[38]improve this question + asked Aug 26 '13 at 15:26 + [39]rpatel3001 + 2816 + * You can't do that on x86 (you could on x64), there is just no way + to express an EIP-relative address. - [40]harold Aug 26 '13 at + 15:41 + * @harold Well, I'm working on a 64 bit machine so I might as well + make it easier for myself. What's the syntax for doing so, and what + changes would I have to make to the header? - [41]rpatel3001 Aug 26 + '13 at 15:43 + * I'm not sure, I don't really use MASM. Maybe [rel labelname]? Maybe + [rip + offset]? Don't forget the dword ptr-nonsense. If you're + outputting bytes instead of text, you'd output a ModRM byte where + the mod field is zero and the RM field is 5, and the offset is an + sdword after that. - [42]harold Aug 26 '13 at 15:50 + * You could also just use absolute addressing of course (optionally + with relocation information). - [43]harold Aug 26 '13 at 15:59 + * @harold but how would I access the variable using a name without + having declared it first? And doesn't (E/R)IP change based on what + instruction is being executed? - [44]rpatel3001 Aug 26 '13 at 16:50 + + | [45]show 2 more comments + +2 Answers 2 + + [46]active [47]oldest [48]votes + up vote 4 down vote accepted + + Here's a short overview over what a statically allocated global + variable (which is what this question is about) really is and what to + do about them. + +What is a variable anyway + + To the machine, there is no such thing as a variable. It never hears + about them, it never cares about them, it just has no concept of them. + They're just a convention to assign a consistent meaning to a + particular location in RAM (in the case of virtual memory, a position + in your address space). + + Where you actually put a variable, is sort of up to you - but within + reason. If you're going to write to it (and you probably are), it had + better be in a writable location, which means: the address of that + variable should fall within a memory area that is allocated and + writable. The .data section is just an other convention for that. You + don't have to call it that, you don't even need a separate section (you + could make your .text section writable and allocate your globals there, + if you really wanted), you could even use OS functions like + VirtualAllocEx (or equivalent) to allocate memory at a fixed position + and use that (but don't do that). It's up to you. But the .data section + is a convenient place to put them. + + "Allocating" the variables is just a matter of choosing an address such + that the variable doesn't overlap with any other variable. That's not + hard, just lay them out sequentially: start a pointer var_ptr at the + beginning of wherever you're going to put them (so the VA of your .data + section, or 0 if you're using a linker), and then for every variable v: + * the location l of v is align(var_ptr, + round_up_to_power_of_2(sizeof(v))) + * set var_ptr to l + sizeof(v) + + As a minor variation, you could skip the alignment (most compiler + textbooks do that, but in real life you should align). x86 usually lets + you get away with that. + + As a bigger variation, you could try to "fill the holes" left by the + alignments. The simplest way to fill at least most holes is to just + sort the variables biggest-first (that fills all holes if all sizes are + powers of two). While that may save some space (though not necessarily + any, because sections are aligned themselves), it never saves much. + Under the usual alignment rules the "just lay them out + sequentially"-algorithm will, at worst, waste nearly half the space it + uses on holes. The pattern that leads to that is an alternating + sequence of the smallest type and the biggest type. And let's be + honest, that wouldn't really happen - and even if it did, that's not + all that bad. + + Then, you have to make sure that the .data segment is big enough to + hold all variables, and that the initial contents match what the + variables were initialized with. + + But you don't even have to do any of this. You can use variable + declarations in the assembly code (you know how to do this), and then + the assembler/linker (they typically both play a roll in this) will do + all of this for you (and, of course, it will also do the replacement of + variable names by variable addresses). + +How to use a variable + + It depends. If you're using an assembler/linker, just refer to the + label that you gave the variable. The label, of course, does not have + to match the name in the source code, it can be any legal unique name + (for example, you could use the AST node ID of the declaration with an + underscore in front of it). + + So loading a variable could look like this: +mov eax, dword ptr [variablelabel] + + Or, on x64, perhaps this +mov eax, dword ptr [rel variablelabel] + + Which would emit a rip-relative address. If you do that, you don't have + to care about the current value of RIP or where the variable is + allocated, the assembler/linker will take care of it. On x64, using a + RIP-relative address like that is common, for several reasons: + * it allows the .data segment to be somewhere that isn't the first + 4GB (or 2GB) of address space, as long as it's close to the .text + segment + * it's shorter than an instruction with an absolute 64bit address + * there are only two instructions that even take an absolute 64bit + address, namely mov rax,[imm64] and mov [imm64],rax + * you get relocations for free + + If you're not using an assembler and/or linker, it becomes (at least to + some extend) your own job to replace variable-names by whatever address + you allocated for them (if you're using a linker but no assembler, + you'd make relocation data but you wouldn't yourself decide on the + absolute addresses of variables). + + When you're using absolute addresses, you can "put them in" in parallel + with emitting instructions (provided you've already allocated the + variables). When you're using RIP-relative addresses, you can only put + them in once you decide where the code will be (so you'd emit code + where the offsets are 0, do some bookkeeping, decide where the code + will be, then you go back and replace the 0's by the real offsets), + which is a non-trivial problem in itself unless you use a naive way and + don't care about branch-size-optimization (in that case you know the + address of an instruction at the time you emit it, and therefore what + the offset of a variable relative to RIP would be). A RIP-relative + offset is easy enough to calculate, just subtract the RIP of the + position immediately after the current instruction from the VA (virtual + address) of the variable. + +But that's not all + + You may want to make some variables non-writable, to the point that any + attempt to write to them in "funny ways that the compile can't detect" + will fail. That can be accomplished by putting them in a read-only + section, typically called .rdata (but the name is irrelevant really, + what matters is whether the "writable" flag of the section is set in + the PE header). This isn't done often, though it is sometimes used for + string or array constants (which aren't properly variables). + + What is done regularly, is putting zero-initialized variables in their + own section, a section that takes no space in the executable file but + is instead simply zeroed out. Putting zero-initialized variables may + save some space in the executable. This section is commonly called .bss + (not short for bullsh*t section), but as always, the name is + irrelevant. + +More + + Most compiler textbooks deal with this subject to varying amounts, + though usually not in much detail, because when you get right down to + it: static variables aren't hard. Certainly not compared most other + aspects of compilations. Also, some aspects are very platform specific, + such as the details around the sections and how things actually end up + in an executable. + + Some sources/useful things (I've found all of these useful while + working on compilers): + * [49]PE101 + * [50]PE In Depth + * [51]PE Explorer + * [52]CFF Explorer + * [53]Intel Manuals + + [54]share|[55]improve this answer + answered Aug 26 '13 at 20:00 + [56]harold + 39k354106 + * Wow thanks for writing all that up. So, no matter how I access the + memory, I have to declare that much space being used in .data + (being new to the whole assembly thing I don't quite understand + how/where you would set read/writability of a section)? Since + there's no way to do it the (easier) 68k way, I'll probably end up + adding the variable to .data. - [57]rpatel3001 Aug 27 '13 at 2:19 + + add a comment | + up vote 3 down vote + + Many processors support PC-Relative or Absolute addressing. + + On X86 machines however there is the following restriction: + * Jumps and Calls are always PC-Relative (unless register-based) + * Other adresses are always Absolute (unless register-based) + + C compilers that can do PC-Relative addressing will implement this the + following way: + CALL x +x: + ; Now address "x" is on the stack + POP EDI + ; Now EDI contains address of "x" + ; Now we can do (pseudo-)PC-Relative addressing: + MOV EAX,[EDI+1234] + + This is used if the address of the code in the memory is not known + during compile/linking time (e.g. for dynmaic libraries (DLLs) under + Linux) so the address of a variable (here located at address "x+1234") + is not known, yet. + [58]share|[59]improve this answer + answered Aug 26 '13 at 15:54 + [60]Martin Rosenau + 7,3591720 + * So to use variables by name, I'd have to add a label corresponding + to the name of each, and do the call/pop/mov everytime I want to + access it? And what determines the offset from EDI to use? + - [61]rpatel3001 Aug 26 '13 at 16:54 + * The x86 doesn't have relative addressing in the 32-bit mode, but it + does in 64-bit mode. See [62]wiki.osdev.org/... - [63]ataylor Sep 1 + '16 at 21:59 + + add a comment | + +Your Answer + + + _______________________________________________________________________ + _______________________________________________________________________ + _______________________________________________________________________ + _______________________________________________________________________ + _______________________________________________________________________ + _______________________________________________________________________ + _______________________________________________________________________ + _______________________________________________________________________ + _______________________________________________________________________ + _______________________________________________________________________ + _______________________________________________________________________ + _______________________________________________________________________ + _______________________________________________________________________ + _______________________________________________________________________ + _______________________________________________________________________ + + draft saved + draft discarded + ____________________ + +Sign up or [64]log in + + Sign up using Google + Sign up using Facebook + Sign up using Email and Password + [BUTTON Input] (not implemented)______ + +Post as a guest + + Name ______________________________ + Email ______________________________ + +Post as a guest + + Name ______________________________ + Email ______________________________ + (BUTTON) Post Your Answer (BUTTON) Discard + + By clicking "Post Your Answer", you acknowledge that you have read our + updated [65]terms of service, [66]privacy policy and [67]cookie policy, + and that your continued use of the website is subject to these + policies. + +Not the answer you're looking for? Browse other questions tagged [68]assembly +[69]x86 [70]masm [71]68000 [72]addressing or [73]ask your own question. + + asked + + 4 years, 11 months ago + + viewed + + 2,713 times + + active + + [74]4 years, 11 months ago + +Linked + + 1 + [75]Lambdas as closures taking environment. The crucial role of RIP + register + +Related + + 8 + [76]Assembly: Using the Data Segment Register (DS) + 547 + [77]How do I achieve the theoretical maximum of 4 FLOPs per cycle? + 0 + [78]Assembly bubble sort swap + 4 + [79]Using RIP-relative addressing in OSX x64 assembly + 2 + [80]Incorrect output to Fibonacci series in MASM + 1 + [81]MASM error A2088, but only when assembled from within Java + 3 + [82]What c code would compile to something like `call *%eax`? + 1158 + [83]Replacing a 32-bit loop counter with 64-bit introduces crazy + performance deviations + 1 + [84]MASM Mov from/to immediate memory address + 3 + [85]How to write an absolute target for a near direct relative call/jmp + in MASM + +[86]Hot Network Questions + + * [87]Purpose of [ -n "$PS1" ] in bashrc + * [88]Polynomial cannot have all roots real? + * [89]Why are escape characters not working when I read from cin? + * [90]Why did I have to wave my hand in front of my ID card? + * [91]Does this triangle-area theorem have a name? + * [92]Is a pig-mounted cavalry possible? + * [93]Why are airlines so concerned with checked baggage weight? + * [94]What is the need of assumptions in linear regression? + * [95]Is "spaced by 1 meter" correct English? + * [96]Is this news article from 1912, essentially explaining climate + change, real? + * [97]Teaching the daughter of a lecturer, while being enrolled into + a course of him + * [98]Form Ui Component doesn't submit field in the html content + * [99]How do I show concern to my manager, who is coming back from an + emergency leave? Want to ask him if everything was good back at + home + * [100]Is it Possible to use the Result of Callout1 in Callout2? + * [101]How to handle colleagues who are unwilling to write a bug + report? + * [102]What is a person being envied called? + * [103]Is it legal to invent "artificial" bills to build credit? + * [104]Kid throwing ice cream cone back to the vendor + * [105]What's the difference between "vanilla" and "plain" when + talking about yogurts? + * [106]How would schools that take in multiple nationalities address + the language barrier issue? + * [107]What is the recommended level of detail for published + mathematical proofs? + * [108]What does "junk-food-scoffing masses" mean? + * [109]How do non-LaTeX users handle citations? + * [110]As I Was Reflecting On Nothing + + [111]more hot questions + [112]question feed + +[113]Stack Overflow + + * [114]Questions + * [115]Jobs + * [116]Developer Jobs Directory + * [117]Salary Calculator + * [118]Help + * Mobile + +[119]Products + + * [120]Teams + * [121]Talent + * [122]Engagement + * [123]Enterprise + +[124]Company + + * [125]About + * [126]Press + * [127]Work Here + * [128]Legal + * [129]Privacy Policy + * [130]Contact Us + +[131]Stack Exchange +Network + + * [132]Technology + * [133]Life / Arts + * [134]Culture / Recreation + * [135]Science + * [136]Other + + * [137]Stack Overflow + * [138]Server Fault + * [139]Super User + * [140]Web Applications + * [141]Ask Ubuntu + * [142]Webmasters + * [143]Game Development + + * [144]TeX - LaTeX + * [145]Software Engineering + * [146]Unix & Linux + * [147]Ask Different (Apple) + * [148]WordPress Development + * [149]Geographic Information Systems + * [150]Electrical Engineering + + * [151]Android Enthusiasts + * [152]Information Security + * [153]Database Administrators + * [154]Drupal Answers + * [155]SharePoint + * [156]User Experience + * [157]Mathematica + + * [158]Salesforce + * [159]ExpressionEngine® Answers + * [160]Stack Overflow em Português + * [161]Blender + * [162]Network Engineering + * [163]Cryptography + * [164]Code Review + + * [165]Magento + * [166]Software Recommendations + * [167]Signal Processing + * [168]Emacs + * [169]Raspberry Pi + * [170]Stack Overflow na russkom + * [171]Programming Puzzles & Code Golf + + * [172]Stack Overflow en español + * [173]Ethereum + * [174]Data Science + * [175]Arduino + * [176]Bitcoin + * [177]more (30) + + * [178]Photography + * [179]Science Fiction & Fantasy + * [180]Graphic Design + * [181]Movies & TV + * [182]Music: Practice & Theory + * [183]Worldbuilding + * [184]Seasoned Advice (cooking) + + * [185]Home Improvement + * [186]Personal Finance & Money + * [187]Academia + * [188]Law + * [189]more (15) + + * [190]English Language & Usage + * [191]Skeptics + * [192]Mi Yodeya (Judaism) + * [193]Travel + * [194]Christianity + * [195]English Language Learners + * [196]Japanese Language + + * [197]Arqade (gaming) + * [198]Bicycles + * [199]Role-playing Games + * [200]Anime & Manga + * [201]Puzzling + * [202]Motor Vehicle Maintenance & Repair + * [203]more (33) + + * [204]MathOverflow + * [205]Mathematics + * [206]Cross Validated (stats) + * [207]Theoretical Computer Science + * [208]Physics + * [209]Chemistry + * [210]Biology + + * [211]Computer Science + * [212]Philosophy + * [213]more (10) + + * [214]Meta Stack Exchange + * [215]Stack Apps + * [216]API + * [217]Data + * [218]Area 51 + + * [219]Blog + * [220]Facebook + * [221]Twitter + * [222]LinkedIn + + site design / logo © 2018 Stack Exchange Inc; user contributions + licensed under [223]cc by-sa 3.0 with [224]attribution required. + rev 2018.8.15.31327 + + Stack Overflow works best with JavaScript enabled + +References + + Visible links: + 1. https://stackoverflow.com/opensearch.xml + 2. https://stackoverflow.com/feeds/question/18447627 + 3. https://stackoverflow.com/ + 4. https://stackoverflow.com/users/login?ssrc=head&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f18447627%2fwhat-is-pc-relative-addressing-and-how-can-i-use-it-in-masm + 5. https://stackoverflow.com/users/signup?ssrc=head&returnurl=%2fusers%2fstory%2fcurrent + 6. https://stackoverflow.com/ + 7. https://stackoverflow.com/help + 8. https://chat.stackoverflow.com/ + 9. https://stackoverflow.com/users/signup?ssrc=site_switcher&returnurl=%2fusers%2fstory%2fcurrent + 10. https://stackoverflow.com/users/login?ssrc=site_switcher&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f18447627%2fwhat-is-pc-relative-addressing-and-how-can-i-use-it-in-masm + 11. https://stackexchange.com/sites + 12. https://stackoverflow.blog/ + 13. https://stackoverflow.com/tour + 14. https://stackoverflow.com/help + 15. https://meta.stackoverflow.com/ + 16. https://stackoverflow.com/company/about + 17. https://www.stackoverflowbusiness.com/?ref=topbar_help + 18. https://stackoverflow.com/legal/cookie-policy + 19. https://stackoverflow.com/legal/privacy-policy + 20. https://stackoverflow.com/legal/terms-of-service/public + 21. https://stackoverflow.com/conduct + 22. https://stackoverflow.com/users/signup?ssrc=hero&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f18447627%2fwhat-is-pc-relative-addressing-and-how-can-i-use-it-in-masm + 23. https://stackoverflow.com/ + 24. https://stackoverflow.com/questions + 25. https://stackoverflow.com/tags + 26. https://stackoverflow.com/users + 27. https://stackoverflow.com/jobs?med=site-ui&ref=jobs-tab + 28. https://stackoverflow.com/teams + 29. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm + 30. https://stackoverflow.com/questions/ask + 31. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm + 32. https://stackoverflow.com/questions/tagged/assembly + 33. https://stackoverflow.com/questions/tagged/x86 + 34. https://stackoverflow.com/questions/tagged/masm + 35. https://stackoverflow.com/questions/tagged/68000 + 36. https://stackoverflow.com/questions/tagged/addressing + 37. https://stackoverflow.com/q/18447627 + 38. https://stackoverflow.com/posts/18447627/edit + 39. https://stackoverflow.com/users/2708313/rpatel3001 + 40. https://stackoverflow.com/users/555045/harold + 41. https://stackoverflow.com/users/2708313/rpatel3001 + 42. https://stackoverflow.com/users/555045/harold + 43. https://stackoverflow.com/users/555045/harold + 44. https://stackoverflow.com/users/2708313/rpatel3001 + 45. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm + 46. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm?answertab=active#tab-top + 47. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm?answertab=oldest#tab-top + 48. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm?answertab=votes#tab-top + 49. http://code.google.com/p/corkami/wiki/PE101 + 50. http://msdn.microsoft.com/en-us/magazine/cc301805.aspx + 51. http://www.heaventools.com/overview.htm + 52. http://www.ntcore.com/exsuite.php + 53. http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html?wapkw=%28Intel%20Architecture%20Software%20Developer%E2%80%99s%20Manual%2991 + 54. https://stackoverflow.com/a/18452082 + 55. https://stackoverflow.com/posts/18452082/edit + 56. https://stackoverflow.com/users/555045/harold + 57. https://stackoverflow.com/users/2708313/rpatel3001 + 58. https://stackoverflow.com/a/18448109 + 59. https://stackoverflow.com/posts/18448109/edit + 60. https://stackoverflow.com/users/2705055/martin-rosenau + 61. https://stackoverflow.com/users/2708313/rpatel3001 + 62. http://wiki.osdev.org/X86-64_Instruction_Encoding#RIP.2FEIP-relative_addressing + 63. https://stackoverflow.com/users/190201/ataylor + 64. https://stackoverflow.com/users/login?ssrc=question_page&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f18447627%2fwhat-is-pc-relative-addressing-and-how-can-i-use-it-in-masm%23new-answer + 65. https://stackoverflow.com/legal/terms-of-service/public + 66. https://stackoverflow.com/legal/privacy-policy + 67. https://stackoverflow.com/legal/cookie-policy + 68. https://stackoverflow.com/questions/tagged/assembly + 69. https://stackoverflow.com/questions/tagged/x86 + 70. https://stackoverflow.com/questions/tagged/masm + 71. https://stackoverflow.com/questions/tagged/68000 + 72. https://stackoverflow.com/questions/tagged/addressing + 73. https://stackoverflow.com/questions/ask + 74. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm?lastactivity + 75. https://stackoverflow.com/questions/40841057/lambdas-as-closures-taking-environment-the-crucial-role-of-rip-register?noredirect=1 + 76. https://stackoverflow.com/questions/4903906/assembly-using-the-data-segment-register-ds + 77. https://stackoverflow.com/questions/8389648/how-do-i-achieve-the-theoretical-maximum-of-4-flops-per-cycle + 78. https://stackoverflow.com/questions/11497966/assembly-bubble-sort-swap + 79. https://stackoverflow.com/questions/12339972/using-rip-relative-addressing-in-osx-x64-assembly + 80. https://stackoverflow.com/questions/13218552/incorrect-output-to-fibonacci-series-in-masm + 81. https://stackoverflow.com/questions/18424714/masm-error-a2088-but-only-when-assembled-from-within-java + 82. https://stackoverflow.com/questions/21324087/what-c-code-would-compile-to-something-like-call-eax + 83. https://stackoverflow.com/questions/25078285/replacing-a-32-bit-loop-counter-with-64-bit-introduces-crazy-performance-deviati + 84. https://stackoverflow.com/questions/35904895/masm-mov-from-to-immediate-memory-address + 85. https://stackoverflow.com/questions/50058523/how-to-write-an-absolute-target-for-a-near-direct-relative-call-jmp-in-masm + 86. https://stackexchange.com/questions?tab=hot + 87. https://unix.stackexchange.com/questions/462663/purpose-of-n-ps1-in-bashrc + 88. https://math.stackexchange.com/questions/2884490/polynomial-cannot-have-all-roots-real + 89. https://stackoverflow.com/questions/51864157/why-are-escape-characters-not-working-when-i-read-from-cin + 90. https://security.stackexchange.com/questions/191460/why-did-i-have-to-wave-my-hand-in-front-of-my-id-card + 91. https://math.stackexchange.com/questions/2884063/does-this-triangle-area-theorem-have-a-name + 92. https://worldbuilding.stackexchange.com/questions/121474/is-a-pig-mounted-cavalry-possible + 93. https://aviation.stackexchange.com/questions/54337/why-are-airlines-so-concerned-with-checked-baggage-weight + 94. https://stats.stackexchange.com/questions/362284/what-is-the-need-of-assumptions-in-linear-regression + 95. https://ell.stackexchange.com/questions/176416/is-spaced-by-1-meter-correct-english + 96. https://skeptics.stackexchange.com/questions/42008/is-this-news-article-from-1912-essentially-explaining-climate-change-real + 97. https://academia.stackexchange.com/questions/115353/teaching-the-daughter-of-a-lecturer-while-being-enrolled-into-a-course-of-him + 98. https://magento.stackexchange.com/questions/238520/form-ui-component-doesnt-submit-field-in-the-html-content + 99. https://workplace.stackexchange.com/questions/117573/how-do-i-show-concern-to-my-manager-who-is-coming-back-from-an-emergency-leave + 100. https://salesforce.stackexchange.com/questions/229056/is-it-possible-to-use-the-result-of-callout1-in-callout2 + 101. https://workplace.stackexchange.com/questions/117560/how-to-handle-colleagues-who-are-unwilling-to-write-a-bug-report + 102. https://english.stackexchange.com/questions/460338/what-is-a-person-being-envied-called + 103. https://money.stackexchange.com/questions/98585/is-it-legal-to-invent-artificial-bills-to-build-credit + 104. https://parenting.stackexchange.com/questions/34647/kid-throwing-ice-cream-cone-back-to-the-vendor + 105. https://ell.stackexchange.com/questions/176388/whats-the-difference-between-vanilla-and-plain-when-talking-about-yogurts + 106. https://scifi.stackexchange.com/questions/192898/how-would-schools-that-take-in-multiple-nationalities-address-the-language-barri + 107. https://academia.stackexchange.com/questions/115325/what-is-the-recommended-level-of-detail-for-published-mathematical-proofs + 108. https://english.stackexchange.com/questions/460209/what-does-junk-food-scoffing-masses-mean + 109. https://academia.stackexchange.com/questions/115291/how-do-non-latex-users-handle-citations + 110. https://puzzling.stackexchange.com/questions/69671/as-i-was-reflecting-on-nothing + 111. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm + 112. https://stackoverflow.com/feeds/question/18447627 + 113. https://stackoverflow.com/ + 114. https://stackoverflow.com/questions + 115. https://stackoverflow.com/jobs + 116. https://stackoverflow.com/jobs/directory/developer-jobs + 117. https://stackoverflow.com/jobs/salary + 118. https://stackoverflow.com/help + 119. https://www.stackoverflowbusiness.com/ + 120. https://stackoverflow.com/teams + 121. https://www.stackoverflowbusiness.com/talent + 122. https://www.stackoverflowbusiness.com/advertise + 123. https://stackoverflow.com/enterprise + 124. https://stackoverflow.com/company/about + 125. https://stackoverflow.com/company/about + 126. https://stackoverflow.com/company/press + 127. https://stackoverflow.com/company/work-here + 128. https://stackoverflow.com/legal + 129. https://stackoverflow.com/legal/privacy-policy + 130. https://stackoverflow.com/company/contact + 131. https://stackexchange.com/ + 132. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm + 133. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm + 134. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm + 135. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm + 136. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm + 137. https://stackoverflow.com/ + 138. https://serverfault.com/ + 139. https://superuser.com/ + 140. https://webapps.stackexchange.com/ + 141. https://askubuntu.com/ + 142. https://webmasters.stackexchange.com/ + 143. https://gamedev.stackexchange.com/ + 144. https://tex.stackexchange.com/ + 145. https://softwareengineering.stackexchange.com/ + 146. https://unix.stackexchange.com/ + 147. https://apple.stackexchange.com/ + 148. https://wordpress.stackexchange.com/ + 149. https://gis.stackexchange.com/ + 150. https://electronics.stackexchange.com/ + 151. https://android.stackexchange.com/ + 152. https://security.stackexchange.com/ + 153. https://dba.stackexchange.com/ + 154. https://drupal.stackexchange.com/ + 155. https://sharepoint.stackexchange.com/ + 156. https://ux.stackexchange.com/ + 157. https://mathematica.stackexchange.com/ + 158. https://salesforce.stackexchange.com/ + 159. https://expressionengine.stackexchange.com/ + 160. https://pt.stackoverflow.com/ + 161. https://blender.stackexchange.com/ + 162. https://networkengineering.stackexchange.com/ + 163. https://crypto.stackexchange.com/ + 164. https://codereview.stackexchange.com/ + 165. https://magento.stackexchange.com/ + 166. https://softwarerecs.stackexchange.com/ + 167. https://dsp.stackexchange.com/ + 168. https://emacs.stackexchange.com/ + 169. https://raspberrypi.stackexchange.com/ + 170. https://ru.stackoverflow.com/ + 171. https://codegolf.stackexchange.com/ + 172. https://es.stackoverflow.com/ + 173. https://ethereum.stackexchange.com/ + 174. https://datascience.stackexchange.com/ + 175. https://arduino.stackexchange.com/ + 176. https://bitcoin.stackexchange.com/ + 177. https://stackexchange.com/sites#technology + 178. https://photo.stackexchange.com/ + 179. https://scifi.stackexchange.com/ + 180. https://graphicdesign.stackexchange.com/ + 181. https://movies.stackexchange.com/ + 182. https://music.stackexchange.com/ + 183. https://worldbuilding.stackexchange.com/ + 184. https://cooking.stackexchange.com/ + 185. https://diy.stackexchange.com/ + 186. https://money.stackexchange.com/ + 187. https://academia.stackexchange.com/ + 188. https://law.stackexchange.com/ + 189. https://stackexchange.com/sites#lifearts + 190. https://english.stackexchange.com/ + 191. https://skeptics.stackexchange.com/ + 192. https://judaism.stackexchange.com/ + 193. https://travel.stackexchange.com/ + 194. https://christianity.stackexchange.com/ + 195. https://ell.stackexchange.com/ + 196. https://japanese.stackexchange.com/ + 197. https://gaming.stackexchange.com/ + 198. https://bicycles.stackexchange.com/ + 199. https://rpg.stackexchange.com/ + 200. https://anime.stackexchange.com/ + 201. https://puzzling.stackexchange.com/ + 202. https://mechanics.stackexchange.com/ + 203. https://stackexchange.com/sites#culturerecreation + 204. https://mathoverflow.net/ + 205. https://math.stackexchange.com/ + 206. https://stats.stackexchange.com/ + 207. https://cstheory.stackexchange.com/ + 208. https://physics.stackexchange.com/ + 209. https://chemistry.stackexchange.com/ + 210. https://biology.stackexchange.com/ + 211. https://cs.stackexchange.com/ + 212. https://philosophy.stackexchange.com/ + 213. https://stackexchange.com/sites#science + 214. https://meta.stackexchange.com/ + 215. https://stackapps.com/ + 216. https://api.stackexchange.com/ + 217. https://data.stackexchange.com/ + 218. https://area51.stackexchange.com/ + 219. https://stackoverflow.blog/?blb=1 + 220. https://www.facebook.com/officialstackoverflow/ + 221. https://twitter.com/stackoverflow + 222. https://linkedin.com/company/stack-overflow + 223. https://creativecommons.org/licenses/by-sa/3.0/ + 224. https://stackoverflow.blog/2009/06/25/attribution-required/ + + Hidden links: + 226. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm + 227. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm + 228. https://stackexchange.com/users/?tab=inbox + 229. https://stackexchange.com/users/?tab=reputation + 230. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm + 231. https://stackexchange.com/ + 232. https://stackoverflow.com/ + 233. https://meta.stackoverflow.com/ + 234. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm + 235. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm + 236. https://stackoverflow.com/users/2708313/rpatel3001 + 237. https://stackoverflow.com/users/555045/harold + 238. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm + 239. https://stackoverflow.com/users/2705055/martin-rosenau + 240. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm + 241. https://stackoverflow.com/q/40841057 + 242. https://stackoverflow.com/q/4903906 + 243. https://stackoverflow.com/q/8389648 + 244. https://stackoverflow.com/q/11497966 + 245. https://stackoverflow.com/q/12339972 + 246. https://stackoverflow.com/q/13218552 + 247. https://stackoverflow.com/q/18424714 + 248. https://stackoverflow.com/q/21324087 + 249. https://stackoverflow.com/q/25078285 + 250. https://stackoverflow.com/q/35904895 + 251. https://stackoverflow.com/q/50058523 + 252. https://stackoverflow.com/ + 253. https://stackoverflow.com/questions/18447627/what-is-pc-relative-addressing-and-how-can-i-use-it-in-masm diff --git a/crenshaw/docs/tutor3-wp_examples_relative.txt b/crenshaw/docs/tutor3-wp_examples_relative.txt new file mode 100644 index 0000000..f460040 --- /dev/null +++ b/crenshaw/docs/tutor3-wp_examples_relative.txt @@ -0,0 +1,391 @@ + ____________________ + + Apollo + + The evolution of the Greek sculpture can be observed in his depictions + from the almost static formal Kouros type in early archaic period, to + the representation of motion in a relative harmonious whole in late + archaic period. [1]mehr + + Andorra + + Given its relative isolation, Andorra has existed outside the + mainstream of European history, with few ties to countries other than + France, Spain and Portugal. [2]mehr + + Andorra + + Andorra's relative advantage has recently eroded as the economies of + adjoining France and Spain have been opened up, providing broader + availability of goods and lower tariffs. [3]mehr + + Alaska + + Because of its population relative to other U.S. [4]mehr + + Alkane + + The time taken for an ethane molecule to pass from one staggered + conformation to the next, equivalent to the rotation of one CH[3]-group + by 120° relative to the other, is of the order of 10^-11 seconds. + [5]mehr + + Alkane + + The fragmentation pattern can be difficult to interpret, but, in the + case of branched chain alkanes, the carbon chain is preferentially + cleaved at tertiary or quaternary carbons due to the relative stability + of the resulting free radicals. [6]mehr + + Alphabet + + In the Pollard script, an abugida, vowels are indicated by diacritics, + but the placement of the diacritic relative to the consonant is + modified to indicate the tone. [7]mehr + + Atomic number + + Since protons and neutrons have approximately the same mass (and the + mass of the electrons is negligible for many purposes) and the mass + defect of nucleon binding is always small compared to the nucleon mass, + the atomic mass of any atom, when expressed in unified atomic mass + units (making a quantity called the "relative isotopic mass"), is + roughly (to within 1%) equal to the whole number "A". [8]mehr + + Atomic number + + A little more than three-quarters of naturally occurring elements exist + as a mixture of isotopes (see monoisotopic elements), and the average + isotopic mass of an isotopic mixture for an element (called the + relative atomic mass) in a defined environment on Earth, determines the + element's standard atomic weight. [9]mehr + + Aruba + + As part of the Kingdom of the Netherlands, citizens of (mainland) the + Netherlands can travel with relative ease to Aruba and other islands of + the Dutch Antilles. [10]mehr + + Albania + + With its coastline facing the Adriatic and Ionian seas, its highlands + backed upon the elevated Balkan landmass, and the entire country lying + at a latitude subject to a variety of weather patterns during the + winter and summer seasons, Albania has a high number of climatic + regions relative to its landmass. [11]mehr + + Albania + + Likewise, Albanian has taken the old relative "jos" and innovatively + used it exclusively to qualify adjectives, much in the way Balto-Slavic + has used this word to provide the definite ending of adjectives. + [12]mehr + + Algorithm + + This means that the programmer must know a "language" that is effective + relative to the target computing agent (computer/computor). [13]mehr + + Algorithm + + There is a wide variety: some algorithms complete in linear time + relative to input size, some do so in an exponential amount of time or + even worse, and some never halt. [14]mehr + + Allocution + + Do you have anything to say as to why the sentence of this Court should + not now be passed upon you?" The defense counsel will then make a "plea + in mitigation" (also called "submissions on penalty") in an attempt to + mitigate the relative seriousness of the offense and heavily refer to + and rely upon the defendant's previous good character and good works + (if any). [15]mehr + + Ancient Egypt + + Egyptian civilization coalesced around 3150 BC (according to + conventional Egyptian chronology) The history of ancient Egypt occurred + in a series of stable Kingdoms, separated by periods of relative + instability known as Intermediate Periods: the Old Kingdom of the Early + Bronze Age, the Middle Kingdom of the Middle Bronze Age and the New + Kingdom of the Late Bronze Age. [16]mehr + + Abugida + + The Pollard script, which was based on shorthand, also uses diacritics + for vowels; the placements of the vowel relative to the consonant + indicates tone. [17]mehr + + ABBA + + To escape the media swirl and concentrate on their writing, Andersson + and Ulvaeus secretly travelled to Compass Point Studios in Nassau, + Bahamas, where for two weeks they prepared their next album's songs in + relative quiet. [18]mehr + + August Derleth + + A close literary relative of the "Sac Prairie Saga" was Derleth's + "Wisconsin Saga", which comprises several historical novels. [19]mehr + + Algorithms for calculating variance + + This is particularly bad if the standard deviation is small relative to + the mean. [20]mehr + + Politics of Antigua and Barbuda + + There are special legislative provisions to account for Barbuda's low + population relative to that of Antigua. [21]mehr + + Adelaide + + Adelaide enjoyed a post-war boom, entering a time of relative + prosperity. [22]mehr + + Adelaide + + A relative lack of suitable locally available timber for construction + purposes led to the early development of a brick-making industry, as + well as the use of stone, for houses and other buildings. [23]mehr + + Accordion + + Sarah Kiener, the former hurdy-gurdy player for the Swiss + melodic-death/folk metal band Eluveitie, played a Helvetic accordion + known as a "zugerörgeli", which could be a distant relative (in one way + or another) to the Swiss schwyzerörgeli, as both are indigenous to and + very rare outside of Switzerland. [24]mehr + + Athena + + Apart from her attributes, there seems to be a relative consensus in + late sculpture from the Classical period, the 5th century onward, as to + what Athena looked like. [25]mehr + + Angle + + Pairwise these angles are named according to their location relative to + each other. [26]mehr + + Angle + + In some contexts, such as identifying a point on a circle or describing + the "orientation" of an object in two dimensions relative to a + reference orientation, angles that differ by an exact multiple of a + full turn are effectively equivalent. In other contexts, such as + identifying a point on a spiral curve or describing the "cumulative + rotation" of an object in two dimensions relative to a reference + orientation, angles that differ by a non-zero multiple of a full turn + are not equivalent. [27]mehr + + Angle + + Although the definition of the measurement of an angle does not support + the concept of a negative angle, it is frequently useful to impose a + convention that allows positive and negative angular values to + represent orientations and/or rotations in opposite directions relative + to some reference. [28]mehr + + Angle + + In three-dimensional geometry, "clockwise" and "anticlockwise" have no + absolute meaning, so the direction of positive and negative angles must + be defined relative to some reference, which is typically a vector + passing through the angle's vertex and perpendicular to the plane in + which the rays of the angle lie. [29]mehr + + Angle + + In navigation, bearings are measured relative to north. [30]mehr + + Alternate history + + In any case, even if it is true that every possible outcome occurs in + some world, it can still be argued that traits such as bravery and + intelligence might still affect the relative frequency of worlds in + which better or worse outcomes occurred (even if the total number of + worlds with each type of outcome is infinite, it is still possible to + assign a different measure to different infinite sets). What you do for + the better increases the portion of the multiverse where good things + happen." This view is perhaps somewhat too abstract to be explored + directly in science fiction stories, but a few writers have tried, such + as Greg Egan in his short story "The Infinite Assassin", where an agent + is trying to contain reality-scrambling "whirlpools" that form around + users of a certain drug, and the agent is constantly trying to maximize + the consistency of behavior among his alternate selves, attempting to + compensate for events and thoughts he experiences but he guesses are of + low measure relative to those experienced by most of his other selves. + [31]mehr + + Atomic orbital + + This relativistic increase in momentum for high speed electrons causes + a corresponding decrease in wavelength and contraction of 6s orbitals + relative to 5d orbitals (by comparison to corresponding s and d + electrons in lighter elements in the same column of the periodic + table); this results in 6s valence electrons becoming lowered in + energy. [32]mehr + + Astronomical unit + + Neither "G" nor can be measured to high accuracy in SI units, but the + value of their product is known very precisely from observing the + relative positions of planets (Kepler's Third Law expressed in terms of + Newtonian gravitation). [33]mehr + + Anisotropy + + An "anisotropic liquid" has the fluidity of a normal liquid, but has an + average structural order relative to each other along the molecular + axis, unlike water or chloroform, which contain no structural ordering + of the molecules. [34]mehr + + Alpha decay + + The relative biological effectiveness (RBE) of alpha radiation is + higher than that of beta or gamma radiation. [35]mehr + + Extreme poverty + + For example, when used to measure headcount ratio (i.e. the percentage + of people living below the line), the $1.25/day line is unable to + capture other important measures such as depth of poverty, relative + poverty and how people view their own financial situation (known as the + "socially subjective poverty line"). [36]mehr + + Augustus + + The reign of Augustus initiated an era of relative peace known as the + "Pax Romana" ("The Roman Peace"). [37]mehr + + Geography of Antarctica + + Western Antarctica and Eastern Antarctica correspond roughly to the + eastern and western hemispheres relative to the Greenwich meridian. + [38]mehr + + Allosaurus + + Relative to the large and powerful hindlimbs, its three-fingered + forelimbs were small, and the body was balanced by a long and heavily + muscled tail. [39]mehr + + Ammonia + + The relative intensity of the ammonia lines can be used to measure the + temperature of the emitting medium. [40]mehr + + Albertosaurus + + Although relatively large for a theropod, "Albertosaurus" was much + smaller than its more famous relative "Tyrannosaurus", probably + weighing less than 2 metric tons. [41]mehr + + Assembly language + + There have always been debates over the usefulness and performance of + assembly language relative to high-level languages. [42]mehr + + Assembly language + + The second column is the relative address, in hex, of where the code + will be placed in memory. [43]mehr + + Alabaster + + The two kinds are distinguished from each other readily by differences + in their relative hardness. [44]mehr + + Amazing Grace + + It debuted in print in 1779 in Newton and Cowper's "Olney Hymns" but + settled into relative obscurity in England. [45]mehr + + Amide + + This relative lack of basicity is explained by the electron-withdrawing + nature of the carbonyl group where the lone pair of electrons on the + nitrogen is delocalized by resonance. [46]mehr + + Agrippina the Elder + + Agrippina was the wife of the general and statesman Germanicus and a + relative to the first Roman Emperors. [47]mehr + + Agrippina the Elder + + Haterius Agrippa (cos. CE 22, called a relative of Germanicus by Tac. + "Ann." 2.49). [48]mehr + + Ealdred (archbishop of York) + + Ealdred supported Harold as king, but when Harold was defeated at the + Battle of Hastings, Ealdred backed Edgar the Ætheling and then endorsed + King William the Conqueror, the Duke of Normandy and a distant relative + of King Edward's. [49]mehr + + Alexander III of Russia + + Alexander and his wife regularly spent their summers at Langinkoski + manor near Kotka on the Finnish coast, where their children were + immersed in a Scandinavian lifestyle of relative modesty. [50]mehr + + [51]Textbeispiele für relative, aus Wikipedia (en) + + 50 Ergebnisse, [52]Ladezeit: 15.4 msec + +References + + 1. javascript:; + 2. javascript:; + 3. javascript:; + 4. javascript:; + 5. javascript:; + 6. javascript:; + 7. javascript:; + 8. javascript:; + 9. javascript:; + 10. javascript:; + 11. javascript:; + 12. javascript:; + 13. javascript:; + 14. javascript:; + 15. javascript:; + 16. javascript:; + 17. javascript:; + 18. javascript:; + 19. javascript:; + 20. javascript:; + 21. javascript:; + 22. javascript:; + 23. javascript:; + 24. javascript:; + 25. javascript:; + 26. javascript:; + 27. javascript:; + 28. javascript:; + 29. javascript:; + 30. javascript:; + 31. javascript:; + 32. javascript:; + 33. javascript:; + 34. javascript:; + 35. javascript:; + 36. javascript:; + 37. javascript:; + 38. javascript:; + 39. javascript:; + 40. javascript:; + 41. javascript:; + 42. javascript:; + 43. javascript:; + 44. javascript:; + 45. javascript:; + 46. javascript:; + 47. javascript:; + 48. javascript:; + 49. javascript:; + 50. javascript:; + 51. https://en.wikipedia.org/wiki/Special:Search?search=relative + 52. javascript:location.reload() diff --git a/crenshaw/emul.c b/crenshaw/emul.c index c17e48b..8a0b79c 100644 --- a/crenshaw/emul.c +++ b/crenshaw/emul.c @@ -136,6 +136,8 @@ int main( int argc, char *argv[] ) printf( "-- iteration %d\n", iteration ); iteration++; + + printf( "%04X: ", address ); if( !cs_disasm_iter( cs, (const uint8_t **)&code, &code_size, &address, instr ) ) { fprintf( stderr, "ERROR: failed to call cs_disasm_iter( ): %s\n", cs_strerror( cs_errno( cs ) ) ); @@ -144,9 +146,11 @@ int main( int argc, char *argv[] ) exit( EXIT_FAILURE ); } - printf( "%04X: ", address ); for( int i = 0; i < instr->size; i++ ) { - printf( "%02X ", instr->bytes[i] ); + printf( "%02X", instr->bytes[i] ); + } + for( int i = ( 16 - instr->size ) *2; i > 0; i-- ) { + printf( " " ); } printf( " %s\t\t%s\n", instr->mnemonic, instr->op_str ); diff --git a/crenshaw/main.pas b/crenshaw/main.pas index 654d547..74999f1 100644 --- a/crenshaw/main.pas +++ b/crenshaw/main.pas @@ -79,39 +79,58 @@ end; procedure Expression; Forward; +type + symbolType = ( variableType = 1, functionType = 2 ); + var - nof_names : integer; - names : array[0..26] of char; + nof_symbols : integer; + symbols : array[0..26] of record + name : char; + sym_type : symbolType; + end; -procedure RememberName(name : char); +procedure RememberName(name : char; sym_type : symbolType); var i : integer; found : boolean; begin found := false; - for i := 0 to nof_names do begin - if names[i] = name then + for i := 0 to nof_symbols do begin + if symbols[i].name = name then found := true; end; - if i = 26 then Abort('Table of variable names overflowed'); + if i = 26 then Abort('Table of variable symbols overflowed'); if not found then begin - names[nof_names] := name; - inc(nof_names); + symbols[nof_symbols].name := name; + symbols[nof_symbols].sym_type := sym_type; + inc(nof_symbols); end; end; -procedure Factor; +procedure Ident; var name : char; begin + name := GetName; if Look = '(' then begin Match('('); - Expression; Match(')'); - end else if IsAlpha(Look) then begin - name := GetName; - RememberName(name); + RememberName(name, functionType); + EmitLn('call ' + name); + end else begin + RememberName(name, variableType); EmitLn('mov eax, [' + name + ']'); - end else + end; +end; + +procedure Factor; +begin + if Look = '(' then begin + Match('('); + Expression; + Match(')'); + end else if IsAlpha(Look) then + Ident + else EmitLn('mov eax, ' + GetNum); end; @@ -182,7 +201,7 @@ end; procedure Init; begin - nof_names := 0; + nof_symbols := 0; GetChar; end; @@ -202,9 +221,16 @@ end; procedure Variables; var i : integer; begin - for i := 0 to nof_names-1 do begin - EmitLabel(names[i]); - EmitLn('dw 0'); + for i := 0 to nof_symbols-1 do begin + EmitLabel(symbols[i].name); + case symbols[i].sym_type of + VariableType: begin + EmitLn('dw 0'); + end; + FunctionType: begin + EmitLn('ret'); + end; + end; end; end; diff --git a/crenshaw/test.prog b/crenshaw/test.prog index 339791d..880418a 100644 --- a/crenshaw/test.prog +++ b/crenshaw/test.prog @@ -1 +1 @@ -(4+4)*3/2-3+a-b +(4+4)*3/2-3+a-b*f() |