Their library function calls must run in the execution bank.
;
-; 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);
;
.proc _clock_gettime
- jsr sys_bank
jsr pushax
jsr pushax
+ jsr sys_bank
ldy #CIA::TODHR
lda (cia2),y
sed
lda (cia2),y
jsr BCD2dec
sta TM + tm::tm_sec
+ ldy #CIA::TOD10
+ lda (cia2),y
+ jsr restore_bank
+ pha
lda #<TM
ldx #>TM
jsr _mktime
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
;
-; 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);
;
.proc _clock_settime
- jsr sys_bank
jsr pushax
.assert timespec::tv_sec = 0, error
dey
bpl @L1
+ jsr sys_bank
lda TM + tm::tm_hour
jsr dec2BCD
tax ; Force flags
jsr dec2BCD
ldy #CIA::TODSEC
sta (cia2),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 (cia2),y
+ jsr restore_bank
- jsr incsp3
-
- lda #0
+ lda #$00
tax
- jmp restore_bank
+ jmp incsp3
.endproc
;
-; 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);
;
.proc _clock_gettime
- jsr sys_bank
jsr pushax
jsr pushax
+ jsr sys_bank
ldy #CIA::TODHR
lda (cia),y
sed
lda (cia),y
jsr BCD2dec
sta TM + tm::tm_sec
+ ldy #CIA::TOD10
+ lda (cia),y
+ jsr restore_bank
+ pha
lda #<TM
ldx #>TM
jsr _mktime
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
;
-; 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);
;
.proc _clock_settime
- jsr sys_bank
jsr pushax
.assert timespec::tv_sec = 0, error
dey
bpl @L1
+ jsr sys_bank
lda TM + tm::tm_hour
jsr dec2BCD
tax ; Force flags
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