Tutorial by Examples

; IF d0 == 10 GO TO ten, ELSE GO TO other CMP #10,d0 ; compare register contents to immediate value 10 ; instruction affects the zero flag BEQ ten ; branch if zero flag set other: ; do whatever needs to be done for d0 != 10 BRA ...
The Z80 has a specific instruction to implement loop counts: DJNZstanding for "decrement B register and jump if not zero". So, B is the register of choice to implement loops on this processor. FOR...NEXT needs to be implemented "backwards", because the register counts down to zer...
section .data msg_eq db 'Equal', 10 len_eq equ $ - msg_eq msg_le db 'Less than', 10 len_le equ $ - msg_le msg_gr db 'Greater than', 10 len_gr equ $ - msg_gr ; Length of msg_gr section .text global _main ; Make the _main label global for linker _main: cmp...
section .data msg db 'Hello, world!', 0xA len equ $ - msg section .text global _main _main: mov rax, 0 ; This will be the current number mov rcx, 10 ; This will be the last number _loop: cmp rax, rcx jl .loopbody ; Jump to .loopbody if rax < rcx jge _e...

Page 1 of 1