1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2024-06-08 21:29:31 +00:00
rk65c02/test/test_emulation_sbc_16bit.s

22 lines
487 B
ArmAsm
Raw Permalink Normal View History

2017-02-02 20:16:31 +00:00
; 16-bit subtraction simple example by FMan/Tropyx
; modified by rkujawa
.org 0xC000
.set num1lo, 0x62
.set num1hi, 0x63
.set num2lo, 0x64
.set num2hi, 0x65
.set reslo, 0x66
.set reshi, 0x67
; subtracts number 2 from number 1 and writes result out
sub: sec ; set carry for borrow purpose
lda num1lo
sbc num2lo ; perform subtraction on the LSBs
sta reslo
lda num1hi ; do the same for the MSBs, with carry
sbc num2hi ; set according to the previous result
sta reshi
stp