; ; 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.0 ; ; Unicard Example1: ; Cteni revize firmware unikarty. ; ; porty CMDPORT equ 0x50 DATAPORT equ 0x51 ; prikazy cmdRESET equ 0x00 cmdSHASCII equ 0x02 cmdREV equ 0x05 ; kde bude nas program prg_begin: equ 0x2000 org prg_begin - 0x80 ; MZF header db 0x01 db "UNICARD EXAMPLE1",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 ; ; Priklad hrubeho a rychleho pristupu k datum, ; bez zbytecneho testovani statusu. ; ; ; Zavolanim resetu provedeme stejnou proceduru, ; ktera se vola pri startu STM32 v unikarte. ; ; Pozaviraji se vsechny soubory. Ukonci vsechny vstupy a vystupy. ; CDW se nastavi na korenovy adresar "/". ; Vypne se konverze SharpASCII. ; ld a, cmdRESET out (CMDPORT), a ; Chceme pouzivat vypisovaci rutiny v ROM, takze si prepneme ; komunikaci do SharpASCII ld a, cmdSHASCII out (CMDPORT), a ; Zjistime verzi firmware. ld a, cmdREV out (CMDPORT), a ld hl, data ; Sem si ulozime info o revizi ld c, DATAPORT ld e, 0x00 ; Chystame se cist txt data, ktere mohou ; obsahovat jen znaky >= 0x20. ; ; Konec kazdeho txt retezce je oznacen ; znakem 0x0d - ten se nam hodi az budeme ; txt retezec predavat zobrazovaci rutine v ; ROM. ; ; Jakmile nam unikarta nema co posilat ; (konec retezce), tak zacne posilat 0x00. ; cti z DATA portu dokud nenarazis na 0x00 rdbyte: in a, (c) ld (hl), a inc hl cp e jr nz, rdbyte ld de, data ; revizi firmware vypsat na obrazovku call 0x0015 ; zastavit, stat, raz, dva... di halt data: prg_end: