From 7b8d4b28c7ec175cae2d8d71ba322f34aaa90094 Mon Sep 17 00:00:00 2001 From: Greg King Date: Sun, 19 Aug 2018 17:12:54 -0400 Subject: [PATCH] Fixed the system banking in the cbm510 and the cbm610 targets' versions of clock_gettime() and clock_settime(). Their library function calls must run in the execution bank. --- libsrc/cbm510/gettime.s | 22 ++++++++++++---------- libsrc/cbm510/settime.s | 15 +++++++++------ libsrc/cbm610/gettime.s | 22 ++++++++++++---------- libsrc/cbm610/settime.s | 15 +++++++++------ 4 files changed, 42 insertions(+), 32 deletions(-) diff --git a/libsrc/cbm510/gettime.s b/libsrc/cbm510/gettime.s index 5a0a172e4..c767c1f33 100644 --- a/libsrc/cbm510/gettime.s +++ b/libsrc/cbm510/gettime.s @@ -1,7 +1,8 @@ ; -; Stefan Haubenthal, 2009-07-27 -; Ullrich von Bassewitz, 2009-09-24 -; Oliver Schmidt, 2018-08-14 +; 2009-07-27, Stefan Haubenthal +; 2009-09-24, Ullrich von Bassewitz +; 2018-08-18, Oliver Schmidt +; 2018-08-19, Greg King ; ; int clock_gettime (clockid_t clk_id, struct timespec *tp); ; @@ -21,10 +22,10 @@ .proc _clock_gettime - jsr sys_bank jsr pushax jsr pushax + jsr sys_bank ldy #CIA::TODHR lda (cia2),y sed @@ -48,6 +49,10 @@ lda (cia2),y jsr BCD2dec sta TM + tm::tm_sec + ldy #CIA::TOD10 + lda (cia2),y + jsr restore_bank + pha lda #TM jsr _mktime @@ -57,19 +62,16 @@ jsr load_tenth jsr pusheax - ldy #CIA::TOD10 - lda (cia2),y + pla ldx #>$0000 jsr tosmul0ax ldy #timespec::tv_nsec jsr steaxspidx ; Pops address pushed by 1. pushax - jsr incsp1 - - lda #0 + lda #$00 tax - jmp restore_bank + jmp incsp1 .endproc diff --git a/libsrc/cbm510/settime.s b/libsrc/cbm510/settime.s index 0c377eb63..6eb08a1ac 100644 --- a/libsrc/cbm510/settime.s +++ b/libsrc/cbm510/settime.s @@ -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 (cia2),y + jsr restore_bank jsr ldax0sp ldy #3+timespec::tv_nsec @@ -62,14 +64,15 @@ jsr pusheax jsr load_tenth jsr tosdiveax + + jsr sys_bank ldy #CIA::TOD10 sta (cia2),y + jsr restore_bank - jsr incsp3 - - lda #0 + lda #$00 tax - jmp restore_bank + jmp incsp3 .endproc diff --git a/libsrc/cbm610/gettime.s b/libsrc/cbm610/gettime.s index 7adf5a14d..4c66f7747 100644 --- a/libsrc/cbm610/gettime.s +++ b/libsrc/cbm610/gettime.s @@ -1,7 +1,8 @@ ; -; Stefan Haubenthal, 2009-07-27 -; Ullrich von Bassewitz, 2009-09-24 -; Oliver Schmidt, 2018-08-14 +; 2009-07-27, Stefan Haubenthal +; 2009-09-24, Ullrich von Bassewitz +; 2018-08-18, Oliver Schmidt +; 2018-08-19, Greg King ; ; int clock_gettime (clockid_t clk_id, struct timespec *tp); ; @@ -21,10 +22,10 @@ .proc _clock_gettime - jsr sys_bank jsr pushax jsr pushax + jsr sys_bank ldy #CIA::TODHR lda (cia),y sed @@ -48,6 +49,10 @@ lda (cia),y jsr BCD2dec sta TM + tm::tm_sec + ldy #CIA::TOD10 + lda (cia),y + jsr restore_bank + pha lda #TM jsr _mktime @@ -57,19 +62,16 @@ jsr load_tenth jsr pusheax - ldy #CIA::TOD10 - lda (cia),y + pla ldx #>$0000 jsr tosmul0ax ldy #timespec::tv_nsec jsr steaxspidx ; Pops address pushed by 1. pushax - jsr incsp1 - - lda #0 + lda #$00 tax - jmp restore_bank + jmp incsp1 .endproc diff --git a/libsrc/cbm610/settime.s b/libsrc/cbm610/settime.s index a42f451cf..3d2a24af9 100644 --- a/libsrc/cbm610/settime.s +++ b/libsrc/cbm610/settime.s @@ -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 @@ -62,14 +64,15 @@ 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 -- 2.39.5