mirror of https://github.com/zxdos/zxuno.git
utils: add copyright and licensing information to some files
This commit is contained in:
parent
b9e1a4f71b
commit
d2bd67db8a
|
@ -0,0 +1,7 @@
|
||||||
|
SPDX-FileName: ROMS.ZX1
|
||||||
|
|
||||||
|
SPDX-FileType: BINARY
|
||||||
|
|
||||||
|
SPDX-FileChecksum: SHA1: 997cf950d7ba5f1ff893869b3b40c908071ad0d9
|
||||||
|
|
||||||
|
SPDX-FileComment: ROMS.ZX1 by desUBIKado
|
|
@ -1,3 +1,31 @@
|
||||||
|
; back16m.asm - dumps to a file, in the root directory of the microSD
|
||||||
|
; card, the contents of a 16 Meg SPI Flash memory.
|
||||||
|
;
|
||||||
|
; It must be run while using a "root" mode ROM. After finishing, it is
|
||||||
|
; necessary to execute the command .ls so that the cache is written to
|
||||||
|
; the card.
|
||||||
|
;
|
||||||
|
; Copyright (C) 2019, 2021 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/>.
|
||||||
|
;
|
||||||
|
; SPDX-FileCopyrightText: Copyright (C) 2019, 2021 Antonio Villena
|
||||||
|
;
|
||||||
|
; SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
|
; Compatible compilers:
|
||||||
|
; SJAsmPlus, <https://github.com/sjasmplus/sjasmplus/>
|
||||||
|
|
||||||
output BACK16M
|
output BACK16M
|
||||||
|
|
||||||
include zxuno.inc
|
include zxuno.inc
|
||||||
|
@ -140,7 +168,7 @@ rdfls2 ini
|
||||||
wreg flash_cs, 1
|
wreg flash_cs, 1
|
||||||
pop hl
|
pop hl
|
||||||
ret
|
ret
|
||||||
|
|
||||||
rst28 ld bc, zxuno_port + $100
|
rst28 ld bc, zxuno_port + $100
|
||||||
pop hl
|
pop hl
|
||||||
outi
|
outi
|
||||||
|
|
|
@ -1,188 +1,217 @@
|
||||||
define zxdos 1
|
; back32m.asm - creates a file, in the root directory of the microSD
|
||||||
|
; card, with the contents of a 32 Meg SPI Flash memory.
|
||||||
IF zxdos=1
|
;
|
||||||
output BACKZX2
|
; It must be run while using a "root" mode ROM. After finishing it's
|
||||||
ELSE
|
; execution, you must execute the command .ls to finish recording the
|
||||||
output BACKZXD
|
; cache on the microSD card. If not, the length of the file will be
|
||||||
ENDIF
|
; wrongly set to 0.
|
||||||
|
;
|
||||||
include zxuno.inc
|
; Copyright (C) 2019, 2021 Antonio Villena
|
||||||
|
;
|
||||||
org $2000 ; comienzo de la ejecución de los comandos ESXDOS
|
; 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
|
||||||
call wrear0
|
; the Free Software Foundation, version 3.
|
||||||
dec b
|
;
|
||||||
out (c), 0
|
; This program is distributed in the hope that it will be useful,
|
||||||
inc b
|
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
in f, (c)
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
jp p, Nonlock
|
; GNU General Public License for more details.
|
||||||
call Print
|
;
|
||||||
dz 'ROM not rooted'
|
; You should have received a copy of the GNU General Public License
|
||||||
ret
|
; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
Nonlock wreg flash_cs, 0 ; activamos spi, enviando un 0
|
;
|
||||||
wreg flash_spi, $9f ; jedec id
|
; SPDX-FileCopyrightText: Copyright (C) 2019, 2021 Antonio Villena
|
||||||
in a, (c)
|
;
|
||||||
in a, (c)
|
; SPDX-License-Identifier: GPL-3.0-only
|
||||||
in a, (c)
|
|
||||||
in a, (c)
|
; Compatible compilers:
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
; SJAsmPlus, <https://github.com/sjasmplus/sjasmplus/>
|
||||||
sub $19
|
|
||||||
jr z, Goodflsh
|
define zxdos 1
|
||||||
call Print
|
|
||||||
dz 'Incorrect flash IC'
|
IF zxdos=1
|
||||||
ret
|
output BACKZX2
|
||||||
Goodflsh ld a, scandbl_ctrl
|
ELSE
|
||||||
dec b
|
output BACKZXD
|
||||||
out (c), a
|
ENDIF
|
||||||
inc b
|
|
||||||
in a, (c)
|
include zxuno.inc
|
||||||
and $3f
|
|
||||||
ld (normal+1), a
|
org $2000 ; comienzo de la ejecución de los comandos ESXDOS
|
||||||
or $c0
|
|
||||||
out (c), a
|
call wrear0
|
||||||
call init
|
dec b
|
||||||
ld bc, zxuno_port
|
out (c), 0
|
||||||
ld a, scandbl_ctrl
|
inc b
|
||||||
out (c), a
|
in f, (c)
|
||||||
inc b
|
jp p, Nonlock
|
||||||
normal ld a, 0
|
call Print
|
||||||
out (c), a
|
dz 'ROM not rooted'
|
||||||
ret
|
ret
|
||||||
init xor a
|
Nonlock wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
esxdos M_GETSETDRV ; A = unidad actual
|
wreg flash_spi, $9f ; jedec id
|
||||||
jr nc, SDCard
|
in a, (c)
|
||||||
call Print
|
in a, (c)
|
||||||
dz 'SD card not inserted'
|
in a, (c)
|
||||||
ret
|
in a, (c)
|
||||||
SDCard ld b, FA_WRITE | FA_OPEN_AL ; B = modo de apertura
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
ld hl, FileName ; HL = Puntero al nombre del fichero (ASCIIZ)
|
sub $19
|
||||||
esxdos F_OPEN
|
jr z, Goodflsh
|
||||||
ld (handle+1), a
|
call Print
|
||||||
jr nc, FileFound
|
dz 'Incorrect flash IC'
|
||||||
call Print
|
ret
|
||||||
IF zxdos=1
|
Goodflsh ld a, scandbl_ctrl
|
||||||
dz 'Can\'t open FLASH.ZX2'
|
dec b
|
||||||
ELSE
|
out (c), a
|
||||||
dz 'Can\'t open FLASH.ZXD'
|
inc b
|
||||||
ENDIF
|
in a, (c)
|
||||||
ret
|
and $3f
|
||||||
FileFound call Print
|
ld (normal+1), a
|
||||||
IF zxdos=1
|
or $c0
|
||||||
dz 'Backing up FLASH.ZX2 to SD', 13
|
out (c), a
|
||||||
ELSE
|
call init
|
||||||
dz 'Backing up FLASH.ZXD to SD', 13
|
ld bc, zxuno_port
|
||||||
ENDIF
|
ld a, scandbl_ctrl
|
||||||
call write16m
|
out (c), a
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
inc b
|
||||||
wreg flash_spi, 6 ; envío write enable
|
normal ld a, 0
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
out (c), a
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
ret
|
||||||
wreg flash_spi, $c5 ; envío wrear
|
init xor a
|
||||||
ld l, 1
|
esxdos M_GETSETDRV ; A = unidad actual
|
||||||
out (c), l
|
jr nc, SDCard
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
call Print
|
||||||
call write16m
|
dz 'SD card not inserted'
|
||||||
esxdos F_CLOSE
|
ret
|
||||||
call Print
|
SDCard ld b, FA_WRITE | FA_OPEN_AL ; B = modo de apertura
|
||||||
dz 13, 'Backup complete'
|
ld hl, FileName ; HL = Puntero al nombre del fichero (ASCIIZ)
|
||||||
wrear0 wreg flash_cs, 0 ; activamos spi, enviando un 0
|
esxdos F_OPEN
|
||||||
wreg flash_spi, 6 ; envío write enable
|
ld (handle+1), a
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
jr nc, FileFound
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
call Print
|
||||||
wreg flash_spi, $c5 ; envío wrear
|
IF zxdos=1
|
||||||
out (c), 0
|
dz 'Can\'t open FLASH.ZX2'
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
ELSE
|
||||||
ret
|
dz 'Can\'t open FLASH.ZXD'
|
||||||
|
ENDIF
|
||||||
write16m ld hl, $0000
|
ret
|
||||||
Bucle push hl
|
FileFound call Print
|
||||||
ld de, $8000
|
IF zxdos=1
|
||||||
ld a, $40
|
dz 'Backing up FLASH.ZX2 to SD', 13
|
||||||
call rdflsh
|
ELSE
|
||||||
add hl, hl
|
dz 'Backing up FLASH.ZXD to SD', 13
|
||||||
add hl, hl
|
ENDIF
|
||||||
ld a, h
|
call write16m
|
||||||
and $3f
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
jr nz, punto
|
wreg flash_spi, 6 ; envío write enable
|
||||||
ld a, 'o'
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
rst $10
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
punto ld hl, $8000
|
wreg flash_spi, $c5 ; envío wrear
|
||||||
ld bc, $4000
|
ld l, 1
|
||||||
handle ld a, 0
|
out (c), l
|
||||||
esxdos F_WRITE
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
pop hl
|
call write16m
|
||||||
jr nc, WriteOK
|
esxdos F_CLOSE
|
||||||
call Print
|
call Print
|
||||||
dz 'Write Error'
|
dz 13, 'Backup complete'
|
||||||
ret
|
wrear0 wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
WriteOK ld de, $0040
|
wreg flash_spi, 6 ; envío write enable
|
||||||
adc hl, de
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
jr nc, Bucle
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
ret
|
wreg flash_spi, $c5 ; envío wrear
|
||||||
|
out (c), 0
|
||||||
Print pop hl
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
db $3e
|
ret
|
||||||
Print1 rst $10
|
|
||||||
ld a, (hl)
|
write16m ld hl, $0000
|
||||||
inc hl
|
Bucle push hl
|
||||||
or a
|
ld de, $8000
|
||||||
jr nz, Print1
|
ld a, $40
|
||||||
jp (hl)
|
call rdflsh
|
||||||
|
add hl, hl
|
||||||
; ------------------------
|
add hl, hl
|
||||||
; Read from SPI flash
|
ld a, h
|
||||||
; Parameters:
|
and $3f
|
||||||
; DE: destination address
|
jr nz, punto
|
||||||
; HL: source address without last byte
|
ld a, 'o'
|
||||||
; A: number of pages (256 bytes) to read
|
rst $10
|
||||||
; ------------------------
|
punto ld hl, $8000
|
||||||
rdflsh ex af, af'
|
ld bc, $4000
|
||||||
xor a
|
handle ld a, 0
|
||||||
push hl
|
esxdos F_WRITE
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
pop hl
|
||||||
wreg flash_spi, 3 ; envio flash_spi un 3, orden de lectura
|
jr nc, WriteOK
|
||||||
pop hl
|
call Print
|
||||||
push hl
|
dz 'Write Error'
|
||||||
out (c), h
|
ret
|
||||||
out (c), l
|
WriteOK ld de, $0040
|
||||||
out (c), a
|
adc hl, de
|
||||||
ex af, af'
|
jr nc, Bucle
|
||||||
ex de, hl
|
ret
|
||||||
in f, (c)
|
|
||||||
rdfls1 ld e, $20
|
Print pop hl
|
||||||
rdfls2 ini
|
db $3e
|
||||||
inc b
|
Print1 rst $10
|
||||||
ini
|
ld a, (hl)
|
||||||
inc b
|
inc hl
|
||||||
ini
|
or a
|
||||||
inc b
|
jr nz, Print1
|
||||||
ini
|
jp (hl)
|
||||||
inc b
|
|
||||||
ini
|
; ------------------------
|
||||||
inc b
|
; Read from SPI flash
|
||||||
ini
|
; Parameters:
|
||||||
inc b
|
; DE: destination address
|
||||||
ini
|
; HL: source address without last byte
|
||||||
inc b
|
; A: number of pages (256 bytes) to read
|
||||||
ini
|
; ------------------------
|
||||||
inc b
|
rdflsh ex af, af'
|
||||||
dec e
|
xor a
|
||||||
jr nz, rdfls2
|
push hl
|
||||||
dec a
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
jr nz, rdfls1
|
wreg flash_spi, 3 ; envio flash_spi un 3, orden de lectura
|
||||||
wreg flash_cs, 1
|
pop hl
|
||||||
pop hl
|
push hl
|
||||||
ret
|
out (c), h
|
||||||
|
out (c), l
|
||||||
rst28 ld bc, zxuno_port + $100
|
out (c), a
|
||||||
pop hl
|
ex af, af'
|
||||||
outi
|
ex de, hl
|
||||||
ld b, (zxuno_port >> 8)+2
|
in f, (c)
|
||||||
outi
|
rdfls1 ld e, $20
|
||||||
jp (hl)
|
rdfls2 ini
|
||||||
|
inc b
|
||||||
IF zxdos=1
|
ini
|
||||||
FileName dz 'FLASH.ZX2'
|
inc b
|
||||||
ELSE
|
ini
|
||||||
FileName dz 'FLASH.ZXD'
|
inc b
|
||||||
ENDIF
|
ini
|
||||||
|
inc b
|
||||||
|
ini
|
||||||
|
inc b
|
||||||
|
ini
|
||||||
|
inc b
|
||||||
|
ini
|
||||||
|
inc b
|
||||||
|
ini
|
||||||
|
inc b
|
||||||
|
dec e
|
||||||
|
jr nz, rdfls2
|
||||||
|
dec a
|
||||||
|
jr nz, rdfls1
|
||||||
|
wreg flash_cs, 1
|
||||||
|
pop hl
|
||||||
|
ret
|
||||||
|
|
||||||
|
rst28 ld bc, zxuno_port + $100
|
||||||
|
pop hl
|
||||||
|
outi
|
||||||
|
ld b, (zxuno_port >> 8)+2
|
||||||
|
outi
|
||||||
|
jp (hl)
|
||||||
|
|
||||||
|
IF zxdos=1
|
||||||
|
FileName dz 'FLASH.ZX2'
|
||||||
|
ELSE
|
||||||
|
FileName dz 'FLASH.ZXD'
|
||||||
|
ENDIF
|
||||||
|
|
|
@ -1,3 +1,26 @@
|
||||||
|
; backup.asm
|
||||||
|
;
|
||||||
|
; Copyright (C) 2019, 2021 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/>.
|
||||||
|
;
|
||||||
|
; SPDX-FileCopyrightText: Copyright (C) 2019, 2021 Antonio Villena
|
||||||
|
;
|
||||||
|
; SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
|
; Compatible compilers:
|
||||||
|
; SJAsmPlus, <https://github.com/sjasmplus/sjasmplus/>
|
||||||
|
|
||||||
output BACKUP
|
output BACKUP
|
||||||
|
|
||||||
include zxuno.inc
|
include zxuno.inc
|
||||||
|
@ -138,7 +161,7 @@ rdfls2 ini
|
||||||
wreg flash_cs, 1
|
wreg flash_cs, 1
|
||||||
pop hl
|
pop hl
|
||||||
ret
|
ret
|
||||||
|
|
||||||
rst28 ld bc, zxuno_port + $100
|
rst28 ld bc, zxuno_port + $100
|
||||||
pop hl
|
pop hl
|
||||||
outi
|
outi
|
||||||
|
|
|
@ -1,3 +1,26 @@
|
||||||
|
; corclean.asm
|
||||||
|
;
|
||||||
|
; Copyright (C) 2019, 2021 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/>.
|
||||||
|
;
|
||||||
|
; SPDX-FileCopyrightText: Copyright (C) 2019, 2021 Antonio Villena
|
||||||
|
;
|
||||||
|
; SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
|
; Compatible compilers:
|
||||||
|
; SJAsmPlus, <https://github.com/sjasmplus/sjasmplus/>
|
||||||
|
|
||||||
output CORCLEAN
|
output CORCLEAN
|
||||||
|
|
||||||
include zxuno.inc
|
include zxuno.inc
|
||||||
|
@ -174,7 +197,7 @@ waits6 in a, (c)
|
||||||
jr nz, waits6
|
jr nz, waits6
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
rst28 ld bc, zxuno_port + $100
|
rst28 ld bc, zxuno_port + $100
|
||||||
pop hl
|
pop hl
|
||||||
outi
|
outi
|
||||||
|
|
|
@ -1,3 +1,26 @@
|
||||||
|
; corebios.asm - update simultaneously ZX Spectrum core and BIOS.
|
||||||
|
;
|
||||||
|
; Copyright (C) 2019, 2021 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/>.
|
||||||
|
;
|
||||||
|
; SPDX-FileCopyrightText: Copyright (C) 2019, 2021 Antonio Villena
|
||||||
|
;
|
||||||
|
; SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
|
; Compatible compilers:
|
||||||
|
; SJAsmPlus, <https://github.com/sjasmplus/sjasmplus/>
|
||||||
|
|
||||||
output COREBIOS
|
output COREBIOS
|
||||||
|
|
||||||
include zxuno.inc
|
include zxuno.inc
|
||||||
|
@ -237,7 +260,7 @@ waits6 in a, (c)
|
||||||
jr nz, waits6
|
jr nz, waits6
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
rst28 ld bc, zxuno_port + $100
|
rst28 ld bc, zxuno_port + $100
|
||||||
pop hl
|
pop hl
|
||||||
outi
|
outi
|
||||||
|
|
|
@ -1,185 +1,213 @@
|
||||||
output ROMSBACK
|
; romsback.asm - dumps to a RomPack file named ROMS.ZX1, in the root
|
||||||
|
; directory of the microSD card, all ZX Spectrum core ROMS which are
|
||||||
include zxuno.inc
|
; stored in SPI flash memory.
|
||||||
|
;
|
||||||
org $2000 ; comienzo de la ejecución de los comandos ESXDOS
|
; It must be run while using a "root" mode ROM. Only works correctly
|
||||||
|
; on ZX-Uno and ZXDOS (do not use on ZXDOS+ or gomaDOS+).
|
||||||
call wrear0
|
;
|
||||||
dec b
|
; Copyright (C) 2019, 2021 Antonio Villena
|
||||||
out (c), 0
|
;
|
||||||
inc b
|
; This program is free software: you can redistribute it and/or modify
|
||||||
in f, (c)
|
; it under the terms of the GNU General Public License as published by
|
||||||
jp p, Nonlock
|
; the Free Software Foundation, version 3.
|
||||||
call Print
|
;
|
||||||
dz 'ROM not rooted'
|
; This program is distributed in the hope that it will be useful,
|
||||||
ret
|
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
Nonlock ld a, scandbl_ctrl
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
dec b
|
; GNU General Public License for more details.
|
||||||
out (c), a
|
;
|
||||||
inc b
|
; You should have received a copy of the GNU General Public License
|
||||||
in a, (c)
|
; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
and $3f
|
;
|
||||||
ld (normal+1), a
|
; SPDX-FileCopyrightText: Copyright (C) 2019, 2021 Antonio Villena
|
||||||
or $c0
|
;
|
||||||
out (c), a
|
; SPDX-License-Identifier: GPL-3.0-only
|
||||||
call init
|
|
||||||
ld bc, zxuno_port
|
; Compatible compilers:
|
||||||
ld a, scandbl_ctrl
|
; SJAsmPlus, <https://github.com/sjasmplus/sjasmplus/>
|
||||||
out (c), a
|
|
||||||
inc b
|
output ROMSBACK
|
||||||
normal ld a, 0
|
|
||||||
out (c), a
|
include zxuno.inc
|
||||||
ret
|
|
||||||
init xor a
|
org $2000 ; comienzo de la ejecución de los comandos ESXDOS
|
||||||
esxdos M_GETSETDRV ; A = unidad actual
|
|
||||||
jr nc, SDCard
|
call wrear0
|
||||||
call Print
|
dec b
|
||||||
dz 'SD card not inserted'
|
out (c), 0
|
||||||
ret
|
inc b
|
||||||
SDCard ld b, FA_WRITE | FA_OPEN_AL ; B = modo de apertura
|
in f, (c)
|
||||||
ld hl, FileName ; HL = Puntero al nombre del fichero (ASCIIZ)
|
jp p, Nonlock
|
||||||
esxdos F_OPEN
|
call Print
|
||||||
ld (handle+1), a
|
dz 'ROM not rooted'
|
||||||
jr nc, FileFound
|
ret
|
||||||
call Print
|
Nonlock ld a, scandbl_ctrl
|
||||||
dz 'Can\'t open ROMS.ZX1'
|
dec b
|
||||||
ret
|
out (c), a
|
||||||
FileFound call Print
|
inc b
|
||||||
db 'Backing up ROMS.ZX1 to SD', 13
|
in a, (c)
|
||||||
dz '[', 6, ' ]', 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8
|
and $3f
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
ld (normal+1), a
|
||||||
wreg flash_spi, $9f ; jedec id
|
or $c0
|
||||||
in a, (c)
|
out (c), a
|
||||||
in a, (c)
|
call init
|
||||||
in a, (c)
|
ld bc, zxuno_port
|
||||||
in a, (c)
|
ld a, scandbl_ctrl
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
out (c), a
|
||||||
sub $19
|
inc b
|
||||||
jr nz, ZX1
|
normal ld a, 0
|
||||||
ld ix, $1d40
|
out (c), a
|
||||||
ld iy, $0000
|
ret
|
||||||
jr ZX2cont
|
init xor a
|
||||||
ZX1 ld ix, $2d40
|
esxdos M_GETSETDRV ; A = unidad actual
|
||||||
ld iy, $34c0
|
jr nc, SDCard
|
||||||
ZX2cont ld de, $8000
|
call Print
|
||||||
ld hl, $0060
|
dz 'SD card not inserted'
|
||||||
ld a, $11
|
ret
|
||||||
call rdflsh
|
SDCard ld b, FA_WRITE | FA_OPEN_AL ; B = modo de apertura
|
||||||
ld hl, $8000
|
ld hl, FileName ; HL = Puntero al nombre del fichero (ASCIIZ)
|
||||||
ld bc, $1041
|
esxdos F_OPEN
|
||||||
handle ld a, 0
|
ld (handle+1), a
|
||||||
esxdos F_WRITE
|
jr nc, FileFound
|
||||||
ld hl, $00c0
|
call Print
|
||||||
jr c, tError
|
dz 'Can\'t open ROMS.ZX1'
|
||||||
Bucle ld a, ixl
|
ret
|
||||||
dec a
|
FileFound call Print
|
||||||
and $03
|
db 'Backing up ROMS.ZX1 to SD', 13
|
||||||
jr nz, punto
|
dz '[', 6, ' ]', 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8
|
||||||
ld a, 'o'
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
rst $10
|
wreg flash_spi, $9f ; jedec id
|
||||||
punto ld a, ixl
|
in a, (c)
|
||||||
cp ixh
|
in a, (c)
|
||||||
jr nz, o29roms
|
in a, (c)
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
in a, (c)
|
||||||
wreg flash_spi, 6 ; envío write enable
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
sub $19
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
jr nz, ZX1
|
||||||
wreg flash_spi, $c5 ; envío wrear
|
ld ix, $1d40
|
||||||
ld l, 1
|
ld iy, $0000
|
||||||
out (c), l
|
jr ZX2cont
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
ZX1 ld ix, $2d40
|
||||||
push iy
|
ld iy, $34c0
|
||||||
pop hl
|
ZX2cont ld de, $8000
|
||||||
o29roms ld de, $8000
|
ld hl, $0060
|
||||||
ld a, $40
|
ld a, $11
|
||||||
call rdflsh
|
call rdflsh
|
||||||
ld de, $0040
|
ld hl, $8000
|
||||||
add hl, de
|
ld bc, $1041
|
||||||
push hl
|
handle ld a, 0
|
||||||
ld hl, $8000
|
esxdos F_WRITE
|
||||||
ld bc, $4000
|
ld hl, $00c0
|
||||||
ld a, (handle+1)
|
jr c, tError
|
||||||
esxdos F_WRITE
|
Bucle ld a, ixl
|
||||||
pop hl
|
dec a
|
||||||
jr nc, ReadOK
|
and $03
|
||||||
tError call Print
|
jr nz, punto
|
||||||
dz 'Write Error'
|
ld a, 'o'
|
||||||
ret
|
rst $10
|
||||||
ReadOK dec ixl
|
punto ld a, ixl
|
||||||
jr nz, Bucle
|
cp ixh
|
||||||
ld a, (handle+1)
|
jr nz, o29roms
|
||||||
esxdos F_CLOSE
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
call Print
|
wreg flash_spi, 6 ; envío write enable
|
||||||
dz 13, 'Backup complete', 13
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
ld iy, $5c3a
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
wrear0 wreg flash_cs, 0 ; activamos spi, enviando un 0
|
wreg flash_spi, $c5 ; envío wrear
|
||||||
wreg flash_spi, 6 ; envío write enable
|
ld l, 1
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
out (c), l
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
wreg flash_spi, $c5 ; envío wrear
|
push iy
|
||||||
out (c), 0
|
pop hl
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
o29roms ld de, $8000
|
||||||
ret
|
ld a, $40
|
||||||
|
call rdflsh
|
||||||
Print pop hl
|
ld de, $0040
|
||||||
db $3e
|
add hl, de
|
||||||
Print1 rst $10
|
push hl
|
||||||
ld a, (hl)
|
ld hl, $8000
|
||||||
inc hl
|
ld bc, $4000
|
||||||
or a
|
ld a, (handle+1)
|
||||||
jr nz, Print1
|
esxdos F_WRITE
|
||||||
jp (hl)
|
pop hl
|
||||||
|
jr nc, ReadOK
|
||||||
; ------------------------
|
tError call Print
|
||||||
; Read from SPI flash
|
dz 'Write Error'
|
||||||
; Parameters:
|
ret
|
||||||
; DE: destination address
|
ReadOK dec ixl
|
||||||
; HL: source address without last byte
|
jr nz, Bucle
|
||||||
; A: number of pages (256 bytes) to read
|
ld a, (handle+1)
|
||||||
; ------------------------
|
esxdos F_CLOSE
|
||||||
rdflsh ex af, af'
|
call Print
|
||||||
xor a
|
dz 13, 'Backup complete', 13
|
||||||
push hl
|
ld iy, $5c3a
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
wrear0 wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
wreg flash_spi, 3 ; envio flash_spi un 3, orden de lectura
|
wreg flash_spi, 6 ; envío write enable
|
||||||
pop hl
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
push hl
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
out (c), h
|
wreg flash_spi, $c5 ; envío wrear
|
||||||
out (c), l
|
out (c), 0
|
||||||
out (c), a
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
ex af, af'
|
ret
|
||||||
ex de, hl
|
|
||||||
in f, (c)
|
Print pop hl
|
||||||
rdfls1 ld e, $20
|
db $3e
|
||||||
rdfls2 ini
|
Print1 rst $10
|
||||||
inc b
|
ld a, (hl)
|
||||||
ini
|
inc hl
|
||||||
inc b
|
or a
|
||||||
ini
|
jr nz, Print1
|
||||||
inc b
|
jp (hl)
|
||||||
ini
|
|
||||||
inc b
|
; ------------------------
|
||||||
ini
|
; Read from SPI flash
|
||||||
inc b
|
; Parameters:
|
||||||
ini
|
; DE: destination address
|
||||||
inc b
|
; HL: source address without last byte
|
||||||
ini
|
; A: number of pages (256 bytes) to read
|
||||||
inc b
|
; ------------------------
|
||||||
ini
|
rdflsh ex af, af'
|
||||||
inc b
|
xor a
|
||||||
dec e
|
push hl
|
||||||
jr nz, rdfls2
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
dec a
|
wreg flash_spi, 3 ; envio flash_spi un 3, orden de lectura
|
||||||
jr nz, rdfls1
|
pop hl
|
||||||
wreg flash_cs, 1
|
push hl
|
||||||
pop hl
|
out (c), h
|
||||||
ret
|
out (c), l
|
||||||
|
out (c), a
|
||||||
rst28 ld bc, zxuno_port + $100
|
ex af, af'
|
||||||
pop hl
|
ex de, hl
|
||||||
outi
|
in f, (c)
|
||||||
ld b, (zxuno_port >> 8)+2
|
rdfls1 ld e, $20
|
||||||
outi
|
rdfls2 ini
|
||||||
jp (hl)
|
inc b
|
||||||
|
ini
|
||||||
FileName dz 'ROMS.ZX1'
|
inc b
|
||||||
|
ini
|
||||||
|
inc b
|
||||||
|
ini
|
||||||
|
inc b
|
||||||
|
ini
|
||||||
|
inc b
|
||||||
|
ini
|
||||||
|
inc b
|
||||||
|
ini
|
||||||
|
inc b
|
||||||
|
ini
|
||||||
|
inc b
|
||||||
|
dec e
|
||||||
|
jr nz, rdfls2
|
||||||
|
dec a
|
||||||
|
jr nz, rdfls1
|
||||||
|
wreg flash_cs, 1
|
||||||
|
pop hl
|
||||||
|
ret
|
||||||
|
|
||||||
|
rst28 ld bc, zxuno_port + $100
|
||||||
|
pop hl
|
||||||
|
outi
|
||||||
|
ld b, (zxuno_port >> 8)+2
|
||||||
|
outi
|
||||||
|
jp (hl)
|
||||||
|
|
||||||
|
FileName dz 'ROMS.ZX1'
|
||||||
|
|
|
@ -1,282 +1,309 @@
|
||||||
output ROMSUPGR
|
; romsupgr.asm - load from a RomPack file named ROMS.ZX1, in the root
|
||||||
|
; directory of the SD card, all ZX Spectrum core ROMS into SPI flash
|
||||||
include zxuno.inc
|
; memory.
|
||||||
|
;
|
||||||
org $2000 ; comienzo de la ejecución de los comandos ESXDOS
|
; It must be run while using a "root" mode ROM.
|
||||||
|
;
|
||||||
call wrear0
|
; Copyright (C) 2019, 2021 Antonio Villena
|
||||||
dec b
|
;
|
||||||
out (c), 0
|
; This program is free software: you can redistribute it and/or modify
|
||||||
inc b
|
; it under the terms of the GNU General Public License as published by
|
||||||
in f, (c)
|
; the Free Software Foundation, version 3.
|
||||||
jp p, Nonlock
|
;
|
||||||
call Print
|
; This program is distributed in the hope that it will be useful,
|
||||||
dz 'ROM not rooted'
|
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
ret
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Nonlock ld a, scandbl_ctrl
|
; GNU General Public License for more details.
|
||||||
dec b
|
;
|
||||||
out (c), a
|
; You should have received a copy of the GNU General Public License
|
||||||
inc b
|
; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
in a, (c)
|
;
|
||||||
and $3f
|
; SPDX-FileCopyrightText: Copyright (C) 2019, 2021 Antonio Villena
|
||||||
ld (normal+1), a
|
;
|
||||||
or $c0
|
; SPDX-License-Identifier: GPL-3.0-only
|
||||||
out (c), a
|
|
||||||
call init
|
; Compatible compilers:
|
||||||
ld bc, zxuno_port
|
; SJAsmPlus, <https://github.com/sjasmplus/sjasmplus/>
|
||||||
ld a, scandbl_ctrl
|
|
||||||
out (c), a
|
output ROMSUPGR
|
||||||
inc b
|
|
||||||
normal ld a, 0
|
include zxuno.inc
|
||||||
out (c), a
|
|
||||||
ret
|
org $2000 ; comienzo de la ejecución de los comandos ESXDOS
|
||||||
init xor a
|
|
||||||
esxdos M_GETSETDRV ; A = unidad actual
|
call wrear0
|
||||||
jr nc, SDCard
|
dec b
|
||||||
call Print
|
out (c), 0
|
||||||
dz 'SD card not inserted'
|
inc b
|
||||||
ret
|
in f, (c)
|
||||||
SDCard ld b, FA_READ ; B = modo de apertura
|
jp p, Nonlock
|
||||||
ld hl, FileName ; HL = Puntero al nombre del fichero (ASCIIZ)
|
call Print
|
||||||
esxdos F_OPEN
|
dz 'ROM not rooted'
|
||||||
ld (handle+1), a
|
ret
|
||||||
jr nc, FileFound
|
Nonlock ld a, scandbl_ctrl
|
||||||
call Print
|
dec b
|
||||||
dz 'File ROMS.ZX1 not found'
|
out (c), a
|
||||||
ret
|
inc b
|
||||||
FileFound wreg flash_cs, 0 ; activamos spi, enviando un 0
|
in a, (c)
|
||||||
wreg flash_spi, $9f ; jedec id
|
and $3f
|
||||||
in a, (c)
|
ld (normal+1), a
|
||||||
in a, (c)
|
or $c0
|
||||||
in a, (c)
|
out (c), a
|
||||||
in a, (c)
|
call init
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
ld bc, zxuno_port
|
||||||
sub $19
|
ld a, scandbl_ctrl
|
||||||
jp nz, ZX1
|
out (c), a
|
||||||
ld de, $8000
|
inc b
|
||||||
ld hl, $0980
|
normal ld a, 0
|
||||||
ld a, 1
|
out (c), a
|
||||||
call rdflsh
|
ret
|
||||||
ld a, ($8000)
|
init xor a
|
||||||
inc a
|
esxdos M_GETSETDRV ; A = unidad actual
|
||||||
jr nz, ZX2P
|
jr nc, SDCard
|
||||||
call Print
|
call Print
|
||||||
db 'Upgrading ROMS.ZX1 from SD', 13
|
dz 'SD card not inserted'
|
||||||
dz '[ ]', 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8
|
ret
|
||||||
jr ZX2PC
|
SDCard ld b, FA_READ ; B = modo de apertura
|
||||||
ZX2P call Print
|
ld hl, FileName ; HL = Puntero al nombre del fichero (ASCIIZ)
|
||||||
db 'Upgrading ROMS.ZX1 from SD', 13
|
esxdos F_OPEN
|
||||||
dz '[', 6, ' ]', 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8
|
ld (handle+1), a
|
||||||
ZX2PC ld a, ($8000)
|
jr nc, FileFound
|
||||||
inc a
|
call Print
|
||||||
ld ix, $0a2c
|
dz 'File ROMS.ZX1 not found'
|
||||||
ld iy, $0000
|
ret
|
||||||
jr z, ZX2cont
|
FileFound wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
ld ix, $1840
|
wreg flash_spi, $9f ; jedec id
|
||||||
jr ZX2cont
|
in a, (c)
|
||||||
ZX1 call Print
|
in a, (c)
|
||||||
db 'Upgrading ROMS.ZX1 from SD', 13
|
in a, (c)
|
||||||
dz '[', 6, ' ]', 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8
|
in a, (c)
|
||||||
ld ix, $2e40
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
ld iy, $34c0
|
sub $19
|
||||||
ZX2cont ld de, $8000
|
jp nz, ZX1
|
||||||
ld hl, $0060
|
ld de, $8000
|
||||||
ld a, $20
|
ld hl, $0980
|
||||||
call rdflsh
|
ld a, 1
|
||||||
ld de, $0060
|
call rdflsh
|
||||||
exx
|
ld a, ($8000)
|
||||||
ld hl, $8000
|
inc a
|
||||||
ld bc, $1041
|
jr nz, ZX2P
|
||||||
handle ld a, 0
|
call Print
|
||||||
esxdos F_READ
|
db 'Upgrading ROMS.ZX1 from SD', 13
|
||||||
jr c, tError
|
dz '[ ]', 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8
|
||||||
ld a, $20
|
jr ZX2PC
|
||||||
ld hl, $8000
|
ZX2P call Print
|
||||||
exx
|
db 'Upgrading ROMS.ZX1 from SD', 13
|
||||||
call wrflsh
|
dz '[', 6, ' ]', 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8
|
||||||
ld e, $c0
|
ZX2PC ld a, ($8000)
|
||||||
exx
|
inc a
|
||||||
Bucle ld a, ixl
|
ld ix, $0a2c
|
||||||
dec a
|
ld iy, $0000
|
||||||
and $03
|
jr z, ZX2cont
|
||||||
jr nz, punto
|
ld ix, $1840
|
||||||
ld a, 'o'
|
jr ZX2cont
|
||||||
exx
|
ZX1 call Print
|
||||||
push de
|
db 'Upgrading ROMS.ZX1 from SD', 13
|
||||||
rst $10
|
dz '[', 6, ' ]', 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8
|
||||||
pop de
|
ld ix, $2e40
|
||||||
exx
|
ld iy, $34c0
|
||||||
punto ld hl, $8000
|
ZX2cont ld de, $8000
|
||||||
ld bc, $4000
|
ld hl, $0060
|
||||||
ld a, (handle+1)
|
ld a, $20
|
||||||
esxdos F_READ
|
call rdflsh
|
||||||
jr nc, ReadOK
|
ld de, $0060
|
||||||
tError call Print
|
exx
|
||||||
dz 'Read Error'
|
ld hl, $8000
|
||||||
ret
|
ld bc, $1041
|
||||||
ReadOK ld a, $40
|
handle ld a, 0
|
||||||
ld hl, $8000
|
esxdos F_READ
|
||||||
exx
|
jr c, tError
|
||||||
call wrflsh
|
ld a, $20
|
||||||
inc de
|
ld hl, $8000
|
||||||
ld a, ixl
|
exx
|
||||||
cp ixh
|
call wrflsh
|
||||||
jr nz, o10roms
|
ld e, $c0
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
exx
|
||||||
wreg flash_spi, 6 ; envío write enable
|
Bucle ld a, ixl
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
dec a
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
and $03
|
||||||
wreg flash_spi, $c5 ; envío wrear
|
jr nz, punto
|
||||||
ld l, 1
|
ld a, 'o'
|
||||||
out (c), l
|
exx
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
push de
|
||||||
push iy
|
rst $10
|
||||||
pop de
|
pop de
|
||||||
o10roms exx
|
exx
|
||||||
dec ixl
|
punto ld hl, $8000
|
||||||
jr nz, Bucle
|
ld bc, $4000
|
||||||
ld a, (handle+1)
|
ld a, (handle+1)
|
||||||
esxdos F_CLOSE
|
esxdos F_READ
|
||||||
call Print
|
jr nc, ReadOK
|
||||||
dz 13, 'Upgrade complete', 13
|
tError call Print
|
||||||
ld iy, $5c3a
|
dz 'Read Error'
|
||||||
wrear0 wreg flash_cs, 0 ; activamos spi, enviando un 0
|
ret
|
||||||
wreg flash_spi, 6 ; envío write enable
|
ReadOK ld a, $40
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
ld hl, $8000
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
exx
|
||||||
wreg flash_spi, $c5 ; envío wrear
|
call wrflsh
|
||||||
out (c), 0
|
inc de
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
ld a, ixl
|
||||||
ret
|
cp ixh
|
||||||
|
jr nz, o10roms
|
||||||
Print pop hl
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
db $3e
|
wreg flash_spi, 6 ; envío write enable
|
||||||
Print1 rst $10
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
ld a, (hl)
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
inc hl
|
wreg flash_spi, $c5 ; envío wrear
|
||||||
or a
|
ld l, 1
|
||||||
jr nz, Print1
|
out (c), l
|
||||||
jp (hl)
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
|
push iy
|
||||||
; ------------------------
|
pop de
|
||||||
; Read from SPI flash
|
o10roms exx
|
||||||
; Parameters:
|
dec ixl
|
||||||
; DE: destination address
|
jr nz, Bucle
|
||||||
; HL: source address without last byte
|
ld a, (handle+1)
|
||||||
; A: number of pages (256 bytes) to read
|
esxdos F_CLOSE
|
||||||
; ------------------------
|
call Print
|
||||||
rdflsh ex af, af'
|
dz 13, 'Upgrade complete', 13
|
||||||
xor a
|
ld iy, $5c3a
|
||||||
push hl
|
wrear0 wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
wreg flash_spi, 6 ; envío write enable
|
||||||
wreg flash_spi, 3 ; envio flash_spi un 3, orden de lectura
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
pop hl
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
push hl
|
wreg flash_spi, $c5 ; envío wrear
|
||||||
out (c), h
|
out (c), 0
|
||||||
out (c), l
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
out (c), a
|
ret
|
||||||
ex af, af'
|
|
||||||
ex de, hl
|
Print pop hl
|
||||||
in f, (c)
|
db $3e
|
||||||
rdfls1 ld e, $20
|
Print1 rst $10
|
||||||
rdfls2 ini
|
ld a, (hl)
|
||||||
inc b
|
inc hl
|
||||||
ini
|
or a
|
||||||
inc b
|
jr nz, Print1
|
||||||
ini
|
jp (hl)
|
||||||
inc b
|
|
||||||
ini
|
; ------------------------
|
||||||
inc b
|
; Read from SPI flash
|
||||||
ini
|
; Parameters:
|
||||||
inc b
|
; DE: destination address
|
||||||
ini
|
; HL: source address without last byte
|
||||||
inc b
|
; A: number of pages (256 bytes) to read
|
||||||
ini
|
; ------------------------
|
||||||
inc b
|
rdflsh ex af, af'
|
||||||
ini
|
xor a
|
||||||
inc b
|
push hl
|
||||||
dec e
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
jr nz, rdfls2
|
wreg flash_spi, 3 ; envio flash_spi un 3, orden de lectura
|
||||||
dec a
|
pop hl
|
||||||
jr nz, rdfls1
|
push hl
|
||||||
wreg flash_cs, 1
|
out (c), h
|
||||||
pop hl
|
out (c), l
|
||||||
ret
|
out (c), a
|
||||||
|
ex af, af'
|
||||||
; ------------------------
|
ex de, hl
|
||||||
; Write to SPI flash
|
in f, (c)
|
||||||
; Parameters:
|
rdfls1 ld e, $20
|
||||||
; A: number of pages (256 bytes) to write
|
rdfls2 ini
|
||||||
; DE: target address without last byte
|
inc b
|
||||||
; HL': source address from memory
|
ini
|
||||||
; ------------------------
|
inc b
|
||||||
wrflsh ex af, af'
|
ini
|
||||||
xor a
|
inc b
|
||||||
wrfls1 wreg flash_cs, 0 ; activamos spi, enviando un 0
|
ini
|
||||||
wreg flash_spi, 6 ; envío write enable
|
inc b
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
ini
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
inc b
|
||||||
wreg flash_spi, $20 ; envío sector erase
|
ini
|
||||||
out (c), d
|
inc b
|
||||||
out (c), e
|
ini
|
||||||
out (c), a
|
inc b
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
ini
|
||||||
wrfls2 call waits5
|
inc b
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
dec e
|
||||||
wreg flash_spi, 6 ; envío write enable
|
jr nz, rdfls2
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
dec a
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
jr nz, rdfls1
|
||||||
wreg flash_spi, 2 ; page program
|
wreg flash_cs, 1
|
||||||
out (c), d
|
pop hl
|
||||||
out (c), e
|
ret
|
||||||
out (c), a
|
|
||||||
ld a, $20
|
; ------------------------
|
||||||
exx
|
; Write to SPI flash
|
||||||
ld bc, zxuno_port+$100
|
; Parameters:
|
||||||
wrfls3 inc b
|
; A: number of pages (256 bytes) to write
|
||||||
outi
|
; DE: target address without last byte
|
||||||
inc b
|
; HL': source address from memory
|
||||||
outi
|
; ------------------------
|
||||||
inc b
|
wrflsh ex af, af'
|
||||||
outi
|
xor a
|
||||||
inc b
|
wrfls1 wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
outi
|
wreg flash_spi, 6 ; envío write enable
|
||||||
inc b
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
outi
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
inc b
|
wreg flash_spi, $20 ; envío sector erase
|
||||||
outi
|
out (c), d
|
||||||
inc b
|
out (c), e
|
||||||
outi
|
out (c), a
|
||||||
inc b
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
outi
|
wrfls2 call waits5
|
||||||
dec a
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
jr nz, wrfls3
|
wreg flash_spi, 6 ; envío write enable
|
||||||
exx
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
ex af, af'
|
wreg flash_spi, 2 ; page program
|
||||||
dec a
|
out (c), d
|
||||||
jr z, waits5
|
out (c), e
|
||||||
ex af, af'
|
out (c), a
|
||||||
inc e
|
ld a, $20
|
||||||
ld a, e
|
exx
|
||||||
and $0f
|
ld bc, zxuno_port+$100
|
||||||
jr nz, wrfls2
|
wrfls3 inc b
|
||||||
ld hl, wrfls1
|
outi
|
||||||
push hl
|
inc b
|
||||||
waits5 wreg flash_cs, 0 ; activamos spi, enviando un 0
|
outi
|
||||||
wreg flash_spi, 5 ; envío read status
|
inc b
|
||||||
in a, (c)
|
outi
|
||||||
waits6 in a, (c)
|
inc b
|
||||||
and 1
|
outi
|
||||||
jr nz, waits6
|
inc b
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
outi
|
||||||
ret
|
inc b
|
||||||
|
outi
|
||||||
rst28 ld bc, zxuno_port + $100
|
inc b
|
||||||
pop hl
|
outi
|
||||||
outi
|
inc b
|
||||||
ld b, (zxuno_port >> 8)+2
|
outi
|
||||||
outi
|
dec a
|
||||||
jp (hl)
|
jr nz, wrfls3
|
||||||
|
exx
|
||||||
FileName dz 'ROMS.ZX1'
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
|
ex af, af'
|
||||||
|
dec a
|
||||||
|
jr z, waits5
|
||||||
|
ex af, af'
|
||||||
|
inc e
|
||||||
|
ld a, e
|
||||||
|
and $0f
|
||||||
|
jr nz, wrfls2
|
||||||
|
ld hl, wrfls1
|
||||||
|
push hl
|
||||||
|
waits5 wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
|
wreg flash_spi, 5 ; envío read status
|
||||||
|
in a, (c)
|
||||||
|
waits6 in a, (c)
|
||||||
|
and 1
|
||||||
|
jr nz, waits6
|
||||||
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
|
ret
|
||||||
|
|
||||||
|
rst28 ld bc, zxuno_port + $100
|
||||||
|
pop hl
|
||||||
|
outi
|
||||||
|
ld b, (zxuno_port >> 8)+2
|
||||||
|
outi
|
||||||
|
jp (hl)
|
||||||
|
|
||||||
|
FileName dz 'ROMS.ZX1'
|
||||||
|
|
|
@ -1,3 +1,29 @@
|
||||||
|
; upgr16m.asm - load the content of a FLASH.ZX1 file, in the root
|
||||||
|
; directory of the microSD card, to a 16 Meg SPI Flash memory.
|
||||||
|
;
|
||||||
|
; It must be run while using a "root" mode ROM.
|
||||||
|
;
|
||||||
|
; Copyright (C) 2019, 2021 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/>.
|
||||||
|
;
|
||||||
|
; SPDX-FileCopyrightText: Copyright (C) 2019, 2021 Antonio Villena
|
||||||
|
;
|
||||||
|
; SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
|
; Compatible compilers:
|
||||||
|
; SJAsmPlus, <https://github.com/sjasmplus/sjasmplus/>
|
||||||
|
|
||||||
output UPGR16M
|
output UPGR16M
|
||||||
|
|
||||||
include zxuno.inc
|
include zxuno.inc
|
||||||
|
@ -173,7 +199,7 @@ waits6 in a, (c)
|
||||||
jr nz, waits6
|
jr nz, waits6
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
rst28 ld bc, zxuno_port + $100
|
rst28 ld bc, zxuno_port + $100
|
||||||
pop hl
|
pop hl
|
||||||
outi
|
outi
|
||||||
|
|
|
@ -1,221 +1,247 @@
|
||||||
define zxdos 1
|
; upgr32m.asm - write the content of a FLASH.ZX2 or FLASH.ZXD file, in
|
||||||
|
; the root directory of the microSD card, to a 32 Meg SPI Flash memory.
|
||||||
IF zxdos=1
|
;
|
||||||
output UPGRZX2
|
; It must be run while using a "root" mode ROM.
|
||||||
ELSE
|
;
|
||||||
output UPGRZXD
|
; Copyright (C) 2019, 2021 Antonio Villena
|
||||||
ENDIF
|
;
|
||||||
|
; This program is free software: you can redistribute it and/or modify
|
||||||
include zxuno.inc
|
; it under the terms of the GNU General Public License as published by
|
||||||
|
; the Free Software Foundation, version 3.
|
||||||
org $2000 ; comienzo de la ejecución de los comandos ESXDOS
|
;
|
||||||
|
; This program is distributed in the hope that it will be useful,
|
||||||
call wrear0
|
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
dec b
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
out (c), 0
|
; GNU General Public License for more details.
|
||||||
inc b
|
;
|
||||||
in f, (c)
|
; You should have received a copy of the GNU General Public License
|
||||||
jp p, Nonlock
|
; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
call Print
|
;
|
||||||
dz 'ROM not rooted'
|
; SPDX-FileCopyrightText: Copyright (C) 2019, 2021 Antonio Villena
|
||||||
ret
|
;
|
||||||
Nonlock wreg flash_cs, 0 ; activamos spi, enviando un 0
|
; SPDX-License-Identifier: GPL-3.0-only
|
||||||
wreg flash_spi, $9f ; jedec id
|
|
||||||
in a, (c)
|
; Compatible compilers:
|
||||||
in a, (c)
|
; SJAsmPlus, <https://github.com/sjasmplus/sjasmplus/>
|
||||||
in a, (c)
|
|
||||||
in a, (c)
|
define zxdos 1
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
|
||||||
sub $19
|
IF zxdos=1
|
||||||
jr z, Goodflsh
|
output UPGRZX2
|
||||||
call Print
|
ELSE
|
||||||
dz 'Incorrect flash IC'
|
output UPGRZXD
|
||||||
ret
|
ENDIF
|
||||||
Goodflsh ld a, scandbl_ctrl
|
|
||||||
dec b
|
include zxuno.inc
|
||||||
out (c), a
|
|
||||||
inc b
|
org $2000 ; comienzo de la ejecución de los comandos ESXDOS
|
||||||
in a, (c)
|
|
||||||
and $3f
|
call wrear0
|
||||||
ld (normal+1), a
|
dec b
|
||||||
or $c0
|
out (c), 0
|
||||||
out (c), a
|
inc b
|
||||||
call init
|
in f, (c)
|
||||||
ld bc, zxuno_port
|
jp p, Nonlock
|
||||||
ld a, scandbl_ctrl
|
call Print
|
||||||
out (c), a
|
dz 'ROM not rooted'
|
||||||
inc b
|
ret
|
||||||
normal ld a, 0
|
Nonlock wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
out (c), a
|
wreg flash_spi, $9f ; jedec id
|
||||||
ret
|
in a, (c)
|
||||||
init xor a
|
in a, (c)
|
||||||
esxdos M_GETSETDRV ; A = unidad actual
|
in a, (c)
|
||||||
jr nc, SDCard
|
in a, (c)
|
||||||
call Print
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
dz 'SD card not inserted'
|
sub $19
|
||||||
ret
|
jr z, Goodflsh
|
||||||
SDCard ld b, FA_READ ; B = modo de apertura
|
call Print
|
||||||
ld hl, FileName ; HL = Puntero al nombre del fichero (ASCIIZ)
|
dz 'Incorrect flash IC'
|
||||||
esxdos F_OPEN
|
ret
|
||||||
ld (handle+1), a
|
Goodflsh ld a, scandbl_ctrl
|
||||||
jr nc, FileFound
|
dec b
|
||||||
call Print
|
out (c), a
|
||||||
IF zxdos=1
|
inc b
|
||||||
dz 'Can\'t open FLASH.ZX2'
|
in a, (c)
|
||||||
ELSE
|
and $3f
|
||||||
dz 'Can\'t open FLASH.ZXD'
|
ld (normal+1), a
|
||||||
ENDIF
|
or $c0
|
||||||
ret
|
out (c), a
|
||||||
FileFound call Print
|
call init
|
||||||
IF zxdos=1
|
ld bc, zxuno_port
|
||||||
dz 'Upgrading FLASH.ZX2 from SD', 13
|
ld a, scandbl_ctrl
|
||||||
ELSE
|
out (c), a
|
||||||
dz 'Upgrading FLASH.ZXD from SD', 13
|
inc b
|
||||||
ENDIF
|
normal ld a, 0
|
||||||
call read16m
|
out (c), a
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
ret
|
||||||
wreg flash_spi, 6 ; envío write enable
|
init xor a
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
esxdos M_GETSETDRV ; A = unidad actual
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
jr nc, SDCard
|
||||||
wreg flash_spi, $c5 ; envío wrear
|
call Print
|
||||||
ld l, 1
|
dz 'SD card not inserted'
|
||||||
out (c), l
|
ret
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
SDCard ld b, FA_READ ; B = modo de apertura
|
||||||
call read16m
|
ld hl, FileName ; HL = Puntero al nombre del fichero (ASCIIZ)
|
||||||
ld a, (handle+1)
|
esxdos F_OPEN
|
||||||
esxdos F_CLOSE
|
ld (handle+1), a
|
||||||
call Print
|
jr nc, FileFound
|
||||||
dz 13, 'Upgrade complete'
|
call Print
|
||||||
wrear0 wreg flash_cs, 0 ; activamos spi, enviando un 0
|
IF zxdos=1
|
||||||
wreg flash_spi, 6 ; envío write enable
|
dz 'Can\'t open FLASH.ZX2'
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
ELSE
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
dz 'Can\'t open FLASH.ZXD'
|
||||||
wreg flash_spi, $c5 ; envío wrear
|
ENDIF
|
||||||
out (c), 0
|
ret
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
FileFound call Print
|
||||||
ret
|
IF zxdos=1
|
||||||
|
dz 'Upgrading FLASH.ZX2 from SD', 13
|
||||||
read16m ld ix, $0400
|
ELSE
|
||||||
ld de, $0000
|
dz 'Upgrading FLASH.ZXD from SD', 13
|
||||||
exx
|
ENDIF
|
||||||
Bucle ld a, ixl
|
call read16m
|
||||||
inc a
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
and $3f
|
wreg flash_spi, 6 ; envío write enable
|
||||||
jr nz, punto
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
ld a, 'o'
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
exx
|
wreg flash_spi, $c5 ; envío wrear
|
||||||
push de
|
ld l, 1
|
||||||
rst $10
|
out (c), l
|
||||||
pop de
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
exx
|
call read16m
|
||||||
punto ld hl, $8000
|
ld a, (handle+1)
|
||||||
ld bc, $4000
|
esxdos F_CLOSE
|
||||||
handle ld a, 0
|
call Print
|
||||||
esxdos F_READ
|
dz 13, 'Upgrade complete'
|
||||||
jr nc, ReadOK
|
wrear0 wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
call Print
|
wreg flash_spi, 6 ; envío write enable
|
||||||
dz 'Read Error'
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
ret
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
ReadOK ld a, $40
|
wreg flash_spi, $c5 ; envío wrear
|
||||||
ld hl, $8000
|
out (c), 0
|
||||||
exx
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
call wrflsh
|
ret
|
||||||
inc de
|
|
||||||
exx
|
read16m ld ix, $0400
|
||||||
dec ixl
|
ld de, $0000
|
||||||
jr nz, Bucle
|
exx
|
||||||
dec ixh
|
Bucle ld a, ixl
|
||||||
jr nz, Bucle
|
inc a
|
||||||
ret
|
and $3f
|
||||||
|
jr nz, punto
|
||||||
Print pop hl
|
ld a, 'o'
|
||||||
db $3e
|
exx
|
||||||
Print1 rst $10
|
push de
|
||||||
ld a, (hl)
|
rst $10
|
||||||
inc hl
|
pop de
|
||||||
or a
|
exx
|
||||||
jr nz, Print1
|
punto ld hl, $8000
|
||||||
jp (hl)
|
ld bc, $4000
|
||||||
|
handle ld a, 0
|
||||||
; ------------------------
|
esxdos F_READ
|
||||||
; Write to SPI flash
|
jr nc, ReadOK
|
||||||
; Parameters:
|
call Print
|
||||||
; A: number of pages (256 bytes) to write
|
dz 'Read Error'
|
||||||
; DE: target address without last byte
|
ret
|
||||||
; BC': zxuno_port+$100 (constant)
|
ReadOK ld a, $40
|
||||||
; HL': source address from memory
|
ld hl, $8000
|
||||||
; ------------------------
|
exx
|
||||||
wrflsh ex af, af'
|
call wrflsh
|
||||||
xor a
|
inc de
|
||||||
wrfls1 wreg flash_cs, 0 ; activamos spi, enviando un 0
|
exx
|
||||||
wreg flash_spi, 6 ; envío write enable
|
dec ixl
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
jr nz, Bucle
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
dec ixh
|
||||||
wreg flash_spi, $20 ; envío sector erase
|
jr nz, Bucle
|
||||||
out (c), d
|
ret
|
||||||
out (c), e
|
|
||||||
out (c), a
|
Print pop hl
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
db $3e
|
||||||
wrfls2 call waits5
|
Print1 rst $10
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
ld a, (hl)
|
||||||
wreg flash_spi, 6 ; envío write enable
|
inc hl
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
or a
|
||||||
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
jr nz, Print1
|
||||||
wreg flash_spi, 2 ; page program
|
jp (hl)
|
||||||
out (c), d
|
|
||||||
out (c), e
|
; ------------------------
|
||||||
out (c), a
|
; Write to SPI flash
|
||||||
ld a, $20
|
; Parameters:
|
||||||
exx
|
; A: number of pages (256 bytes) to write
|
||||||
ld bc, zxuno_port+$100
|
; DE: target address without last byte
|
||||||
wrfls3 inc b
|
; BC': zxuno_port+$100 (constant)
|
||||||
outi
|
; HL': source address from memory
|
||||||
inc b
|
; ------------------------
|
||||||
outi
|
wrflsh ex af, af'
|
||||||
inc b
|
xor a
|
||||||
outi
|
wrfls1 wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
inc b
|
wreg flash_spi, 6 ; envío write enable
|
||||||
outi
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
inc b
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
outi
|
wreg flash_spi, $20 ; envío sector erase
|
||||||
inc b
|
out (c), d
|
||||||
outi
|
out (c), e
|
||||||
inc b
|
out (c), a
|
||||||
outi
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
inc b
|
wrfls2 call waits5
|
||||||
outi
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
dec a
|
wreg flash_spi, 6 ; envío write enable
|
||||||
jr nz, wrfls3
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
exx
|
wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
wreg flash_spi, 2 ; page program
|
||||||
ex af, af'
|
out (c), d
|
||||||
dec a
|
out (c), e
|
||||||
jr z, waits5
|
out (c), a
|
||||||
ex af, af'
|
ld a, $20
|
||||||
inc e
|
exx
|
||||||
ld a, e
|
ld bc, zxuno_port+$100
|
||||||
and $0f
|
wrfls3 inc b
|
||||||
jr nz, wrfls2
|
outi
|
||||||
ld hl, wrfls1
|
inc b
|
||||||
push hl
|
outi
|
||||||
waits5 wreg flash_cs, 0 ; activamos spi, enviando un 0
|
inc b
|
||||||
wreg flash_spi, 5 ; envío read status
|
outi
|
||||||
in a, (c)
|
inc b
|
||||||
waits6 in a, (c)
|
outi
|
||||||
and 1
|
inc b
|
||||||
jr nz, waits6
|
outi
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
inc b
|
||||||
ret
|
outi
|
||||||
|
inc b
|
||||||
rst28 ld bc, zxuno_port + $100
|
outi
|
||||||
pop hl
|
inc b
|
||||||
outi
|
outi
|
||||||
ld b, (zxuno_port >> 8)+2
|
dec a
|
||||||
outi
|
jr nz, wrfls3
|
||||||
jp (hl)
|
exx
|
||||||
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
IF zxdos=1
|
ex af, af'
|
||||||
FileName dz 'FLASH.ZX2'
|
dec a
|
||||||
ELSE
|
jr z, waits5
|
||||||
FileName dz 'FLASH.ZXD'
|
ex af, af'
|
||||||
ENDIF
|
inc e
|
||||||
|
ld a, e
|
||||||
|
and $0f
|
||||||
|
jr nz, wrfls2
|
||||||
|
ld hl, wrfls1
|
||||||
|
push hl
|
||||||
|
waits5 wreg flash_cs, 0 ; activamos spi, enviando un 0
|
||||||
|
wreg flash_spi, 5 ; envío read status
|
||||||
|
in a, (c)
|
||||||
|
waits6 in a, (c)
|
||||||
|
and 1
|
||||||
|
jr nz, waits6
|
||||||
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
|
ret
|
||||||
|
|
||||||
|
rst28 ld bc, zxuno_port + $100
|
||||||
|
pop hl
|
||||||
|
outi
|
||||||
|
ld b, (zxuno_port >> 8)+2
|
||||||
|
outi
|
||||||
|
jp (hl)
|
||||||
|
|
||||||
|
IF zxdos=1
|
||||||
|
FileName dz 'FLASH.ZX2'
|
||||||
|
ELSE
|
||||||
|
FileName dz 'FLASH.ZXD'
|
||||||
|
ENDIF
|
||||||
|
|
|
@ -1,3 +1,26 @@
|
||||||
|
; upgrade.asm
|
||||||
|
;
|
||||||
|
; Copyright (C) 2019, 2021 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/>.
|
||||||
|
;
|
||||||
|
; SPDX-FileCopyrightText: Copyright (C) 2019, 2021 Antonio Villena
|
||||||
|
;
|
||||||
|
; SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
|
; Compatible compilers:
|
||||||
|
; SJAsmPlus, <https://github.com/sjasmplus/sjasmplus/>
|
||||||
|
|
||||||
output UPGRADE
|
output UPGRADE
|
||||||
|
|
||||||
include zxuno.inc
|
include zxuno.inc
|
||||||
|
@ -168,7 +191,7 @@ waits6 in a, (c)
|
||||||
jr nz, waits6
|
jr nz, waits6
|
||||||
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
wreg flash_cs, 1 ; desactivamos spi, enviando un 1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
rst28 ld bc, zxuno_port + $100
|
rst28 ld bc, zxuno_port + $100
|
||||||
pop hl
|
pop hl
|
||||||
outi
|
outi
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
; zxuno.inc
|
||||||
|
;
|
||||||
|
; SPDX-FileCopyrightText: Copyright (C) 2019, 2021 Antonio Villena
|
||||||
|
;
|
||||||
|
; SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
|
; Compatible compilers:
|
||||||
|
; SJAsmPlus, <https://github.com/sjasmplus/sjasmplus/>
|
||||||
|
|
||||||
define zxuno_port $fc3b
|
define zxuno_port $fc3b
|
||||||
define master_conf 0
|
define master_conf 0
|
||||||
define master_mapper 1
|
define master_mapper 1
|
||||||
|
|
Loading…
Reference in New Issue