commit 963309eaeeb669a7becd560d1be8025952af59bc Author: Lucia Ceionia Date: Sat Dec 2 01:38:16 2023 -0600 day 1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1a687bd --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.o +a.out diff --git a/01/Makefile b/01/Makefile new file mode 100644 index 0000000..573eb71 --- /dev/null +++ b/01/Makefile @@ -0,0 +1,3 @@ +all: + nasm -g -felf32 main.s && ld -melf_i386 -g main.o + diff --git a/01/input b/01/input new file mode 100644 index 0000000..9427a8d --- /dev/null +++ b/01/input @@ -0,0 +1,1000 @@ +hcpjssql4kjhbcqzkvr2fivebpllzqbkhg +4threethreegctxg3dmbm1 +1lxk2hfmcgxtmps89mdvkl +sixbfjblhsjr3 +soneighttwo39ktl132 +sqd1fivenfsmpsmjtscfivedzxfhnbbj8six +9oneonetwofiveseven42 +7mhpslddjtwo9sixkzdvqzvggvfoursdvd +onetwothreextbtpkrcphhp4kfplhqdvp9 +89l991eightttxtj3 +7znvzpdnnnfsevennrvlhseven16b +5eight8579 +6twotwo18eightthreeeight +5fourthreesbgsix6two +nineoneh841dxnrvcmtwo +9one7three9kbrdcdeighttqmgg +vsrsixfiveninestndvtfqmr7 +six5eight +prvdoneqmsnstjgq7bdshdninenine9 +3715nineeighthxnqxhg4ch +zvdhmnvnineqjghs93bmmxrtxhrvsksqgfive +6hznsq5qjcjsvgnl +51gzmkn5 +2rscfiveonetwoonexndftfive +5gkxjcskc89eight +onethreeoneeightqskd4zhr +8dnkzpsfzrqljhkx6one +threenine41tczlqlsjjrkhsjm3jqhgscgspx +sevennine4dkkqrrjcpfourckzxj71one +nineseven2sixnineqd +eight72threefivefour9onefive +gprffive3kksp +qcl27four4 +sfdreight4ninesix5 +1756gvjdggpchc9 +threerzcxhlvdjkhtlxlg6ninetwonine1 +thnine5 +twoninejxxm1one +nc73threetwoeight +s2sixbnsmngsclg +6tplzllbthreecljqhtgqlkxnl +4four4 +ntxmgvkm9 +5fourslt8gqdrdsseven6six +fourfour26 +263eightfivefthkfxfxnfms2 +716 +twodgksqsdtrsrpeight8five1 +jdhtxp1nine8jrxrrkc12six3 +2gmmtgzstg1rbsix +threemhmfivevg6sixlppbjmmninej +9eighthvxnlvthqjtpsjnleightwokq +three8threeeightmcnvlmj7 +sixmn5 +8jctlksix +fkrxrsseven6dcxzhdmvtg +sixxgrnqk8qvgrqbs +skprzqrt3h65eighteightdlpljhnjdp +onelpfdt669hrzninethree +3ninehgveightzppzljfourfour4 +838onejonehznckplj5nine +lrdtwo61 +niner5kqzqg +4eight8seventwo3 +fvbrtpbcfive24 +twoczldjcsix1six +9fourklmzjmnlgtvh +five7nine2nvjbprppthnine8 +tmht6mfjnnpznrv6jscqfjxkvtgklmprsix +svpqzpj9sixsixxnvbprh1 +eight8two47g11 +7qxbfj5c +2hzcmzl7 +4gbkshmmksfseven +8sevenone +oneseven1three +9three2fjldqmdhv +3vfsqqzrpzq38twotwondxrc +sixbgz1four +trzvzjzeight7sixdgq41 +94rj2 +twofour3tkjjvjsfourz3 +cxtgfmqddm9five61f +ninesfvfmrk7vrgddhzvh11onethree +zhdbmjhsfv5nkkllpthree88seven +69zlsvkk2six +576dqcspgvd +7flqjn9 +eightqxsix4fiveeightfive +oneeight9onemll8ccgrrqvrp +7qdscnine5two +eightfive5threekkrb741xgnndtvzd +6xpdgng622cplsixone +ninesix4jxxgjppthree9six +87sixtwotcjlss +njlfxvcxbpmk6ttdng +sevenzcprvz4eightnk6ninefourtwo +2twomvdjvrhrsgrqhp +eightonehtmvfvxeight2onettnkt +ngbtlr8five5fourtwotwojsdl +39sixthree9 +4ntgdsbshd32 +ninetwo5htqnmctjkxrttgtdfone +bckgxxpreight4eightbpchtxv8seven +twoeight2sxnxsfkxqkbsix +one8kjtgoneeightsdcmrllcfiveqxsj7 +gsfmgl4one43 +zthm8cmmb83twotwothree +seventgd6 +sixphptdkzcqsixlgztbffhs5 +2onenine9sevenonefourfvd +1djkqqd +slfldflseven6five85tvxbzvmjvjhpbnqtfxtvcfc +six2kseven +seven7464 +zcslbttpgk3foureightone5 +4oneone4453 +fivex6lz +zceightwobvhfqqzngtctgsq3rjzmtnmbx7xtc +zxrxseven7ncr5m4 +7ninelzrrzmlfourpssbjpkckj9 +6vbrpprjfive3twovfklfh7 +9cgkqfgccl5fivezlhcfgvm +bttvvjkgp6clntnrksthreeeight7 +threesix8eight4foureightkjxjfgxlcfqnh +three5foursevenlhlmrzrdvxthreeglfvksgmxlrz +c48seventhree +sevenddgcqkgkr9fourppxqzpqxpkzjpcc51rh +3rn2zhhth +628nine +seven86four +7bdqmrbdnzbnine +nine621rlqzseven +73two +rnbchhfk6884fivejtr5twonet +qpjlhpnxpnszsrgglpnlclml5qone +3threeninesixdsdsjvz +vmeightbtzkbvdjbcqsx5mfqft8sevensl +jzvqqfzxrbfbhonetwo2knrhfl +1hjkmdchmone2twotwosix +sixseven9 +9two8zlkph +7twoz +ninergqldrlxvn148zdpvgdrptvpg9nbbhgk +szcspm5sixtwovtrmvrthreefour7oneightqqj +foursixthreetwo7vjjdgcqrbh7 +qgqhpnkzgrfivenine7foursixlgqcxzkcjr +phhljpb4zsixpxt22four3 +twogjbhrdrnl9six +znbkscjpxnjzninesevenjnkdvckhgtwo5five +xfkgbhrrpckrftonenxghthree2mz +fivefdgxmb894ztnrljrr7kxzrvlxjcq2 +nqblpkxmzcnhplrhcpv4 +tq3nine9 +bqxh6nine57 +nine5fgvfmthreethree2 +2bqvhb79rrczpptxbb4lmcdgkqm6 +seven1eightnine3seventhreeeightlcsspsb +one7llljbvzngchlnineoneeight +dcztsfgsix8sixjlghbxslpd +4v365 +5fiveqsgkf63fivefmp9seven +2gpnfjrnmcvjfninelmdzkvrmkjqvcp +2lznfour1threerqjtphnine +nzvvxdbb8cpxjdlqxxfour +joneight9nlqrzbthreeonenine +four5hhnbcc8eight4eightbvhsfktmk +sixfpnzsixgksix2s +9onefmkkgvzlzqpl7eight5 +p8vceight1 +dnkzmnvffthreefive7sevenxthdvzxxg +nine4seven38mbhpcdfour +4seventwo7nine +tqxhpxmgllzvbxlfvrmvsgkk3four6 +xgvvninensvnjhglfng8ninefive +threecqccjxnfournineeight7 +fkone9bstvjhmrzh9qfhnxdld1 +72gxqrns94 +8xkqjdvone1339dgdzj +61zvcqrbdlgfivefourdcvpfpspbgxsmjbmblkz +4ninethreelbjtv89xnrt +honeightfivegjbghjfbvlv78vcg +sixjg5dbhkr2sevenjsbrvfv +6onenineone +688ninetwo +7tworbz +jthreesixsixfive7fiveseven +slnsnqn1glrhtrltdlvqmmgfrvckhkbxtsixxjlzqh +msj8 +pqz759rdgv2fourfjvdqvtn3 +gscbthreethree3five7five68 +3seven2 +5llpcgxpcv85d39qqkxltchpc +2vflrsvfive7hnkmgfvnnsqz +7lfdthreegbkqsevenninefive5nj +3dsddfournine +2gghdftbmm9three +jnfxg762 +pgrzbonenine3eight959nine +4phpncp2six +hvdvhprnsplknvdqlx9eightgcxvphpv4687 +5ninembmxsppthreefour3 +tworgvxntpjhr7xftlhponehzqdggmbhp62 +sseven5two +rhtzskrlvtmzgkszone1eightone +1tjrchtrxknstbmxh2zdpglqsxpdbnx4 +8vvpsixbjxxkxclxchjvlvvqqdspqrgh +2six1gfzlrvxgfntqhjqd +8onenineeightsevendfhgbbmc1 +six12three81vfive +four153one +1dfbkfpnqvthreemqzlvcvdnsxgfourtwovhmf +tll5xhqgfvq1hsphkgclrzhmlsqeight8 +2three9sixkprzkzrdzjndjtptbmbsfjzplss +36onepntjtvpjfour4eightnine +8t2ninefour6sixjx +gpnfthree16xj8fqx8n +seven42eight5pzxvx +6ninefour +zrmgttjv3vtnlmrkdtjgsdhc +8plhvcl8sblzgsd +one77phjchvd5six +6gfour8bvgcxsrslrqf +36jllpvdrzqkdjvcts1fjkbfttbeightseven +4nine663mjtdlmqqrvsxnlhcz3six +ftzqhxjvstrz18threepzrjkkqxrd4 +mtbvkvsq38rzk +xtldnjzthree7 +3eightfive83nine32 +3qpdkkdfxgvlktkkbtptnzqnzxl7four5 +nine97eight212 +mcvj6 +sixninefkgntpsboneskphgqmvfq81 +six7mdntzshzr6two81bklxmvcv +qs7ft +fiveqzpcskcrlninebnkvgthreengfbfhln3sevenfour +spjqtwo4seventwo +8fqq +4eightgltkrzs64spgdrhf35 +ffckrhfjb9 +lv128sixninefive +6th +sevenfive19eightninenine9seven +jhmfcj6foursevenmszfjthree8gkpdpnnxbhj +8gvjzvvthreeseven33 +threexnfjlnkmkt9seven949sixgsfdkzzk +eightvfdjxhcvonebnzhrrqpvxdmnqxtzf7tzl +fivesjkthreem6twokhdrsk1hz +641pqhdbzk99onetwofour +sevenxsskzhcppdthree48 +2two49qcnine +sevenseventhreemqcgvbr8onernnone +rkclvq4seven446dkjfpgtseightwobc +two11pzzzxlqqqnfxxqg +5911four4three6six +7jsvdgx +dvdffj2 +8fourfourdbrbbnsjrzhj7 +pzkckdkmfonefivetwozmdxrdmztwo6xd +48sevenninexqglbmcnbgsdtjtkcp +nine4rbbnhlbmfseventwobqbrpvqssxcxqsmcg +7lgzfznxpspthreedgreightwopmf +zmlhnk9bhtdqmxzvgdssixtvvrkpznvjpn +11five16snqbrtqbx +gnvmgninenine83 +onehnmbqdhtpmone29vhhxsxzkrnsix +9dpcdfxp3qtcktbbxglrfp2dsjdhbdncbtxj +fouronezh9ninethreenine +6lrbthreemplnineseven +five6onefourthree +3twoseven +8sixxtmqfxnp234twohsfr +6seven5ninenine3 +sevenfivectsglsqstxjmgdsjrzfveight7 +four9sevensixs7onergssqzfmbvbspmr +jjeightwosix9fklkfxrfhjxksznine +39six +ndbbqgqf3gvzczcdkpzxlxfjshr9 +fourxmnjvrbkln8mnzvpthree5 +foureight94 +ztjplxlksevenseven8ktlb +94ngctc1hnvkpgxnmxxsp1 +qchqnmstcsevenmkkmkxltzjtfsc798 +97zkqgmsfive8 +nqkjxjvvb7nqbgtr45sixsixgczfive +pvrjzqpfoureightfivetwo4zcmmcffnlthree +xktoneighttwoqljrsctbzxxqjtwo1ftsjczrsevenzqcdxtnktwo +eightjbxnnhscg5seven +gpjxfmgpdcmbc6 +six1two9 +g8fivethree +kv5nine9fzkvznlfive +1ts86 +75five6 +threepbhr81 +ninek2xhmcmtnrf +eightkntlndvjskzfour5c +threehpg7kgnjkgqzs87 +4bnnpbgqpmfour2rjpthreeqmjrb9four +four24three +2chsixsixqfcksfpqbt +2ztjdqjr4kpbxmcdpd +xfive79two775eightwohm +cpcjzmltqbtljgqqvnine78three +5sevenl +6tqsvxbbqx +two9zkvfcllbpmmsscvn2fivecndc4 +zqmz46fivejfljvptwosix +4zmhnjftwo1qmtqnhbtt +sixsevenlknss2gzcvfshvfpkfcq9four6 +81mjbktphdjfv6glzl +five6cpctwofiveccsvlshnj +three8lninexhlqmrhm +225onecrjvgckdbk6 +nine154fivemtgvpfnlgx +rtmpvkpdtgtm67five +seventmcrfpsfpx9seven9five1seven9 +rpftkjkhfive858mgjjgcpcsevenxrjfsxrr +kvcthrfkcjvq3659 +kxnbtm5 +three7mmqmcpkz7sixhpzsxpknszbdr +nine92csvcxhcr7 +7fouronefive6qfml9eight5 +489hdvzxfsgjngkzkdvfiveone3 +6sgnbhjqqxqeightgmvtqdcfivesix +dfphtx3 +four8mcrszfpbbsjdmqpkjdgftqhskp9 +7763tqbgpfltbrcgm6 +9onevrnmrhtb5onethree3zbpdfznxbkbscjtjb +pninethreetwo76tclssnpz +9fournine +63nxvsmhbngseventwosix +djnine3jzghptvbpbseven9 +2six16one +4eight2 +four85nzfour69one +6625lbssixkrxsfshjp +2133eightzmfxcrlhngthree +four7fcszmcs +gtfqrjqxkxjkblfstrcszcrz3one1mjhbv +vbpseven2four +2bngj8rdxvdcxdvj7four +2pqnineeighttworps +twoszzrbzlqb8sixq +six54bgrpn +17five +8threefrvhj19fivethree42 +eightltpcssixtwoxms5ghf +sevenonefive57mdpqbsdttdxxzctcqonethree +threersqkhmgbsnlszskhslp57oneightlm +six9threerzdsfkzj +rskvrvxrxntspzstworpxfxqjrvnmhgsvcdthree21zvjlxd +3gdkcg +vvvxkxhzeight295seven +1hqzbfzdzrbnz3x6 +9fiveeightpvjpvdrl +7jcgbkthree3pqxlsixfour +rxeightwonineqntwocpstsl3rtfbzzf5 +trlsqtls9nxstgtnthree89 +glxnkkssflcttone73 +3drvbgb8eight +4937fouronemnqb +63vjtwo1fourcmvkmzpcsh +four8119sixonedjmsqnxtwo +296544 +ninefj3 +three4ninefour8two +fiveninethreethree3jss8lzlk +gsjfrnhggktwobcnxfp96bt +27onerbtz4fourfour1 +88three6five +ffckjftkbrxfvzphmx4 +2nqbxnqhxonesevengsxfspghjnglnl2 +7hqtrhpdtnrhjx1sixeightknhzpmt +five29xb1xhdf6bxbxptxfnrmmvn +2sixmmdkrzkgmvjvp1six9four +414fournine2kcjss +7kgb5twonine +66five3threerhx +qzh9 +ninexsdkngnzffourljrhrsrkx9sevenseven +five6eightninetnonesix +6prgtmxjlztstbkcfour +th9 +jmtgprnslgn5 +7twoeightgngmcqnpd +92eight8 +twolvxlvg57 +3ninethreeeightvgvbnk2f +nsmeightwo8vjbgfhhrsixoneclzeight +9sixeight3nrbxqhtgskeightvmh8 +threelsqvpd99chmlmtj +xeightwo8 +5pjjjkxxkfourjvgshnffjfjzd4 +1px +three8twoneh +sevenfivephvqsqrzl524 +2seven3 +five45pktjrjnckjsixninezrcjxdrsmdc +rxgxctwobtwo9ngbrhfjhqc +six153bq +2qltqxkzeightonevxhsbglxk +hjpltpcf1blmcfourtwonine467 +42five9eight +sixxhlfqh1ttp +threetwosgbvsprq7j5threelcbx +npgrkbnhbsmpbnshg46 +ninenine9five8m +pjdxpnddndfiveqjlsp5dtlstrlz +tvc57krtsmhqqvfqxfpjkfbbddpg3five +1jkcfxpgmeight4qmhxrxjlghjsgnjptltvtwones +eightkpgvbmlpfmrpfncnlb6rtltdbk4 +3fxcmvxfivemntgvphgsspeightzsdjdrpxnlxs +shsdpncrxhlxsevenmkjpznnkdjr5fournine +four8qdrjtt1eightnineonefour3 +three82gnpljsnbcn5 +1ggfivethreefour75 +one6vhx +5fivetwo2529 +six2b2 +fourninefiveseven9 +fourfvrglnpdqfhsnine6zpsccbone1h +1eight8mzdtwofour +8eightwoq +ninesixfivecpmlvqkk9three +kgcmvpjvjbmnqbstwo45fiveoneightqhn +xjrcgdblffour5onefive +hqtxjnineqngjvsfour4gbt2 +9sevenlxzlrvzln +brcptklplkfj1vqdpbvbdsix96 +four9oneldsvbfivesix +145tdpvphfbqknine +ljflbdvxqhvmtsevensix4eight +6onefive8zlplrvfour +6mzhddbtg8sevennine48rnc +fivesix3fivehtpdghxhm62 +87123 +fivethree43seven5pztchmt +onegzqbbzm6vpm5 +952eight +6four2srtnppsttwoninegvhctmqftp +5threethreeqxvspthn612phhseven +73four35pgtvz +5four29 +79fiveeightone1 +bgblfdstmvbsgsjgn281sevenzlrpmtxbeightwohcq +9sixpqttnvjmlscone5 +6threesfourfivebkkx +fivesixsevendlmldl3 +bqvpfzghfoursxbndvlxzgbs5eighteight +fbmcgpz83pztlsevenmjbxbpcxx +three61rrthjdzs +8mx57sevennines7 +3rmcfbldjhtcfhfnqsixkkpclcb5z +ttsm16gzcqninetzkjzcrmcbkrn +qkvonetwoseven486 +lnqnbkpsix84 +5sixrzl1hlgjcnzxsevenone7 +99hcznvbnbnhssk +2cccbmqtzkfivenine7gnhjvcg5 +8gxkkrgnpsx38kbxeightwonzm +8kdv +pmxninecqeightfour1bgpqrrkjnhjfhtn +nineseventwo6nine +fpftlgd33sevenseven417 +fourt3fivethree +tfive8jzbjf5nkvttwonzpbplthc +41nineninethreeone8two +31mdlfvreightwotr +6twosixsixjlmcdqrpjthree4four +g2 +eightjjzh3ntlglxxpmcdrfnvkone +ht6 +eight9threehmbfnsjtpl5threergldqjfjheightdhbz +vssqqrmvpnpjthreetwo8bhbbrfckmzvbc4 +klgl8nntkkvhsixsixfour47fivetwonel +ttwospnvbcr2ktkzcmftpfqxbbrfjxpxthree +six7jcfjpjt6lgclnzonebzlbfsdbgbpzdkhx +six824czjxvvkghdvzbzql6 +vfivecjlm8seven +fiveeightcrn6ldxqdqxkvntwo4 +lzcqrfkct4ninesixfour5onenjqx +ninenine1ttjjjmvrbs +4xcmqggjhts +8nkd1six +mldzcxznine4seight +eighthdthqc56 +zhjffivefshkbqttwo5 +lgngmclkjjvhncffivetwo5stcjnzlfjb2 +glpflvjx6 +one863sixfivenineninejrbvqlz +9fttbspxxtgbeight +sglfjndn8mcfcftwotwo +fxzsrvxhpvkseven3fivejmtjlpmb +9kphnine31ddxztph +s39lffour3lkdbrks +3fhhth5hgsmh8vqspmmqcteight +6sevenhtclc +26njgdfive7onejtglghzlj +kktgkzfcpd6nlfcvxvvfnine +8ccnhdd4czfgsevennineqszfqd +onefour194xkj9eight8 +onesixkvjr52 +eightfive1rnrqjbfdck9hp8klq +five69bcg +threefivet136pfivefive +seven7mhdhlhnmghklbbjcbseven93mgltsvnbx +9762threefive +ctdssd25qnrztptmr +13fxdptkcgmxjfdccgcrj545gfzdlmcrpp +sixjrlmbcfournrsvjltwo5sbbvsfxsr5 +grkkhhpmx9 +vbvmkmxnmvdxfive8jd +41141722 +91xngpn3sfjkkfmjnthree +zxsix17brp7twotwo +nine39six6 +llq7 +83threethreeeightninethree +svdbjstvsix6zqbppsfour +two76fxzdss3sevenzg9htmnflgq +fourtwotwo2ptb +cbrv9 +vrvdvq1psq2fourgvmqk +42sevendmdsonetwom75 +fourhxr4ntppb +14btwo18 +vzx8two +3sdmnlqsqkb9324xfdhptnine +6n4 +5twoltmoneseven +xmqdjlz5seveneightonetwoseven9 +7three4eightzxlgpxhnrb4667 +5nine39eight +one1twojxjnb +eightkmlhjvhhgd5pqkblcr +jddsgdgdf16231sixmzfnpgvnqp +hgkss234five691 +kxzvnbnnine3n438xrt +lhnfour9 +fourrqktqhglbh3sevensevenfive89 +xdrtgjlstwothreeqdhnpxhqtjkldfcbkqgxmlktfour7 +fqoneightftbxksztshxssevensq1 +3rtsnzspqrrqsfive +213 +nine6three53bzrhpg6nine +t3sxccdtzvhvfive +7762 +7gxvmb +644eight5448two +8hxnqrqknththree3 +3sevenfive9six +fiveseven3threemkppbkpxhqgn +czseven6418mqkjdlftcjfbjsd4 +971ponenckqqv1 +ninesevenmqqtcnl151seven2 +7cmrgqbzfour +3six6fourdxbxngjonelzhjl +txtfxpsmmlninefour8q8 +pqhpzfive3four +7bggjsjrsv +49ninefive1fivenstnfcm5 +seven2lrkhzgkj5fourtwo +eightone7717eight9 +fld3threetwo1three +1fourfive34onetszfour +mxfdscrkbr8nine53seven +onethree4fivemxlchhzqbzpvszj7 +cjzhpqseven1fivetwofour78 +9vsnhq22ksrrjmkhvdtwo +2lzkxtvseventhreeseventwo +three8fourfivetwozgcrbrxdjk +87vqrqfvxrkdsix3 +two3ccsix +spjtwo5four +53gvzvzrnr29mrxljz +onefourone1ninethreeeight66 +6kbt +3nc5eight +sevennkbjttdjv216m9djcrntqxx +jzs333tjlhhroneklmmhflgvb +two9seven2eight834five +fivetwo4two3five +five76 +9sevenljjrrrrvfg +tlttwonermnfrl94 +xpbjpfzbkcgseven36fiveseven +7fivefourhvjf6seven +5three765nkj +eight8nine8eighttwonine3 +2fivesixvfhninehbsfklrhgzfourjdjgb +cdthree6vbntwo9 +sevenfpnmvftmpn8 +qcbhgzqtrbcc6 +ntvtxbdkcvtxdkzdz5kvkvdbxhdj5twojxfivekxvdtmg +pzlxrnsqlfour9hdpllf9sxjtxntwo +7prlzzkninenxthqdk4nine +twothhhbfourbsdbmsixczrhddqdt1 +nineninefivetwo6eightfour74 +foureightghgrjtwo5zvnrxttwo4 +two8five +hltjz5two1seven19 +sixcfz1jpfp3onesix57 +544 +7626 +fhzhpfivebbkvsix71 +xtwonefive1eight7cfss18 +threeninefmlbfznine6sixtwohfxnfffive +szpgrtwo7 +3xsixtwo1nzlpb +5three1rhcczoneg +onefourz3tff6htmmqk +mfclgcvn8fourkxjdtwohsxphnftsn +392one29 +2hpflkrtwo +8ncfncgvtcgxd3rkfqb3twodlldrzqsix +3three63eighttwovgsdkx18 +6sixfour +zksq2xdxkz1onebtbmbmmlc71vldqsk +r2 +1ncdcsbq +8cbdqgbcc1six5pxdbkgzjhq +tltwopsjsgtvvftc2six +fournvseight3two3 +four57cphtrbghtscdhkhjttr +qninesixtrrjxgbvms9five28six +one8qsixthree75csc +8pqd4threefivephpkqcgnine +nkfjpxqhsjmbbx64rpdfqksmfq877 +677sixbgg1 +4six3mzzrgcrms5six +gzcmlrqvktstnjmrzqx36pmftnbvr5 +honemvzkfbkvxsjnlkhfrs6seven3six +8onemmcjp +sixseventhree8threetwo3six +7sevengdjqlx12three +chgvllfqlfninetwo7twotkntcpls6four +6lvxcqzcfmg9mcjjlnbr9 +onelfjdbnntlvndktceight42 +95rfdnllb3pqtnpmgbtssbbx +sixkntcqsnmg3eightldfkeight8six +vonexcchsdssblsqd8dsmggkzjsdfclmbpthree7 +4msevenfivesevenljxtkxhdfbnine +fksf6 +lmmqndlfthree17397 +fourninemrr8cljkkqbseven +336six4blbbpxcbdd +ninetwo1threefggtvbrsczftcrthkcmxhtseven +sevensixone4three2 +one4four +bc2 +qhgndzxpdmonecbjqtwojvkftdlfvnhqrtpdb4lbkgffvlp +324fiveninenzp +c54 +482799 +6ninemd +kd3ljjxmmckrcbrcshxflgs6llvvthrhvd2 +hjlxsksix2eight +one12twotzchrdfpg +3dfksprqsvzmr2eight4 +sftsktwofjxbhhvseven76sevengtptwonej +seven2threefour4two +2tdzxcbnpnx4 +2b6six4lsglzkbjxk2 +kfrntpdnl6sixvs3lxcrpjmkkff +ninesix8xkhmmnplggvng +3jjd5onevssix +nine2cfbhdmgptwo4xz8 +sdjtzbzm1threethreedhvhshgvnn3 +sevenone534bgjmzlpcmxfz +pvvbcnlq8djdp21lhdgkfkleightoneightlxv +4xgjzmcbkn2jgb41 +4pmfbgqrjdrkmxfjthreeone2 +eight7ninefqxjvm3oneightx +1ntbgttnbfive8 +6nqfive +fourpdxvg1dqhtbc +8ninemrdtwo +8onesbdp +34kxkvvdkfourmktjbzqpktwo5 +8jjnjvzrzkmkj8qqsevenfjkqnbvlrqdnbfnxvb +ljhpqnqfdkstssrptpq1hhv +dsix7df4qhsvjp53vlnhthp +fourpq9 +dcvlmlvbtwo5jlfkhmxxrldsqqhkztx1sevenfive +1rgnhdjrcvhnxhk5ndfxprfmmgff +8jhqfm3bonen7 +2eight2km7kjdkltnfivesixnine +8j5onecmbceightoneseven +nvvskqrjfz77four21tvclspzgjq8 +fhdlvm52seven5ninethclsbhbmcsixtx +8btlvsfpz +sevenonepsxfdhqck5fzvftnsix +five4twoone56 +rzgxzdzqrmseven1rrkpbp +vvhpzfcbchtwo3seven8nine3 +three7zqxvhmbnrsdxvnpjsevenninefour2 +6fivesblnqfjtrninekrxvzd927 +sixfp2xfdqqkblc9 +nlvxkslrgjrsfive2 +kvxtdkfvxntwo7hvqlzz +3five4twolvxnmzltcbthree +2sevenfive6 +sixseven3113ncgzrjjkr +2gppmh39dmmgjks +363czlhjeight95 +zk1sixsix6twosix +8fourtc5 +sixeight1three2twonine87 +5vvnh +fhnvvkhsx3 +one9nine +jnrk8r +zhjqc66oneightxf +three72cpzhp2pmgzkddb8 +6sixtcxqcv +three3mdqgkhjdbc1nine76nvht +dqbk6fourfssthlnjmgmjfjf72 +fjgjfbv2dlmqgtssnmonesevenfoureighttwo +66gqffpzqfs +zpmslbnm75foureightspkjssseventwo +81xjd3 +t2three7zqcnklffivefive +kfdkflvrgkfour6threevhdm +gpjdrtm2sbttvbcxdvfmc3one5three +xcpjgnninenineonenine3fourfourqghsvqfn +hvxtnvtn9twot +svftdtjhlone5twosevenonekjxtnnnrg5 +2ninesixthree +88twofourf +14brpnzhmlljgxxc +rzzmsskzbsonelts28 +34ninerft5 +rzvlkjvone142oneightpv +onenzeightvcgzhpkmfn3rxninenstzzbv +78xtwo3qmjvnlmvslqftd +twoeightnine4ctzmjrfjtqpv8g4 +9pcfive7four7nine +7kjnfhncjxcdhmsptr9srht9 +89548szcgrnvfive +xdtgbmkknmoneseven6jtzmlbpcktncfcllvfgckqbpxtwo +nfjqcnine68eight +61fqhc +bljszntg1hchhb +eight331qs5drzfn +75733 +sevenfour7fourfive3 +qhn7jrcxzxm +72fournpppvgzxhfkz15pbcvhlqm +kzktsfzq5dhhmzfbx55 +sjcqgjnxrcxhnineninemzpmczrxbppp5 +three8dqhstsgpc78 +g46zlqxtn4 +fivegzddrsevenseven9xmztgpjprxseven3 +9nqdflnboneeightnineone2 +3hxlf8nine9 +6sx9eight4 +77two121 +two31ltrbfrsix1 +sevenone575jxgcvqjzcrthktczhqnq1 +53phstwo +5sixkgmvkxcf +3mlcvx +164vpmdfeightzqsddcd +55jcqcfthtgsssbc +kmfsxjv4mrpvceight857zdqtqb6 +bdms1czcpxgcgb1jsjhpzncxdrqcbhkfivexgzlq +ninenineeightfivedhthreelfour5 +mbsmkshmsbnxbflmrz7qzqz87qqqxbhphgbvgseven +9sevenldstrnjtkdkjtlspsjmzzttzdzsix +5lsrdqxghnl1 +64twoninethreeqqfrzcmmrfqnbp +khoneightsevenrflbbdmfourm6nhfdxzpkhlbsdqgvtctlp +eighteightfive5 +eightrfourrbscmnrsxg9kjj +ninexpbbmlsevenfour9 +ntnckzcfour9twosrff +rnxdgvfivesix1psstntffn +cbcxxst47three2ninevkpbcspcj +16seven5qbpnhqxrcjvtwo +849two8185 +seven2seven2one8fourfourseven +fourdjjmtvfbr12 +sevennvrfqzl9lhgsflkk +cdhklbhntwosgbpqmljhsevensfff1onesixvmdxcglt +6pcqhlzzzone +eightqkthfivesevenfpxbrnkphfttgstdv3 +48fivesevenfivetwo +n5fivefour +4gnnbznfour +1threefivebcgxzpd +ttmeightwo19mrnhbgxz2gjdctxvhtzpkq +sevenmtlmpzlzgzq5one29 +314threehdmtckfgtxbvdg +1fivefour4jninevgdxthreeone +bhkjl84fiveeight +sgtbgcrplgfqqqkkxsveightseven2 +twonine9 +3nineqffxrtthree98spldqjdrqzzcs +one9fpgbcdsldpfour +6two1sevenmrxbvkp22 +ctdsninethree5 +cszlntkkq4prfcrdsx4 +cmvxcgtgrsbjsd8189 +4sixrshzpspnzvftftwotk8bmcrpn +four5pbqqpdgcmkspsccmgffive939 +j3eight2 +6twosixeightfkfftzthree +hhjn7ccfxjl3eight +2fiveseven +four9rt +7ffflzh5zrqftwonehht +4qfive +four7h +six8four149six8 +nine74six1hblnnrone +sixtlrmmckxgsmskqdmtnvvmncmdtqtmpfive4 +5seven95bmrtd +17cgstgbcjsixvlzkqh3fgsvmcssjvsevenffrjtt +6576bkmbjplfive7seven9 +nrbmhmkbxdntb17qbncrtmvjcsix4 +8dckvflvm +33seven7nmjlctwovrpjpvmrgr +2eighttwo7mdv9 +vk9gone +9cdxlcxgvoneseveneight +8five7one +sevendtslgtkcrs1rqpkl4mq5five8 +3thhhqplbqczvkg67 +7661dqjcnsix7knccb +four3eightbslcfbsbvj4 +2fivegfvhsvsj4fourqxd +six35smmsqtnmtwo3threeeighttwo +9fchjtgvfvpxlvpbghn +threefoureighttwo1q +fiveeighttwo6 +25three9eighteightsix +cjhbnineone342xjvfour +sixnine3 +1nine53 +5fouronevzstmptgrgffrprbbjnrhfzmfour +fnlvqxgbseven3qdbsvqcm8sixthreerfp +foureighteight2 +foureight82dx8gdqzrpssd4jqkzm +dpthree2565cqgthree4 +cjjjkftntjq4 +1qdmmfivetwo +lb4four +two6hjgqt +ddjchjglpbcsfourdtvtcbzb3five +6twojqffjcbxone +4gc6cskjfptjxbpone +32gfttjsdtfvsixone +oneffjrrtrx4xlscjrpcdzv +hznvzf59jfsftctzh1343 +pkxpqnbvgscseventhreeeight2two3 +tgsrfcseight5four +9three5 +njddsqsix5three +drpksbtwo6jgxmphdnvjbxc951 +dltwone554rrczft9four +ninethreeghlldqbtl69bvpbmxx +four6spcfqgvvcvz6ninedtltbcnhsj +7lfnzntzjxvthreeonefourthreevssnvvgzc +3fourxxqbfdjxjdmrbxxzgxjhmvxh +pkxjxrszx4 +onetwoqpzltxj4threetwokzlcqrvmpq +mpfslkxeighttdfcbpvdjbfb84hsbz +twosixeight72gdvmqbnpq +threefivenndkfive4lqhkxqfthree +92cpsgjonefivethreefourvnqmrn +8eightbtcskqbl +8eightqcqcfrtdc8sixtwomfdg +5z14 +7sevenfiveonefbsgzzf5ninevjhqx +57eighttcspqjtxponeightffd +5ninenxthreeonectxfqmrlskzkxclghth +97ttkhsvqfivez6 +lvkkp9jkkxrmph1 +jfnfpzqttgzmcrhn3nvbddtnrtxfoursix +7ff7tgdzfour +3four8kggghfzmcq1 +onefour4xfnpgfrfp +43pbxbjp6vqvrvkvc +twofournkcj56nine5 +one9qzkptjmeight +f86ninen24twothree +three2ffqzzzzbdm837qtczrbpd +6five49 +399ffk +825pbghkzmz +27eighteight38sixfive +2fivepqqcnphkfc19xnqfljkrqt +769clhcfmcbnntlrrtg21 +323jmphjone +lpgvnlqtwo8 +97onesix5 +99dccchbdfdlczdfxtfbh4 +8tkqfsdsevenfour11 +4klm3fiveeightcszvlftm1 +eight6foureightfouronefht6 +qpfive1 +32nrjhnnldb +7ninefourhpbfivermgkkxqsixnjkrntfv +9mzjsevenghctqjcbjz +two95gdfive +5flpvgjsmbbxgsgh2threesqjnoneightdt +mtpcvjlq2891rnine8 +srhrgtwonine4 +fivesixninenkkrnpthreeseven6mffive +qrmtfour8 +eightfourfive4 +558 +15sixbfdsgrdmponefour +5threepfqbrkcgrv +twolxzdhfourqjeightfour55zjvconeightnf +hmscktxrthreeqrp26 +27kzbhxzfiverrzkdrxqfd3two +765eight748vzflchf +6fourljfoursix3 +nineone9 +dtwone672fiveqzzcfrpzfjmhttninetgm +clkseveneight8jcgmtmkrv +fourfive4vqtqtngssone +rkjjcbgsxfzxjfd2hjonerqkkhnxpboneh +one3mbccxfv7rgtxbnvs7 +61pxsixpztmvfr5eight4ntgl +63kmhbdgdbnbctkrtwotmd4tx +fiveseven4eightwolq +4three2fivecnlzgone3 +7mmmfrrdcqs +fivegfk5sixeight7pt14 +19two +1gqsqnmbvlzklsxdbmeight1six4fourgztmkqsl +sevenzbqdzlmthree7two381eight +eight7nxzvrpxl +fourtwothreeqjvqgsbtlmgqnb9sevenrxn +5eight4sixeightbggshzhjtwo2dsvhtsgg +3oneeightrhzktblfcp5 +339bfrsfdbbxv32zxjxkflknlvsq +51 +34eightcvgm +gb944hzjhdtdcg9 +seven2khjt +sixpgsvqxdgd8813rrzv +six1eightrksvzhltnnfivefqvnxcsjzzthree1 +89xz +jxzccq8eighteight +rn4ncmgllzht +nhrptztv2eightseven +sixbztt3sevenjnhzxkgsbsvmq +eightsixeight9two5four +5kgkrnbplph7 +fivefour3one37sevenbhd +one6onepkpnfhqmp +1sevenqzcgsnine1zkone +1vbbppvtxonefive +vpxlbcqfivejhxh69six14six +54kzqzvfshddq +zk124jcgnc3three1 +fbkvqqbhmkfiveone9kctfour7 +jkzgeightfour7nine6 +cdvxvmtwofourgbsk9kmfrtv +x9one +gsixfourzkmnmvk41djssgh +threehvpdzlhnzpthree9 +2z +vttbsmn1seven9nine4 +xtht483fivet +threehgxlkzrd1 +sevensixmb68sixthreefive1 +5sfqxpx2fiveone +38zdpcljqkf +two32ndxvvqpnn5 +1fourprmkdzqxqsonedlkhxbqplx +3nine5two8three +4sbvcnsjdmktwofourseven +moneeight2jjrfvfxztcseven +two8three3twoljpzzshzgfqjpb +twosix7nineseven +seight3qvmq2f1kkfone +xtwonezkxhsdkqvmp2fmcmqxcczpeight +5sixthree22fourfoursix +fivezqpspcbzkdmmtwo3ssgpfgkhnrpplt +lbtsdpgjp73 +3rccfnineffpgrmh +5bsnjxljdcsixtwo53 +fivefour4fourg9 +98seven +sevenninemskq8 +dhpbgtkmjfourone6rsgnpvsbjtkfqsvrs9threethree +one5nine +ninelnsmgk3seven27eightsshhpqpb +fourtwoqscffdv4nmvngxbqht +ndtvfive2brkzntrjjl179 +8six82one +nine5fivecgfsbvbtsn57five7djxlclnfv +2gzqrfldtlpeight3fivencmlmffivevqkhncfm +7bbfbcvh6 +ffnrprtnine1tjznmckv5sixczv diff --git a/01/main.s b/01/main.s new file mode 100644 index 0000000..683d2d4 --- /dev/null +++ b/01/main.s @@ -0,0 +1,222 @@ +%define BUFF_LIM 32768 + +; call # val val2 +; int $0x80 eax eax edx - +; +; arg1 arg2 arg3 arg4 arg5 arg6 arg7 +; ebx ecx edx esi edi ebp - +global _start +[bits 32] +[section .text] +_start: +push 0 ; eof +mov eax, 5 ; open +mov ebx, filename +xor ecx, ecx ; read only +int 0x80 +mov ebx, eax +mov eax, 3 ; read +mov ecx, read_buff +mov edx, BUFF_LIM +int 0x80 +cmp eax, -1 ; err +je exit +cmp eax, BUFF_LIM +je .no_eof +; we hit eof +inc dword [esp] +.no_eof: +; parse section +lea edi, [read_buff+eax] +mov esi, read_buff +.cont_read: +xor ecx, ecx ; set if first is found +; last digit in ebx +xor ebx, ebx +; counting loop +xor eax, eax +push eax ; first digit +jmp .count_loop_cont +.count_loop: +lodsb +cmp al, 10 ; newline +je .next_line +cmp al, '0' +jl .count_loop_cont +cmp al, '9' +jg .check_str +sub al, '0' +; reset string parsing when we got a numeral +call reset_string_wheels +.matched: +test ecx, ecx +jnz .have_first +mov [esp], eax ; first digit +inc ecx +.have_first: +mov ebx, eax ; set last to current +.count_loop_cont: +cmp esi, edi +jl .count_loop +.next_line: +test ecx, ecx +jz .check_end ; no digits (huh?) +pop eax ; first digit +mov dl, 10 +mul dl +add eax, ebx +; add to total +add [final_value], eax +.check_end: +; reset string parsing when we got a newline +call reset_string_wheels +; check for more data +cmp esi, edi +jl .cont_read +; TODO handle files over BUFF_LIM bytes +; check for EOF +cmp dword [esp], 1 +jne .cont_read +; we're at EOF, print result +mov eax, [final_value] +call print_dec +jmp exit +.check_str: +call weird_string_parser +; check result +mov al, [matched_value] +test al, al +jnz .match_found +; nothing matched yet +; check if we got a word char +cmp byte [matched_any_char], 1 +je .count_loop_cont +; not a word char, reset wheels +call reset_string_wheels +jmp .count_loop_cont +.match_found: +; we have a match +; reset the matched value +; and go back to loop +mov byte [matched_value], 0 +jmp .matched + +reset_string_wheels: +push edi +push ecx +push eax +mov edi, number_wheels +mov ecx, number_lens - number_wheels +xor eax, eax +rep stosb +pop eax +pop ecx +pop edi +ret + +exit: +mov eax, 1 +int 0x80 ; exit + +; i hate this +print_dec: +sub esp, 12 +lea ecx, [esp+11] +test eax, eax +jz .zero +mov esi, 0 +mov ebx, 10 +.div_shit: +xor edx, edx +div ebx +dec ecx +inc esi +add dl, '0' +mov byte [ecx], dl +test eax, eax +jnz .div_shit +mov edx, esi +jmp .write +.zero: +mov byte [esp+10], 0 +lea ecx, [esp+10] +mov edx, 1 ; count +.write: +mov eax, 4 ; write +mov ebx, 1 ; stdout +int 0x80 +add esp, 12 +ret + +; i'm in hell +weird_string_parser: +pushad +; reset matched any char +mov byte [matched_any_char], 0 +mov edi, number_wheels +mov esi, number_lens +mov ebp, numbers +mov ecx, 0 +.test_loop: +mov edx, ebp +; add current wheel value +movzx ebx, byte [edi] +add edx, ebx +; compare to input +cmp byte [edx], al +jne .next_test_fail +; match - increment counter +inc bl +; test against length +cmp byte [esi], bl +je .full_match +.partial_match: +; partial match - save value +mov [edi], bl +; we matched any char +mov byte [matched_any_char], 1 +jmp .next_test_match +.next_test_fail: +; reset the current wheel +mov byte [edi], 0 +; check if it's the start of the word +cmp byte [ebp], al +jne .next_test_match ; nope +; yep! save +mov bl, 1 +jmp .partial_match +.next_test_match: +inc ecx +; check if we're done testing +cmp ecx, 9 +jge .done +; add current value length to string +movzx ebx, byte [esi] +add ebp, ebx +inc edi +inc esi +; loop +jmp .test_loop +.done: +popad +ret +.full_match: +; save matched byte +inc ecx ; zero -> one +mov byte [matched_value], cl +; reset this wheel +mov byte [edi], 0 +; next check +jmp .next_test_match + +[section .data] +final_value: dd 0 +matched_value: db 0 +matched_any_char: db 0 +number_wheels: db 0,0,0,0,0,0,0,0,0 +number_lens: db 3,3,5,4,4,3,5,5,4 +numbers: db "onetwothreefourfivesixseveneightnine" +filename: db "input",0 + +[section .bss] +read_buff: resb BUFF_LIM diff --git a/01/main_part1.s b/01/main_part1.s new file mode 100644 index 0000000..1f868e0 --- /dev/null +++ b/01/main_part1.s @@ -0,0 +1,117 @@ +%define BUFF_LIM 32768 + +; call # val val2 +; int $0x80 eax eax edx - +; +; arg1 arg2 arg3 arg4 arg5 arg6 arg7 +; ebx ecx edx esi edi ebp - +global _start +[bits 32] +[section .text] +_start: +push 0 ; eof +mov eax, 5 ; open +mov ebx, filename +xor ecx, ecx ; read only +int 0x80 +mov ebx, eax +mov eax, 3 ; read +mov ecx, read_buff +mov edx, BUFF_LIM +int 0x80 +cmp eax, -1 ; err +je exit +cmp eax, BUFF_LIM +je .no_eof +; we hit eof +inc dword [esp] +.no_eof: +; parse section +lea edi, [read_buff+eax] +mov esi, read_buff +.cont_read: +xor ecx, ecx ; set if first is found +; last digit in ebx +xor ebx, ebx +; counting loop +xor eax, eax +push eax ; first digit +jmp .count_loop_cont +.count_loop: +lodsb +cmp al, 10 ; newline +je .next_line +sub al, '0' +js .count_loop_cont +cmp al, 9 +jg .count_loop_cont +test ecx, ecx +jnz .have_first +mov [esp], eax ; first digit +inc ecx +.have_first: +mov ebx, eax ; set last to current +.count_loop_cont: +cmp esi, edi +jl .count_loop +.next_line: +test ecx, ecx +jz .cont_read ; no digits! +pop eax ; first digit +mov dl, 10 +mul dl +add eax, ebx +; add to total +add [final_value], eax +; check for more data +cmp esi, edi +jl .cont_read +; TODO handle files over BUFF_LIM bytes +; check for EOF +cmp dword [esp], 1 +jne .cont_read +; we're at EOF, print result +mov eax, [final_value] +call print_dec +jmp exit + +exit: +mov eax, 1 +int 0x80 ; exit + +; i hate this +print_dec: +sub esp, 12 +lea ecx, [esp+11] +test eax, eax +jz .zero +mov esi, 0 +mov ebx, 10 +.div_shit: +xor edx, edx +div ebx +dec ecx +inc esi +add dl, '0' +mov byte [ecx], dl +test eax, eax +jnz .div_shit +mov edx, esi +jmp .write +.zero: +mov byte [esp+10], 0 +lea ecx, [esp+10] +mov edx, 1 ; count +.write: +mov eax, 4 ; write +mov ebx, 1 ; stdout +int 0x80 +add esp, 12 +ret + +[section .data] +final_value: dd 0 +filename: db "input",0 + +[section .bss] +read_buff: resb BUFF_LIM diff --git a/README.md b/README.md new file mode 100644 index 0000000..99a91c6 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# advent of code 2023 +i'm doing this in assembly +bc masochism or something +i'm dying +why +