32 lines
641 B
Plaintext
32 lines
641 B
Plaintext
|
;
|
||
|
; Exercise SUB/SUBN opcodes
|
||
|
;
|
||
|
|
||
|
; preload some values
|
||
|
LD Va, 12
|
||
|
LD Vb, 34
|
||
|
LD Vc, 56
|
||
|
LD Vd, 89
|
||
|
LD Ve, ff
|
||
|
|
||
|
LD V0, 24
|
||
|
SUB V0, Va ; SUB Vx, Vy - no borrow
|
||
|
LD V1, Vf
|
||
|
|
||
|
LD V2, 45
|
||
|
SUB V2, Vd ; SUB Vx, nn - borrow
|
||
|
LD V3, Vf
|
||
|
|
||
|
LD V4, 22
|
||
|
SUBN V4, Vc ; SUBN Vx, Vy - no borrow
|
||
|
LD V5, Vf
|
||
|
|
||
|
LD V6, 56
|
||
|
SUBN V6, Vb ; SUBN Vx, Vy - borrow
|
||
|
LD V7, Vf
|
||
|
|
||
|
; TODO: Check corner case where one of the operands is Vf
|
||
|
|
||
|
EXIT
|
||
|
|