1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-10 19:29:45 +00:00

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.
This commit is contained in:
Greg King 2018-08-19 17:12:54 -04:00
parent b93b88211c
commit 7b8d4b28c7
4 changed files with 42 additions and 32 deletions

View File

@ -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
ldx #>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

View 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 (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

View File

@ -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
ldx #>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

View 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
@ -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