m_genesis.kv 1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
m_genesis.kv 2 ;; ;;
m_genesis.kv 3 ;; This file is part of 'M', a MIPS system emulator. ;;
m_genesis.kv 4 ;; ;;
m_genesis.kv 5 ;; (C) 2019 Stanislav Datskovskiy ( www.loper-os.org ) ;;
m_genesis.kv 6 ;; http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html ;;
m_genesis.kv 7 ;; ;;
m_genesis.kv 8 ;; You do not have, nor can you ever acquire the right to use, copy or ;;
m_genesis.kv 9 ;; distribute this software ; Should you use this software for any purpose, ;;
m_genesis.kv 10 ;; or copy and distribute it to anyone or in any manner, you are breaking ;;
m_genesis.kv 11 ;; the laws of whatever soi-disant jurisdiction, and you promise to ;;
m_genesis.kv 12 ;; continue doing so for the indefinite future. In any case, please ;;
m_genesis.kv 13 ;; always : read and understand any software ; verify any PGP signatures ;;
m_genesis.kv 14 ;; that you use - for any purpose. ;;
m_genesis.kv 15 ;; ;;
m_genesis.kv 16 ;; See also http://trilema.com/2015/a-new-software-licensing-paradigm . ;;
m_genesis.kv 17 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
m_genesis.kv 18
m_genesis.kv 19 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
m_genesis.kv 20 ;; Real-Time Clock Device ;;
m_genesis.kv 21 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
m_genesis.kv 22
m_genesis.kv 23 ;-----------------------------------------------------------------------------
m_genesis.kv 24 ;; Real-Time Clock MMIO:
m_genesis.kv 25 DECLARE_BUS_DEVICE RTC, 0x430, 0x434
m_genesis.kv 26 ;-----------------------------------------------------------------------------
m_genesis.kv 27
m_genesis.kv 28 ;-----------------------------------------------------------------------------
m_genesis.kv 29 ; Epoch Time: 'Sec. since 00:00:00 Thursday, 1 January 1970'
m_genesis.kv 30 %define RTC_REG_EPOCH_LO 0 ; Lower 32 bits of RTC Epoch Time
m_genesis.kv 31 %define RTC_REG_EPOCH_HI 4 ; Upper 32 bits of RTC Epoch Time
m_genesis.kv 32 ;-----------------------------------------------------------------------------
m_genesis.kv 33
m_genesis.kv 34 ;-----------------------------------------------------------------------------
m_genesis.kv 35 _PD_Read_Word_RTC: ; Word reads from RTC:
m_genesis.kv 36 sub eax, RTC_BASE ; Adjust for base of RTC MMIO
m_genesis.kv 37 cmp eax, RTC_REG_EPOCH_LO ; Word at 0x0: Low 32 bits of time
m_genesis.kv 38 je .rtc_epoch_low_word
m_genesis.kv 39 cmp eax, RTC_REG_EPOCH_HI ; Word at 0x4: High 32 bits of time
m_genesis.kv 40 je .rtc_epoch_high_word
m_genesis.kv 41 .rtc_undefined_reg: ; If unknown reg (how?) :
m_genesis.kv 42 ACHTUNG "Read Unknown RTC Reg?"
m_genesis.kv 43 xor eax, eax ; ... return 0 always.
m_genesis.kv 44 ret ; Fin.
m_genesis.kv 45 .rtc_epoch_low_word: ; Get LOW 32 bits of Epoch Time :
m_genesis.kv 46 call _Get_Epoch_Time ; Retrieve epoch time from host
m_genesis.kv 47 mov eax, edx ; eax := low word
m_genesis.kv 48 ret ; Fin.
m_genesis.kv 49 .rtc_epoch_high_word: ; Get HIGH 32 bits of Epoch Time :
m_genesis.kv 50 call _Get_Epoch_Time ; Retrieve epoch time from host
m_genesis.kv 51 shr rdx, 32 ; get high word
m_genesis.kv 52 mov eax, edx ; eax := high word
m_genesis.kv 53 ret ; Fin.
m_genesis.kv 54 ;-----------------------------------------------------------------------------
m_genesis.kv 55 _PD_Write_Word_RTC: ; Word writes to RTC do nothing!
m_genesis.kv 56 ret
m_genesis.kv 57 ;-----------------------------------------------------------------------------
m_genesis.kv 58 _PD_Read_Byte_RTC:
m_genesis.kv 59 xor eax, eax ; Read Byte from RTC: always 0
m_genesis.kv 60 ret
m_genesis.kv 61 ;-----------------------------------------------------------------------------
m_genesis.kv 62 _PD_Write_Byte_RTC:
m_genesis.kv 63 ret ; Fin.
m_genesis.kv 64 ;-----------------------------------------------------------------------------
m_genesis.kv 65 _Device_Init_RTC: ; Needs no init.
m_genesis.kv 66 ret
m_genesis.kv 67 ;-----------------------------------------------------------------------------
m_genesis.kv 68 _Device_Shutdown_RTC: ; Needs no shutdown.
m_genesis.kv 69 ret
m_genesis.kv 70 ;-----------------------------------------------------------------------------