Browse Source

CP/M 3 Date Hack

- Hack to allow INTRTC to increment time without destroying the date
pull/110/head
Wayne Warthen 6 years ago
parent
commit
153b494e61
  1. 27
      Source/CPM3/boot.z80

27
Source/CPM3/boot.z80

@ -490,16 +490,21 @@ time$ret:
time$get: time$get:
; RTC -> cpm date/time in SCB ; RTC -> cpm date/time in SCB
; read time from RTC ; read time from RTC
ld b,020h ; HBIOS func: get time ld b,020h ; HBIOS func: get time
ld hl,tim$buf ; time buffer ld hl,tim$buf ; time buffer
rst 08 ; do it rst 08 ; do it
ret nz ; bail out on error ret nz ; bail out on error
ld a,(datehack)
or a
jr nz,time$get1
; convert yymmss in time buffer -> cpm3 epoch date offset ; convert yymmss in time buffer -> cpm3 epoch date offset
call date2cpm ; time buf (yr, mon, day) -> SCB (@date) call date2cpm ; time buf (yr, mon, day) -> SCB (@date)
time$get1:
; set time fields in SCB ; set time fields in SCB
ld a,(tim$hr) ; get hour from time buf ld a,(tim$hr) ; get hour from time buf
ld (@hour),a ; ... and put in SCB ld (@hour),a ; ... and put in SCB
@ -514,7 +519,23 @@ time$set:
; CPM date/time in SCB -> RTC ; CPM date/time in SCB -> RTC
; convert CPM3 epoch date offset in SCB -> yymmss in time buffer ; convert CPM3 epoch date offset in SCB -> yymmss in time buffer
call cpm2date ; SCB (@date) -> time buf (yr, mon, day)
;call cpm2date ; SCB (@date) -> time buf (yr, mon, day)
; this is a temporary hack!!!
; since we cannot actually set the date on the RTC, we
; just read the current RTC date and use that so that we
; don't clobber a potentially good date.
; read time from RTC
ld b,020h ; HBIOS func: get time
ld hl,tim$buf ; time buffer
rst 08 ; do it
ret nz ; bail out on error
;
; now we set a hack active flag so that future time$get
; calls do not update the date field in the SCB
;
ld a,0FFh ; true value
ld (datehack),a ; save it
; copy CPM3 time values from SCB -> time buffer ; copy CPM3 time values from SCB -> time buffer
ld a,(@hour) ; get hour from SCB ld a,(@hour) ; get hour from SCB
@ -629,6 +650,8 @@ tim$hr db 01h
tim$min db 02h tim$min db 02h
tim$sec db 03h tim$sec db 03h
datehack db 00h
open: open:
ld c,15 ld c,15
jp bdos jp bdos

Loading…
Cancel
Save