Day 10
Looping
Yep, Looping. This is most similar to a FOR loop in High Level Languages.
The LOOP Instruction
The LOOP instruction works like so:
mov cx,200 ; note that without 'h' that 200 is a decimal value (base 10).
AdditionLoop:
add ax,3
loop AdditionLoop ; will add 3 to AX, 200 times.
Each time LOOP is executed, CX is decremented and if it's not zero, the label specified is
jumped to.
DEC and INC Instructions
Now would be a great time to tell you about DEC and INC.
DEC subtracts 1 from a register or memory location and INC adds 1.
Examples:
inc ax ; AX++; or AX = AX + 1;
dec dx ; DX--; or DX = DX - 1;
var dw 0
dec var ; should work, I think. var--; or var = var - 1;
This Day In Review
I'm running out of easy instructions. Look for output oriented stuff soon!
Happy coding!,
-GbaGuy
Intro - Day 11
Patater GBAGuy Mirror
Contact