mirror of https://github.com/zxdos/zxuno.git
add mc
This commit is contained in:
parent
4fdcb809b1
commit
285beea478
|
|
@ -88,7 +88,7 @@ export ZCCCFG
|
|||
# PATH
|
||||
|
||||
export PATH := $(_path):$(PATH)
|
||||
undefine _path
|
||||
#undefine _path
|
||||
|
||||
endif # !ZXSDK
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ BINS=\
|
|||
BACKUP\
|
||||
CORCLEAN\
|
||||
COREBIOS\
|
||||
MC\
|
||||
ROMSBACK\
|
||||
ROMSUPGR\
|
||||
UPGR16M\
|
||||
|
|
@ -197,6 +198,17 @@ build/UPGRADE: $(srcdir)/upgrade.asm\
|
|||
| build
|
||||
$(AS) $(AFLAGS) --raw=$@ $<
|
||||
|
||||
|
||||
build/MC: $(srcdir)/mc.asm\
|
||||
$(INCLUDEDIR)/zxuno.def\
|
||||
$(INCLUDEDIR)/esxdos.def\
|
||||
$(INCLUDEDIR)/rst28.mac\
|
||||
$(INCLUDEDIR)/Print.inc\
|
||||
$(INCLUDEDIR)/wrflsh.inc\
|
||||
$(INCLUDEDIR)/rst28.inc\
|
||||
| build
|
||||
$(AS) $(AFLAGS) --raw=$@ $<
|
||||
|
||||
build/ZXUNOCFG: $(srcdir)/zxunocfg.asm\
|
||||
$(INCLUDEDIR)/zxuno.def\
|
||||
| build
|
||||
|
|
|
|||
|
|
@ -0,0 +1,148 @@
|
|||
; mc.asm - multicore load any .ZX1 core on slot 9.
|
||||
; File must exists in current directory. It must be run while using a "root" mode ROM.
|
||||
;
|
||||
; Copyright (C) 2022 Antonio Villena
|
||||
;
|
||||
; 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, version 3.
|
||||
;
|
||||
; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
;
|
||||
; Compatible compilers:
|
||||
; SjAsmPlus, <https://github.com/z00m128/sjasmplus>
|
||||
|
||||
output MC
|
||||
|
||||
include zxuno.def
|
||||
include esxdos.def
|
||||
include rst28.mac
|
||||
|
||||
define VERSION "0.1"
|
||||
|
||||
org $2000 ; comienzo de la ejecución de los comandos ESXDOS
|
||||
|
||||
Main ld a, h
|
||||
or l
|
||||
jr nz, NoPrint ; si no se ha especificado nombre de fichero, imprimir uso
|
||||
call Print;567890123456789012345678901
|
||||
dz '.mc corefile.zx1', 13, 13, 'Loads and executes a core'
|
||||
ret
|
||||
NoPrint ld de, FileName
|
||||
NextChar ld a, (hl)
|
||||
or a
|
||||
jr z, EndParse
|
||||
cp ' '
|
||||
jr c, EndParse
|
||||
ldi
|
||||
jr NextChar
|
||||
EndParse xor a
|
||||
ld (de), a
|
||||
ld bc, zxuno_port
|
||||
out (c), a
|
||||
inc b
|
||||
in f, (c)
|
||||
jp p, Nonlock
|
||||
call Print
|
||||
dz 'ROM not rooted'
|
||||
ret
|
||||
Nonlock wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||
wreg flash_spi, $9f ; jedec id
|
||||
in a, (c)
|
||||
in a, (c)
|
||||
in a, (c)
|
||||
in a, (c)
|
||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||
sub $19
|
||||
jr z, Goodflsh
|
||||
call Print
|
||||
dz 'Incorrect flash IC'
|
||||
ret
|
||||
Goodflsh ld a, scandbl_ctrl
|
||||
dec b
|
||||
out (c), a
|
||||
inc b
|
||||
in a, (c)
|
||||
and $3f
|
||||
ld (normal+1), a
|
||||
or $c0
|
||||
out (c), a
|
||||
call init
|
||||
ld bc, zxuno_port
|
||||
ld a, scandbl_ctrl
|
||||
out (c), a
|
||||
inc b
|
||||
normal ld a, 0
|
||||
out (c), a
|
||||
ld bc, zxuno_port
|
||||
out (c), a
|
||||
ld bc, zxuno_port
|
||||
ld a, core_addr
|
||||
ld hl, $2f80
|
||||
ld de, core_boot
|
||||
out (c), a
|
||||
inc b
|
||||
out (c), h
|
||||
out (c), l
|
||||
out (c), d
|
||||
dec b
|
||||
out (c), e
|
||||
inc b
|
||||
out (c), a
|
||||
init xor a
|
||||
esxdos M_GETSETDRV ; A = unidad actual
|
||||
jr nc, SDCard
|
||||
call Print
|
||||
dz 'SD card not inserted'
|
||||
ret
|
||||
SDCard ld b, FA_READ ; B = modo de apertura
|
||||
ld hl, FileName ; HL = Puntero al nombre del fichero (ASCIIZ)
|
||||
esxdos F_OPEN
|
||||
ld (handle+1), a
|
||||
jr nc, FileFound
|
||||
call Print
|
||||
dz 'File not found'
|
||||
ret
|
||||
FileFound call Print
|
||||
db 'Writing SPI flash', 13
|
||||
dz '[', 6, ' ]', 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8
|
||||
ld ixl, $15
|
||||
ld de, $2f80
|
||||
exx
|
||||
Bucle ld a, 'o'
|
||||
exx
|
||||
push de
|
||||
rst $10
|
||||
pop de
|
||||
exx
|
||||
punto ld hl, $8000
|
||||
ld bc, $4000
|
||||
handle ld a, 0
|
||||
esxdos F_READ
|
||||
jr nc, ReadOK
|
||||
call Print
|
||||
dz 'Read Error'
|
||||
ret
|
||||
ReadOK ld a, $40
|
||||
ld hl, $8000
|
||||
exx
|
||||
call wrflsh
|
||||
inc de
|
||||
exx
|
||||
dec ixl
|
||||
jr nz, Bucle
|
||||
ld a, (handle+1)
|
||||
esxdos F_CLOSE
|
||||
call Print
|
||||
dz 13, 'Launching core'
|
||||
ret
|
||||
include Print.inc
|
||||
include wrflsh.inc
|
||||
include rst28.inc
|
||||
FileName
|
||||
Loading…
Reference in New Issue