{"id":1955,"date":"2024-10-13T14:38:44","date_gmt":"2024-10-13T13:38:44","guid":{"rendered":"https:\/\/blog.univ-angers.fr\/mathsinfo\/?p=1955"},"modified":"2024-10-15T07:23:12","modified_gmt":"2024-10-15T06:23:12","slug":"initiation-a-lassembleur-8080-sur-altair-8800","status":"publish","type":"post","link":"https:\/\/blog.univ-angers.fr\/mathsinfo\/2024\/10\/13\/initiation-a-lassembleur-8080-sur-altair-8800\/","title":{"rendered":"Initiation \u00e0 l&rsquo;assembleur 8080 sur ALTAIR 8800"},"content":{"rendered":"\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Conjecture Syracuse sur ALTAIR 8800 (Assembleur 8080)\" width=\"584\" height=\"329\" src=\"https:\/\/www.youtube.com\/embed\/d0CS1v1sjS0?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Outils<\/h3>\n\n\n\n<p>Simulateur 8080 : <a href=\"https:\/\/www.sim8085.com\">https:\/\/www.sim8085.com<\/a><\/p>\n\n\n\n<p>Cr\u00e9ation d&rsquo;un fichier binaire : <a href=\"https:\/\/www.asm80.com\/\">https:\/\/www.asm80.com\/<\/a><\/p>\n\n\n\n<p>Simulateur ALTAIR 8800 : <a href=\"https:\/\/s2js.com\/altair\/sim.html\">https:\/\/s2js.com\/altair\/sim.html<\/a><\/p>\n\n\n\n<p>Tous les codes (00.MEM = 3n+1, 01.MEM = n\/2, 02.MEM = pair\/impair + saut, 03.MEM = avec temps de vol, 04.MEM = avec maximum, 16bits.bin = version 16 bits) : <a href=\"https:\/\/uabox.univ-angers.fr\/s\/o96B5MEfeQAcXLA\">https:\/\/uabox.univ-angers.fr\/s\/o96B5MEfeQAcXLA<\/a><\/p>\n\n\n\n<p>Chargement d&rsquo;une bande perfor\u00e9e : <a href=\"https:\/\/youtu.be\/qv5b1Xowxdk?feature=shared&amp;t=235\">https:\/\/youtu.be\/qv5b1Xowxdk?feature=shared&amp;t=235<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Calcul de 3n+1<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>Mettre une valeur N en 80h puis lancer le programme ci-dessous\nLire en 80h la valeur 3N+1 (modulo 256)\n\nHEXA : 3A80004787803C32800076\n\nProgramme source :\n\nLDA 80h\nMOV B, A\nADD A\nADD B\nINR A\nSTA 80h\nHLT\n\nProgramme objet :\n\n3A 80 00   LDA 80h\n47         MOV B, A\n87         ADD A\n80         ADD B\n3C         INR A\n32 80 00   STA 80h\n76         HLT\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Division par 2<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>Mettre une valeur N en 80h puis lancer le programme ci-dessous\nLire en 80h la valeur ENT(N\/2)\n\nHEXA : 373F3E1B1F32800076\n\nProgramme source :\n\nSTC\nCMC\nMVI A, 27\nRAR\nSTA 80h\nHLT<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Sauts avec tests pair ou impair<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>HEXA : 3A800047FE01CA2100E60178CA180087803C328000C30000373F1F328000C3000076\n\nProgramme source :\n\nloop: \tLDA 80h\n\tMOV B, A\n        CPI 1\n\tJZ fin\n\tANI 1\n\tMOV A, B\n\tJZ pair\n\tADD A\n\tADD B\n\tINR A\n\tSTA 80h\n\tJMP loop\npair:\tSTC\n\tCMC\n\tRAR\n\tSTA 80h\n\tJMP loop\nfin:\tHLT \n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Version 1 avec temps de vol uniquement<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>HEXA : 3E003281 003A8000 47FE01CA 2E003A81 003C3281 0078E601 78CA2500 87803C32 8000C305 00373F1F 328000C3 050076\n\nProgramme source :\n\nMVI A, 0\nSTA 81h\nloop: \tLDA 80h\n\tMOV B, A\nCPI 1\n\tJZ fin\n\tLDA 81h\n\tINR A\n\tSTA 81h\n\tMOV A, B\n\tANI 1\n\tMOV A, B\n\tJZ pair\n\tADD A\n\tADD B\n\tINR A\n\tSTA 80h\n\tJMP loop\npair:\tSTC\n\tCMC\n\tRAR\n\tSTA 80h\n\tJMP loop\nfin:\tHLT \n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Version 2 avec temps de vol et maximum<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>HEXA : 3E003281 003A8000 3282003A 800047FE 01CA4000 3A81003C 32810078 E60178CA 37008780 3C328000 473A8200 B8D20B00 78328200 C30B0037 3F1F3280 00C30B00 76\n\nProgramme source :\n\nMVI A, 0\nSTA 81h\nLDA 80h\nSTA 82h\n\nloop: \tLDA 80h\n\tMOV B, A\n        CPI 1\n\tJZ fin\n\tLDA 81h\n\tINR A\n\tSTA 81h\n\tMOV A, B\n\tANI 1\n\tMOV A, B\n\tJZ pair\n\tADD A\n\tADD B\n\tINR A\n\tSTA 80h\n\tMOV B, A\n    \tLDA 82h\n    \tCMP B\n    \tJNC loop\n    \tMOV A, B\n    \tSTA 82h\n\tJMP loop\npair:\tSTC\n\tCMC\n\tRAR\n\tSTA 80h\n\tJMP loop\nfin:\tHLT \n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Version 16 bits<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>Mettre la partie basse de N en 80h et la partie haute en 81h. Par exemple pour 27 : 00 011 011 en 80h et 00 000 000 en 81h\n\nLire le temps de vol en 84h et le maximum aux adresses 82h (partie basse) et 83h (partie haute)\n\n2A 80 00\tLHLD 80H \t; Initialisation des m\u00e9moires 82h \u00e0 84h\n22 82 00\tSHLD 82H \t; copie de 80-81h vers 82-83h\n21 84 00\tLXI H, 84H\t;\n36 00\t\tMVI M, 0 \t; Temps de vol = 0\n21 81 00 collatz: LXI H, 81H\t\n7E\t\tMOV A, M  \t; Si la valeur haute\nB7\t\tORA A     \t; n'est pas nulle\nC2 1A 00\tJNZ parity \t; On va tester la parit\u00e9 \n2B\t\tDCX H       \t; sinon,\n7E\t\tMOV A, M\t; Si la valeur basse\nFE 01\t\tCPI 1       \t;  vaut 1\nCA 5D 00\tJZ fin\t        ; on arr\u00eate le programme\n21 84 00 parity:LXI H, 84H\t\n34\t\tINR M     \t; temps de vol augmente de +1\n21 80 00\tLXI H, 80H\t\n7E\t\tMOV A, M\t\n5F\t\tMOV E, A    \t; que l'on stocke dans E\nE6 01\t\tANI 1       \t; Si Z = 0\nCA 3A 00\tJZ pair     \t; C'est un nombre pair\n23\t\tINX H\t\n56\t\tMOV D, M\t\nD5\t\tPUSH D\t\nE1\t\tPOP H\t        ; HL = DE\n29\t\tDAD H\t        ; HL = 2HL\n19\t\tDAD D\t        ; HL = 3HL\n23\t\tINX H\t        ; HL = 3HL + 1\n22 80 00\tSHLD 80h    \t; Nouvelle valeur en 80h\nE5\t\tPUSH H\t\nD1\t\tPOP D    \t; On la stocke dans DE\nCD 46 00\tCALL maxi\t; Sous-routine maxi\nC3 0B 00\tJMP collatz \t; Retour \u00e0 collatz\n23\t  pair: INX H  \t        ; Si le nombre est pair\nAF\t\tXRA A         \t; Carry = 0\n7E\t\tMOV A, M      \t; Division par 2\n1F\t\tRAR           \t; de la partie haute\n77\t\tMOV M, A\t\n2B\t\tDCX H\t\n7E\t\tMOV A, M      \t; division par 2 de la partie basse\n1F\t\tRAR           \t; avec ajout \u00e9ventuel de C \u00e0 gauche\n77\t\tMOV M, A\t;\nC3 0B 00\tJMP collatz   \t; Retour \u00e0 collatz\n2A 82 00  maxi:\tLHLD 82H\t;\n7A\t\tMOV A, D      \t; R\u00e9cup partie haute du max\nBC\t\tCMP H         \t; si \u00e9galit\u00e9 des parties hautes\nCA 52 00\tJZ unite      \t; tester les unit\u00e9s\nD2 58 00\tJNC change    \t; si retenue le max a \u00e9t\u00e9 d\u00e9pass\u00e9\nC9\t\tRET           \t; sinon ne rien faire\n7B\tunite:\tMOV A, E   \t; test des unit\u00e9s\nBD\t\tCMP L           ; si une retenue\nDA 58 00\tJC change     \t; le max est d\u00e9pass\u00e9\nC9\t\tRET           \t; retour\nEB\tchange:\tXCHG  \t        ; HL = DE\n22 82 00\tSHLD 82H\t; que l'on place en 82h\nC9\t\tRET\t\n76\tfin:\tHLT\t<\/code><\/pre>\n\n\n\n<p>R\u00e9sultats \u00e0 obtenir aux adresses 82-83h et 84h<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>00 010 000 en 82h (partie basse) et 00 100 100 en 83h (haut) \n\nparseInt('0010010000010000',2)\n9232\n\n01 101 111 \u00e0 l'adresse 84h : \n\nparseInt('01101111',2)\n111<\/code><\/pre>\n\n\n\n<p>R\u00e9sultats pour N = 639<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt;&gt;&gt; bin(639)\n'0b1001111111'\n\nIl faut donc mettre 01 111 111 \u00e0 l'adresse 80h et 10 \u00e0 l'adresse 81h\n\nOn lance le programme et on trouve :\n\nAdresse 82h : 00 110 100\nAdresse 83h : 10 100 010\n\nLe maximum vaut donc :\n\n&gt;&gt;&gt; int('1010001000110100',2)\n41524\n\nEt le temps de vol est \u00e0 l'adresse 84h : 10 000 011\n\n&gt;&gt;&gt; int('10000011',2)\n131<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Outils Simulateur 8080 : https:\/\/www.sim8085.com Cr\u00e9ation d&rsquo;un fichier binaire : https:\/\/www.asm80.com\/ Simulateur ALTAIR 8800 : https:\/\/s2js.com\/altair\/sim.html Tous les codes (00.MEM = 3n+1, 01.MEM = n\/2, 02.MEM = pair\/impair + saut, 03.MEM = avec temps de vol, 04.MEM = avec maximum, &hellip; <a href=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/2024\/10\/13\/initiation-a-lassembleur-8080-sur-altair-8800\/\">Continuer la lecture <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":4913,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1955","post","type-post","status-publish","format-standard","hentry","category-non-classe"],"_links":{"self":[{"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/posts\/1955","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/users\/4913"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/comments?post=1955"}],"version-history":[{"count":12,"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/posts\/1955\/revisions"}],"predecessor-version":[{"id":1970,"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/posts\/1955\/revisions\/1970"}],"wp:attachment":[{"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/media?parent=1955"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/categories?post=1955"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/tags?post=1955"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}