]> git.sur5r.net Git - cc65/blob - libsrc/atmos/revers.s
lseek: Return EINVAL if new position is less than 0 or greater than 2^24 - 1.
[cc65] / libsrc / atmos / revers.s
1 ;
2 ; Ullrich von Bassewitz, 07.08.1998
3 ;
4 ; unsigned char revers (unsigned char onoff);
5 ;
6
7         .export         _revers
8         .export         rvs
9
10 ; ------------------------------------------------------------------------
11 ;
12
13 .code
14 .proc   _revers
15
16         ldx     #$00            ; Assume revers off
17         tay                     ; Test onoff
18         beq     L1              ; Jump if off
19         ldx     #$80            ; Load on value
20         ldy     #$00            ; Assume old value is zero
21 L1:     lda     rvs             ; Load old value
22         stx     rvs             ; Set new value
23         beq     L2              ; Jump if old value zero
24         iny                     ; Make old value = 1
25 L2:     ldx     #$00            ; Load high byte of result
26         tya                     ; Load low byte, set CC
27         rts
28
29 .endproc
30
31 ; ------------------------------------------------------------------------
32 ;
33
34 .bss
35 rvs:    .res    1
36
37