]> git.sur5r.net Git - cc65/blobdiff - libsrc/cbm610/settime.s
Fixed the system banking in the cbm510 and the cbm610 targets' versions of clock_gett...
[cc65] / libsrc / cbm610 / settime.s
index a42f451cf56bfd95fdb3797e18ecfdbcfae7322d..3d2a24af98888e6aad5eb92e32d56fc3f7fa604d 100644 (file)
@@ -1,5 +1,6 @@
 ;
-; Oliver Schmidt, 16.8.2018
+; 2018-08-18, Oliver Schmidt
+; 2018-08-19, Greg King
 ;
 ; int clock_settime (clockid_t clk_id, const struct timespec *tp);
 ;
@@ -20,7 +21,6 @@
 
 .proc   _clock_settime
 
-        jsr     sys_bank
         jsr     pushax
 
         .assert timespec::tv_sec = 0, error
@@ -33,6 +33,7 @@
         dey
         bpl     @L1
 
+        jsr     sys_bank
         lda     TM + tm::tm_hour
         jsr     dec2BCD
         tax                     ; Force flags
@@ -55,6 +56,7 @@
         jsr     dec2BCD
         ldy     #CIA::TODSEC
         sta     (cia),y
+        jsr     restore_bank
 
         jsr     ldax0sp
         ldy     #3+timespec::tv_nsec
         jsr     pusheax
         jsr     load_tenth
         jsr     tosdiveax
+
+        jsr     sys_bank
         ldy     #CIA::TOD10
         sta     (cia),y
+        jsr     restore_bank
 
-        jsr     incsp3
-
-        lda     #0
+        lda     #$00
         tax
-        jmp     restore_bank
+        jmp     incsp3
 
 .endproc