]> cloudbase.mooo.com Git - z180-stamp-cpm3.git/blobdiff - cbios/time.180
file reorg. move routines, that are mainly used in initialization to banked area
[z180-stamp-cpm3.git] / cbios / time.180
index 65696824cb2b1cff56ccc6cbd75164896c9da91b..e2ffc6b79f3f815f8e285d143d70a87eac827dd1 100644 (file)
@@ -8,6 +8,7 @@
        extrn   f_cpu
        extrn   ioiniml,div32_16
        extrn   msg.sm,msg.recv
+       extrn   _b0call
 
        include config.inc
        include z180reg.inc
 
        ld      c,3
 
-       ; fall thru
+       b0call  gs_rtc
+       ret
 
 ;----------------------------------------------------------------------
 ; c = 2: get time
 ; c = 3: set time
 
+       dseg
 gs_rtc:
 
        push    hl
        push    de
 
+       di
        ld      hl,(@date)
-       push    hl                      ;2
        ld      a,(@hour)
-       ld      h,a
+       ld      d,a
        ld      a,(@min)
-       ld      l,a
-       push    hl                      ;4
+       ld      e,a
        ld      a,(@sec)
+       ei
        ld      b,a                     ;b = sec, c = subcommand
+       push    hl                      ;2
+       push    de                      ;4
        push    bc                      ;6
        ld      hl,3 * 256 + 0          ;h = command, l = 0
        push    hl                      ;8
 
-       ld      h,l
+       ld      h,l                     ;hl = 0
        add     hl,sp
        push    hl
        inc     hl                      ;7
@@ -60,17 +65,19 @@ gs_rtc:
        ld      b,8                     ; max receive message len
        call    msg.recv
 
-       pop     hl                      ;len/command
-       pop     hl                      ;subc/sec
-       ld      a,h
-       ld      (@sec),a
+       pop     hl                      ;len/command (discard)
+       pop     bc                      ;subc/sec
+       pop     de
        pop     hl
-       ld      a,l
+       ld      a,b
+       di
+       ld      (@sec),a
+       ld      a,e
        ld      (@min),a
-       ld      a,h
+       ld      a,d
        ld      (@hour),a
-       pop     hl
        ld      (@date),hl
+       ei
 
        pop     de
        pop     hl
@@ -126,7 +133,7 @@ isvprt0:
        in0     a,(tmdr0l)
        in0     a,(tmdr0h)
 
-       ld      a,(tim_ms)              ;
+       ld      a,(counter_10ms)                ;
        inc     a
        cp      100                     ;100 * 10ms ?
        jr      nz,iprt_1
@@ -166,12 +173,12 @@ iprt_2:
        ld      (@sec),a
        xor     a
 iprt_1:
-       ld      (tim_ms),a
+       ld      (counter_10ms),a
        pop     af
        ei
        ret
 
-tim_ms:
+counter_10ms:
        db      0
 
        end