mirror of
https://github.com/Russell-S-Harper/COMMON.git
synced 2024-11-24 23:32:09 +00:00
Adding TST instruction.
This commit is contained in:
parent
c630c4ef6e
commit
45b2efb2ca
@ -242,6 +242,22 @@ _DCR .( ; DCR r 6r Rr <- Rr - 1.0 - decrement register
|
||||
.)
|
||||
|
||||
_TST .( ; TST r 7r F <- Rr <=> 0.0 - test register
|
||||
LDA _F
|
||||
AND #_MSK_T ; clear TST bits
|
||||
STA _F
|
||||
LDA _R0+3,X ; check highest byte
|
||||
BMI _1 ; is negative
|
||||
ORA _R0+2,X ; could be positive or zero, OR with all other bytes
|
||||
ORA _R0+1,X
|
||||
ORA _R0,X
|
||||
BNE _2 ; is positive
|
||||
LDA #_F_Z ; set zero flag
|
||||
BNE _3
|
||||
_1 LDA #_F_N ; set negative flag
|
||||
BNE _3
|
||||
_2 LDA #_F_P ; set positive flag
|
||||
_3 ORA _F
|
||||
STA _F
|
||||
RTS
|
||||
.)
|
||||
|
||||
|
@ -138,4 +138,7 @@ _MNS_1 = %11111100 ; i.e. the $FC part of $FFFFFC00
|
||||
|
||||
_MSK_O = %11000000 ; mask for overflow
|
||||
|
||||
; mask for TST
|
||||
_MSK_T = (_F_Z + _F_P + _F_N)^$FF
|
||||
|
||||
#endif /* __COMMON_H */
|
||||
|
@ -15,6 +15,9 @@ HDR(DEMO)
|
||||
DCR(R3)
|
||||
INR(R0)
|
||||
DCR(R1)
|
||||
TST(R4)
|
||||
TST(R2)
|
||||
TST(R3)
|
||||
ESC
|
||||
BRK
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user