home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| LaTeX document text
| default
| |
99%
| file
| LaTeX document, ASCII text
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| gt2
| Textdatei (UNIX)
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 0a 4d 61 74 20 2d 20 0a | 0a 49 20 74 68 6f 75 67 |.Mat - .|.I thoug|
|00000010| 68 74 20 79 6f 75 20 6d | 69 67 68 74 20 62 65 20 |ht you m|ight be |
|00000020| 69 6e 74 65 72 65 73 74 | 65 64 20 69 6e 20 74 68 |interest|ed in th|
|00000030| 69 73 2e 20 20 49 74 27 | 73 20 61 20 4c 61 54 65 |is. It'|s a LaTe|
|00000040| 58 20 76 65 72 73 69 6f | 6e 20 6f 66 0a 74 68 65 |X versio|n of.the|
|00000050| 20 68 69 67 68 6c 79 20 | 65 6e 74 65 72 74 61 69 | highly |entertai|
|00000060| 6e 69 6e 67 20 73 79 6e | 70 61 70 65 72 20 61 76 |ning syn|paper av|
|00000070| 61 69 6c 61 62 6c 65 20 | 6f 6e 20 74 68 65 20 65 |ailable |on the e|
|00000080| 78 65 63 75 74 6f 72 20 | 66 74 70 0a 73 69 74 65 |xecutor |ftp.site|
|00000090| 2e 20 20 49 74 20 6c 6f | 6f 6b 73 20 71 75 69 74 |. It lo|oks quit|
|000000a0| 65 20 6e 69 63 65 20 77 | 68 65 6e 20 70 72 69 6e |e nice w|hen prin|
|000000b0| 74 65 64 20 6f 75 74 2e | 20 20 49 20 68 61 76 65 |ted out.| I have|
|000000c0| 20 61 20 62 61 64 20 68 | 61 62 69 74 20 2d 2d 0a | a bad h|abit --.|
|000000d0| 77 68 65 6e 65 76 65 72 | 20 49 20 67 65 74 20 73 |whenever| I get s|
|000000e0| 6f 6d 65 74 68 69 6e 67 | 20 69 6e 20 41 53 43 49 |omething| in ASCI|
|000000f0| 49 20 66 6f 72 6d 61 74 | 20 74 68 61 74 20 49 20 |I format| that I |
|00000100| 77 61 6e 74 20 74 6f 20 | 72 65 61 64 2c 20 49 0a |want to |read, I.|
|00000110| 67 65 6e 65 72 61 6c 6c | 79 20 65 6e 64 20 75 70 |generall|y end up|
|00000120| 20 4c 61 54 65 58 27 69 | 6e 67 20 69 74 2c 20 73 | LaTeX'i|ng it, s|
|00000130| 69 6e 63 65 20 69 74 20 | 64 6f 65 73 6e 27 74 20 |ince it |doesn't |
|00000140| 74 61 6b 65 20 74 68 61 | 74 20 6d 75 63 68 0a 74 |take tha|t much.t|
|00000150| 69 6d 65 2c 20 61 6e 64 | 20 69 74 20 6c 6f 6f 6b |ime, and| it look|
|00000160| 73 20 6f 72 64 65 72 73 | 20 6f 66 20 6d 61 67 6e |s orders| of magn|
|00000170| 69 74 75 64 65 20 62 65 | 74 74 65 72 2e 0a 0a 54 |itude be|tter...T|
|00000180| 61 6b 65 20 63 61 72 65 | 2c 20 0a 0a 45 6c 61 6e |ake care|, ..Elan|
|00000190| 20 46 65 69 6e 67 6f 6c | 64 0a 0a 38 2d 3c 2d 2d | Feingol|d..8-<--|
|000001a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 20 62 65 67 69 6e 20 |--------|- begin |
|000001b0| 73 79 6e 70 61 70 65 72 | 2e 74 65 78 20 2d 2d 2d |synpaper|.tex ---|
|000001c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 3e 2d 38 0a 5c |--------|--->-8.\|
|000001d0| 64 6f 63 75 6d 65 6e 74 | 73 74 79 6c 65 7b 61 72 |document|style{ar|
|000001e0| 74 69 63 6c 65 7d 0a 5c | 74 69 74 6c 65 7b 7b 5c |ticle}.\|title{{\|
|000001f0| 68 75 67 65 7b 53 79 6e | 36 38 6b 7d 7d 20 5c 5c |huge{Syn|68k}} \\|
|00000200| 20 41 52 44 49 27 73 20 | 64 79 6e 61 6d 69 63 61 | ARDI's |dynamica|
|00000210| 6c 6c 79 20 63 6f 6d 70 | 69 6c 69 6e 67 20 36 38 |lly comp|iling 68|
|00000220| 4c 43 30 34 30 20 65 6d | 75 6c 61 74 6f 72 7d 0a |LC040 em|ulator}.|
|00000230| 5c 64 61 74 65 7b 5c 74 | 6f 64 61 79 7d 0a 5c 62 |\date{\t|oday}.\b|
|00000240| 65 67 69 6e 7b 64 6f 63 | 75 6d 65 6e 74 7d 0a 5c |egin{doc|ument}.\|
|00000250| 6d 61 6b 65 74 69 74 6c | 65 0a 0a 5c 73 65 63 74 |maketitl|e..\sect|
|00000260| 69 6f 6e 7b 4f 76 65 72 | 76 69 65 77 7d 0a 0a 54 |ion{Over|view}..T|
|00000270| 68 69 73 20 64 6f 63 75 | 6d 65 6e 74 20 69 73 20 |his docu|ment is |
|00000280| 6d 65 61 6e 74 20 74 6f | 20 67 69 76 65 20 61 20 |meant to| give a |
|00000290| 63 6f 6e 63 69 73 65 20 | 74 65 63 68 6e 69 63 61 |concise |technica|
|000002a0| 6c 20 73 75 6d 6d 61 72 | 79 20 6f 66 20 68 6f 77 |l summar|y of how|
|000002b0| 0a 73 79 6e 36 38 6b 20 | 77 6f 72 6b 73 2e 0a 0a |.syn68k |works...|
|000002c0| 60 60 53 79 6e 36 38 6b | 2c 27 27 20 41 52 44 49 |``Syn68k|,'' ARDI|
|000002d0| 27 73 20 36 38 4c 43 30 | 34 30 20 65 6d 75 6c 61 |'s 68LC0|40 emula|
|000002e0| 74 6f 72 2c 20 69 73 20 | 62 6f 74 68 20 68 69 67 |tor, is |both hig|
|000002f0| 68 6c 79 20 70 6f 72 74 | 61 62 6c 65 20 61 6e 64 |hly port|able and|
|00000300| 0a 66 61 73 74 2e 20 20 | 54 68 65 20 70 6f 72 74 |.fast. |The port|
|00000310| 61 62 6c 65 20 63 6f 72 | 65 20 6f 66 20 73 79 6e |able cor|e of syn|
|00000320| 36 38 6b 2c 20 77 68 69 | 63 68 20 77 6f 72 6b 73 |68k, whi|ch works|
|00000330| 20 62 79 20 64 79 6e 61 | 6d 69 63 61 6c 6c 79 0a | by dyna|mically.|
|00000340| 63 6f 6d 70 69 6c 69 6e | 67 20 36 38 30 78 30 20 |compilin|g 680x0 |
|00000350| 63 6f 64 65 20 69 6e 74 | 6f 20 61 6e 20 65 66 66 |code int|o an eff|
|00000360| 69 63 69 65 6e 74 20 69 | 6e 74 65 72 70 72 65 74 |icient i|nterpret|
|00000370| 65 64 20 66 6f 72 6d 2c | 20 77 61 73 20 64 65 73 |ed form,| was des|
|00000380| 69 67 6e 65 64 0a 74 6f | 20 72 75 6e 20 6f 6e 20 |igned.to| run on |
|00000390| 61 6c 6c 20 6d 61 6a 6f | 72 20 43 50 55 27 73 2e |all majo|r CPU's.|
|000003a0| 20 20 4f 6e 20 73 75 70 | 70 6f 72 74 65 64 20 61 | On sup|ported a|
|000003b0| 72 63 68 69 74 65 63 74 | 75 72 65 73 2c 20 73 79 |rchitect|ures, sy|
|000003c0| 6e 36 38 6b 20 63 61 6e | 0a 61 6c 73 6f 20 74 72 |n68k can|.also tr|
|000003d0| 61 6e 73 6c 61 74 65 20 | 36 38 30 78 30 20 63 6f |anslate |680x0 co|
|000003e0| 64 65 20 69 6e 74 6f 20 | 6e 61 74 69 76 65 20 63 |de into |native c|
|000003f0| 6f 64 65 20 74 68 61 74 | 20 74 68 65 20 68 6f 73 |ode that| the hos|
|00000400| 74 20 70 72 6f 63 65 73 | 73 6f 72 0a 63 61 6e 20 |t proces|sor.can |
|00000410| 72 75 6e 20 64 69 72 65 | 63 74 6c 79 2e 0a 0a 5c |run dire|ctly...\|
|00000420| 73 65 63 74 69 6f 6e 7b | 53 79 6e 67 65 6e 7d 0a |section{|Syngen}.|
|00000430| 0a 41 52 44 49 27 73 20 | 60 60 73 79 6e 67 65 6e |.ARDI's |``syngen|
|00000440| 27 27 20 73 79 73 74 65 | 6d 20 61 6e 61 6c 79 7a |'' syste|m analyz|
|00000450| 65 73 20 61 20 6c 69 73 | 70 2d 6c 69 6b 65 20 66 |es a lis|p-like f|
|00000460| 69 6c 65 20 64 65 73 63 | 72 69 62 69 6e 67 20 74 |ile desc|ribing t|
|00000470| 68 65 0a 62 69 74 20 70 | 61 74 74 65 72 6e 73 20 |he.bit p|atterns |
|00000480| 61 6e 64 20 73 65 6d 61 | 6e 74 69 63 73 20 6f 66 |and sema|ntics of|
|00000490| 20 74 68 65 20 36 38 30 | 78 30 20 69 6e 73 74 72 | the 680|x0 instr|
|000004a0| 75 63 74 69 6f 6e 20 73 | 65 74 20 61 6e 64 20 70 |uction s|et and p|
|000004b0| 72 6f 64 75 63 65 73 0a | 6c 6f 6f 6b 75 70 20 74 |roduces.|lookup t|
|000004c0| 61 62 6c 65 73 20 61 6e | 64 20 43 20 63 6f 64 65 |ables an|d C code|
|000004d0| 20 66 6f 72 20 74 68 65 | 20 72 75 6e 74 69 6d 65 | for the| runtime|
|000004e0| 20 73 79 73 74 65 6d 20 | 74 6f 20 75 73 65 2e 20 | system |to use. |
|000004f0| 20 54 68 69 73 0a 70 72 | 6f 63 65 73 73 20 74 61 | This.pr|ocess ta|
|00000500| 6b 65 73 20 70 6c 61 63 | 65 20 6f 6e 6c 79 20 77 |kes plac|e only w|
|00000510| 68 65 6e 20 73 79 6e 36 | 38 6b 20 69 73 20 62 75 |hen syn6|8k is bu|
|00000520| 69 6c 74 2c 20 73 6f 20 | 77 65 20 63 61 6e 20 61 |ilt, so |we can a|
|00000530| 66 66 6f 72 64 0a 65 78 | 74 65 6e 73 69 76 65 20 |fford.ex|tensive |
|00000540| 61 6e 61 6c 79 73 69 73 | 20 68 65 72 65 2e 20 20 |analysis| here. |
|00000550| 54 68 65 20 63 6f 64 65 | 20 61 6e 64 20 74 61 62 |The code| and tab|
|00000560| 6c 65 73 20 67 65 6e 65 | 72 61 74 65 64 20 62 79 |les gene|rated by|
|00000570| 20 73 79 6e 67 65 6e 0a | 64 65 70 65 6e 64 20 73 | syngen.|depend s|
|00000580| 6f 6d 65 77 68 61 74 20 | 6f 6e 20 74 68 65 20 63 |omewhat |on the c|
|00000590| 68 61 72 61 63 74 65 72 | 69 73 74 69 63 73 20 6f |haracter|istics o|
|000005a0| 66 20 74 68 65 20 68 6f | 73 74 20 70 72 6f 63 65 |f the ho|st proce|
|000005b0| 73 73 6f 72 3b 20 66 6f | 72 0a 65 78 61 6d 70 6c |ssor; fo|r.exampl|
|000005c0| 65 2c 20 6f 6e 20 61 20 | 6c 69 74 74 6c 65 20 65 |e, on a |little e|
|000005d0| 6e 64 69 61 6e 20 6d 61 | 63 68 69 6e 65 20 69 74 |ndian ma|chine it|
|000005e0| 20 69 73 20 61 64 76 61 | 6e 74 61 67 65 6f 75 73 | is adva|ntageous|
|000005f0| 20 74 6f 20 62 79 74 65 | 20 73 77 61 70 0a 73 6f | to byte| swap.so|
|00000600| 6d 65 20 65 78 74 72 61 | 63 74 65 64 20 36 38 30 |me extra|cted 680|
|00000610| 78 30 20 6f 70 65 72 61 | 6e 64 73 20 61 74 20 63 |x0 opera|nds at c|
|00000620| 6f 6d 70 69 6c 65 20 74 | 69 6d 65 20 69 6e 73 74 |ompile t|ime inst|
|00000630| 65 61 64 20 6f 66 20 61 | 74 20 72 75 6e 74 69 6d |ead of a|t runtim|
|00000640| 65 2e 0a 0a 54 68 65 20 | 36 38 30 78 30 20 64 65 |e...The |680x0 de|
|00000650| 73 63 72 69 70 74 69 6f | 6e 20 66 69 6c 65 20 63 |scriptio|n file c|
|00000660| 61 6e 20 64 65 73 63 72 | 69 62 65 20 6d 75 6c 74 |an descr|ibe mult|
|00000670| 69 70 6c 65 20 77 61 79 | 73 20 74 6f 20 65 6d 75 |iple way|s to emu|
|00000680| 6c 61 74 65 0a 61 6e 79 | 20 70 61 72 74 69 63 75 |late.any| particu|
|00000690| 6c 61 72 20 36 38 30 78 | 30 20 6f 70 63 6f 64 65 |lar 680x|0 opcode|
|000006a0| 2e 20 20 54 68 65 20 72 | 75 6e 74 69 6d 65 20 73 |. The r|untime s|
|000006b0| 79 73 74 65 6d 20 6c 6f | 6f 6b 73 20 61 74 20 77 |ystem lo|oks at w|
|000006c0| 68 61 74 20 43 43 0a 62 | 69 74 73 20 61 72 65 20 |hat CC.b|its are |
|000006d0| 6c 69 76 65 20 61 66 74 | 65 72 20 74 68 65 20 69 |live aft|er the i|
|000006e0| 6e 73 74 72 75 63 74 69 | 6f 6e 20 61 6e 64 20 63 |nstructi|on and c|
|000006f0| 68 6f 6f 73 65 73 20 74 | 68 65 20 66 61 73 74 65 |hooses t|he faste|
|00000700| 73 74 20 76 61 72 69 61 | 6e 74 0a 69 74 20 63 61 |st varia|nt.it ca|
|00000710| 6e 20 6c 65 67 61 6c 6c | 79 20 75 73 65 2e 20 20 |n legall|y use. |
|00000720| 49 6e 20 74 68 65 20 66 | 6f 6c 6c 6f 77 69 6e 67 |In the f|ollowing|
|00000730| 20 65 78 61 6d 70 6c 65 | 2c 20 77 65 20 68 61 76 | example|, we hav|
|00000740| 65 20 74 77 6f 20 43 43 | 0a 76 61 72 69 61 6e 74 |e two CC|.variant|
|00000750| 73 20 6f 66 20 6c 73 72 | 77 3b 20 6f 6e 65 20 63 |s of lsr|w; one c|
|00000760| 6f 6d 70 75 74 65 73 20 | 6e 6f 20 43 43 20 62 69 |omputes |no CC bi|
|00000770| 74 73 2c 20 61 6e 64 20 | 74 68 65 20 6f 74 68 65 |ts, and |the othe|
|00000780| 72 20 63 6f 6d 70 75 74 | 65 73 0a 61 6c 6c 20 6f |r comput|es.all o|
|00000790| 66 20 74 68 65 6d 3a 0a | 0a 5c 62 65 67 69 6e 7b |f them:.|.\begin{|
|000007a0| 76 65 72 62 61 74 69 6d | 7d 0a 28 64 65 66 6f 70 |verbatim|}.(defop|
|000007b0| 63 6f 64 65 20 6c 73 72 | 77 5f 65 61 0a 20 20 28 |code lsr|w_ea. (|
|000007c0| 6c 69 73 74 20 36 38 30 | 30 30 20 61 6d 6f 64 65 |list 680|00 amode|
|000007d0| 5f 61 6c 74 65 72 61 62 | 6c 65 5f 6d 65 6d 6f 72 |_alterab|le_memor|
|000007e0| 79 20 28 29 20 28 6c 69 | 73 74 20 22 31 31 31 30 |y () (li|st "1110|
|000007f0| 30 30 31 30 31 31 6d 6d | 6d 6d 6d 6d 22 29 29 0a |001011mm|mmmm")).|
|00000800| 20 20 28 6c 69 73 74 20 | 22 2d 2d 2d 2d 2d 22 20 | (list |"-----" |
|00000810| 22 2d 2d 2d 2d 2d 22 20 | 64 6f 6e 74 5f 65 78 70 |"-----" |dont_exp|
|00000820| 61 6e 64 0a 09 28 61 73 | 73 69 67 6e 20 24 31 2e |and..(as|sign $1.|
|00000830| 6d 75 77 20 28 3e 3e 20 | 24 31 2e 6d 75 77 20 31 |muw (>> |$1.muw 1|
|00000840| 29 29 29 0a 20 20 28 6c | 69 73 74 20 22 43 4e 30 |))). (l|ist "CN0|
|00000850| 58 5a 22 20 22 2d 2d 2d | 2d 2d 22 20 64 6f 6e 74 |XZ" "---|--" dont|
|00000860| 5f 65 78 70 61 6e 64 0a | 09 28 6c 69 73 74 0a 09 |_expand.|.(list..|
|00000870| 20 28 61 73 73 69 67 6e | 20 63 63 78 20 28 61 73 | (assign| ccx (as|
|00000880| 73 69 67 6e 20 63 63 63 | 20 28 26 20 24 31 2e 6d |sign ccc| (& $1.m|
|00000890| 75 77 20 31 29 29 29 0a | 09 20 28 41 53 53 49 47 |uw 1))).|. (ASSIG|
|000008a0| 4e 5f 4e 4e 5a 5f 57 4f | 52 44 20 28 61 73 73 69 |N_NNZ_WO|RD (assi|
|000008b0| 67 6e 20 24 31 2e 6d 75 | 77 20 28 3e 3e 20 24 31 |gn $1.mu|w (>> $1|
|000008c0| 2e 6d 75 77 20 31 29 29 | 29 29 29 29 0a 5c 65 6e |.muw 1))|)))).\en|
|000008d0| 64 7b 76 65 72 62 61 74 | 69 6d 7d 0a 0a 54 68 65 |d{verbat|im}..The|
|000008e0| 20 36 38 30 78 30 20 64 | 65 73 63 72 69 70 74 69 | 680x0 d|escripti|
|000008f0| 6f 6e 20 66 69 6c 65 20 | 63 61 6e 20 61 6c 73 6f |on file |can also|
|00000900| 20 73 70 65 63 69 66 79 | 20 77 68 69 63 68 20 36 | specify| which 6|
|00000910| 38 30 78 30 20 6f 70 65 | 72 61 6e 64 73 0a 73 68 |80x0 ope|rands.sh|
|00000920| 6f 75 6c 64 20 62 65 20 | 60 60 65 78 70 61 6e 64 |ould be |``expand|
|00000930| 65 64 27 27 20 74 6f 20 | 62 65 63 6f 6d 65 20 69 |ed'' to |become i|
|00000940| 6d 70 6c 69 63 69 74 6c | 79 20 6b 6e 6f 77 6e 20 |mplicitl|y known |
|00000950| 62 79 20 74 68 65 20 63 | 6f 72 72 65 73 70 6f 6e |by the c|orrespon|
|00000960| 64 69 6e 67 0a 73 79 6e | 74 68 65 74 69 63 20 6f |ding.syn|thetic o|
|00000970| 70 63 6f 64 65 2e 20 20 | 46 6f 72 20 65 78 61 6d |pcode. |For exam|
|00000980| 70 6c 65 2c 20 66 75 6c | 6c 79 20 65 78 70 61 6e |ple, ful|ly expan|
|00000990| 64 69 6e 67 20 6f 75 74 | 20 60 60 61 64 64 6c 20 |ding out| ``addl |
|000009a0| 64 78 2c 64 79 27 27 0a | 77 6f 75 6c 64 20 72 65 |dx,dy''.|would re|
|000009b0| 73 75 6c 74 20 69 6e 20 | 36 34 20 73 79 6e 74 68 |sult in |64 synth|
|000009c0| 65 74 69 63 20 6f 70 63 | 6f 64 65 73 2c 20 6f 6e |etic opc|odes, on|
|000009d0| 65 20 66 6f 72 20 65 61 | 63 68 20 63 6f 6d 62 69 |e for ea|ch combi|
|000009e0| 6e 61 74 69 6f 6e 20 6f | 66 0a 64 61 74 61 20 72 |nation o|f.data r|
|000009f0| 65 67 69 73 74 65 72 20 | 6f 70 65 72 61 6e 64 73 |egister |operands|
|00000a00| 2e 20 20 54 68 69 73 20 | 72 65 73 75 6c 74 73 20 |. This |results |
|00000a10| 69 6e 20 73 6d 61 6c 6c | 65 72 20 61 6e 64 20 66 |in small|er and f|
|00000a20| 61 73 74 65 72 20 73 79 | 6e 74 68 65 74 69 63 0a |aster sy|nthetic.|
|00000a30| 6f 70 63 6f 64 65 73 20 | 61 74 20 74 68 65 20 65 |opcodes |at the e|
|00000a40| 78 70 65 6e 73 65 20 6f | 66 20 69 6e 63 72 65 61 |xpense o|f increa|
|00000a50| 73 69 6e 67 20 74 68 65 | 20 74 6f 74 61 6c 20 6e |sing the| total n|
|00000a60| 75 6d 62 65 72 20 6f 66 | 20 73 79 6e 74 68 65 74 |umber of| synthet|
|00000a70| 69 63 0a 6f 70 63 6f 64 | 65 73 2e 20 20 54 6f 20 |ic.opcod|es. To |
|00000a80| 63 6f 6e 73 65 72 76 65 | 20 73 70 61 63 65 2c 20 |conserve| space, |
|00000a90| 77 65 20 6f 6e 6c 79 20 | 65 78 70 61 6e 64 20 6f |we only |expand o|
|00000aa0| 75 74 20 63 6f 6d 6d 6f | 6e 20 36 38 30 78 30 20 |ut commo|n 680x0 |
|00000ab0| 6f 70 63 6f 64 65 73 2e | 0a 4f 6e 20 68 6f 73 74 |opcodes.|.On host|
|00000ac0| 20 61 72 63 68 69 74 65 | 63 74 75 72 65 73 20 77 | archite|ctures w|
|00000ad0| 68 65 72 65 20 77 65 20 | 63 61 6e 20 63 6f 6d 70 |here we |can comp|
|00000ae0| 69 6c 65 20 74 6f 20 6e | 61 74 69 76 65 20 63 6f |ile to n|ative co|
|00000af0| 64 65 2c 20 77 65 20 64 | 6f 6e 27 74 0a 77 61 73 |de, we d|on't.was|
|00000b00| 74 65 20 73 70 61 63 65 | 20 62 79 20 60 60 65 78 |te space| by ``ex|
|00000b10| 70 61 6e 64 69 6e 67 20 | 6f 75 74 27 27 20 63 6f |panding |out'' co|
|00000b20| 6d 6d 6f 6e 20 73 79 6e | 74 68 65 74 69 63 20 6f |mmon syn|thetic o|
|00000b30| 70 63 6f 64 65 73 2e 0a | 0a 5c 73 65 63 74 69 6f |pcodes..|.\sectio|
|00000b40| 6e 7b 54 65 73 74 20 73 | 75 69 74 65 73 7d 0a 0a |n{Test s|uites}..|
|00000b50| 41 52 44 49 20 68 61 73 | 20 61 20 6c 61 72 67 65 |ARDI has| a large|
|00000b60| 20 73 65 74 20 6f 66 20 | 74 65 73 74 20 73 75 69 | set of |test sui|
|00000b70| 74 65 73 20 74 68 61 74 | 20 74 72 79 20 74 68 6f |tes that| try tho|
|00000b80| 75 73 61 6e 64 73 20 75 | 70 6f 6e 20 74 68 6f 75 |usands u|pon thou|
|00000b90| 73 61 6e 64 73 0a 6f 66 | 20 76 61 72 69 61 74 69 |sands.of| variati|
|00000ba0| 6f 6e 73 20 6f 66 20 36 | 38 30 78 30 20 6f 70 63 |ons of 6|80x0 opc|
|00000bb0| 6f 64 65 73 20 61 6e 64 | 20 63 6f 6d 70 61 72 65 |odes and| compare|
|00000bc0| 20 74 68 65 20 72 65 73 | 75 6c 74 73 20 74 6f 20 | the res|ults to |
|00000bd0| 74 68 6f 73 65 0a 67 65 | 6e 65 72 61 74 65 64 20 |those.ge|nerated |
|00000be0| 62 79 20 61 20 72 65 61 | 6c 20 36 38 30 34 30 2e |by a rea|l 68040.|
|00000bf0| 20 20 54 68 65 73 65 20 | 74 65 73 74 20 73 75 69 | These |test sui|
|00000c00| 74 65 73 20 68 61 76 65 | 20 70 72 6f 76 65 6e 20 |tes have| proven |
|00000c10| 74 6f 20 62 65 20 61 6e | 0a 69 6e 76 61 6c 75 61 |to be an|.invalua|
|00000c20| 62 6c 65 20 64 65 62 75 | 67 67 69 6e 67 20 74 6f |ble debu|gging to|
|00000c30| 6f 6c 2c 20 62 6f 74 68 | 20 61 73 20 6e 65 77 20 |ol, both| as new |
|00000c40| 66 65 61 74 75 72 65 73 | 20 61 72 65 20 61 64 64 |features| are add|
|00000c50| 65 64 20 61 6e 64 20 61 | 73 0a 77 65 20 68 61 76 |ed and a|s.we hav|
|00000c60| 65 20 70 6f 72 74 65 64 | 20 73 79 6e 36 38 6b 20 |e ported| syn68k |
|00000c70| 74 6f 20 6f 74 68 65 72 | 20 61 72 63 68 69 74 65 |to other| archite|
|00000c80| 63 74 75 72 65 73 20 28 | 6e 6f 74 61 62 6c 79 20 |ctures (|notably |
|00000c90| 38 30 78 38 36 2c 20 36 | 38 30 78 30 2c 0a 69 38 |80x86, 6|80x0,.i8|
|00000ca0| 36 30 20 61 6e 64 20 41 | 6c 70 68 61 29 2e 20 20 |60 and A|lpha). |
|00000cb0| 4f 75 72 20 6e 61 74 69 | 76 65 20 63 6f 64 65 20 |Our nati|ve code |
|00000cc0| 73 75 70 70 6f 72 74 20 | 69 73 20 73 6f 20 72 65 |support |is so re|
|00000cd0| 63 65 6e 74 20 74 68 61 | 74 20 6f 75 72 0a 74 65 |cent tha|t our.te|
|00000ce0| 73 74 20 73 75 69 74 65 | 73 20 64 6f 20 6e 6f 74 |st suite|s do not|
|00000cf0| 20 79 65 74 20 61 64 65 | 71 75 61 74 65 6c 79 20 | yet ade|quately |
|00000d00| 74 65 73 74 20 61 6c 6c | 20 6f 66 20 74 68 65 20 |test all| of the |
|00000d10| 73 69 74 75 61 74 69 6f | 6e 73 20 74 68 61 74 0a |situatio|ns that.|
|00000d20| 61 72 69 73 65 20 77 68 | 65 6e 20 67 65 6e 65 72 |arise wh|en gener|
|00000d30| 61 74 69 6e 67 20 6e 61 | 74 69 76 65 20 63 6f 64 |ating na|tive cod|
|00000d40| 65 2c 20 62 75 74 20 77 | 65 20 70 6c 61 6e 20 74 |e, but w|e plan t|
|00000d50| 6f 20 65 78 74 65 6e 64 | 20 74 68 65 6d 20 69 6e |o extend| them in|
|00000d60| 0a 74 68 65 20 6e 65 61 | 72 20 66 75 74 75 72 65 |.the nea|r future|
|00000d70| 2e 0a 0a 5c 73 65 63 74 | 69 6f 6e 7b 49 6e 74 65 |...\sect|ion{Inte|
|00000d80| 72 70 72 65 74 65 64 20 | 63 6f 64 65 7d 0a 0a 4f |rpreted |code}..O|
|00000d90| 75 72 20 69 6e 74 65 72 | 70 72 65 74 65 64 20 63 |ur inter|preted c|
|00000da0| 6f 64 65 20 63 6f 6e 73 | 69 73 74 73 20 6f 66 20 |ode cons|ists of |
|00000db0| 63 6f 6e 74 69 67 75 6f | 75 73 20 73 65 71 75 65 |contiguo|us seque|
|00000dc0| 6e 63 65 73 20 6f 66 20 | 60 60 73 79 6e 74 68 65 |nces of |``synthe|
|00000dd0| 74 69 63 0a 6f 70 63 6f | 64 65 73 27 27 20 61 6e |tic.opco|des'' an|
|00000de0| 64 20 74 68 65 69 72 20 | 6f 70 65 72 61 6e 64 73 |d their |operands|
|00000df0| 2e 20 20 53 79 6e 67 65 | 6e 20 63 61 6e 20 67 65 |. Synge|n can ge|
|00000e00| 6e 65 72 61 74 65 20 41 | 4e 53 49 20 43 2c 20 62 |nerate A|NSI C, b|
|00000e10| 75 74 20 77 68 65 6e 0a | 63 6f 6d 70 69 6c 65 64 |ut when.|compiled|
|00000e20| 20 77 69 74 68 20 67 63 | 63 20 69 74 20 75 73 65 | with gc|c it use|
|00000e30| 73 20 43 20 6c 61 6e 67 | 75 61 67 65 20 65 78 74 |s C lang|uage ext|
|00000e40| 65 6e 73 69 6f 6e 73 20 | 74 68 61 74 20 6d 61 6b |ensions |that mak|
|00000e50| 65 20 73 79 6e 74 68 65 | 74 69 63 0a 6f 70 63 6f |e synthe|tic.opco|
|00000e60| 64 65 73 20 70 6f 69 6e | 74 65 72 73 20 74 6f 20 |des poin|ters to |
|00000e70| 74 68 65 20 43 20 63 6f | 64 65 20 72 65 73 70 6f |the C co|de respo|
|00000e80| 6e 73 69 62 6c 65 20 66 | 6f 72 20 69 6e 74 65 72 |nsible f|or inter|
|00000e90| 70 72 65 74 69 6e 67 20 | 74 68 61 74 0a 6f 70 63 |preting |that.opc|
|00000ea0| 6f 64 65 2e 20 20 54 68 | 69 73 20 60 60 74 68 72 |ode. Th|is ``thr|
|00000eb0| 65 61 64 65 64 20 69 6e | 74 65 72 70 72 65 74 69 |eaded in|terpreti|
|00000ec0| 6e 67 27 27 20 65 6e 74 | 69 72 65 6c 79 20 65 6c |ng'' ent|irely el|
|00000ed0| 69 6d 69 6e 61 74 65 73 | 20 73 77 69 74 63 68 0a |iminates| switch.|
|00000ee0| 64 69 73 70 61 74 63 68 | 20 61 6e 64 20 6c 6f 6f |dispatch| and loo|
|00000ef0| 70 20 6f 76 65 72 68 65 | 61 64 2e 0a 0a 54 6f 20 |p overhe|ad...To |
|00000f00| 69 6c 6c 75 73 74 72 61 | 74 65 20 74 68 65 20 61 |illustra|te the a|
|00000f10| 62 6f 76 65 20 70 6f 69 | 6e 74 73 2c 20 68 65 72 |bove poi|nts, her|
|00000f20| 65 20 69 73 20 74 68 65 | 20 61 73 73 65 6d 62 6c |e is the| assembl|
|00000f30| 79 20 6c 61 6e 67 75 61 | 67 65 0a 67 65 6e 65 72 |y langua|ge.gener|
|00000f40| 61 74 65 64 20 66 6f 72 | 20 74 68 65 20 73 79 6e |ated for| the syn|
|00000f50| 74 68 65 74 69 63 20 6f | 70 63 6f 64 65 20 74 68 |thetic o|pcode th|
|00000f60| 61 74 20 77 6f 75 6c 64 | 20 68 61 6e 64 6c 65 20 |at would| handle |
|00000f70| 61 20 66 75 6c 6c 79 20 | 65 78 70 61 6e 64 65 64 |a fully |expanded|
|00000f80| 0a 60 60 61 64 64 6c 20 | 64 30 2c 64 31 27 27 20 |.``addl |d0,d1'' |
|00000f90| 77 68 65 6e 20 6e 6f 20 | 43 43 20 62 69 74 20 76 |when no |CC bit v|
|00000fa0| 61 6c 75 65 73 20 61 72 | 65 20 72 65 71 75 69 72 |alues ar|e requir|
|00000fb0| 65 64 2e 20 20 54 68 69 | 73 20 69 73 20 77 68 61 |ed. Thi|s is wha|
|00000fc0| 74 0a 67 63 63 27 73 20 | 38 30 78 38 36 20 6f 75 |t.gcc's |80x86 ou|
|00000fd0| 74 70 75 74 20 6c 6f 6f | 6b 73 20 6c 69 6b 65 20 |tput loo|ks like |
|00000fe0| 28 65 64 69 74 65 64 20 | 66 6f 72 20 72 65 61 64 |(edited |for read|
|00000ff0| 61 62 69 6c 69 74 79 29 | 20 61 66 74 65 72 20 77 |ability)| after w|
|00001000| 65 0a 72 75 6e 20 6f 75 | 72 20 69 6e 74 65 72 70 |e.run ou|r interp|
|00001010| 72 65 74 65 72 20 74 68 | 72 6f 75 67 68 20 41 52 |reter th|rough AR|
|00001020| 44 49 27 73 20 50 65 6e | 74 69 75 6d 2d 73 70 65 |DI's Pen|tium-spe|
|00001030| 63 69 66 69 63 20 69 6e | 73 74 72 75 63 74 69 6f |cific in|structio|
|00001040| 6e 0a 73 63 68 65 64 75 | 6c 69 6e 67 20 50 65 72 |n.schedu|ling Per|
|00001050| 6c 20 73 63 72 69 70 74 | 3a 0a 0a 5c 62 65 67 69 |l script|:..\begi|
|00001060| 6e 7b 76 65 72 62 61 74 | 69 6d 7d 0a 09 6d 6f 76 |n{verbat|im}..mov|
|00001070| 6c 09 5f 64 30 2c 25 65 | 61 78 09 3b 20 66 65 74 |l._d0,%e|ax.; fet|
|00001080| 63 68 20 64 30 0a 09 6d | 6f 76 6c 09 28 25 65 73 |ch d0..m|ovl.(%es|
|00001090| 69 29 2c 25 65 64 69 09 | 3b 20 66 65 74 63 68 20 |i),%edi.|; fetch |
|000010a0| 6e 65 78 74 20 73 79 6e | 74 68 65 74 69 63 20 6f |next syn|thetic o|
|000010b0| 70 63 6f 64 65 0a 09 61 | 64 64 6c 09 25 65 61 78 |pcode..a|ddl.%eax|
|000010c0| 2c 5f 64 31 09 3b 20 64 | 6f 20 74 68 65 20 61 64 |,_d1.; d|o the ad|
|000010d0| 64 0a 09 61 64 64 6c 09 | 24 34 2c 25 65 73 69 09 |d..addl.|$4,%esi.|
|000010e0| 09 3b 20 69 6e 63 72 65 | 6d 65 6e 74 20 73 79 6e |.; incre|ment syn|
|000010f0| 74 68 65 74 69 63 20 50 | 43 0a 09 6a 6d 70 09 2a |thetic P|C..jmp.*|
|00001100| 25 65 64 69 09 09 3b 20 | 6a 75 6d 70 20 74 6f 20 |%edi..; |jump to |
|00001110| 6e 65 78 74 20 73 79 6e | 74 68 65 74 69 63 20 6f |next syn|thetic o|
|00001120| 70 63 6f 64 65 20 68 61 | 6e 64 6c 65 72 0a 5c 65 |pcode ha|ndler.\e|
|00001130| 6e 64 7b 76 65 72 62 61 | 74 69 6d 7d 0a 0a 57 65 |nd{verba|tim}..We|
|00001140| 20 6d 75 73 74 20 65 6d | 70 68 61 73 69 7a 65 20 | must em|phasize |
|00001150| 74 68 61 74 20 74 68 65 | 20 70 72 65 63 65 64 69 |that the| precedi|
|00001160| 6e 67 20 65 78 61 6d 70 | 6c 65 20 69 73 20 6e 6f |ng examp|le is no|
|00001170| 74 20 6e 61 74 69 76 65 | 20 63 6f 64 65 0a 67 65 |t native| code.ge|
|00001180| 6e 65 72 61 74 65 64 20 | 62 79 20 6f 75 72 20 65 |nerated |by our e|
|00001190| 6d 75 6c 61 74 6f 72 2c | 20 62 75 74 20 6d 65 72 |mulator,| but mer|
|000011a0| 65 6c 79 20 61 20 73 6e | 69 70 70 65 74 20 6f 66 |ely a sn|ippet of|
|000011b0| 20 77 68 61 74 20 67 63 | 63 20 67 65 6e 65 72 61 | what gc|c genera|
|000011c0| 74 65 73 0a 66 6f 72 20 | 6f 75 72 20 69 6e 74 65 |tes.for |our inte|
|000011d0| 72 70 72 65 74 65 72 2e | 20 20 54 68 69 73 20 67 |rpreter.| This g|
|000011e0| 69 76 65 73 20 79 6f 75 | 20 73 6f 6d 65 20 69 64 |ives you| some id|
|000011f0| 65 61 20 6f 66 20 74 68 | 65 20 65 66 66 69 63 69 |ea of th|e effici|
|00001200| 65 6e 63 79 0a 6f 66 20 | 74 68 65 20 70 6f 72 74 |ency.of |the port|
|00001210| 61 62 6c 65 20 63 6f 6d | 70 6f 6e 65 6e 74 20 6f |able com|ponent o|
|00001220| 66 20 6f 75 72 20 65 6d | 75 6c 61 74 6f 72 2e 0a |f our em|ulator..|
|00001230| 0a 5c 73 65 63 74 69 6f | 6e 7b 4e 61 74 69 76 65 |.\sectio|n{Native|
|00001240| 20 63 6f 64 65 7d 0a 0a | 53 79 6e 36 38 6b 20 73 | code}..|Syn68k s|
|00001250| 75 70 70 6f 72 74 73 20 | 6f 70 74 69 6f 6e 61 6c |upports |optional|
|00001260| 20 61 72 63 68 69 74 65 | 63 74 75 72 65 2d 73 70 | archite|cture-sp|
|00001270| 65 63 69 66 69 63 20 6e | 61 74 69 76 65 20 63 6f |ecific n|ative co|
|00001280| 64 65 20 65 78 74 65 6e | 73 69 6f 6e 73 2e 0a 4f |de exten|sions..O|
|00001290| 6e 20 73 79 73 74 65 6d | 73 20 77 68 65 72 65 20 |n system|s where |
|000012a0| 74 68 65 79 20 61 72 65 | 20 70 72 65 73 65 6e 74 |they are| present|
|000012b0| 2c 20 74 68 65 20 72 75 | 6e 74 69 6d 65 20 73 79 |, the ru|ntime sy|
|000012c0| 73 74 65 6d 20 74 72 69 | 65 73 20 74 6f 0a 67 65 |stem tri|es to.ge|
|000012d0| 6e 65 72 61 74 65 20 6e | 61 74 69 76 65 20 63 6f |nerate n|ative co|
|000012e0| 64 65 20 77 68 65 6e 65 | 76 65 72 20 70 6f 73 73 |de whene|ver poss|
|000012f0| 69 62 6c 65 2e 20 20 49 | 6e 20 74 68 6f 73 65 20 |ible. I|n those |
|00001300| 72 61 72 65 20 63 61 73 | 65 73 20 77 68 65 6e 0a |rare cas|es when.|
|00001310| 69 74 20 63 61 6e 6e 6f | 74 2c 20 69 74 20 72 65 |it canno|t, it re|
|00001320| 76 65 72 74 73 20 74 6f | 20 6f 75 72 20 69 6e 74 |verts to| our int|
|00001330| 65 72 70 72 65 74 65 64 | 20 63 6f 64 65 2e 20 20 |erpreted| code. |
|00001340| 53 69 6e 63 65 20 73 79 | 6e 36 38 6b 20 73 75 70 |Since sy|n68k sup|
|00001350| 70 6f 72 74 73 0a 62 6f | 74 68 20 6e 61 74 69 76 |ports.bo|th nativ|
|00001360| 65 20 61 6e 64 20 73 79 | 6e 74 68 65 74 69 63 20 |e and sy|nthetic |
|00001370| 63 6f 64 65 2c 20 74 68 | 65 20 72 75 6e 74 69 6d |code, th|e runtim|
|00001380| 65 20 73 79 73 74 65 6d | 20 61 75 74 6f 6d 61 74 |e system| automat|
|00001390| 69 63 61 6c 6c 79 0a 69 | 6e 73 65 72 74 73 20 67 |ically.i|nserts g|
|000013a0| 61 74 65 77 61 79 73 20 | 62 65 74 77 65 65 6e 20 |ateways |between |
|000013b0| 74 68 65 20 74 77 6f 20 | 77 68 65 6e 65 76 65 72 |the two |whenever|
|000013c0| 20 74 68 65 72 65 20 69 | 73 20 61 20 74 72 61 6e | there i|s a tran|
|000013d0| 73 69 74 69 6f 6e 2e 0a | 54 68 69 73 20 61 70 70 |sition..|This app|
|000013e0| 72 6f 61 63 68 20 61 6c | 6c 6f 77 73 20 75 73 20 |roach al|lows us |
|000013f0| 74 6f 20 67 72 61 64 75 | 61 6c 6c 79 20 70 68 61 |to gradu|ally pha|
|00001400| 73 65 20 69 6e 20 6e 61 | 74 69 76 65 20 63 6f 64 |se in na|tive cod|
|00001410| 65 20 68 61 6e 64 6c 65 | 72 73 0a 66 6f 72 20 6d |e handle|rs.for m|
|00001420| 6f 73 74 20 36 38 30 78 | 30 20 69 6e 73 74 72 75 |ost 680x|0 instru|
|00001430| 63 74 69 6f 6e 73 20 77 | 68 69 6c 65 20 6c 65 61 |ctions w|hile lea|
|00001440| 76 69 6e 67 20 74 72 69 | 63 6b 79 20 61 6e 64 20 |ving tri|cky and |
|00001450| 75 6e 69 6d 70 6f 72 74 | 61 6e 74 0a 72 61 72 65 |unimport|ant.rare|
|00001460| 20 63 61 73 65 73 20 61 | 6c 6f 6e 65 2e 0a 0a 41 | cases a|lone...A|
|00001470| 6c 74 68 6f 75 67 68 20 | 6f 75 72 20 6e 61 74 69 |lthough |our nati|
|00001480| 76 65 20 63 6f 64 65 20 | 63 6f 6d 70 69 6c 61 74 |ve code |compilat|
|00001490| 69 6f 6e 20 65 6e 67 69 | 6e 65 20 69 73 20 6e 6f |ion engi|ne is no|
|000014a0| 74 20 61 72 63 68 69 74 | 65 63 74 75 72 65 2d 73 |t archit|ecture-s|
|000014b0| 70 65 63 69 66 69 63 2c | 0a 74 6f 20 64 61 74 65 |pecific,|.to date|
|000014c0| 20 77 65 20 68 61 76 65 | 20 6f 6e 6c 79 20 69 6d | we have| only im|
|000014d0| 70 6c 65 6d 65 6e 74 65 | 64 20 61 6e 20 38 30 78 |plemente|d an 80x|
|000014e0| 38 36 20 62 61 63 6b 20 | 65 6e 64 2e 20 20 54 68 |86 back |end. Th|
|000014f0| 65 20 38 30 78 38 36 0a | 61 72 63 68 69 74 65 63 |e 80x86.|architec|
|00001500| 74 75 72 65 20 68 61 73 | 20 61 63 68 69 65 76 65 |ture has| achieve|
|00001510| 64 20 73 75 63 68 20 69 | 6d 70 6f 72 74 61 6e 74 |d such i|mportant|
|00001520| 20 73 74 61 74 75 73 20 | 69 6e 20 74 68 65 20 69 | status |in the i|
|00001530| 6e 64 75 73 74 72 79 0a | 74 68 61 74 20 69 74 20 |ndustry.|that it |
|00001540| 6d 61 6b 65 73 20 73 65 | 6e 73 65 20 66 6f 72 20 |makes se|nse for |
|00001550| 75 73 20 74 6f 20 64 65 | 73 63 72 69 62 65 20 68 |us to de|scribe h|
|00001560| 6f 77 20 77 65 20 67 65 | 6e 65 72 61 74 65 20 6e |ow we ge|nerate n|
|00001570| 61 74 69 76 65 20 63 6f | 64 65 0a 66 6f 72 20 69 |ative co|de.for i|
|00001580| 74 2c 20 65 76 65 6e 20 | 74 68 6f 75 67 68 20 6d |t, even |though m|
|00001590| 61 6e 79 20 6f 66 20 74 | 68 65 73 65 20 74 65 63 |any of t|hese tec|
|000015a0| 68 6e 69 71 75 65 73 20 | 77 6f 75 6c 64 20 6e 6f |hniques |would no|
|000015b0| 74 20 62 65 20 6e 65 63 | 65 73 73 61 72 79 0a 6f |t be nec|essary.o|
|000015c0| 6e 20 52 49 53 43 20 61 | 72 63 68 69 74 65 63 74 |n RISC a|rchitect|
|000015d0| 75 72 65 73 2e 0a 0a 57 | 65 20 61 72 65 20 67 6c |ures...W|e are gl|
|000015e0| 61 64 20 74 68 61 74 20 | 77 65 20 69 6d 70 6c 65 |ad that |we imple|
|000015f0| 6d 65 6e 74 65 64 20 74 | 68 65 20 6d 6f 73 74 20 |mented t|he most |
|00001600| 64 69 66 66 69 63 75 6c | 74 20 62 61 63 6b 20 65 |difficul|t back e|
|00001610| 6e 64 20 66 69 72 73 74 | 2e 0a 57 65 20 62 65 6c |nd first|..We bel|
|00001620| 69 65 76 65 20 74 68 61 | 74 2c 20 77 65 72 65 20 |ieve tha|t, were |
|00001630| 77 65 20 74 6f 20 68 61 | 76 65 20 73 74 61 72 74 |we to ha|ve start|
|00001640| 65 64 20 77 69 74 68 20 | 61 20 52 49 53 43 20 62 |ed with |a RISC b|
|00001650| 61 63 6b 20 65 6e 64 2c | 20 77 65 0a 77 6f 75 6c |ack end,| we.woul|
|00001660| 64 20 68 61 76 65 20 71 | 75 69 74 65 20 70 6f 73 |d have q|uite pos|
|00001670| 73 69 62 6c 79 20 61 72 | 63 68 69 74 65 63 74 65 |sibly ar|chitecte|
|00001680| 64 20 61 20 73 79 73 74 | 65 6d 20 77 68 65 72 65 |d a syst|em where|
|00001690| 20 72 65 74 72 6f 66 69 | 74 74 69 6e 67 0a 74 68 | retrofi|tting.th|
|000016a0| 65 20 65 78 6f 74 69 63 | 20 6d 65 63 68 61 6e 69 |e exotic| mechani|
|000016b0| 73 6d 73 20 6e 65 63 65 | 73 73 61 72 79 20 66 6f |sms nece|ssary fo|
|000016c0| 72 20 65 66 66 69 63 69 | 65 6e 74 20 38 30 78 38 |r effici|ent 80x8|
|000016d0| 36 20 73 75 70 70 6f 72 | 74 20 77 61 73 0a 64 69 |6 suppor|t was.di|
|000016e0| 66 66 69 63 75 6c 74 2e | 0a 0a 54 68 72 65 65 20 |fficult.|..Three |
|000016f0| 6d 61 6a 6f 72 20 70 72 | 6f 62 6c 65 6d 73 20 6d |major pr|oblems m|
|00001700| 61 6b 65 20 74 72 61 6e | 73 6c 61 74 69 6e 67 20 |ake tran|slating |
|00001710| 36 38 30 78 30 20 63 6f | 64 65 20 74 6f 20 38 30 |680x0 co|de to 80|
|00001720| 78 38 36 20 63 6f 64 65 | 20 64 69 66 66 69 63 75 |x86 code| difficu|
|00001730| 6c 74 3a 0a 0a 5c 62 65 | 67 69 6e 7b 65 6e 75 6d |lt:..\be|gin{enum|
|00001740| 65 72 61 74 65 7d 0a 5c | 69 74 65 6d 20 54 68 65 |erate}.\|item The|
|00001750| 20 38 30 78 38 36 20 68 | 61 73 20 6f 6e 6c 79 20 | 80x86 h|as only |
|00001760| 38 20 72 65 67 69 73 74 | 65 72 73 2c 20 77 68 69 |8 regist|ers, whi|
|00001770| 6c 65 20 74 68 65 20 36 | 38 30 78 30 20 68 61 73 |le the 6|80x0 has|
|00001780| 20 31 36 2e 0a 5c 69 74 | 65 6d 20 54 68 65 20 38 | 16..\it|em The 8|
|00001790| 30 78 38 36 20 69 73 20 | 6c 69 74 74 6c 65 20 65 |0x86 is |little e|
|000017a0| 6e 64 69 61 6e 2c 20 77 | 68 69 6c 65 20 74 68 65 |ndian, w|hile the|
|000017b0| 20 36 38 30 78 30 20 69 | 73 20 62 69 67 20 65 6e | 680x0 i|s big en|
|000017c0| 64 69 61 6e 2e 0a 5c 69 | 74 65 6d 20 54 68 65 20 |dian..\i|tem The |
|000017d0| 38 30 78 38 36 20 64 6f | 65 73 20 6e 6f 74 20 68 |80x86 do|es not h|
|000017e0| 61 76 65 20 67 65 6e 65 | 72 61 6c 2d 70 75 72 70 |ave gene|ral-purp|
|000017f0| 6f 73 65 20 70 6f 73 74 | 69 6e 63 72 65 6d 65 6e |ose post|incremen|
|00001800| 74 20 61 6e 64 20 70 72 | 65 64 65 63 72 65 6d 65 |t and pr|edecreme|
|00001810| 6e 74 0a 20 20 20 6f 70 | 65 72 61 74 6f 72 73 2c |nt. op|erators,|
|00001820| 20 77 68 69 63 68 20 61 | 72 65 20 75 73 65 64 20 | which a|re used |
|00001830| 66 72 65 71 75 65 6e 74 | 6c 79 20 69 6e 20 36 38 |frequent|ly in 68|
|00001840| 30 78 30 20 63 6f 64 65 | 2e 0a 5c 65 6e 64 7b 65 |0x0 code|..\end{e|
|00001850| 6e 75 6d 65 72 61 74 65 | 7d 0a 0a 4f 6e 20 74 68 |numerate|}..On th|
|00001860| 65 20 6f 74 68 65 72 20 | 68 61 6e 64 2c 20 73 65 |e other |hand, se|
|00001870| 76 65 72 61 6c 20 66 61 | 63 74 6f 72 73 20 6d 61 |veral fa|ctors ma|
|00001880| 6b 65 20 74 68 65 20 6a | 6f 62 20 65 61 73 69 65 |ke the j|ob easie|
|00001890| 72 3a 0a 0a 5c 62 65 67 | 69 6e 7b 65 6e 75 6d 65 |r:..\beg|in{enume|
|000018a0| 72 61 74 65 7d 0a 5c 69 | 74 65 6d 20 54 68 65 20 |rate}.\i|tem The |
|000018b0| 38 30 78 38 36 20 68 61 | 73 20 61 6c 6c 20 6f 66 |80x86 ha|s all of|
|000018c0| 20 74 68 65 20 43 49 53 | 43 20 61 64 64 72 65 73 | the CIS|C addres|
|000018d0| 73 69 6e 67 20 6d 6f 64 | 65 73 20 63 6f 6d 6d 6f |sing mod|es commo|
|000018e0| 6e 6c 79 20 75 73 65 64 | 20 69 6e 20 36 38 30 78 |nly used| in 680x|
|000018f0| 30 20 63 6f 64 65 2e 0a | 5c 69 74 65 6d 20 54 68 |0 code..|\item Th|
|00001900| 65 20 38 30 78 38 36 20 | 68 61 73 20 43 43 20 62 |e 80x86 |has CC b|
|00001910| 69 74 73 20 74 68 61 74 | 20 6d 61 70 20 64 69 72 |its that| map dir|
|00001920| 65 63 74 6c 79 20 74 6f | 20 74 68 65 69 72 20 36 |ectly to| their 6|
|00001930| 38 30 78 30 20 63 6f 75 | 6e 74 65 72 70 61 72 74 |80x0 cou|nterpart|
|00001940| 73 0a 20 20 20 28 65 78 | 63 65 70 74 20 66 6f 72 |s. (ex|cept for|
|00001950| 20 74 68 65 20 36 38 30 | 78 30 27 73 20 58 20 62 | the 680|x0's X b|
|00001960| 69 74 29 2e 0a 5c 69 74 | 65 6d 20 54 68 65 20 38 |it)..\it|em The 8|
|00001970| 30 78 38 36 20 73 75 70 | 70 6f 72 74 73 20 38 2d |0x86 sup|ports 8-|
|00001980| 2c 20 31 36 2d 20 61 6e | 64 20 33 32 2d 62 69 74 |, 16- an|d 32-bit|
|00001990| 20 6f 70 65 72 61 74 69 | 6f 6e 73 2c 20 28 61 6c | operati|ons, (al|
|000019a0| 74 68 6f 75 67 68 20 69 | 74 20 63 61 6e 20 6f 6e |though i|t can on|
|000019b0| 6c 79 0a 20 20 20 73 75 | 70 70 6f 72 74 20 38 20 |ly. su|pport 8 |
|000019c0| 62 69 74 20 6f 70 65 72 | 61 74 69 6f 6e 73 20 6f |bit oper|ations o|
|000019d0| 6e 20 66 6f 75 72 20 6f | 66 20 69 74 73 20 72 65 |n four o|f its re|
|000019e0| 67 69 73 74 65 72 73 29 | 2e 0a 5c 69 74 65 6d 20 |gisters)|..\item |
|000019f0| 54 68 65 20 38 30 78 38 | 36 20 61 6e 64 20 36 38 |The 80x8|6 and 68|
|00001a00| 30 78 30 20 68 61 76 65 | 20 61 6e 61 6c 61 67 6f |0x0 have| analago|
|00001a10| 75 73 20 63 6f 6e 64 69 | 74 69 6f 6e 61 6c 20 62 |us condi|tional b|
|00001a20| 72 61 6e 63 68 20 69 6e | 73 74 72 75 63 74 69 6f |ranch in|structio|
|00001a30| 6e 73 2e 0a 5c 69 74 65 | 6d 20 54 68 65 20 38 30 |ns..\ite|m The 80|
|00001a40| 78 38 36 20 61 6c 6c 6f | 77 73 20 75 6e 61 6c 69 |x86 allo|ws unali|
|00001a50| 67 6e 65 64 20 6d 65 6d | 6f 72 79 20 61 63 63 65 |gned mem|ory acce|
|00001a60| 73 73 65 73 20 77 69 74 | 68 6f 75 74 20 73 75 62 |sses wit|hout sub|
|00001a70| 73 74 61 6e 74 69 61 6c | 20 6f 76 65 72 68 65 61 |stantial| overhea|
|00001a80| 64 2e 0a 5c 65 6e 64 7b | 65 6e 75 6d 65 72 61 74 |d..\end{|enumerat|
|00001a90| 65 7d 0a 0a 54 68 65 20 | 74 6f 75 67 68 65 73 74 |e}..The |toughest|
|00001aa0| 20 70 72 6f 62 6c 65 6d | 20 69 73 20 74 68 65 20 | problem| is the |
|00001ab0| 6c 61 63 6b 20 6f 66 20 | 72 65 67 69 73 74 65 72 |lack of |register|
|00001ac0| 73 2e 20 20 4f 6e 20 33 | 32 2d 72 65 67 69 73 74 |s. On 3|2-regist|
|00001ad0| 65 72 20 52 49 53 43 0a | 61 72 63 68 69 74 65 63 |er RISC.|architec|
|00001ae0| 74 75 72 65 73 20 69 74 | 27 73 20 65 61 73 79 20 |tures it|'s easy |
|00001af0| 74 6f 20 61 6c 6c 6f 63 | 61 74 65 20 6f 6e 65 20 |to alloc|ate one |
|00001b00| 52 49 53 43 20 72 65 67 | 69 73 74 65 72 20 66 6f |RISC reg|ister fo|
|00001b10| 72 20 65 61 63 68 0a 36 | 38 30 78 30 20 72 65 67 |r each.6|80x0 reg|
|00001b20| 69 73 74 65 72 2c 20 62 | 75 74 20 6f 6e 20 74 68 |ister, b|ut on th|
|00001b30| 65 20 38 30 78 38 36 20 | 61 20 64 69 66 66 65 72 |e 80x86 |a differ|
|00001b40| 65 6e 74 20 61 70 70 72 | 6f 61 63 68 20 69 73 20 |ent appr|oach is |
|00001b50| 6e 65 65 64 65 64 2e 0a | 54 68 65 20 6f 62 76 69 |needed..|The obvi|
|00001b60| 6f 75 73 20 73 6f 6c 75 | 74 69 6f 6e 20 69 73 20 |ous solu|tion is |
|00001b70| 74 6f 20 70 65 72 66 6f | 72 6d 20 66 75 6c 6c 2d |to perfo|rm full-|
|00001b80| 62 6c 6f 77 6e 20 69 6e | 74 65 72 2d 62 6c 6f 63 |blown in|ter-bloc|
|00001b90| 6b 20 72 65 67 69 73 74 | 65 72 0a 61 6c 6c 6f 63 |k regist|er.alloc|
|00001ba0| 61 74 69 6f 6e 2c 20 62 | 75 74 20 77 65 20 66 65 |ation, b|ut we fe|
|00001bb0| 61 72 20 74 68 61 74 20 | 75 73 69 6e 67 20 74 72 |ar that |using tr|
|00001bc0| 61 64 69 74 69 6f 6e 61 | 6c 20 63 6f 6d 70 69 6c |aditiona|l compil|
|00001bd0| 65 72 20 74 65 63 68 6e | 69 71 75 65 73 0a 77 6f |er techn|iques.wo|
|00001be0| 75 6c 64 20 62 65 20 75 | 6e 61 63 63 65 70 74 61 |uld be u|naccepta|
|00001bf0| 62 6c 79 20 73 6c 6f 77 | 2e 0a 0a 46 6f 72 20 6e |bly slow|...For n|
|00001c00| 6f 77 2c 20 77 65 20 68 | 61 76 65 20 61 64 6f 70 |ow, we h|ave adop|
|00001c10| 74 65 64 20 61 20 73 69 | 6d 70 6c 65 20 63 6f 6e |ted a si|mple con|
|00001c20| 73 74 72 61 69 6e 74 3a | 20 62 65 74 77 65 65 6e |straint:| between|
|00001c30| 20 62 61 73 69 63 20 62 | 6c 6f 63 6b 73 2c 0a 61 | basic b|locks,.a|
|00001c40| 6c 6c 20 72 65 67 69 73 | 74 65 72 73 20 61 6e 64 |ll regis|ters and|
|00001c50| 20 6c 69 76 65 20 43 43 | 20 62 69 74 73 20 6d 75 | live CC| bits mu|
|00001c60| 73 74 20 72 65 73 69 64 | 65 20 69 6e 20 74 68 65 |st resid|e in the|
|00001c70| 69 72 20 63 61 6e 6f 6e | 69 63 61 6c 20 68 6f 6d |ir canon|ical hom|
|00001c80| 65 0a 69 6e 20 6d 65 6d | 6f 72 79 2e 20 20 57 69 |e.in mem|ory. Wi|
|00001c90| 74 68 69 6e 20 61 20 62 | 6c 6f 63 6b 2c 20 61 6e |thin a b|lock, an|
|00001ca0| 79 74 68 69 6e 67 20 67 | 6f 65 73 2e 20 20 53 6f |ything g|oes. So|
|00001cb0| 20 77 68 61 74 20 6c 69 | 62 65 72 74 69 65 73 20 | what li|berties |
|00001cc0| 64 6f 65 73 0a 73 79 6e | 36 38 6b 20 74 61 6b 65 |does.syn|68k take|
|00001cd0| 20 77 69 74 68 69 6e 20 | 61 20 62 6c 6f 63 6b 3f | within |a block?|
|00001ce0| 0a 0a 54 68 65 20 38 30 | 78 38 36 20 72 65 67 69 |..The 80|x86 regi|
|00001cf0| 73 74 65 72 20 73 65 74 | 20 69 73 20 74 72 65 61 |ster set| is trea|
|00001d00| 74 65 64 20 61 73 20 61 | 20 63 61 63 68 65 20 66 |ted as a| cache f|
|00001d10| 6f 72 20 72 65 63 65 6e | 74 6c 79 20 75 73 65 64 |or recen|tly used|
|00001d20| 0a 36 38 30 78 30 20 72 | 65 67 69 73 74 65 72 73 |.680x0 r|egisters|
|00001d30| 2c 20 61 6e 64 20 74 68 | 65 20 38 30 78 38 36 20 |, and th|e 80x86 |
|00001d40| 43 43 20 62 69 74 73 20 | 61 72 65 20 75 73 65 64 |CC bits |are used|
|00001d50| 20 61 73 20 61 20 63 61 | 63 68 65 20 66 6f 72 20 | as a ca|che for |
|00001d60| 74 68 65 0a 36 38 30 78 | 30 20 43 43 20 62 69 74 |the.680x|0 CC bit|
|00001d70| 73 2e 20 20 41 74 20 61 | 6e 79 20 70 61 72 74 69 |s. At a|ny parti|
|00001d80| 63 75 6c 61 72 20 70 6f | 69 6e 74 20 77 69 74 68 |cular po|int with|
|00001d90| 69 6e 20 61 20 62 6c 6f | 63 6b 2c 20 65 61 63 68 |in a blo|ck, each|
|00001da0| 20 36 38 30 78 30 0a 72 | 65 67 69 73 74 65 72 20 | 680x0.r|egister |
|00001db0| 69 73 20 65 69 74 68 65 | 72 20 73 69 74 74 69 6e |is eithe|r sittin|
|00001dc0| 67 20 69 6e 20 69 74 73 | 20 6d 65 6d 6f 72 79 20 |g in its| memory |
|00001dd0| 68 6f 6d 65 20 6f 72 20 | 69 73 20 63 61 63 68 65 |home or |is cache|
|00001de0| 64 20 69 6e 20 61 6e 0a | 38 30 78 38 36 20 72 65 |d in an.|80x86 re|
|00001df0| 67 69 73 74 65 72 2c 20 | 61 6e 64 20 65 61 63 68 |gister, |and each|
|00001e00| 20 6c 69 76 65 20 36 38 | 30 78 30 20 43 43 20 62 | live 68|0x0 CC b|
|00001e10| 69 74 20 69 73 20 65 69 | 74 68 65 72 20 63 61 63 |it is ei|ther cac|
|00001e20| 68 65 64 20 69 6e 20 69 | 74 73 0a 38 30 78 38 36 |hed in i|ts.80x86|
|00001e30| 20 65 71 75 69 76 61 6c | 65 6e 74 20 6f 72 20 73 | equival|ent or s|
|00001e40| 74 6f 72 65 64 20 69 6e | 20 69 74 73 20 6d 65 6d |tored in| its mem|
|00001e50| 6f 72 79 20 68 6f 6d 65 | 2e 20 20 43 61 63 68 65 |ory home|. Cache|
|00001e60| 64 20 72 65 67 69 73 74 | 65 72 73 0a 6d 61 79 20 |d regist|ers.may |
|00001e70| 62 65 20 69 6e 20 63 61 | 6e 6f 6e 69 63 61 6c 20 |be in ca|nonical |
|00001e80| 66 6f 72 6d 2c 20 6d 61 | 79 20 62 65 20 62 79 74 |form, ma|y be byt|
|00001e90| 65 20 73 77 61 70 70 65 | 64 2c 20 6d 61 79 20 68 |e swappe|d, may h|
|00001ea0| 61 76 65 20 6f 6e 6c 79 | 20 74 68 65 69 72 0a 6c |ave only| their.l|
|00001eb0| 6f 77 20 74 77 6f 20 62 | 79 74 65 73 20 73 77 61 |ow two b|ytes swa|
|00001ec0| 70 70 65 64 2c 20 6f 72 | 20 6d 61 79 20 62 65 20 |pped, or| may be |
|00001ed0| 6f 66 66 73 65 74 20 62 | 79 20 61 20 6b 6e 6f 77 |offset b|y a know|
|00001ee0| 6e 20 63 6f 6e 73 74 61 | 6e 74 20 66 72 6f 6d 0a |n consta|nt from.|
|00001ef0| 74 68 65 69 72 20 61 63 | 74 75 61 6c 20 76 61 6c |their ac|tual val|
|00001f00| 75 65 2e 0a 0a 45 61 63 | 68 20 36 38 30 78 30 20 |ue...Eac|h 680x0 |
|00001f10| 69 6e 73 74 72 75 63 74 | 69 6f 6e 20 63 61 6e 20 |instruct|ion can |
|00001f20| 72 65 71 75 69 72 65 20 | 74 68 61 74 20 36 38 30 |require |that 680|
|00001f30| 78 30 20 72 65 67 69 73 | 74 65 72 73 20 62 65 20 |x0 regis|ters be |
|00001f40| 63 61 63 68 65 64 0a 69 | 6e 20 70 61 72 74 69 63 |cached.i|n partic|
|00001f50| 75 6c 61 72 20 77 61 79 | 73 3b 20 74 68 65 20 63 |ular way|s; the c|
|00001f60| 6f 6d 70 69 6c 61 74 69 | 6f 6e 20 65 6e 67 69 6e |ompilati|on engin|
|00001f70| 65 20 67 65 6e 65 72 61 | 74 65 73 20 74 68 65 20 |e genera|tes the |
|00001f80| 6d 69 6e 69 6d 61 6c 0a | 63 6f 64 65 20 6e 65 65 |minimal.|code nee|
|00001f90| 64 65 64 20 74 6f 20 73 | 61 74 69 73 66 79 20 74 |ded to s|atisfy t|
|00001fa0| 68 6f 73 65 20 63 6f 6e | 73 74 72 61 69 6e 74 73 |hose con|straints|
|00001fb0| 20 61 6e 64 20 74 68 65 | 6e 20 63 61 6c 6c 73 20 | and the|n calls |
|00001fc0| 61 20 73 65 71 75 65 6e | 63 65 0a 6f 66 20 72 6f |a sequen|ce.of ro|
|00001fd0| 75 74 69 6e 65 73 20 74 | 6f 20 67 65 6e 65 72 61 |utines t|o genera|
|00001fe0| 74 65 20 74 68 65 20 6e | 61 74 69 76 65 20 63 6f |te the n|ative co|
|00001ff0| 64 65 2e 20 20 41 73 20 | 65 61 63 68 20 36 38 30 |de. As |each 680|
|00002000| 78 30 20 69 6e 73 74 72 | 75 63 74 69 6f 6e 0a 69 |x0 instr|uction.i|
|00002010| 73 20 70 72 6f 63 65 73 | 73 65 64 2c 20 65 61 63 |s proces|sed, eac|
|00002020| 68 20 36 38 30 78 30 20 | 72 65 67 69 73 74 65 72 |h 680x0 |register|
|00002030| 27 73 20 63 61 63 68 65 | 20 73 74 61 74 75 73 20 |'s cache| status |
|00002040| 69 73 20 75 70 64 61 74 | 65 64 2e 20 20 44 69 72 |is updat|ed. Dir|
|00002050| 74 79 0a 72 65 67 69 73 | 74 65 72 73 20 61 72 65 |ty.regis|ters are|
|00002060| 20 63 61 6e 6f 6e 69 63 | 61 6c 69 7a 65 64 20 61 | canonic|alized a|
|00002070| 6e 64 20 73 70 69 6c 6c | 65 64 20 62 61 63 6b 20 |nd spill|ed back |
|00002080| 74 6f 20 6d 65 6d 6f 72 | 79 20 61 74 20 74 68 65 |to memor|y at the|
|00002090| 20 65 6e 64 0a 6f 66 20 | 65 61 63 68 20 62 6c 6f | end.of |each blo|
|000020a0| 63 6b 20 28 6f 72 20 77 | 68 65 6e 20 77 65 20 72 |ck (or w|hen we r|
|000020b0| 75 6e 20 6f 75 74 20 6f | 66 20 38 30 78 38 36 20 |un out o|f 80x86 |
|000020c0| 72 65 67 69 73 74 65 72 | 73 20 61 6e 64 20 77 65 |register|s and we|
|000020d0| 20 6e 65 65 64 0a 74 6f | 20 6d 61 6b 65 20 72 6f | need.to| make ro|
|000020e0| 6f 6d 29 2e 0a 0a 57 65 | 20 61 6c 6c 6f 77 20 36 |om)...We| allow 6|
|000020f0| 38 30 78 30 20 72 65 67 | 69 73 74 65 72 73 20 74 |80x0 reg|isters t|
|00002100| 6f 20 62 65 20 63 61 63 | 68 65 64 20 77 69 74 68 |o be cac|hed with|
|00002110| 20 76 61 72 79 69 6e 67 | 20 62 79 74 65 20 6f 72 | varying| byte or|
|00002120| 64 65 72 73 20 61 6e 64 | 0a 6f 66 66 73 65 74 73 |ders and|.offsets|
|00002130| 20 73 6f 20 74 68 61 74 | 20 77 65 20 63 61 6e 20 | so that| we can |
|00002140| 70 65 72 66 6f 72 6d 20 | 74 68 65 20 6f 70 74 69 |perform |the opti|
|00002150| 6d 69 7a 61 74 69 6f 6e | 73 20 6f 66 20 6c 61 7a |mization|s of laz|
|00002160| 79 20 62 79 74 65 0a 73 | 77 61 70 70 69 6e 67 20 |y byte.s|wapping |
|00002170| 61 6e 64 20 6c 61 7a 79 | 20 63 6f 6e 73 74 61 6e |and lazy| constan|
|00002180| 74 20 6f 66 66 73 65 74 | 74 69 6e 67 2e 20 20 49 |t offset|ting. I|
|00002190| 66 20 74 68 65 20 36 38 | 30 78 30 20 70 72 6f 67 |f the 68|0x0 prog|
|000021a0| 72 61 6d 20 6c 6f 61 64 | 73 0a 61 20 72 65 67 69 |ram load|s.a regi|
|000021b0| 73 74 65 72 20 66 72 6f | 6d 20 6d 65 6d 6f 72 79 |ster fro|m memory|
|000021c0| 20 61 6e 64 20 74 68 65 | 6e 20 65 6e 64 73 20 75 | and the|n ends u|
|000021d0| 70 20 77 72 69 74 69 6e | 67 20 69 74 20 6f 75 74 |p writin|g it out|
|000021e0| 20 6c 61 74 65 72 2c 20 | 77 65 0a 61 76 6f 69 64 | later, |we.avoid|
|000021f0| 20 75 6e 6e 65 63 65 73 | 73 61 72 79 20 62 79 74 | unneces|sary byt|
|00002200| 65 20 73 77 61 70 73 20 | 62 79 20 6e 6f 74 20 63 |e swaps |by not c|
|00002210| 61 6e 6f 6e 69 63 61 6c | 69 7a 69 6e 67 20 74 68 |anonical|izing th|
|00002220| 65 20 76 61 6c 75 65 0a | 69 6d 6d 65 64 69 61 74 |e value.|immediat|
|00002230| 65 6c 79 2e 20 20 4c 61 | 7a 79 20 63 6f 6e 73 74 |ely. La|zy const|
|00002240| 61 6e 74 20 6f 66 66 73 | 65 74 74 69 6e 67 20 6d |ant offs|etting m|
|00002250| 69 74 69 67 61 74 65 73 | 20 74 68 65 20 6f 76 65 |itigates| the ove|
|00002260| 72 68 65 61 64 20 6f 66 | 0a 70 6f 73 74 69 6e 63 |rhead of|.postinc|
|00002270| 72 65 6d 65 6e 74 20 61 | 6e 64 20 70 72 65 64 65 |rement a|nd prede|
|00002280| 63 72 65 6d 65 6e 74 20 | 73 69 64 65 20 65 66 66 |crement |side eff|
|00002290| 65 63 74 73 2e 20 20 46 | 6f 72 20 65 78 61 6d 70 |ects. F|or examp|
|000022a0| 6c 65 2c 20 74 68 69 73 | 0a 36 38 30 78 30 20 63 |le, this|.680x0 c|
|000022b0| 6f 64 65 3a 0a 0a 5c 62 | 65 67 69 6e 7b 76 65 72 |ode:..\b|egin{ver|
|000022c0| 62 61 74 69 6d 7d 0a 09 | 70 65 61 09 09 30 78 31 |batim}..|pea..0x1|
|000022d0| 0a 09 70 65 61 09 09 30 | 78 32 0a 09 70 65 61 09 |..pea..0|x2..pea.|
|000022e0| 09 30 78 33 0a 09 70 65 | 61 09 09 30 78 34 0a 09 |.0x3..pe|a..0x4..|
|000022f0| 2e 2e 2e 0a 5c 65 6e 64 | 7b 76 65 72 62 61 74 69 |....\end|{verbati|
|00002300| 6d 7d 0a 0a 62 65 63 6f | 6d 65 73 20 74 68 69 73 |m}..beco|mes this|
|00002310| 20 38 30 78 38 36 20 63 | 6f 64 65 3a 0a 0a 5c 62 | 80x86 c|ode:..\b|
|00002320| 65 67 69 6e 7b 76 65 72 | 62 61 74 69 6d 7d 0a 09 |egin{ver|batim}..|
|00002330| 6d 6f 76 6c 09 5f 61 37 | 2c 25 65 64 69 0a 09 6d |movl._a7|,%edi..m|
|00002340| 6f 76 6c 09 24 30 78 30 | 31 30 30 30 30 30 30 2c |ovl.$0x0|1000000,|
|00002350| 2d 34 28 25 65 64 69 29 | 09 3b 20 22 70 75 73 68 |-4(%edi)|.; "push|
|00002360| 22 20 62 69 67 2d 65 6e | 64 69 61 6e 20 63 6f 6e |" big-en|dian con|
|00002370| 73 74 61 6e 74 0a 09 6d | 6f 76 6c 09 24 30 78 30 |stant..m|ovl.$0x0|
|00002380| 32 30 30 30 30 30 30 2c | 2d 38 28 25 65 64 69 29 |2000000,|-8(%edi)|
|00002390| 0a 09 6d 6f 76 6c 09 24 | 30 78 30 33 30 30 30 30 |..movl.$|0x030000|
|000023a0| 30 30 2c 2d 31 32 28 25 | 65 64 69 29 0a 09 6d 6f |00,-12(%|edi)..mo|
|000023b0| 76 6c 09 24 30 78 30 34 | 30 30 30 30 30 30 2c 2d |vl.$0x04|000000,-|
|000023c0| 31 36 28 25 65 64 69 29 | 0a 09 2e 2e 2e 20 3c 6d |16(%edi)|..... <m|
|000023d0| 6f 72 65 20 75 73 65 73 | 20 6f 66 20 61 37 20 6d |ore uses| of a7 m|
|000023e0| 61 79 20 66 6f 6c 6c 6f | 77 2c 20 61 6e 64 20 74 |ay follo|w, and t|
|000023f0| 68 65 79 27 6c 6c 20 75 | 73 65 20 25 65 64 69 3e |hey'll u|se %edi>|
|00002400| 0a 09 73 75 62 6c 09 24 | 31 36 2c 25 65 64 69 0a |..subl.$|16,%edi.|
|00002410| 09 6d 6f 76 6c 09 24 65 | 64 69 2c 5f 61 37 0a 09 |.movl.$e|di,_a7..|
|00002420| 2e 2e 2e 0a 5c 65 6e 64 | 7b 76 65 72 62 61 74 69 |....\end|{verbati|
|00002430| 6d 7d 0a 0a 41 73 20 6d | 65 6e 74 69 6f 6e 65 64 |m}..As m|entioned|
|00002440| 20 61 62 6f 76 65 2c 20 | 77 65 20 75 73 65 20 74 | above, |we use t|
|00002450| 68 65 20 38 30 78 38 36 | 20 63 6f 6e 64 69 74 69 |he 80x86| conditi|
|00002460| 6f 6e 20 63 6f 64 65 20 | 62 69 74 73 20 61 73 20 |on code |bits as |
|00002470| 61 20 63 61 63 68 65 0a | 66 6f 72 20 74 68 65 20 |a cache.|for the |
|00002480| 72 65 61 6c 20 36 38 30 | 78 30 20 43 43 20 62 69 |real 680|x0 CC bi|
|00002490| 74 73 2e 20 20 41 6c 74 | 68 6f 75 67 68 20 6c 69 |ts. Alt|hough li|
|000024a0| 76 65 20 63 61 63 68 65 | 64 20 43 43 20 62 69 74 |ve cache|d CC bit|
|000024b0| 73 20 61 72 65 0a 6f 63 | 63 61 73 69 6f 6e 61 6c |s are.oc|casional|
|000024c0| 6c 79 20 73 70 69 6c 6c | 65 64 20 62 61 63 6b 20 |ly spill|ed back |
|000024d0| 74 6f 20 6d 65 6d 6f 72 | 79 20 62 65 63 61 75 73 |to memor|y becaus|
|000024e0| 65 20 73 6f 6d 65 20 38 | 30 78 38 36 20 69 6e 73 |e some 8|0x86 ins|
|000024f0| 74 72 75 63 74 69 6f 6e | 0a 69 73 20 61 62 6f 75 |truction|.is abou|
|00002500| 74 20 74 6f 20 63 6c 6f | 62 62 65 72 20 74 68 65 |t to clo|bber the|
|00002510| 6d 2c 20 74 68 69 73 20 | 74 72 69 63 6b 20 61 6c |m, this |trick al|
|00002520| 6d 6f 73 74 20 61 6c 77 | 61 79 73 20 77 6f 72 6b |most alw|ays work|
|00002530| 73 2e 20 20 55 73 69 6e | 67 0a 38 30 78 38 36 20 |s. Usin|g.80x86 |
|00002540| 43 43 20 62 69 74 73 2c | 20 77 65 20 63 61 6e 20 |CC bits,| we can |
|00002550| 66 72 65 71 75 65 6e 74 | 6c 79 20 67 65 74 20 61 |frequent|ly get a|
|00002560| 77 61 79 20 77 69 74 68 | 20 65 78 74 72 65 6d 65 |way with| extreme|
|00002570| 6c 79 20 63 6f 6e 63 69 | 73 65 0a 63 6f 64 65 20 |ly conci|se.code |
|00002580| 73 65 71 75 65 6e 63 65 | 73 3b 20 66 6f 72 20 65 |sequence|s; for e|
|00002590| 78 61 6d 70 6c 65 2c 20 | 61 20 36 38 30 78 30 20 |xample, |a 680x0 |
|000025a0| 63 6f 6d 70 61 72 65 20 | 61 6e 64 20 63 6f 6e 64 |compare |and cond|
|000025b0| 69 74 69 6f 6e 61 6c 20 | 62 72 61 6e 63 68 0a 62 |itional |branch.b|
|000025c0| 65 63 6f 6d 65 73 20 61 | 6e 20 38 30 78 38 36 20 |ecomes a|n 80x86 |
|000025d0| 63 6f 6d 70 61 72 65 20 | 61 6e 64 20 63 6f 6e 64 |compare |and cond|
|000025e0| 69 74 69 6f 6e 61 6c 20 | 62 72 61 6e 63 68 2e 0a |itional |branch..|
|000025f0| 0a 5c 73 65 63 74 69 6f | 6e 7b 53 65 6c 66 2d 6d |.\sectio|n{Self-m|
|00002600| 6f 64 69 66 79 69 6e 67 | 20 63 6f 64 65 7d 0a 0a |odifying| code}..|
|00002610| 4c 69 6b 65 20 6d 6f 73 | 74 20 64 79 6e 61 6d 69 |Like mos|t dynami|
|00002620| 63 61 6c 6c 79 20 63 6f | 6d 70 69 6c 69 6e 67 20 |cally co|mpiling |
|00002630| 65 6d 75 6c 61 74 6f 72 | 73 2c 20 73 79 6e 36 38 |emulator|s, syn68|
|00002640| 6b 20 64 6f 65 73 6e 27 | 74 20 64 65 74 65 63 74 |k doesn'|t detect|
|00002650| 0a 73 65 6c 66 2d 6d 6f | 64 69 66 79 69 6e 67 20 |.self-mo|difying |
|00002660| 63 6f 64 65 3b 20 74 68 | 65 20 6f 76 65 72 68 65 |code; th|e overhe|
|00002670| 61 64 20 69 73 20 74 6f | 6f 20 68 69 67 68 2e 20 |ad is to|o high. |
|00002680| 20 46 6f 72 74 75 6e 61 | 74 65 6c 79 2c 0a 73 65 | Fortuna|tely,.se|
|00002690| 6c 66 2d 6d 6f 64 69 66 | 79 69 6e 67 20 70 72 6f |lf-modif|ying pro|
|000026a0| 67 72 61 6d 73 20 64 6f | 6e 27 74 20 77 6f 72 6b |grams do|n't work|
|000026b0| 20 6f 6e 20 74 68 65 20 | 72 65 61 6c 20 36 38 30 | on the |real 680|
|000026c0| 34 30 20 65 69 74 68 65 | 72 2e 20 20 57 65 0a 72 |40 eithe|r. We.r|
|000026d0| 65 6c 79 20 6f 6e 20 74 | 68 65 20 70 72 6f 67 72 |ely on t|he progr|
|000026e0| 61 6d 20 6d 61 6b 69 6e | 67 20 65 78 70 6c 69 63 |am makin|g explic|
|000026f0| 69 74 20 73 79 73 74 65 | 6d 20 63 61 6c 6c 73 20 |it syste|m calls |
|00002700| 74 6f 20 66 6c 75 73 68 | 20 74 68 65 20 63 61 63 |to flush| the cac|
|00002710| 68 65 73 0a 77 68 65 6e | 65 76 65 72 20 36 38 30 |hes.when|ever 680|
|00002720| 78 30 20 63 6f 64 65 20 | 6d 61 79 20 68 61 76 65 |x0 code |may have|
|00002730| 20 62 65 65 6e 20 6d 6f | 64 69 66 69 65 64 20 6f | been mo|dified o|
|00002740| 72 20 63 72 65 61 74 65 | 64 2e 20 20 53 6f 6d 65 |r create|d. Some|
|00002750| 20 70 72 6f 67 72 61 6d | 73 0a 28 6c 69 6b 65 20 | program|s.(like |
|00002760| 48 79 70 65 72 43 61 72 | 64 29 20 66 6c 75 73 68 |HyperCar|d) flush|
|00002770| 20 74 68 65 20 63 61 63 | 68 65 73 20 76 65 72 79 | the cac|hes very|
|00002780| 20 6f 66 74 65 6e 2c 20 | 77 68 69 63 68 20 63 61 | often, |which ca|
|00002790| 6e 20 63 61 75 73 65 20 | 72 65 61 6c 0a 70 65 72 |n cause |real.per|
|000027a0| 66 6f 72 6d 61 6e 63 65 | 20 68 65 61 64 61 63 68 |formance| headach|
|000027b0| 65 73 20 69 66 20 63 6f | 64 65 20 69 73 20 63 6f |es if co|de is co|
|000027c0| 6e 74 69 6e 75 6f 75 73 | 6c 79 20 72 65 63 6f 6d |ntinuous|ly recom|
|000027d0| 70 69 6c 65 64 2e 20 20 | 57 65 20 68 61 76 65 0a |piled. |We have.|
|000027e0| 73 6f 6c 76 65 64 20 74 | 68 69 73 20 70 72 6f 62 |solved t|his prob|
|000027f0| 6c 65 6d 20 62 79 20 63 | 68 65 63 6b 73 75 6d 6d |lem by c|hecksumm|
|00002800| 69 6e 67 20 36 38 30 78 | 30 20 62 6c 6f 63 6b 73 |ing 680x|0 blocks|
|00002810| 20 61 73 20 74 68 65 79 | 20 61 72 65 20 63 6f 6d | as they| are com|
|00002820| 70 69 6c 65 64 0a 61 6e | 64 20 6f 6e 6c 79 20 64 |piled.an|d only d|
|00002830| 65 63 6f 6d 70 69 6c 69 | 6e 67 20 62 6c 6f 63 6b |ecompili|ng block|
|00002840| 73 20 77 68 69 63 68 20 | 66 61 69 6c 20 74 68 65 |s which |fail the|
|00002850| 69 72 20 63 68 65 63 6b | 73 75 6d 73 2e 20 20 54 |ir check|sums. T|
|00002860| 68 69 73 0a 6f 70 74 69 | 6d 69 7a 61 74 69 6f 6e |his.opti|mization|
|00002870| 20 61 6c 6f 6e 65 20 73 | 70 65 64 20 75 70 20 73 | alone s|ped up s|
|00002880| 6f 6d 65 20 48 79 70 65 | 72 43 61 72 64 20 73 74 |ome Hype|rCard st|
|00002890| 61 63 6b 73 20 62 79 20 | 61 20 66 61 63 74 6f 72 |acks by |a factor|
|000028a0| 20 6f 66 0a 74 68 72 65 | 65 20 6f 72 20 73 6f 2e | of.thre|e or so.|
|000028b0| 0a 0a 5c 73 65 63 74 69 | 6f 6e 7b 52 65 73 70 6f |..\secti|on{Respo|
|000028c0| 6e 73 69 76 65 6e 65 73 | 73 7d 0a 0a 52 65 73 70 |nsivenes|s}..Resp|
|000028d0| 6f 6e 73 69 76 65 6e 65 | 73 73 20 69 73 20 61 20 |onsivene|ss is a |
|000028e0| 63 6f 6e 63 65 72 6e 20 | 66 6f 72 20 61 6e 79 20 |concern |for any |
|000028f0| 64 79 6e 61 6d 69 63 20 | 63 6f 6d 70 69 6c 65 72 |dynamic |compiler|
|00002900| 2e 20 20 46 6f 72 74 75 | 6e 61 74 65 6c 79 2c 0a |. Fortu|nately,.|
|00002910| 73 79 6e 36 38 6b 20 69 | 73 20 6c 61 72 67 65 6c |syn68k i|s largel|
|00002920| 79 20 64 72 69 76 65 6e | 20 62 79 20 61 75 74 6f |y driven| by auto|
|00002930| 6d 61 74 69 63 61 6c 6c | 79 20 67 65 6e 65 72 61 |maticall|y genera|
|00002940| 74 65 64 20 6c 6f 6f 6b | 75 70 20 74 61 62 6c 65 |ted look|up table|
|00002950| 73 0a 73 6f 20 63 6f 6d | 70 69 6c 61 74 69 6f 6e |s.so com|pilation|
|00002960| 20 73 70 65 65 64 20 69 | 73 20 67 6f 6f 64 2e 20 | speed i|s good. |
|00002970| 20 4c 69 6b 65 20 6f 74 | 68 65 72 20 64 79 6e 61 | Like ot|her dyna|
|00002980| 6d 69 63 20 63 6f 6d 70 | 69 6c 65 72 73 2c 20 73 |mic comp|ilers, s|
|00002990| 79 6e 36 38 6b 0a 6f 6e | 6c 79 20 62 6f 74 68 65 |yn68k.on|ly bothe|
|000029a0| 72 73 20 74 6f 20 63 6f | 6d 70 69 6c 65 20 36 38 |rs to co|mpile 68|
|000029b0| 30 78 30 20 63 6f 64 65 | 20 77 68 65 6e 20 69 74 |0x0 code| when it|
|000029c0| 20 65 6e 63 6f 75 6e 74 | 65 72 73 20 69 74 20 66 | encount|ers it f|
|000029d0| 6f 72 20 74 68 65 0a 66 | 69 72 73 74 20 74 69 6d |or the.f|irst tim|
|000029e0| 65 2e 0a 0a 57 68 65 6e | 20 73 79 6e 36 38 6b 20 |e...When| syn68k |
|000029f0| 65 6e 63 6f 75 6e 74 65 | 72 73 20 6e 65 77 20 63 |encounte|rs new c|
|00002a00| 6f 64 65 2c 20 69 74 20 | 63 6f 6d 70 69 6c 65 73 |ode, it |compiles|
|00002a10| 20 6f 74 68 65 72 20 36 | 38 30 78 30 20 63 6f 64 | other 6|80x0 cod|
|00002a20| 65 20 74 68 61 74 0a 69 | 74 20 63 61 6e 20 72 65 |e that.i|t can re|
|00002a30| 61 63 68 20 66 72 6f 6d | 20 74 68 65 72 65 20 62 |ach from| there b|
|00002a40| 75 74 20 64 6f 65 73 20 | 6e 6f 74 20 63 6f 6d 70 |ut does |not comp|
|00002a50| 69 6c 65 20 74 68 72 6f | 75 67 68 20 6a 73 72 27 |ile thro|ugh jsr'|
|00002a60| 73 2e 20 20 4f 6e 6c 79 | 0a 77 68 65 6e 20 61 20 |s. Only|.when a |
|00002a70| 6a 73 72 20 69 73 20 61 | 63 74 75 61 6c 6c 79 20 |jsr is a|ctually |
|00002a80| 65 78 65 63 75 74 65 64 | 20 64 6f 65 73 20 73 79 |executed| does sy|
|00002a90| 6e 36 38 6b 20 63 6f 6d | 70 69 6c 65 20 74 68 65 |n68k com|pile the|
|00002aa0| 20 74 61 72 67 65 74 0a | 72 6f 75 74 69 6e 65 2e | target.|routine.|
|00002ab0| 20 20 4f 6e 63 65 20 74 | 68 61 74 20 74 61 72 67 | Once t|hat targ|
|00002ac0| 65 74 20 72 6f 75 74 69 | 6e 65 20 69 73 20 63 6f |et routi|ne is co|
|00002ad0| 6d 70 69 6c 65 64 2c 20 | 73 79 6e 36 38 6b 20 6d |mpiled, |syn68k m|
|00002ae0| 6f 64 69 66 69 65 73 0a | 74 68 65 20 6a 73 72 20 |odifies.|the jsr |
|00002af0| 68 61 6e 64 6c 65 72 20 | 74 6f 20 70 6f 69 6e 74 |handler |to point|
|00002b00| 20 64 69 72 65 63 74 6c | 79 20 74 6f 20 74 68 65 | directl|y to the|
|00002b10| 20 74 61 72 67 65 74 20 | 72 6f 75 74 69 6e 65 20 | target |routine |
|00002b20| 73 6f 20 74 68 61 74 0a | 74 68 65 20 6a 73 72 20 |so that.|the jsr |
|00002b30| 77 69 6c 6c 20 62 65 20 | 65 78 74 72 65 6d 65 6c |will be |extremel|
|00002b40| 79 20 66 61 73 74 20 74 | 68 65 20 73 65 63 6f 6e |y fast t|he secon|
|00002b50| 64 20 74 69 6d 65 20 69 | 74 20 69 73 20 65 78 65 |d time i|t is exe|
|00002b60| 63 75 74 65 64 2e 0a 57 | 65 27 76 65 20 66 6f 75 |cuted..W|e've fou|
|00002b70| 6e 64 20 74 68 61 74 20 | 6c 61 7a 69 6c 79 20 63 |nd that |lazily c|
|00002b80| 6f 6d 70 69 6c 69 6e 67 | 20 74 68 72 6f 75 67 68 |ompiling| through|
|00002b90| 20 6a 73 72 27 73 20 64 | 6f 65 73 20 61 20 67 6f | jsr's d|oes a go|
|00002ba0| 6f 64 20 6a 6f 62 20 6f | 66 0a 61 76 6f 69 64 69 |od job o|f.avoidi|
|00002bb0| 6e 67 20 63 6f 6d 70 69 | 6c 61 74 69 6f 6e 20 6c |ng compi|lation l|
|00002bc0| 61 67 20 74 68 61 74 20 | 6d 69 67 68 74 20 61 6e |ag that |might an|
|00002bd0| 6e 6f 79 20 74 68 65 20 | 75 73 65 72 2e 0a 0a 53 |noy the |user...S|
|00002be0| 79 6e 36 38 6b 20 64 6f | 65 73 20 6e 6f 74 20 61 |yn68k do|es not a|
|00002bf0| 74 74 65 6d 70 74 20 74 | 6f 20 67 65 6e 65 72 61 |ttempt t|o genera|
|00002c00| 74 65 20 6e 61 74 69 76 | 65 20 63 6f 64 65 20 66 |te nativ|e code f|
|00002c10| 6f 72 20 61 20 62 61 73 | 69 63 20 62 6c 6f 63 6b |or a bas|ic block|
|00002c20| 0a 75 6e 74 69 6c 20 74 | 68 61 74 20 62 6c 6f 63 |.until t|hat bloc|
|00002c30| 6b 20 28 6f 72 20 61 20 | 6e 65 61 72 62 79 20 6f |k (or a |nearby o|
|00002c40| 6e 65 29 20 68 61 73 20 | 62 65 65 6e 20 65 78 65 |ne) has |been exe|
|00002c50| 63 75 74 65 64 20 35 30 | 20 74 69 6d 65 73 2e 0a |cuted 50| times..|
|00002c60| 54 68 69 73 20 73 61 76 | 65 73 20 6d 65 6d 6f 72 |This sav|es memor|
|00002c70| 79 20 61 6e 64 20 73 6f | 6d 65 20 63 6f 6d 70 69 |y and so|me compi|
|00002c80| 6c 61 74 69 6f 6e 20 74 | 69 6d 65 2c 20 61 6c 74 |lation t|ime, alt|
|00002c90| 68 6f 75 67 68 20 77 65 | 20 68 61 76 65 6e 27 74 |hough we| haven't|
|00002ca0| 0a 6e 6f 74 69 63 65 64 | 20 61 6e 79 20 70 61 72 |.noticed| any par|
|00002cb0| 74 69 63 75 6c 61 72 20 | 73 6c 75 67 67 69 73 68 |ticular |sluggish|
|00002cc0| 6e 65 73 73 20 77 68 65 | 6e 20 63 6f 6d 70 69 6c |ness whe|n compil|
|00002cd0| 69 6e 67 20 74 6f 20 6e | 61 74 69 76 65 20 63 6f |ing to n|ative co|
|00002ce0| 64 65 2e 0a 0a 5c 73 65 | 63 74 69 6f 6e 7b 4f 74 |de...\se|ction{Ot|
|00002cf0| 68 65 72 20 6f 70 74 69 | 6d 69 7a 61 74 69 6f 6e |her opti|mization|
|00002d00| 73 7d 0a 0a 53 79 6e 36 | 38 6b 20 6d 61 69 6e 74 |s}..Syn6|8k maint|
|00002d10| 61 69 6e 73 20 61 6e 20 | 69 6e 74 65 72 6e 61 6c |ains an |internal|
|00002d20| 20 60 60 6a 73 72 20 73 | 74 61 63 6b 27 27 20 74 | ``jsr s|tack'' t|
|00002d30| 6f 20 73 70 65 65 64 20 | 75 70 20 74 68 65 20 63 |o speed |up the c|
|00002d40| 6f 6d 6d 6f 6e 0a 63 61 | 73 65 20 6f 66 20 6a 73 |ommon.ca|se of js|
|00002d50| 72 2f 72 74 73 2e 20 20 | 57 65 20 72 65 61 6c 69 |r/rts. |We reali|
|00002d60| 7a 65 20 74 68 61 74 20 | 74 68 65 20 72 74 73 20 |ze that |the rts |
|00002d70| 61 64 64 72 65 73 73 20 | 6d 69 67 68 74 20 68 61 |address |might ha|
|00002d80| 76 65 20 62 65 65 6e 0a | 66 69 64 64 6c 65 64 20 |ve been.|fiddled |
|00002d90| 77 69 74 68 2c 20 73 6f | 20 74 68 65 20 72 74 73 |with, so| the rts|
|00002da0| 20 68 61 6e 64 6c 65 72 | 20 76 65 72 69 66 69 65 | handler| verifie|
|00002db0| 73 20 61 74 20 72 75 6e | 74 69 6d 65 20 74 68 61 |s at run|time tha|
|00002dc0| 74 20 74 68 65 20 72 74 | 73 0a 61 64 64 72 65 73 |t the rt|s.addres|
|00002dd0| 73 20 6d 61 74 63 68 65 | 73 20 74 68 65 20 74 61 |s matche|s the ta|
|00002de0| 67 20 6f 6e 20 74 6f 70 | 20 6f 66 20 74 68 65 20 |g on top| of the |
|00002df0| 6a 73 72 20 73 74 61 63 | 6b 2e 20 20 49 66 20 69 |jsr stac|k. If i|
|00002e00| 74 20 6d 61 74 63 68 65 | 73 2c 0a 73 79 6e 36 38 |t matche|s,.syn68|
|00002e10| 6b 20 64 6f 65 73 20 61 | 20 66 61 73 74 20 6a 75 |k does a| fast ju|
|00002e20| 6d 70 2e 20 20 49 66 20 | 69 74 20 64 6f 65 73 6e |mp. If |it doesn|
|00002e30| 27 74 2c 20 73 79 6e 36 | 38 6b 20 6c 6f 6f 6b 73 |'t, syn6|8k looks|
|00002e40| 20 75 70 20 74 68 65 20 | 63 6f 64 65 0a 63 6f 72 | up the |code.cor|
|00002e50| 72 65 73 70 6f 6e 64 69 | 6e 67 20 74 6f 20 74 68 |respondi|ng to th|
|00002e60| 65 20 72 74 73 20 61 64 | 64 72 65 73 73 20 69 6e |e rts ad|dress in|
|00002e70| 20 61 20 68 61 73 68 20 | 74 61 62 6c 65 2e 0a 0a | a hash |table...|
|00002e80| 5c 73 65 63 74 69 6f 6e | 7b 4e 65 61 74 20 68 61 |\section|{Neat ha|
|00002e90| 63 6b 73 7d 0a 0a 54 68 | 65 20 6c 6f 77 2d 6c 65 |cks}..Th|e low-le|
|00002ea0| 76 65 6c 20 63 6f 64 65 | 20 67 65 6e 65 72 61 74 |vel code| generat|
|00002eb0| 69 6f 6e 20 72 6f 75 74 | 69 6e 65 73 20 66 6f 72 |ion rout|ines for|
|00002ec0| 20 74 68 65 20 38 30 78 | 38 36 20 62 61 63 6b 20 | the 80x|86 back |
|00002ed0| 65 6e 64 20 61 72 65 0a | 6d 61 63 68 69 6e 65 20 |end are.|machine |
|00002ee0| 67 65 6e 65 72 61 74 65 | 64 20 66 72 6f 6d 20 61 |generate|d from a|
|00002ef0| 73 73 65 6d 62 6c 79 20 | 6c 61 6e 67 75 61 67 65 |ssembly |language|
|00002f00| 20 74 65 6d 70 6c 61 74 | 65 73 2e 20 20 54 68 6f | templat|es. Tho|
|00002f10| 75 73 61 6e 64 73 20 6f | 66 0a 6f 70 65 72 61 6e |usands o|f.operan|
|00002f20| 64 20 70 65 72 6d 75 74 | 61 74 69 6f 6e 73 20 66 |d permut|ations f|
|00002f30| 6f 72 20 38 30 78 38 36 | 20 69 6e 73 74 72 75 63 |or 80x86| instruc|
|00002f40| 74 69 6f 6e 73 20 6f 66 | 20 69 6e 74 65 72 65 73 |tions of| interes|
|00002f50| 74 20 61 72 65 20 72 75 | 6e 0a 74 68 72 6f 75 67 |t are ru|n.throug|
|00002f60| 68 20 74 68 65 20 73 79 | 73 74 65 6d 27 73 20 61 |h the sy|stem's a|
|00002f70| 73 73 65 6d 62 6c 65 72 | 20 61 6e 64 20 61 6e 61 |ssembler| and ana|
|00002f80| 6c 79 7a 65 64 20 74 6f | 20 64 65 72 69 76 65 20 |lyzed to| derive |
|00002f90| 74 68 65 20 72 75 6c 65 | 73 0a 74 68 65 20 61 73 |the rule|s.the as|
|00002fa0| 73 65 6d 62 6c 65 72 20 | 75 73 65 73 20 74 6f 20 |sembler |uses to |
|00002fb0| 63 72 65 61 74 65 20 62 | 69 6e 61 72 69 65 73 2e |create b|inaries.|
|00002fc0| 20 20 54 68 6f 73 65 20 | 72 75 6c 65 73 20 61 72 | Those |rules ar|
|00002fd0| 65 20 65 6e 63 61 70 73 | 75 6c 61 74 65 64 0a 69 |e encaps|ulated.i|
|00002fe0| 6e 74 6f 20 43 20 63 6f | 64 65 20 61 6e 64 20 63 |nto C co|de and c|
|00002ff0| 6f 6d 70 69 6c 65 64 20 | 69 6e 74 6f 20 73 79 6e |ompiled |into syn|
|00003000| 36 38 6b 20 73 6f 20 77 | 65 20 63 61 6e 20 67 65 |68k so w|e can ge|
|00003010| 6e 65 72 61 74 65 20 62 | 69 6e 61 72 69 65 73 0a |nerate b|inaries.|
|00003020| 6f 6e 20 74 68 65 20 66 | 6c 79 2e 20 20 48 65 72 |on the f|ly. Her|
|00003030| 65 20 69 73 20 61 20 73 | 61 6d 70 6c 65 20 74 65 |e is a s|ample te|
|00003040| 6d 70 6c 61 74 65 3a 0a | 0a 5c 62 65 67 69 6e 7b |mplate:.|.\begin{|
|00003050| 76 65 72 62 61 74 69 6d | 7d 0a 20 20 7b 20 22 69 |verbatim|}. { "i|
|00003060| 33 38 36 5f 6c 65 61 6c | 5f 69 6e 64 6f 66 66 22 |386_leal|_indoff"|
|00003070| 2c 20 22 22 2c 20 22 22 | 2c 20 22 22 2c 20 22 22 |, "", ""|, "", ""|
|00003080| 2c 20 22 2d 22 2c 0a 20 | 20 20 20 20 20 22 6c 65 |, "-",. | "le|
|00003090| 61 6c 20 25 30 28 25 31 | 29 2c 25 32 22 2c 0a 20 |al %0(%1|),%2",. |
|000030a0| 20 20 20 20 20 7b 20 22 | 6f 66 66 73 65 74 22 2c | { "|offset",|
|000030b0| 20 22 62 61 73 65 22 2c | 20 22 64 73 74 22 20 7d | "base",| "dst" }|
|000030c0| 2c 0a 20 20 20 20 20 20 | 7b 20 7b 20 53 49 5a 45 |,. |{ { SIZE|
|000030d0| 5f 33 32 2c 20 43 4f 4e | 53 54 41 4e 54 2c 20 49 |_32, CON|STANT, I|
|000030e0| 4e 20 7d 2c 20 7b 20 53 | 49 5a 45 5f 33 32 2c 20 |N }, { S|IZE_32, |
|000030f0| 52 45 47 49 53 54 45 52 | 2c 20 49 4e 20 7d 2c 0a |REGISTER|, IN },.|
|00003100| 09 20 20 20 20 7b 20 53 | 49 5a 45 5f 33 32 2c 20 |. { S|IZE_32, |
|00003110| 52 45 47 49 53 54 45 52 | 2c 20 4f 55 54 20 7d 20 |REGISTER|, OUT } |
|00003120| 7d 20 7d 2c 0a 5c 65 6e | 64 7b 76 65 72 62 61 74 |} },.\en|d{verbat|
|00003130| 69 6d 7d 0a 0a 54 68 69 | 73 20 61 70 70 72 6f 61 |im}..Thi|s approa|
|00003140| 63 68 20 68 61 73 20 73 | 61 76 65 64 20 75 73 20 |ch has s|aved us |
|00003150| 63 6f 75 6e 74 6c 65 73 | 73 20 68 6f 75 72 73 20 |countles|s hours |
|00003160| 6f 66 20 64 65 62 75 67 | 67 69 6e 67 20 61 6e 64 |of debug|ging and|
|00003170| 20 61 6c 6c 6f 77 73 0a | 6f 75 72 20 73 79 73 74 | allows.|our syst|
|00003180| 65 6d 20 74 6f 20 61 75 | 74 6f 6d 61 74 69 63 61 |em to au|tomatica|
|00003190| 6c 6c 79 20 70 65 72 66 | 6f 72 6d 20 74 68 65 20 |lly perf|orm the |
|000031a0| 73 61 6d 65 20 6f 70 74 | 69 6d 69 7a 61 74 69 6f |same opt|imizatio|
|000031b0| 6e 73 20 61 73 20 74 68 | 65 0a 68 6f 73 74 20 73 |ns as th|e.host s|
|000031c0| 79 73 74 65 6d 27 73 20 | 61 73 73 65 6d 62 6c 65 |ystem's |assemble|
|000031d0| 72 2e 0a 0a 57 65 27 76 | 65 20 61 6e 6e 6f 74 61 |r...We'v|e annota|
|000031e0| 74 65 64 20 6f 75 72 20 | 38 30 78 38 36 20 64 65 |ted our |80x86 de|
|000031f0| 73 63 72 69 70 74 69 6f | 6e 73 20 77 69 74 68 20 |scriptio|ns with |
|00003200| 69 6e 66 6f 72 6d 61 74 | 69 6f 6e 20 61 62 6f 75 |informat|ion abou|
|00003210| 74 0a 50 65 6e 74 69 75 | 6d 20 70 61 69 72 61 62 |t.Pentiu|m pairab|
|00003220| 69 6c 69 74 79 20 73 6f | 20 74 68 61 74 20 66 75 |ility so| that fu|
|00003230| 74 75 72 65 20 76 65 72 | 73 69 6f 6e 73 20 6f 66 |ture ver|sions of|
|00003240| 20 73 79 6e 36 38 6b 20 | 63 61 6e 20 73 63 68 65 | syn68k |can sche|
|00003250| 64 75 6c 65 0a 74 68 65 | 20 6e 61 74 69 76 65 20 |dule.the| native |
|00003260| 63 6f 64 65 20 77 65 20 | 67 65 6e 65 72 61 74 65 |code we |generate|
|00003270| 20 28 77 65 20 61 6c 72 | 65 61 64 79 20 73 63 68 | (we alr|eady sch|
|00003280| 65 64 75 6c 65 20 6f 75 | 72 20 6d 61 69 6e 20 69 |edule ou|r main i|
|00003290| 6e 74 65 72 70 72 65 74 | 65 72 0a 77 68 65 6e 20 |nterpret|er.when |
|000032a0| 77 65 20 62 75 69 6c 64 | 20 73 79 6e 36 38 6b 29 |we build| syn68k)|
|000032b0| 2e 0a 0a 5c 73 65 63 74 | 69 6f 6e 7b 46 75 74 75 |...\sect|ion{Futu|
|000032c0| 72 65 20 6f 70 74 69 6d | 69 7a 61 74 69 6f 6e 73 |re optim|izations|
|000032d0| 7d 0a 0a 57 65 20 61 72 | 65 20 77 6f 72 6b 69 6e |}..We ar|e workin|
|000032e0| 67 20 6f 6e 20 61 20 73 | 69 6d 70 6c 65 20 69 6e |g on a s|imple in|
|000032f0| 74 65 72 2d 62 6c 6f 63 | 6b 20 72 65 67 69 73 74 |ter-bloc|k regist|
|00003300| 65 72 20 61 6c 6c 6f 63 | 61 74 69 6f 6e 20 61 6c |er alloc|ation al|
|00003310| 67 6f 72 69 74 68 6d 2e | 0a 0a 42 79 20 72 65 6c |gorithm.|..By rel|
|00003320| 6f 63 61 74 69 6e 67 20 | 6d 6f 73 74 20 36 38 30 |ocating |most 680|
|00003330| 78 30 20 72 65 67 69 73 | 74 65 72 20 74 6f 20 38 |x0 regis|ter to 8|
|00003340| 30 78 38 36 20 72 65 67 | 69 73 74 65 72 20 6d 6f |0x86 reg|ister mo|
|00003350| 76 65 73 20 74 6f 20 74 | 68 65 0a 62 65 67 69 6e |ves to t|he.begin|
|00003360| 6e 69 6e 67 20 6f 66 20 | 65 61 63 68 20 62 6c 6f |ning of |each blo|
|00003370| 63 6b 2c 20 77 65 20 63 | 61 6e 20 69 6d 70 72 6f |ck, we c|an impro|
|00003380| 76 65 20 50 65 6e 74 69 | 75 6d 20 70 61 69 72 61 |ve Penti|um paira|
|00003390| 62 69 6c 69 74 79 20 61 | 6e 64 0a 72 65 64 75 63 |bility a|nd.reduc|
|000033a0| 65 20 38 30 34 38 36 20 | 61 6e 64 20 50 65 6e 74 |e 80486 |and Pent|
|000033b0| 69 75 6d 20 61 64 64 72 | 65 73 73 20 67 65 6e 65 |ium addr|ess gene|
|000033c0| 72 61 74 69 6f 6e 20 70 | 69 70 65 6c 69 6e 65 20 |ration p|ipeline |
|000033d0| 73 74 61 6c 6c 73 2e 0a | 0a 4e 6f 77 20 74 68 61 |stalls..|.Now tha|
|000033e0| 74 20 77 65 20 63 6f 6d | 70 69 6c 65 20 74 6f 20 |t we com|pile to |
|000033f0| 6e 61 74 69 76 65 20 63 | 6f 64 65 2c 20 41 2d 6c |native c|ode, A-l|
|00003400| 69 6e 65 20 74 72 61 70 | 20 6f 76 65 72 68 65 61 |ine trap| overhea|
|00003410| 64 20 69 73 20 62 65 63 | 6f 6d 69 6e 67 0a 73 69 |d is bec|oming.si|
|00003420| 67 6e 69 66 69 63 61 6e | 74 2e 20 20 57 65 20 6d |gnifican|t. We m|
|00003430| 61 79 20 73 6f 6f 6e 20 | 63 6f 6d 70 69 6c 65 20 |ay soon |compile |
|00003440| 41 2d 6c 69 6e 65 20 74 | 72 61 70 73 20 74 6f 20 |A-line t|raps to |
|00003450| 6e 61 74 69 76 65 20 63 | 6f 64 65 20 74 68 61 74 |native c|ode that|
|00003460| 0a 64 69 72 65 63 74 6c | 79 20 63 61 6c 6c 73 20 |.directl|y calls |
|00003470| 74 68 65 20 61 70 70 72 | 6f 70 72 69 61 74 65 20 |the appr|opriate |
|00003480| 52 4f 4d 6c 69 62 20 72 | 6f 75 74 69 6e 65 20 77 |ROMlib r|outine w|
|00003490| 69 74 68 20 74 68 65 20 | 61 70 70 72 6f 70 72 69 |ith the |appropri|
|000034a0| 61 74 65 0a 61 72 67 75 | 6d 65 6e 74 73 20 28 63 |ate.argu|ments (c|
|000034b0| 68 65 63 6b 69 6e 67 20 | 61 74 20 72 75 6e 74 69 |hecking |at runti|
|000034c0| 6d 65 20 74 6f 20 6d 61 | 6b 65 20 73 75 72 65 20 |me to ma|ke sure |
|000034d0| 74 68 61 74 20 6e 65 69 | 74 68 65 72 20 74 68 65 |that nei|ther the|
|000034e0| 20 74 72 61 70 0a 6e 6f | 72 20 74 68 65 20 41 2d | trap.no|r the A-|
|000034f0| 6c 69 6e 65 20 76 65 63 | 74 6f 72 20 68 61 73 20 |line vec|tor has |
|00003500| 62 65 65 6e 20 70 61 74 | 63 68 65 64 20 6f 75 74 |been pat|ched out|
|00003510| 2c 20 6f 66 20 63 6f 75 | 72 73 65 29 2e 0a 0a 5c |, of cou|rse)...\|
|00003520| 73 65 63 74 69 6f 6e 7b | 43 6f 64 65 20 65 78 61 |section{|Code exa|
|00003530| 6d 70 6c 65 73 7d 0a 0a | 48 65 72 65 20 61 72 65 |mples}..|Here are|
|00003540| 20 74 77 6f 20 73 61 6d | 70 6c 65 20 36 38 30 78 | two sam|ple 680x|
|00003550| 30 20 63 6f 64 65 20 73 | 65 71 75 65 6e 63 65 73 |0 code s|equences|
|00003560| 20 66 72 6f 6d 20 72 65 | 61 6c 20 61 70 70 6c 69 | from re|al appli|
|00003570| 63 61 74 69 6f 6e 73 2c | 0a 61 6e 64 20 74 68 65 |cations,|.and the|
|00003580| 20 38 30 78 38 36 20 63 | 6f 64 65 20 74 68 61 74 | 80x86 c|ode that|
|00003590| 20 73 79 6e 36 38 6b 20 | 67 65 6e 65 72 61 74 65 | syn68k |generate|
|000035a0| 73 20 66 6f 72 20 74 68 | 65 6d 2e 20 20 57 65 20 |s for th|em. We |
|000035b0| 63 68 6f 73 65 20 74 68 | 65 73 65 0a 63 6f 64 65 |chose th|ese.code|
|000035c0| 20 73 65 71 75 65 6e 63 | 65 73 20 73 70 65 63 69 | sequenc|es speci|
|000035d0| 66 69 63 61 6c 6c 79 20 | 74 6f 20 73 68 6f 77 63 |fically |to showc|
|000035e0| 61 73 65 20 73 65 76 65 | 72 61 6c 20 6f 66 20 74 |ase seve|ral of t|
|000035f0| 68 65 20 74 65 63 68 6e | 69 71 75 65 73 0a 77 65 |he techn|iques.we|
|00003600| 20 75 73 65 2c 20 73 6f | 20 79 6f 75 20 73 68 6f | use, so| you sho|
|00003610| 75 6c 64 6e 27 74 20 75 | 73 65 20 74 68 65 6d 20 |uldn't u|se them |
|00003620| 61 73 20 61 20 73 75 62 | 73 74 69 74 75 74 65 20 |as a sub|stitute |
|00003630| 66 6f 72 20 62 65 6e 63 | 68 6d 61 72 6b 73 2e 0a |for benc|hmarks..|
|00003640| 4e 6f 74 20 61 6c 6c 20 | 36 38 30 78 30 20 63 6f |Not all |680x0 co|
|00003650| 64 65 20 74 72 61 6e 73 | 6c 61 74 65 73 20 61 73 |de trans|lates as|
|00003660| 20 77 65 6c 6c 20 61 73 | 20 74 68 65 73 65 20 65 | well as| these e|
|00003670| 78 61 6d 70 6c 65 73 20 | 64 6f 2c 20 62 75 74 0a |xamples |do, but.|
|00003680| 74 68 65 73 65 20 65 78 | 61 6d 70 6c 65 73 20 61 |these ex|amples a|
|00003690| 72 65 20 66 61 72 20 66 | 72 6f 6d 20 65 78 6f 74 |re far f|rom exot|
|000036a0| 69 63 2e 0a 0a 5c 62 65 | 67 69 6e 7b 69 74 65 6d |ic...\be|gin{item|
|000036b0| 69 7a 65 7d 0a 5c 69 74 | 65 6d 20 45 78 61 6d 70 |ize}.\it|em Examp|
|000036c0| 6c 65 20 31 20 28 53 6f | 6c 61 72 69 61 6e 29 3a |le 1 (So|larian):|
|000036d0| 0a 0a 5c 62 65 67 69 6e | 7b 76 65 72 62 61 74 69 |..\begin|{verbati|
|000036e0| 6d 7d 0a 36 38 30 78 30 | 20 63 6f 64 65 3a 0a 0a |m}.680x0| code:..|
|000036f0| 09 61 64 64 71 62 09 23 | 31 2c 61 34 40 28 31 29 |.addqb.#|1,a4@(1)|
|00003700| 0a 09 6d 6f 76 65 6c 09 | 23 30 2c 64 30 0a 09 6d |..movel.|#0,d0..m|
|00003710| 6f 76 65 62 09 61 34 40 | 2c 64 30 0a 09 73 77 61 |oveb.a4@|,d0..swa|
|00003720| 70 09 64 30 0a 09 63 6c | 72 77 09 64 30 0a 09 73 |p.d0..cl|rw.d0..s|
|00003730| 77 61 70 09 64 30 0a 09 | 61 73 6c 6c 09 23 32 2c |wap.d0..|asll.#2,|
|00003740| 64 30 0a 09 6c 65 61 09 | 61 35 40 28 2d 31 33 34 |d0..lea.|a5@(-134|
|00003750| 36 32 29 2c 61 30 0a 09 | 61 64 64 61 6c 09 64 30 |62),a0..|addal.d0|
|00003760| 2c 61 30 0a 09 6d 6f 76 | 65 61 6c 09 61 30 40 2c |,a0..mov|eal.a0@,|
|00003770| 61 30 0a 09 6d 6f 76 65 | 6c 09 23 30 2c 64 30 0a |a0..move|l.#0,d0.|
|00003780| 09 6d 6f 76 65 62 09 61 | 34 40 28 31 29 2c 64 30 |.moveb.a|4@(1),d0|
|00003790| 0a 09 63 6d 70 77 09 61 | 30 40 2c 64 30 0a 09 62 |..cmpw.a|0@,d0..b|
|000037a0| 63 73 09 30 78 33 66 66 | 66 65 65 32 0a 0a 38 30 |cs.0x3ff|fee2..80|
|000037b0| 78 38 36 20 63 6f 64 65 | 3a 0a 0a 09 6d 6f 76 6c |x86 code|:...movl|
|000037c0| 09 5f 61 34 2c 25 65 64 | 69 09 09 3b 20 61 64 64 |._a4,%ed|i..; add|
|000037d0| 71 62 20 23 31 2c 61 34 | 40 28 31 29 0a 09 61 64 |qb #1,a4|@(1)..ad|
|000037e0| 64 62 09 24 30 78 31 2c | 30 78 31 28 25 65 64 69 |db.$0x1,|0x1(%edi|
|000037f0| 29 0a 09 78 6f 72 6c 09 | 25 65 62 78 2c 25 65 62 |)..xorl.|%ebx,%eb|
|00003800| 78 09 09 3b 20 6d 6f 76 | 65 6c 20 23 30 2c 64 30 |x..; mov|el #0,d0|
|00003810| 0a 09 6d 6f 76 62 09 28 | 25 65 64 69 29 2c 25 62 |..movb.(|%edi),%b|
|00003820| 6c 09 09 3b 20 6d 6f 76 | 65 62 20 61 34 40 2c 64 |l..; mov|eb a4@,d|
|00003830| 30 0a 09 72 6f 72 6c 09 | 24 30 78 31 30 2c 25 65 |0..rorl.|$0x10,%e|
|00003840| 62 78 09 09 3b 20 73 77 | 61 70 20 64 30 0a 09 78 |bx..; sw|ap d0..x|
|00003850| 6f 72 77 09 25 62 78 2c | 25 62 78 09 09 09 3b 20 |orw.%bx,|%bx...; |
|00003860| 63 6c 72 77 20 64 30 0a | 09 72 6f 72 6c 09 24 30 |clrw d0.|.rorl.$0|
|00003870| 78 31 30 2c 25 65 62 78 | 09 09 3b 20 73 77 61 70 |x10,%ebx|..; swap|
|00003880| 20 64 30 0a 09 73 68 6c | 6c 09 24 30 78 32 2c 25 | d0..shl|l.$0x2,%|
|00003890| 65 62 78 09 09 3b 20 61 | 73 6c 6c 20 23 32 2c 64 |ebx..; a|sll #2,d|
|000038a0| 30 0a 09 6d 6f 76 6c 09 | 5f 61 35 2c 25 65 73 69 |0..movl.|_a5,%esi|
|000038b0| 09 09 3b 20 6c 65 61 20 | 61 35 40 28 2d 31 33 34 |..; lea |a5@(-134|
|000038c0| 36 32 29 2c 61 30 0a 09 | 6c 65 61 6c 09 30 78 66 |62),a0..|leal.0xf|
|000038d0| 66 66 66 63 62 36 61 28 | 25 65 73 69 29 2c 25 65 |fffcb6a(|%esi),%e|
|000038e0| 64 78 0a 09 61 64 64 6c | 09 25 65 62 78 2c 25 65 |dx..addl|.%ebx,%e|
|000038f0| 64 78 09 09 3b 20 61 64 | 64 61 6c 20 64 30 2c 61 |dx..; ad|dal d0,a|
|00003900| 30 0a 09 6d 6f 76 6c 09 | 28 25 65 64 78 29 2c 25 |0..movl.|(%edx),%|
|00003910| 65 64 78 09 09 3b 20 6d | 6f 76 65 61 6c 20 61 30 |edx..; m|oveal a0|
|00003920| 40 2c 61 30 0a 09 78 6f | 72 6c 09 25 65 62 78 2c |@,a0..xo|rl.%ebx,|
|00003930| 25 65 62 78 09 09 3b 20 | 6d 6f 76 65 6c 20 23 30 |%ebx..; |movel #0|
|00003940| 2c 64 30 0a 09 6d 6f 76 | 62 09 30 78 31 28 25 65 |,d0..mov|b.0x1(%e|
|00003950| 64 69 29 2c 25 62 6c 09 | 09 3b 20 6d 6f 76 65 62 |di),%bl.|.; moveb|
|00003960| 20 61 34 40 28 31 29 2c | 64 30 0a 09 62 73 77 61 | a4@(1),|d0..bswa|
|00003970| 70 09 25 65 64 78 09 09 | 09 3b 20 63 6d 70 77 20 |p.%edx..|.; cmpw |
|00003980| 61 30 40 2c 64 30 0a 09 | 6d 6f 76 77 09 28 25 65 |a0@,d0..|movw.(%e|
|00003990| 64 78 29 2c 25 63 78 0a | 09 72 6f 72 77 09 24 30 |dx),%cx.|.rorw.$0|
|000039a0| 78 38 2c 25 63 78 0a 09 | 63 6d 70 77 09 25 63 78 |x8,%cx..|cmpw.%cx|
|000039b0| 2c 25 62 78 0a 09 6d 6f | 76 6c 09 25 65 64 78 2c |,%bx..mo|vl.%edx,|
|000039c0| 5f 61 30 09 09 3b 20 3c | 73 70 69 6c 6c 20 64 69 |_a0..; <|spill di|
|000039d0| 72 74 79 20 36 38 6b 0a | 09 6d 6f 76 6c 09 25 65 |rty 68k.|.movl.%e|
|000039e0| 62 78 2c 5f 64 30 09 09 | 3b 20 20 72 65 67 69 73 |bx,_d0..|; regis|
|000039f0| 74 65 72 73 20 62 61 63 | 6b 20 74 6f 20 6d 65 6d |ters bac|k to mem|
|00003a00| 6f 72 79 3e 0a 09 6a 62 | 09 30 78 36 66 61 65 30 |ory>..jb|.0x6fae0|
|00003a10| 63 09 09 3b 20 62 63 73 | 20 30 78 33 66 66 66 65 |c..; bcs| 0x3fffe|
|00003a20| 65 32 0a 09 6a 6d 70 09 | 30 78 36 66 61 66 30 63 |e2..jmp.|0x6faf0c|
|00003a30| 09 09 3b 20 3c 67 6f 20 | 74 6f 20 22 66 61 6c 6c |..; <go |to "fall|
|00003a40| 20 74 68 72 6f 75 67 68 | 22 20 63 6f 64 65 3e 0a | through|" code>.|
|00003a50| 5c 65 6e 64 7b 76 65 72 | 62 61 74 69 6d 7d 0a 5c |\end{ver|batim}.\|
|00003a60| 69 74 65 6d 20 45 78 61 | 6d 70 6c 65 20 32 20 28 |item Exa|mple 2 (|
|00003a70| 50 61 67 65 4d 61 6b 65 | 72 29 3a 0a 0a 5c 62 65 |PageMake|r):..\be|
|00003a80| 67 69 6e 7b 76 65 72 62 | 61 74 69 6d 7d 0a 36 38 |gin{verb|atim}.68|
|00003a90| 30 78 30 20 63 6f 64 65 | 3a 0a 0a 09 6d 6f 76 65 |0x0 code|:...move|
|00003aa0| 6c 09 23 30 2c 64 32 0a | 09 6d 6f 76 65 62 09 64 |l.#0,d2.|.moveb.d|
|00003ab0| 30 2c 64 32 0a 09 6c 73 | 6c 77 09 23 38 2c 64 30 |0,d2..ls|lw.#8,d0|
|00003ac0| 0a 09 6f 72 77 09 64 30 | 2c 64 32 0a 09 6d 6f 76 |..orw.d0|,d2..mov|
|00003ad0| 65 6c 09 64 32 2c 64 30 | 0a 09 73 77 61 70 09 64 |el.d2,d0|..swap.d|
|00003ae0| 32 0a 09 6f 72 6c 09 64 | 32 2c 64 30 0a 09 6d 6f |2..orl.d|2,d0..mo|
|00003af0| 76 65 6c 09 61 30 2c 64 | 32 0a 09 6c 73 72 62 09 |vel.a0,d|2..lsrb.|
|00003b00| 23 31 2c 64 32 0a 09 62 | 63 63 09 30 78 33 66 66 |#1,d2..b|cc.0x3ff|
|00003b10| 66 65 64 34 0a 0a 38 30 | 78 38 36 20 63 6f 64 65 |fed4..80|x86 code|
|00003b20| 3a 0a 0a 09 78 6f 72 6c | 09 25 65 62 78 2c 25 65 |:...xorl|.%ebx,%e|
|00003b30| 62 78 09 09 3b 20 6d 6f | 76 65 6c 20 23 30 2c 64 |bx..; mo|vel #0,d|
|00003b40| 32 0a 09 6d 6f 76 6c 09 | 5f 64 30 2c 25 65 64 78 |2..movl.|_d0,%edx|
|00003b50| 09 09 3b 20 6d 6f 76 65 | 62 20 64 30 2c 64 32 0a |..; move|b d0,d2.|
|00003b60| 09 6d 6f 76 62 09 25 64 | 6c 2c 25 62 6c 0a 09 73 |.movb.%d|l,%bl..s|
|00003b70| 68 6c 77 09 24 30 78 38 | 2c 25 64 78 09 09 3b 20 |hlw.$0x8|,%dx..; |
|00003b80| 6c 73 6c 77 20 23 38 2c | 64 30 0a 09 6f 72 77 09 |lslw #8,|d0..orw.|
|00003b90| 25 64 78 2c 25 62 78 09 | 09 09 3b 20 6f 72 77 20 |%dx,%bx.|..; orw |
|00003ba0| 64 30 2c 64 32 0a 09 6d | 6f 76 6c 09 25 65 62 78 |d0,d2..m|ovl.%ebx|
|00003bb0| 2c 25 65 64 78 09 09 3b | 20 6d 6f 76 65 6c 20 64 |,%edx..;| movel d|
|00003bc0| 32 2c 64 30 0a 09 72 6f | 72 6c 09 24 30 78 31 30 |2,d0..ro|rl.$0x10|
|00003bd0| 2c 25 65 62 78 09 09 3b | 20 73 77 61 70 20 64 32 |,%ebx..;| swap d2|
|00003be0| 0a 09 6f 72 6c 09 25 65 | 62 78 2c 25 65 64 78 09 |..orl.%e|bx,%edx.|
|00003bf0| 09 3b 20 6f 72 6c 20 64 | 32 2c 64 30 0a 09 6d 6f |.; orl d|2,d0..mo|
|00003c00| 76 6c 09 5f 61 30 2c 25 | 65 63 78 09 09 3b 20 6d |vl._a0,%|ecx..; m|
|00003c10| 6f 76 65 6c 20 61 30 2c | 64 32 0a 09 6d 6f 76 6c |ovel a0,|d2..movl|
|00003c20| 09 25 65 63 78 2c 25 65 | 62 78 0a 09 73 68 72 62 |.%ecx,%e|bx..shrb|
|00003c30| 09 25 62 6c 09 09 09 3b | 20 6c 73 72 62 20 23 31 |.%bl...;| lsrb #1|
|00003c40| 2c 64 32 0a 09 6d 6f 76 | 6c 09 25 65 62 78 2c 5f |,d2..mov|l.%ebx,_|
|00003c50| 64 32 09 09 3b 20 3c 73 | 70 69 6c 6c 20 64 69 72 |d2..; <s|pill dir|
|00003c60| 74 79 20 36 38 6b 0a 09 | 6d 6f 76 6c 09 25 65 64 |ty 68k..|movl.%ed|
|00003c70| 78 2c 5f 64 30 09 09 3b | 20 20 72 65 67 69 73 74 |x,_d0..;| regist|
|00003c80| 65 72 73 20 62 61 63 6b | 20 74 6f 20 6d 65 6d 6f |ers back| to memo|
|00003c90| 72 79 3e 0a 09 6a 61 65 | 09 30 78 33 62 37 33 34 |ry>..jae|.0x3b734|
|00003ca0| 63 09 09 3b 20 62 63 63 | 20 30 78 33 66 66 66 65 |c..; bcc| 0x3fffe|
|00003cb0| 64 34 0a 09 6a 6d 70 09 | 30 78 34 33 64 34 38 63 |d4..jmp.|0x43d48c|
|00003cc0| 09 09 3b 20 3c 67 6f 20 | 74 6f 20 22 66 61 6c 6c |..; <go |to "fall|
|00003cd0| 20 74 68 72 6f 75 67 68 | 22 20 36 38 6b 20 63 6f | through|" 68k co|
|00003ce0| 64 65 3e 0a 5c 65 6e 64 | 7b 76 65 72 62 61 74 69 |de>.\end|{verbati|
|00003cf0| 6d 7d 0a 5c 65 6e 64 7b | 69 74 65 6d 69 7a 65 7d |m}.\end{|itemize}|
|00003d00| 0a 5c 73 65 63 74 69 6f | 6e 7b 42 65 6e 63 68 6d |.\sectio|n{Benchm|
|00003d10| 61 72 6b 73 7d 0a 0a 54 | 68 65 73 65 20 70 65 72 |arks}..T|hese per|
|00003d20| 66 6f 72 6d 61 6e 63 65 | 20 6e 75 6d 62 65 72 73 |formance| numbers|
|00003d30| 20 77 65 72 65 20 63 6f | 6d 70 75 74 65 64 20 77 | were co|mputed w|
|00003d40| 69 74 68 20 53 70 65 65 | 64 6f 6d 65 74 65 72 20 |ith Spee|dometer |
|00003d50| 33 2e 32 33 2e 0a 57 65 | 27 76 65 20 72 65 6d 6f |3.23..We|'ve remo|
|00003d60| 76 65 64 20 74 68 65 20 | 66 6c 6f 61 74 69 6e 67 |ved the |floating|
|00003d70| 20 70 6f 69 6e 74 20 74 | 65 73 74 73 20 66 72 6f | point t|ests fro|
|00003d80| 6d 20 74 68 65 20 6c 69 | 73 74 20 73 69 6e 63 65 |m the li|st since|
|00003d90| 20 74 68 65 79 20 64 6f | 0a 6e 6f 74 20 6d 65 61 | they do|.not mea|
|00003da0| 73 75 72 65 20 73 79 6e | 36 38 6b 27 73 20 73 70 |sure syn|68k's sp|
|00003db0| 65 65 64 2e 20 20 53 79 | 6e 36 38 6b 20 63 6f 6e |eed. Sy|n68k con|
|00003dc0| 74 61 69 6e 73 20 6e 6f | 20 73 70 65 63 69 61 6c |tains no| special|
|00003dd0| 20 70 72 6f 76 69 73 69 | 6f 6e 73 0a 66 6f 72 20 | provisi|ons.for |
|00003de0| 53 70 65 65 64 6f 6d 65 | 74 65 72 27 73 20 62 65 |Speedome|ter's be|
|00003df0| 6e 63 68 6d 61 72 6b 73 | 20 61 6e 64 20 77 65 20 |nchmarks| and we |
|00003e00| 62 65 6c 69 65 76 65 20 | 74 68 61 74 20 74 68 65 |believe |that the|
|00003e10| 73 65 20 6e 75 6d 62 65 | 72 73 20 61 72 65 0a 69 |se numbe|rs are.i|
|00003e20| 6e 64 69 63 61 74 69 76 | 65 20 6f 66 20 73 79 6e |ndicativ|e of syn|
|00003e30| 36 38 6b 27 73 20 70 65 | 72 66 6f 72 6d 61 6e 63 |68k's pe|rformanc|
|00003e40| 65 20 66 6f 72 20 6d 61 | 6e 79 20 6f 74 68 65 72 |e for ma|ny other|
|00003e50| 20 43 50 55 2d 69 6e 74 | 65 6e 73 69 76 65 0a 70 | CPU-int|ensive.p|
|00003e60| 72 6f 67 72 61 6d 73 2e | 0a 0a 5c 62 65 67 69 6e |rograms.|..\begin|
|00003e70| 7b 63 65 6e 74 65 72 7d | 0a 5c 62 65 67 69 6e 7b |{center}|.\begin{|
|00003e80| 74 61 62 75 6c 61 72 7d | 7b 7c 7c 6c 7c 7c 63 7c |tabular}|{||l||c||
|00003e90| 63 7c 63 7c 63 7c 7c 7d | 20 5c 68 6c 69 6e 65 20 |c|c|c||}| \hline |
|00003ea0| 5c 68 6c 69 6e 65 0a 5c | 65 6d 7b 5c 73 6d 61 6c |\hline.\|em{\smal|
|00003eb0| 6c 7b 54 65 73 74 2f 43 | 50 55 7d 7d 20 26 20 5c |l{Test/C|PU}} & \|
|00003ec0| 65 6d 7b 5c 73 6d 61 6c | 6c 7b 51 75 61 64 72 61 |em{\smal|l{Quadra|
|00003ed0| 20 36 31 30 7d 7d 20 26 | 20 5c 65 6d 7b 5c 73 6d | 610}} &| \em{\sm|
|00003ee0| 61 6c 6c 7b 50 65 6e 74 | 69 75 6d 20 39 30 4d 68 |all{Pent|ium 90Mh|
|00003ef0| 7a 7d 7d 20 0a 09 26 20 | 5c 65 6d 7b 5c 73 6d 61 |z}} ..& |\em{\sma|
|00003f00| 6c 6c 7b 34 38 36 44 58 | 34 20 37 35 4d 68 7a 7d |ll{486DX|4 75Mhz}|
|00003f10| 7d 20 26 20 5c 65 6d 7b | 5c 73 6d 61 6c 6c 7b 34 |} & \em{|\small{4|
|00003f20| 38 36 44 58 2f 32 20 36 | 36 4d 68 7a 7d 7d 20 5c |86DX/2 6|6Mhz}} \|
|00003f30| 5c 20 5c 68 6c 69 6e 65 | 20 5c 68 6c 69 6e 65 0a |\ \hline| \hline.|
|00003f40| 0a 43 50 55 20 26 20 31 | 36 2e 30 31 38 20 26 20 |.CPU & 1|6.018 & |
|00003f50| 32 38 2e 38 33 33 20 26 | 20 31 35 2e 37 32 37 20 |28.833 &| 15.727 |
|00003f60| 26 20 31 33 2e 38 34 30 | 20 5c 5c 20 5c 68 6c 69 |& 13.840| \\ \hli|
|00003f70| 6e 65 0a 44 68 72 79 73 | 74 6f 6e 65 73 20 26 20 |ne.Dhrys|tones & |
|00003f80| 31 39 2e 35 38 36 20 26 | 20 32 31 2e 38 38 36 20 |19.586 &| 21.886 |
|00003f90| 26 20 31 32 2e 30 38 34 | 20 26 20 39 2e 34 32 34 |& 12.084| & 9.424|
|00003fa0| 20 5c 5c 20 5c 68 6c 69 | 6e 65 0a 54 6f 77 65 72 | \\ \hli|ne.Tower|
|00003fb0| 20 26 09 31 38 2e 39 30 | 39 20 26 20 32 37 2e 31 | &.18.90|9 & 27.1|
|00003fc0| 33 30 20 26 20 31 32 2e | 32 33 35 20 26 20 31 31 |30 & 12.|235 & 11|
|00003fd0| 2e 35 35 36 20 5c 5c 20 | 5c 68 6c 69 6e 65 0a 51 |.556 \\ |\hline.Q|
|00003fe0| 75 69 63 6b 73 6f 72 74 | 20 26 20 31 37 2e 37 35 |uicksort| & 17.75|
|00003ff0| 39 20 26 20 32 37 2e 31 | 30 35 20 26 20 31 35 2e |9 & 27.1|05 & 15.|
|00004000| 36 30 36 20 26 20 31 33 | 2e 39 31 39 20 5c 5c 20 |606 & 13|.919 \\ |
|00004010| 5c 68 6c 69 6e 65 0a 42 | 75 62 62 6c 65 20 73 6f |\hline.B|ubble so|
|00004020| 72 74 20 26 20 31 38 2e | 34 30 39 20 26 20 33 31 |rt & 18.|409 & 31|
|00004030| 2e 31 35 34 20 26 20 31 | 39 2e 32 38 36 20 26 20 |.154 & 1|9.286 & |
|00004040| 31 36 2e 38 37 35 20 5c | 5c 20 5c 68 6c 69 6e 65 |16.875 \|\ \hline|
|00004050| 0a 51 75 65 65 6e 73 20 | 26 20 31 39 2e 30 38 33 |.Queens |& 19.083|
|00004060| 20 26 20 33 38 2e 31 36 | 37 20 26 20 31 39 2e 30 | & 38.16|7 & 19.0|
|00004070| 38 33 20 26 20 31 38 2e | 33 32 30 20 5c 5c 20 5c |83 & 18.|320 \\ \|
|00004080| 68 6c 69 6e 65 0a 50 75 | 7a 7a 6c 65 20 26 20 32 |hline.Pu|zzle & 2|
|00004090| 32 2e 30 38 33 20 26 20 | 34 34 2e 31 36 37 20 26 |2.083 & |44.167 &|
|000040a0| 20 32 33 2e 36 36 31 20 | 26 20 32 31 2e 30 33 32 | 23.661 |& 21.032|
|000040b0| 20 5c 5c 20 5c 68 6c 69 | 6e 65 0a 50 65 72 6d 75 | \\ \hli|ne.Permu|
|000040c0| 74 61 74 69 6f 6e 73 20 | 26 20 32 31 2e 30 31 39 |tations |& 21.019|
|000040d0| 20 26 20 32 38 2e 35 36 | 34 20 26 20 31 31 2e 36 | & 28.56|4 & 11.6|
|000040e0| 30 34 20 26 20 31 32 2e | 32 34 32 20 5c 5c 20 5c |04 & 12.|242 \\ \|
|000040f0| 68 6c 69 6e 65 0a 49 6e | 74 2e 20 4d 61 74 72 69 |hline.In|t. Matri|
|00004100| 78 20 26 20 32 34 2e 32 | 30 30 20 26 20 32 36 2e |x & 24.2|00 & 26.|
|00004110| 34 36 39 20 26 20 31 39 | 2e 33 36 39 20 26 20 31 |469 & 19|.369 & 1|
|00004120| 36 2e 36 30 38 20 5c 5c | 20 5c 68 6c 69 6e 65 0a |6.608 \\| \hline.|
|00004130| 53 69 65 76 65 20 26 20 | 32 33 2e 33 36 32 20 26 |Sieve & |23.362 &|
|00004140| 20 36 30 2e 32 39 30 20 | 26 20 33 33 2e 39 38 32 | 60.290 |& 33.982|
|00004150| 20 26 20 33 30 2e 31 34 | 35 20 5c 5c 20 5c 68 6c | & 30.14|5 \\ \hl|
|00004160| 69 6e 65 20 5c 68 6c 69 | 6e 65 0a 41 76 65 72 61 |ine \hli|ne.Avera|
|00004170| 67 65 09 26 20 32 30 2e | 34 39 30 20 26 20 33 33 |ge.& 20.|490 & 33|
|00004180| 2e 38 38 31 20 26 20 31 | 38 2e 35 38 32 20 26 20 |.881 & 1|8.582 & |
|00004190| 31 36 2e 36 38 30 20 5c | 5c 20 5c 68 6c 69 6e 65 |16.680 \|\ \hline|
|000041a0| 0a 5c 65 6e 64 7b 74 61 | 62 75 6c 61 72 7d 0a 5c |.\end{ta|bular}.\|
|000041b0| 65 6e 64 7b 63 65 6e 74 | 65 72 7d 0a 0a 50 72 65 |end{cent|er}..Pre|
|000041c0| 6c 69 6d 69 6e 61 72 79 | 20 61 6e 61 6c 79 73 69 |liminary| analysi|
|000041d0| 73 20 73 75 67 67 65 73 | 74 73 20 74 68 61 74 20 |s sugges|ts that |
|000041e0| 77 65 20 61 76 65 72 61 | 67 65 20 61 20 72 6f 75 |we avera|ge a rou|
|000041f0| 67 68 6c 79 20 33 3a 31 | 0a 69 6e 73 74 72 75 63 |ghly 3:1|.instruc|
|00004200| 74 69 6f 6e 20 63 6f 75 | 6e 74 20 69 6e 63 72 65 |tion cou|nt incre|
|00004210| 61 73 65 20 77 68 65 6e | 20 74 72 61 6e 73 6c 61 |ase when| transla|
|00004220| 74 69 6e 67 20 74 6f 20 | 38 30 78 38 36 20 63 6f |ting to |80x86 co|
|00004230| 64 65 2e 20 20 57 65 20 | 68 61 76 65 0a 6e 6f 74 |de. We |have.not|
|00004240| 20 79 65 74 20 74 61 6b | 65 6e 20 72 69 67 6f 72 | yet tak|en rigor|
|00004250| 6f 75 73 20 6d 65 61 73 | 75 72 65 6d 65 6e 74 73 |ous meas|urements|
|00004260| 2c 20 62 75 74 20 74 68 | 65 20 33 3a 31 20 66 69 |, but th|e 3:1 fi|
|00004270| 67 75 72 65 20 69 73 20 | 6c 65 6e 74 0a 73 6f 6d |gure is |lent.som|
|00004280| 65 20 63 72 65 64 65 6e | 63 65 20 62 79 20 74 68 |e creden|ce by th|
|00004290| 65 20 66 61 63 74 20 74 | 68 61 74 20 6f 75 72 20 |e fact t|hat our |
|000042a0| 37 35 4d 48 7a 20 34 38 | 36 44 58 34 20 67 65 74 |75MHz 48|6DX4 get|
|000042b0| 73 20 6e 65 61 72 6c 79 | 20 74 68 65 0a 73 61 6d |s nearly| the.sam|
|000042c0| 65 20 70 65 72 66 6f 72 | 6d 61 6e 63 65 20 61 73 |e perfor|mance as|
|000042d0| 20 6f 75 72 20 51 75 61 | 64 72 61 20 36 31 30 2e | our Qua|dra 610.|
|000042e0| 20 20 57 65 20 62 65 6c | 69 65 76 65 20 74 68 61 | We bel|ieve tha|
|000042f0| 74 20 69 6e 74 65 72 2d | 62 6c 6f 63 6b 0a 72 65 |t inter-|block.re|
|00004300| 67 69 73 74 65 72 20 61 | 6c 6c 6f 63 61 74 69 6f |gister a|llocatio|
|00004310| 6e 20 77 69 6c 6c 20 6e | 6f 74 69 63 65 61 62 6c |n will n|oticeabl|
|00004320| 79 20 69 6d 70 72 6f 76 | 65 20 74 68 69 73 20 72 |y improv|e this r|
|00004330| 61 74 69 6f 2e 0a 0a 5c | 65 6e 64 7b 64 6f 63 75 |atio...\|end{docu|
|00004340| 6d 65 6e 74 7d 0a 0a 0a | |ment}...| |
+--------+-------------------------+-------------------------+--------+--------+