AppleIIAsm-Collection/source/disk20_minidisk_A/T.COMP16.SUB.MIN
nathanriggs 82d0e74c1a 0.3.1 updates
some minor bugfixes, directory shuffling, added demo and utility disks
2019-01-26 21:02:17 -05:00

38 lines
951 B
Plaintext

COMP16
PLA
STA RETADR
PLA
STA RETADR+1
PLA
STA :SUBT ; SUBTRAHEND
PLA
STA :SUBT+1
PLA
STA :MINU ; MINUEND
PLA
STA :MINU+1
LDA RETADR+1
PHA
LDA RETADR
PHA
LDA :MINU
CMP :SUBT ; COMPARE LOW BYTES
BEQ :EQUAL
LDA :MINU+1
SBC :SUBT+1 ; COMPARE HIGH BYTES
ORA #1 ; MAKE Z=0, SINCE LOW
; BYTES ARE NOT EQUAL
BVS :OVFLOW ; MUST HANDLE OVERFLOW
RTS ; EXIT
:EQUAL
LDA :MINU+1
SBC :SUBT+1 ; UPPER BYTES
BVS :OVFLOW
RTS ; RETURN W FLAGS SET
:OVFLOW
EOR #$80 ; COMPLEMENT N FLAG
ORA #1 ; IF OVERFLOW THEN THE
RTS
:MINU DS 2
:SUBT DS 2