; ; Copyright (c) 2009 by Michal Hucik ; ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. ; ; MZ-800 Unicard is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with MZ-800 Unicard; if not, write to the Free Software ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ; ; Ver.: 1.3 ; ; Unicard Example5: ; Zmena RTC datumu. Precteni RTC casu. ; ; ; porty CMDPORT equ 0x50 DATAPORT equ 0x51 ; prikazy cmdSTSR equ 0x03 cmdSTORNO equ 0x04 cmdRTCSETD equ 0x60 cmdRTCGETT equ 0x63 ; kde bude nas program prg_begin: equ 0x2000 org prg_begin - 0x80 ; MZF header db 0x01 db "UNICARD EXAMPLE5",0x0d dw prg_end - prg_begin dw prg_start dw prg_begin db " " db " " db " " db " " db " " db " " db " " prg_start: call 0xEA59 ; smazat obrazovku ; ; Nepracujeme s filesystemem, takze kasleme na reset. ; Overime jen, zda je unikarta READY ld a,cmdSTSR ; reset ukazatele statusu out (CMDPORT), a ; pro pripad, ze uz ho nekdo pred nama cetl in a, (CMDPORT) ; Precteme 1. bajt statusu. and 0x01 ; Je 0. bit '0' ? jr z, set_new_date ; Ano, je tedy READY a muzeme pokracovat. ; Pokud byl 0. bit '1', tak to znamena, ze pred nami nekdo vlozil prikaz, ; ktery ocekava dalsi parametry a nechal to "rozmrvene". ; Vlozenim dalsiho prikazu by jsme predchozi prikaz automaticky stopnuli, ale ; korektni bude mozna stejne zavolat STORNO. ld a, cmdSTORNO out (CMDPORT), a jr set_new_date new_date: db 21 ; den db 12 ; mesic db 32 ; rok - 1980 set_new_date: ; Posleme prikaz pro zmenu data ld a, cmdRTCSETD out (CMDPORT), a ld hl, new_date ; nastavime datum konce sveta ;) ld bc, 0x0351 ; odeslat 3 bajty na DATA port (0x51) otir ; sup tam s tim, zmena data hotova ; ; A tady mame hexa hodinky ... ; get_rtc_time: ; prikaz pro precteni casu z RTC ld a, cmdRTCGETT out (CMDPORT), a in a, (DATAPORT) ; Precteme pocet hodin call 0x03c3 ; vypiseme obsah 'A' v hex. ld a, ':' call 0x0012 in a, (DATAPORT) ; Precteme pocet minut call 0x03c3 ; vypiseme obsah 'A' v hex. ld a, ':' call 0x0012 in a, (DATAPORT) ; Precteme pocet sekund call 0x03c3 ; vypiseme obsah 'A' v hex. ld a, 0xcd call 0x0ddc ; Pockame cca 1 sekundu. ld b,2 ld de, 0x0000 wait: dec de ld a,e or d jr nz, wait djnz wait jr get_rtc_time prg_end: