{"id":17945,"date":"2024-10-26T14:21:31","date_gmt":"2024-10-26T14:21:31","guid":{"rendered":"http:\/\/www.max-sperling.bplaced.net\/?p=17945"},"modified":"2025-09-10T15:24:43","modified_gmt":"2025-09-10T15:24:43","slug":"assembler-instructions-selection","status":"publish","type":"post","link":"http:\/\/www.max-sperling.bplaced.net\/?p=17945","title":{"rendered":"Basic assembler instructions (x64, A64)"},"content":{"rendered":"<h2>Instructions<\/h2>\n<table>\n<tr>\n<th>Purpose<\/th>\n<th>x64 (Intel flavor)<\/th>\n<th>A64<\/th>\n<\/tr>\n<tr>\n<td>Copy content (dst = src)<\/td>\n<td>MOV RAX, RBX<\/td>\n<td>MOV X0, X1<\/td>\n<\/tr>\n<tr>\n<td>Copy content (dst = *src)<\/td>\n<td>MOV RAX, [RBX]<\/td>\n<td>LDR X0, [X1]<\/td>\n<\/tr>\n<tr>\n<td>Copy content (*dst = src)<\/td>\n<td>MOV [RAX], RBX<\/td>\n<td>STR X1, [X0]<\/td>\n<\/tr>\n<tr>\n<td>Push on stack<\/td>\n<td>PUSH RAX<\/td>\n<td>PUSH {X0}<\/td>\n<\/tr>\n<tr>\n<td>Pop from stack<\/td>\n<td>POP RAX<\/td>\n<td>POP {X0}<\/td>\n<\/tr>\n<tr>\n<td>Summation<\/td>\n<td>ADD RAX, RBX <br \/> ADD RAX, 0x10<\/td>\n<td>ADD X0, X0, X1 <br \/> ADD X0, #16<\/td>\n<\/tr>\n<tr>\n<td>Subtraction<\/td>\n<td>SUB RAX, RBX <br \/> SUB RAX, 0x10<\/td>\n<td>SUB X0, X0, X1 <br \/> SUB X0, #16<\/td>\n<\/tr>\n<tr>\n<td>Enter Function<\/td>\n<td>CALL function<\/td>\n<td>BL function<\/td>\n<\/tr>\n<tr>\n<td>Leave Function<\/td>\n<td>RET<\/td>\n<td>BX LR<\/td>\n<\/tr>\n<tr>\n<td>Unconditional Jump\/Branch<\/td>\n<td>JMP address<\/td>\n<td>BX address<\/td>\n<\/tr>\n<tr>\n<td>Comparison (Subtraction)<\/td>\n<td>CMP RAX, RBX<\/td>\n<td>CMP X0, X1<\/td>\n<\/tr>\n<tr>\n<td>Comparison (Bitwise AND)<\/td>\n<td>TEST RAX, RAX<\/td>\n<td>TST X0, X0<\/td>\n<\/tr>\n<tr>\n<td>Jump\/Branch if zero (\/equal) <\/td>\n<td>JE address<\/td>\n<td>BEQ address<\/td>\n<\/tr>\n<tr>\n<td>Jump\/Branch if not zero (\/not equal) <\/td>\n<td>JNE address<\/td>\n<td>BNE address<\/td>\n<\/tr>\n<\/table>\n<h3>Syntax flavor<\/h3>\n<pre>\r\n(gdb) set disassembly-flavor att\r\n(gdb) set disassembly-flavor intel\r\n(gdb) show disassembly-flavor\r\n<\/pre>\n<p>&#8211; Intel flavor: COMMAND destination, source<br \/>\n&#8211; AT&#038;T flavor: COMMAND source, destination<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Instructions Purpose x64 (Intel flavor) A64 Copy content (dst = src) MOV RAX, RBX MOV X0, X1 Copy content (dst<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false},"categories":[28],"tags":[],"_links":{"self":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/17945"}],"collection":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=17945"}],"version-history":[{"count":9,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/17945\/revisions"}],"predecessor-version":[{"id":19184,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/17945\/revisions\/19184"}],"wp:attachment":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=17945"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=17945"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=17945"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}