]> git.sur5r.net Git - cc65/blob - libsrc/dbg/dbgisram.s
Removed (pretty inconsistently used) tab chars from source code base.
[cc65] / libsrc / dbg / dbgisram.s
1 ;
2 ; Ullrich von Bassewitz, 10.08.1998
3 ;
4 ; int DbgIsRAM (unsigned Addr);
5 ;
6
7         .export         _DbgIsRAM
8         .import         popax, return0, return1
9         .importzp       ptr1
10
11 _DbgIsRAM:
12         sta     ptr1            ; Store the address
13         stx     ptr1+1
14
15         ldy     #0
16         php                     ; Save I flag
17         sei                     ; Disable interrupts
18
19         lda     (ptr1),y        ; Get old value
20         pha                     ; ...and save it
21
22         ldx     #3
23 L1:     lda     TestVal,x
24         jsr     CheckCell
25         bne     L2
26         dex
27         bpl     L1
28
29 ; This seems to be RAM
30
31         pla
32         sta     (ptr1),y        ; Restore old value
33         plp                     ; Restore old I flag
34         jmp     return1
35
36 ; No RAM at this address
37
38 L2:     pla
39         sta     (ptr1),y        ; Restore old value
40         plp                     ; Restore old I flag
41         jmp     return0
42
43 ; Check one memory cell
44
45 CheckCell:
46         sta     (ptr1),y
47         cmp     (ptr1),y        ; Could we write it?
48         rts
49
50
51 .rodata
52 TestVal:
53         .byte   $55, $AA, $33, $CC
54
55