Merge pull request #9 from Russell-S-Harper/development

Adding TST instruction.
This commit is contained in:
Russell-S-Harper 2018-08-07 21:38:04 -04:00 committed by GitHub
commit 48cbd40be6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 0 deletions

View File

@ -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
.)

View File

@ -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 */

View File

@ -15,6 +15,9 @@ HDR(DEMO)
DCR(R3)
INR(R0)
DCR(R1)
TST(R4)
TST(R2)
TST(R3)
ESC
BRK