Ich gehe durch "Programmierung von Grund auf". Jetzt habe ich den folgenden Code, der 2 als minimale Antwort geben sollte, aber ich bekomme 0 als Antwort, wenn ich $ widerspreche.Assembly Code - bekomme keine richtige Antwort
.section .data
data_items:
.long 3,67,34,222,56,87,9,2,88,22,11,66,900,0
.section .text
.globl _start
_start:
movl $0,%edi
movl data_items(,%edi,4),%eax
movl %eax,%ebx
start_loop:
cmpl $0,%eax
je loop_exit
incl %edi
movl data_items(,%edi,4),%eax
cmpl %ebx,%eax
jg start_loop
movl %eax,%ebx
jmp start_loop
loop_exit:
movl $1,%eax
int $0x80
Als Faustregel in Assembler-Programm, müssen Sie TONNEN Kommentare . Manche Leute empfehlen 1 pro Zeile, was vielleicht ein bisschen viel ist, aber immer noch nicht zu weit weg ist. – samoz
Als ich 1986 für IBM arbeitete, wurde mir gesagt, dass ich mindestens eine Kommentarzeile pro Codezeile von Assembly haben sollte. Dies war eine Voraussetzung, damit weniger technisch versierte Personen den Quellcode lesen konnten. –