mirror of
https://github.com/cc65/cc65.git
synced 2025-01-12 02:30:44 +00:00
Keep unknown flag bits, restore known flags on exit
git-svn-id: svn://svn.cc65.org/cc65/trunk@1901 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
2cb06ddf8e
commit
80a5fe182a
@ -21,12 +21,21 @@ __sys: sta ptr1
|
||||
lda (ptr1),y
|
||||
sta jmpvec+1
|
||||
|
||||
; Get the flags, mask unnecessary bits and push them. Push a
|
||||
; Remember the flags so we can restore them to a known state after calling the
|
||||
; routine
|
||||
|
||||
dey
|
||||
lda (ptr1),y
|
||||
and #%11001111 ; Mask out break and unused flag
|
||||
pha
|
||||
php
|
||||
|
||||
; Get the flags, keep the state of bit 4 and 5 using the other flags from
|
||||
; the flags value pased by the caller. Push the new flags and push A.
|
||||
|
||||
dey
|
||||
php
|
||||
pla ; Current flags -> A
|
||||
eor (ptr1),y
|
||||
and #%00110000
|
||||
eor (ptr1),y
|
||||
pha ; Push new flags value
|
||||
ldy #0
|
||||
lda (ptr1),y
|
||||
pha
|
||||
@ -46,7 +55,7 @@ __sys: sta ptr1
|
||||
plp
|
||||
jsr jmpvec
|
||||
|
||||
; Back from the routine. Save the flags and a
|
||||
; Back from the routine. Save the flags and A.
|
||||
|
||||
php
|
||||
pha
|
||||
@ -66,6 +75,10 @@ __sys: sta ptr1
|
||||
pla
|
||||
sta (ptr1),y
|
||||
|
||||
; Restore the old flags value
|
||||
|
||||
plp
|
||||
|
||||
; Done
|
||||
|
||||
rts
|
||||
|
Loading…
x
Reference in New Issue
Block a user