Details | Last modification | View Log
Rev | Author | Line No. | Line |
---|---|---|---|
1485 | alone | 1 | #ifndef included_diRestore |
2 | #define included_diRestore |
||
3 | diRestore: |
||
4 | ;Adds 151cc if interrupts are enabled, 161cc if disabled |
||
5 | ;Disables interrupts, but sets up the stack so that interrupt settings are restored. |
||
6 | ;Call this at the top of your routine that needs to disable interrupts :) |
||
7 | ex (sp),hl |
||
8 | push hl |
||
9 | push af |
||
10 | ld hl,restoreei |
||
11 | ld a,r |
||
12 | jp pe,+_ |
||
13 | ld hl,restoredi |
||
14 | _: |
||
15 | di |
||
16 | pop af |
||
17 | inc sp |
||
18 | inc sp |
||
19 | ex (sp),hl |
||
20 | dec sp |
||
21 | dec sp |
||
22 | ret |
||
23 | restoredi: |
||
24 | di |
||
25 | ret |
||
26 | restoreei: |
||
27 | ei |
||
28 | ret |
||
29 | #endif |