From 43d72e2fe071a1ed6f4c60a9dcd60debf9f34b5c Mon Sep 17 00:00:00 2001 From: antoniovillena <> Date: Tue, 1 Nov 2022 08:51:20 +0100 Subject: [PATCH] muestro hora en date --- utils/Makefile | 4 +- utils/{setdate.asm => date.asm} | 70 +++++++++++++++++++++++++++++---- 2 files changed, 65 insertions(+), 9 deletions(-) rename utils/{setdate.asm => date.asm} (72%) diff --git a/utils/Makefile b/utils/Makefile index 32e70e2..271677b 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -50,7 +50,7 @@ BINS=\ CORCLEAN\ COREBIOS\ ZX1\ - SETDATE\ + DATE\ RTC.SYS\ ROMSBACK\ ROMSUPGR\ @@ -199,7 +199,7 @@ build/ZX1: $(srcdir)/zx1.asm\ | build $(AS) $(AFLAGS) --raw=$@ $< -build/SETDATE: $(srcdir)/setdate.asm\ +build/DATE: $(srcdir)/date.asm\ $(INCLUDEDIR)/zxuno.def\ $(INCLUDEDIR)/esxdos.def\ $(INCLUDEDIR)/Print.inc\ diff --git a/utils/setdate.asm b/utils/date.asm similarity index 72% rename from utils/setdate.asm rename to utils/date.asm index 3c30e57..4fcf013 100644 --- a/utils/setdate.asm +++ b/utils/date.asm @@ -1,5 +1,5 @@ -; setdate.asm - set date and time using pcf8563 -; .setdate YYYYMMDDHHMMSS +; date.asm - set date and time using pcf8563 +; .date YYYYMMDDHHMMSS ; ; Copyright (C) 2022 Antonio Villena/McLeod_ideafix ; @@ -18,7 +18,7 @@ ; Compatible compilers: ; SjAsmPlus, -; output SETDATE +; output DATE define SCL0SDA0 00b define SCL0SDA1 01b @@ -35,13 +35,52 @@ NoPrint ld (Command+1), hl ld a, h or l jp nz, Init + esxdos M_GETDATE + ld ix, DateFormat+1 + ld a, b + rrca + and %01111111 + ld l, 18 + add a, 80 +Milnov inc l + ld h, a + sub 100 + jr nc, Milnov + ld a, l + call PrnDec + ld a, h + call PrnDec + ld a, b + and %00000001 + xor c + and %00011111 + xor c + call PrnDecS3 + ld a, c + and %00011111 + call PrnDecS + ld a, d + rrca + rrca + rrca + and %00011111 + call PrnDecS + ld a, d + and %00011111 + xor e + and %00011111 + xor e + call PrnDecS3 + ld a, e + and %00011111 + call PrnDecS1 call Print - db 13, 'Usage:', 13 - db ' .SETDATE YYYYMMDDHHMMSS', 13 +DateFormat db 13, '0000/00/00 00:00:00', 13 + db 'Usage:', 13 + db ' .DATE YYYYMMDDHHMMSS', 13 db 'Example:', 13 - dz ' .SETDATE 20151021072800', 13 + dz ' .DATE 20151021072800', 13 ret - Params db 02h ; VL_seconds register . Indico que quiero empezar a leer desde aquí (que es lo típico para leer toda la fecha y hora) db 0,40h,16h,24h,01h,10h,22h,0 ;La hora a la que quieres poner el reloj. En lectura, estos datos se machacan con la hora leída del RTC ; S M H D W Mo Y @@ -135,4 +174,21 @@ ReadBCD ld (de), a or c ret +PrnDecS3 rlca + rlca +PrnDecS1 rlca +PrnDecS inc ix +PrnDec ld l, $2f +PrnDec1 inc l + sub 10 + jr nc, PrnDec1 + add a, $3a + push af + ld a, l + call PrnWrt + pop af +PrnWrt ld (ix), a + inc ix + ret + include Print.inc