Merge pull request #77 from ivan-tat/master

firmware/scroll: added legal stuff
This commit is contained in:
Ivan Tatarinov 2021-05-05 16:22:43 +03:00 committed by GitHub
commit 1de0877661
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 947 additions and 814 deletions

View File

@ -0,0 +1,9 @@
SPDX-FileName: fondo.atr
SPDX-FileType: OTHER
SPDX-FileChecksum: SHA1: 9214a48d573cfe87145d32a461a0c3f6abccfdc6
SPDX-FileCopyrightText: Copyright (C) 2016 Samuel Baselga (a.k.a. Quest)
SPDX-License-Identifier: CC-BY-SA-4.0

View File

@ -0,0 +1,9 @@
SPDX-FileName: fondo.png
SPDX-FileType: IMAGE
SPDX-FileChecksum: SHA1: f3ad5c77329ae235982fbd67feb8c0d85269e37c
SPDX-FileCopyrightText: Copyright (C) 2016 Samuel Baselga (a.k.a. Quest)
SPDX-License-Identifier: CC-BY-SA-4.0

View File

@ -0,0 +1,9 @@
SPDX-FileName: fuente6x8.png
SPDX-FileType: IMAGE
SPDX-FileChecksum: SHA1: 740d34e262db2f3fa2989592027d1907f861ba37
SPDX-FileCopyrightText: Copyright (C) 2016 Samuel Baselga (a.k.a. Quest)
SPDX-License-Identifier: CC-BY-SA-4.0

View File

@ -1,3 +1,10 @@
; SPDX-FileCopyrightText: Copyright (C) 2016, 2017, 2020, 2021 Antonio Villena
;
; SPDX-License-Identifier: GPL-3.0-only
; Compatible compilers:
; SJAsmPlus, <https://github.com/sjasmplus/sjasmplus/>
macro linea src1, src2, src3, dst1, dst2, dst3
ld sp, $4005+$800*src1+$100*src3+$20*src2
pop hl

View File

@ -1,89 +1,96 @@
include define.asm
output loader.bin
org $5ccb
ld de, $8000
di
defb $de, $c0, $37, $0e, $8f, $39, $96 ; Basic de Paolo Ferraris
ld hl, finload-1
ld de, $baff
call dzx7b
inc hl
inc hl
ld bc, $4000 ; filtro RCS inverso (jamorski)
ld a, b
init xor c
and $f8
xor c
ld d, a
xor b
xor c
rlca
rlca
ld e, a
init2 inc bc
ldi
inc bc
ld a, b
cp $58
jr c, init
sub $5b
jr nz, init2
ld hl, $5e6d-2
ld de, compsize
call $07f4
di
ld de, $5e6d+rawsize-1
ld hl, $5e6d-2+compsize-1
call dzx7b
jp $7be4
; -----------------------------------------------------------------------------
; ZX7 Backwards by Einar Saukas, Antonio Villena
; Parameters:
; HL: source address (compressed data)
; DE: destination address (decompressing)
; -----------------------------------------------------------------------------
dzx7b ld bc, $8000
ld a, b
copyby inc c
ldd
mainlo add a, a
call z, getbit
jr nc, copyby
push de
ld d, c
defb $30
lenval add a, a
call z, getbit
rl c
rl b
add a, a
call z, getbit
jr nc, lenval
inc c
jr z, exitdz
ld e, (hl)
dec hl
sll e
jr nc, offend
ld d, $10
nexbit add a, a
call z, getbit
rl d
jr nc, nexbit
inc d
srl d
offend rr e
ex (sp), hl
ex de, hl
adc hl, de
lddr
exitdz pop hl
jr nc, mainlo
getbit ld a, (hl)
dec hl
adc a, a
ret
loadscr incbin loadscr.rcs.zx7b
finload
; SPDX-FileCopyrightText: Copyright (C) 2016, 2017, 2020, 2021 Antonio Villena
;
; SPDX-License-Identifier: GPL-3.0-only
; Compatible compilers:
; SJAsmPlus, <https://github.com/sjasmplus/sjasmplus/>
include define.asm
output loader.bin
org $5ccb
ld de, $8000
di
defb $de, $c0, $37, $0e, $8f, $39, $96 ; Basic de Paolo Ferraris
ld hl, finload-1
ld de, $baff
call dzx7b
inc hl
inc hl
ld bc, $4000 ; filtro RCS inverso (jamorski)
ld a, b
init xor c
and $f8
xor c
ld d, a
xor b
xor c
rlca
rlca
ld e, a
init2 inc bc
ldi
inc bc
ld a, b
cp $58
jr c, init
sub $5b
jr nz, init2
ld hl, $5e6d-2
ld de, compsize
call $07f4
di
ld de, $5e6d+rawsize-1
ld hl, $5e6d-2+compsize-1
call dzx7b
jp $7be4
; -----------------------------------------------------------------------------
; ZX7 Backwards by Einar Saukas, Antonio Villena
; Parameters:
; HL: source address (compressed data)
; DE: destination address (decompressing)
; -----------------------------------------------------------------------------
dzx7b ld bc, $8000
ld a, b
copyby inc c
ldd
mainlo add a, a
call z, getbit
jr nc, copyby
push de
ld d, c
defb $30
lenval add a, a
call z, getbit
rl c
rl b
add a, a
call z, getbit
jr nc, lenval
inc c
jr z, exitdz
ld e, (hl)
dec hl
sll e
jr nc, offend
ld d, $10
nexbit add a, a
call z, getbit
rl d
jr nc, nexbit
inc d
srl d
offend rr e
ex (sp), hl
ex de, hl
adc hl, de
lddr
exitdz pop hl
jr nc, mainlo
getbit ld a, (hl)
dec hl
adc a, a
ret
loadscr incbin loadscr.rcs.zx7b
finload

BIN
firmware/scroll/music.stc Normal file

Binary file not shown.

View File

@ -0,0 +1,11 @@
SPDX-FileName: music.stc
SPDX-FileType: OTHER
SPDX-FileChecksum: SHA1: c45309ee13cc7cb0cbb7becb2eda9ecc4d905788
SPDX-FileCopyrightText: Copyright (C) 2016 Michal B. (a.k.a Yerzmyey)
SPDX-License-Identifier: CC-BY-SA-4.0
SPDX-FileComment: https://zxart.ee/eng/authors/y/yerzmyey/

BIN
firmware/scroll/playstc.bin Normal file

Binary file not shown.

View File

@ -0,0 +1,9 @@
SPDX-FileName: playstc.bin
SPDX-FileType: BINARY
SPDX-FileChecksum: SHA1: 163afa437d12a65e0b78a4cfddf87959ca1502ee
SPDX-FileCopyrightText: Copyright (C) 2016 Antonio Villena
SPDX-License-Identifier: GPL-3.0-only

View File

@ -1,336 +1,364 @@
output scroll.bin
org $5e6d
display $6d35+string-music
string include string.asm
music ld (vari+2), ix
incbin music.bin
fuente incbin fuente6x8.bin
start ld hl, $c000
ld de, $c001
ld bc, $017f
ld (hl), l
ldir
ld hl, fuente
ld b, 3
ldir
ld hl, fondo
ld b, $40 ; filtro RCS inverso
start0 ld a, b
xor c
and $f8
xor c
ld d, a
xor b
xor c
rlca
rlca
ld e, a
inc bc
ldi
inc bc
ld a, b
sub $58
jr nz, start0
ld b, 3
ldir
out ($fe), a
inc a
ex af, af'
; ld de, $401f
;rever ld hl, $ffe1
; add hl, de
; ld c, (hl)
; ld a, $80
;revl1 rl c
; rra
; jr nc, revl1
; ld (de), a
; inc hl
; dec de
; ld c, (hl)
; ld a, $80
;revl2 rl c
; rra
; jr nc, revl2
; ld (de), a
; inc hl
; dec de
; ld c, (hl)
; ld a, $80
;revl3 rl c
; rra
; jr nc, revl3
; ld (de), a
; inc hl
; dec de
; ld c, (hl)
; ld a, $80
;revl4 rl c
; rra
; jr nc, revl4
; ld (de), a
; ld hl, $23
; add hl, de
; ex de, hl
; ld a, d
; cp $58
; jr nz, rever
ld hl, $c000
ld de, $c400
start1 ld b, $08
start2 ld a, (hl)
rrca
ld (de), a
inc de
cpi
jp pe, start2
jr nc, start1
ld a, $c9
ld ($c006), a
ld hl, $716f
call music+7
start3 call $6e77
ei
halt
di
ld bc, 5
start4 djnz start4
dec c
jr nz, start4
include lineas.asm
ld sp, $401b+$800*2+$100*7+$20*7
sbc hl, hl
push hl
push hl
push hl
push hl
push hl
push hl
push hl
push hl
push hl
push hl
push hl
ld sp, hl
vari ld ix, string
ld hl, start3
push hl
ld hl, music
push hl
ex af, af'
rrca
jr c, start5
ex af, af'
ret
start5 ex af, af'
linea 3, 1, 0, 3, 0, 0
linea 3, 2, 0, 3, 1, 0
linea 3, 3, 0, 3, 2, 0
linea 3, 4, 0, 3, 3, 0
linea 3, 5, 0, 3, 4, 0
linea 3, 6, 0, 3, 5, 0
linea 3, 7, 0, 3, 6, 0
linea 3, 0, 1, 3, 7, 0
linea 3, 1, 1, 3, 0, 1
linea 3, 2, 1, 3, 1, 1
linea 3, 3, 1, 3, 2, 1
linea 3, 4, 1, 3, 3, 1
linea 3, 5, 1, 3, 4, 1
linea 3, 6, 1, 3, 5, 1
linea 3, 7, 1, 3, 6, 1
linea 3, 0, 2, 3, 7, 1
linea 3, 1, 2, 3, 0, 2
linea 3, 2, 2, 3, 1, 2
linea 3, 3, 2, 3, 2, 2
linea 3, 4, 2, 3, 3, 2
linea 3, 5, 2, 3, 4, 2
linea 3, 6, 2, 3, 5, 2
ld sp, $fffc
ld b, (ix)
djnz start6
ld ix, string
start6 inc ix
ld hl, $5ac5
ld (hl), b
ld de, $5ac6
ld bc, 21
ldir
xor a
push ix
pop hl
ld bc, $172b
cpir
srl c
ld a, c
jr c, prn2
and %11111100
ld d, a
xor c
ld c, a
ld e, a
jr z, prn1
dec e
prn1 ld a, d
rrca
ld d, a
rrca
add a, d
add a, e
ld e, a
ld a, b
and %00011000
or %01000000
ld d, a
ld a, b
and %00000111
rrca
rrca
rrca
add a, e
ld e, a
rr c
jr c, pos26
jr nz, pos4
pos0 ld a, (ix)
inc ix
add a, a
ret z
ld h, $c0 >> 2
call simple
pos2 ld a, (ix)
inc ix
add a, a
ret z
ld h, $d8 >> 2
ld bc, $04fc
call doble
pos4 ld a, (ix)
inc ix
add a, a
ret z
ld h, $d0 >> 2
ld bc, $04f0
call doble
pos6 ld a, (ix)
inc ix
add a, a
ret z
ld h, $c8 >> 2
call simple
inc de
jr pos0
pos26 rr c
jr c, pos6
jr pos2
prn2 and %11111100
ld d, a
xor c
ld c, a
cp 2
adc a, -1
ld e, a
ld a, d
rrca
ld d, a
rrca
add a, d
add a, e
ld e, a
ld a, b
and %00011000
or %01000000
ld d, a
ld a, b
and %00000111
rrca
rrca
rrca
add a, e
ld e, a
rr c
jr c, pos37
jr nz, pos5
pos1 ld a, (ix)
inc ix
add a, a
ret z
ld h, $cc >> 2
ld bc, $04e0
call doble
pos3 ld a, (ix)
inc ix
add a, a
ret z
ld h, $c4 >> 2
call simple
pos5 ld a, (ix)
inc ix
add a, a
ret z
ld h, $dc >> 2
ld bc, $04fe
call doble
pos7 ld a, (ix)
inc ix
add a, a
ret z
ld h, $d4 >> 2
ld bc, $04f8
call doble
jr pos1
pos37 rr c
jr c, pos7
jr pos3
simple ld b, 4
ld l, a
add hl, hl
add hl, hl
simple2 ld a, (de)
xor (hl)
ld (de), a
inc d
inc l
ld a, (de)
xor (hl)
ld (de), a
inc d
inc l
djnz simple2
ld hl, $f800
add hl, de
ex de, hl
ret
doble ld l, a
add hl, hl
add hl, hl
doble2 ld a, (de)
xor (hl)
and c
xor (hl)
ld (de), a
inc e
ld a, (hl)
and c
ld (de), a
inc d
inc l
ld a, (hl)
and c
ld (de), a
dec e
ld a, (de)
xor (hl)
and c
xor (hl)
ld (de), a
inc d
inc l
djnz doble2
ld hl, $f801
add hl, de
ex de, hl
ret
fondo incbin fondo.rcs
; scroll.asm - an easteg egg showing the list of people who participated
; in the crowdfunding of the ZX-Uno project through Verkami:
; https://www.verkami.com/projects/14074-zx-uno
;
; We put the nick that they agreed. Some of them decided to put their
; complete names.
;
; Copyright (C) 2016, 2017, 2020, 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) 2016, 2017, 2020, 2021 Antonio Villena
;
; SPDX-License-Identifier: GPL-3.0-only
; Compatible compilers:
; SJAsmPlus, <https://github.com/sjasmplus/sjasmplus/>
output scroll.bin
org $5e6d
display $6d35+string-music
string include string.asm
music ld (vari+2), ix
incbin music.bin
fuente incbin fuente6x8.bin
start ld hl, $c000
ld de, $c001
ld bc, $017f
ld (hl), l
ldir
ld hl, fuente
ld b, 3
ldir
ld hl, fondo
ld b, $40 ; filtro RCS inverso
start0 ld a, b
xor c
and $f8
xor c
ld d, a
xor b
xor c
rlca
rlca
ld e, a
inc bc
ldi
inc bc
ld a, b
sub $58
jr nz, start0
ld b, 3
ldir
out ($fe), a
inc a
ex af, af'
; ld de, $401f
;rever ld hl, $ffe1
; add hl, de
; ld c, (hl)
; ld a, $80
;revl1 rl c
; rra
; jr nc, revl1
; ld (de), a
; inc hl
; dec de
; ld c, (hl)
; ld a, $80
;revl2 rl c
; rra
; jr nc, revl2
; ld (de), a
; inc hl
; dec de
; ld c, (hl)
; ld a, $80
;revl3 rl c
; rra
; jr nc, revl3
; ld (de), a
; inc hl
; dec de
; ld c, (hl)
; ld a, $80
;revl4 rl c
; rra
; jr nc, revl4
; ld (de), a
; ld hl, $23
; add hl, de
; ex de, hl
; ld a, d
; cp $58
; jr nz, rever
ld hl, $c000
ld de, $c400
start1 ld b, $08
start2 ld a, (hl)
rrca
ld (de), a
inc de
cpi
jp pe, start2
jr nc, start1
ld a, $c9
ld ($c006), a
ld hl, $716f
call music+7
start3 call $6e77
ei
halt
di
ld bc, 5
start4 djnz start4
dec c
jr nz, start4
include lineas.asm
ld sp, $401b+$800*2+$100*7+$20*7
sbc hl, hl
push hl
push hl
push hl
push hl
push hl
push hl
push hl
push hl
push hl
push hl
push hl
ld sp, hl
vari ld ix, string
ld hl, start3
push hl
ld hl, music
push hl
ex af, af'
rrca
jr c, start5
ex af, af'
ret
start5 ex af, af'
linea 3, 1, 0, 3, 0, 0
linea 3, 2, 0, 3, 1, 0
linea 3, 3, 0, 3, 2, 0
linea 3, 4, 0, 3, 3, 0
linea 3, 5, 0, 3, 4, 0
linea 3, 6, 0, 3, 5, 0
linea 3, 7, 0, 3, 6, 0
linea 3, 0, 1, 3, 7, 0
linea 3, 1, 1, 3, 0, 1
linea 3, 2, 1, 3, 1, 1
linea 3, 3, 1, 3, 2, 1
linea 3, 4, 1, 3, 3, 1
linea 3, 5, 1, 3, 4, 1
linea 3, 6, 1, 3, 5, 1
linea 3, 7, 1, 3, 6, 1
linea 3, 0, 2, 3, 7, 1
linea 3, 1, 2, 3, 0, 2
linea 3, 2, 2, 3, 1, 2
linea 3, 3, 2, 3, 2, 2
linea 3, 4, 2, 3, 3, 2
linea 3, 5, 2, 3, 4, 2
linea 3, 6, 2, 3, 5, 2
ld sp, $fffc
ld b, (ix)
djnz start6
ld ix, string
start6 inc ix
ld hl, $5ac5
ld (hl), b
ld de, $5ac6
ld bc, 21
ldir
xor a
push ix
pop hl
ld bc, $172b
cpir
srl c
ld a, c
jr c, prn2
and %11111100
ld d, a
xor c
ld c, a
ld e, a
jr z, prn1
dec e
prn1 ld a, d
rrca
ld d, a
rrca
add a, d
add a, e
ld e, a
ld a, b
and %00011000
or %01000000
ld d, a
ld a, b
and %00000111
rrca
rrca
rrca
add a, e
ld e, a
rr c
jr c, pos26
jr nz, pos4
pos0 ld a, (ix)
inc ix
add a, a
ret z
ld h, $c0 >> 2
call simple
pos2 ld a, (ix)
inc ix
add a, a
ret z
ld h, $d8 >> 2
ld bc, $04fc
call doble
pos4 ld a, (ix)
inc ix
add a, a
ret z
ld h, $d0 >> 2
ld bc, $04f0
call doble
pos6 ld a, (ix)
inc ix
add a, a
ret z
ld h, $c8 >> 2
call simple
inc de
jr pos0
pos26 rr c
jr c, pos6
jr pos2
prn2 and %11111100
ld d, a
xor c
ld c, a
cp 2
adc a, -1
ld e, a
ld a, d
rrca
ld d, a
rrca
add a, d
add a, e
ld e, a
ld a, b
and %00011000
or %01000000
ld d, a
ld a, b
and %00000111
rrca
rrca
rrca
add a, e
ld e, a
rr c
jr c, pos37
jr nz, pos5
pos1 ld a, (ix)
inc ix
add a, a
ret z
ld h, $cc >> 2
ld bc, $04e0
call doble
pos3 ld a, (ix)
inc ix
add a, a
ret z
ld h, $c4 >> 2
call simple
pos5 ld a, (ix)
inc ix
add a, a
ret z
ld h, $dc >> 2
ld bc, $04fe
call doble
pos7 ld a, (ix)
inc ix
add a, a
ret z
ld h, $d4 >> 2
ld bc, $04f8
call doble
jr pos1
pos37 rr c
jr c, pos7
jr pos3
simple ld b, 4
ld l, a
add hl, hl
add hl, hl
simple2 ld a, (de)
xor (hl)
ld (de), a
inc d
inc l
ld a, (de)
xor (hl)
ld (de), a
inc d
inc l
djnz simple2
ld hl, $f800
add hl, de
ex de, hl
ret
doble ld l, a
add hl, hl
add hl, hl
doble2 ld a, (de)
xor (hl)
and c
xor (hl)
ld (de), a
inc e
ld a, (hl)
and c
ld (de), a
inc d
inc l
ld a, (hl)
and c
ld (de), a
dec e
ld a, (de)
xor (hl)
and c
xor (hl)
ld (de), a
inc d
inc l
djnz doble2
ld hl, $f801
add hl, de
ex de, hl
ret
fondo incbin fondo.rcs

View File

@ -1,5 +1,8 @@
@rem SPDX-FileCopyrightText: 2016, 2021 Antonio Villena
@rem
@rem SPDX-License-Identifier: GPL-3.0-only
@call ..\..\sdk\setenv.bat
FuenteABin
FuenteABin fuente6x8.png fuente6x8.bin
Png2Rcs fondo.png fondo.rcs -a fondo.atr
sjasmplus scroll.asm
call :getfilesize scroll.bin

View File

@ -1,59 +1,68 @@
include define.asm
output scrolldesc.bin
org $5ccb
ld de, $5e6d+filesize-1
di
defb $de, $c0, $37, $0e, $8f, $39, $96
jr aqui
getbit ld a, (hl)
dec hl
adc a, a
ret
aqui ld hl, fin-1
; -----------------------------------------------------------------------------
; ZX7 Backwards by Einar Saukas, Antonio Villena
; Parameters:
; HL: source address (compressed data)
; DE: destination address (decompressing)
; -----------------------------------------------------------------------------
dzx7b ld bc, $8000
ld a, b
copyby inc c
ldd
mainlo add a, a
call z, getbit
jr nc, copyby
push de
ld d, c
defb $30
lenval add a, a
call z, getbit
rl c
rl b
add a, a
call z, getbit
jr nc, lenval
inc c
jr z, exitdz
ld e, (hl)
dec hl
sll e
jr nc, offend
ld d, $10
nexbit add a, a
call z, getbit
rl d
jr nc, nexbit
inc d
srl d
offend rr e
ex (sp), hl
ex de, hl
adc hl, de
lddr
exitdz pop hl
jr nc, mainlo
jp $7be4
incbin scroll.bin.zx7b
fin
; scrolldesc.asm
;
; SPDX-FileCopyrightText: Copyright (C) 2016, 2017, 2020, 2021 Antonio Villena
;
; SPDX-License-Identifier: GPL-3.0-only
; Compatible compilers:
; SJAsmPlus, <https://github.com/sjasmplus/sjasmplus/>
include define.asm
output scrolldesc.bin
org $5ccb
ld de, $5e6d+filesize-1
di
defb $de, $c0, $37, $0e, $8f, $39, $96
jr aqui
getbit ld a, (hl)
dec hl
adc a, a
ret
aqui ld hl, fin-1
; -----------------------------------------------------------------------------
; ZX7 Backwards by Einar Saukas, Antonio Villena
; Parameters:
; HL: source address (compressed data)
; DE: destination address (decompressing)
; -----------------------------------------------------------------------------
dzx7b ld bc, $8000
ld a, b
copyby inc c
ldd
mainlo add a, a
call z, getbit
jr nc, copyby
push de
ld d, c
defb $30
lenval add a, a
call z, getbit
rl c
rl b
add a, a
call z, getbit
jr nc, lenval
inc c
jr z, exitdz
ld e, (hl)
dec hl
sll e
jr nc, offend
ld d, $10
nexbit add a, a
call z, getbit
rl d
jr nc, nexbit
inc d
srl d
offend rr e
ex (sp), hl
ex de, hl
adc hl, de
lddr
exitdz pop hl
jr nc, mainlo
jp $7be4
incbin scroll.bin.zx7b
fin

View File

@ -1,3 +1,12 @@
; string.asm
;
; SPDX-FileCopyrightText: Copyright (C) 2016, 2017, 2020, 2021 Antonio Villena
;
; SPDX-License-Identifier: GPL-3.0-only
; Compatible compilers:
; SJAsmPlus, <https://github.com/sjasmplus/sjasmplus/>
; 01234567 01234567 01234567 01234567
; abcdefab cdefabcd efabcdef 0642
; abcde fabcdefa bcdefabc def 3175
@ -187,7 +196,7 @@
dz $48, 'Pagantipaco'
dz $48, 'Pedro Romero'
dz $48, 'Peter Robert Jones'
dz $48, 'Peter \'Sweetlilmre\' Edwards'
dz $48, "Peter 'Sweetlilmre' Edwards"
dz $48, 'peterthedark'
dz $48, 'princemegahit'
dz $48, 'Radastan'
@ -280,4 +289,4 @@
dz $48
dz $48
dz $48
defb 1
defb 1

View File

@ -1,327 +1,350 @@
output UPGRADE
define FA_READ 0x01
define M_GETSETDRV 0x89
define F_OPEN 0x9a
define F_CLOSE 0x9b
define F_READ 0x9d
define F_SEEK 0x9f
define zxuno_port $fc3b
define flash_spi 2
define flash_cs 48
macro wreg dir, dato
call rst28
defb dir, dato
endm
org $2000 ; comienzo de la ejecución de los comandos ESXDOS
Main xor a
rst $08
db 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)
rst $08
db F_OPEN
ld (handle+1), a
jr nc, FileFound
call Print
dz 'File FLASH not found'
ret
FileFound ld l, 0
ld bc, 0
ld de, 0
rst $08
db F_SEEK
call Print
dz 'No '
ld a, (puerto+2)
add a, $30
rst $10
call repe
jr nz, nfallo
; call hex
call Print
dz 'Flash error'
jr Next
nfallo halt
halt
;jr Verify;call hex
ld ixl, 0
ld de, $0000
exx
Bucle ld a, ixl
inc a
and $0f
jr nz, punto
ld a, '.'
exx
push de
rst $10
pop de
exx
punto ld hl, $8000
ld bc, $4000
handle ld a, 0
rst $08
db 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
halt
halt
Verify ld de, $8000
ld hl, $0040
ld a, 2
call rdflsh
ld de, $8000
ld hl, 0
Verify1 ex de, hl
ld c, (hl)
inc l
ld b, (hl)
inc hl
ex de, hl
add hl, bc
bit 1, d
jr z, Verify1
ld a, h
call hex
ld a, l
call hex
halt
halt
; ld de, $371a
; sbc hl, de
; jr z, Next
; call Print
; dz 'CRC Error'
Next ld a, 13
rst $10
ld a, (puerto+2)
inc a
ld (puerto+2), a
cp $10
ld a, (handle+1)
jp nz, FileFound
rst $08
db F_CLOSE
ret
Print pop hl
db $3e
Print1 rst $10
ld a, (hl)
inc hl
or a
jr nz, Print1
jp (hl)
; ------------------------
; Write to SPI flash
; Parameters:
; A: number of pages (256 bytes) to write
; DE: target address without last byte
; BC': zxuno_port+$100 (constant)
; HL': source address from memory
; ------------------------
wrflsh ex af, af'
wrfls1 call puerto
wreg flash_spi, 6 ; envío write enable
call flashcs
call puerto
wreg flash_spi, $20 ; envío sector erase
out (c), d
out (c), e
out (c), a
call flashcs
wrfls2 call waits5
call puerto
wreg flash_spi, 6 ; envío write enable
call flashcs
call puerto
wreg flash_spi, 2 ; page program
out (c), d
out (c), e
out (c), a
ld a, $20
exx
ld bc, zxuno_port+$100
wrfls3 inc b
outi
inc b
outi
inc b
outi
inc b
outi
inc b
outi
inc b
outi
inc b
outi
inc b
outi
dec a
jr nz, wrfls3
exx
call flashcs
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 call puerto
wreg flash_spi, 5 ; envío read status
in a, (c)
waits6 in a, (c)
and 1
jr nz, waits6
flashcs push af
ld a, (puerto+2)
rrca
jr c, flashcs1
wreg flash_cs, $ff
pop af
ret
flashcs1 wreg flash_cs+1, $ff
pop af
ret
puerto push af
ld a, 0
srl a
push af
ld bc, zxuno_port
ld a, flash_cs
adc a, 0
out (c), a
pop bc
inc b
ld a, $7f
puerto1 rlca
djnz puerto1
ld bc, zxuno_port + $100
out (c), a
pop af
ret
rst28 ld bc, zxuno_port + $100
pop hl
outi
ld b, (zxuno_port >> 8)+2
outi
jp (hl)
repe ld e, 0
repe1 call puerto
wreg flash_spi, 6 ; envío write enable
call flashcs
call puerto
wreg flash_spi, 1 ; envío write register status
out (c), 0
ld a, 2
out (c), a
call flashcs
call puerto
wreg flash_spi, $35 ; envío write register status
in a, (c)
in a, (c)
call flashcs
and 2
ret nz
dec e
jr nz, repe1
ret
; ------------------------
; Read from SPI flash
; Parameters:
; DE: destination address
; HL: source address without last byte
; A: number of pages (256 bytes) to read
; ------------------------
rdflsh ex af, af'
xor a
push hl
call puerto
wreg flash_spi, 3 ; envio flash_spi un 3, orden de lectura
pop hl
push hl
out (c), h
out (c), l
out (c), a
ex af, af'
ex de, hl
in f, (c)
rdfls1 ld e, $20
rdfls2 ini
inc b
ini
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
call flashcs
pop hl
ret
hex push af
and $f0
rrca
rrca
rrca
rrca
cp $0a
jr c, mayo
add a, 7
mayo add a, $30
rst $10
pop af
and $0f
cp $0a
jr c, maya
add a, 7
maya add a, $30
rst $10
ret
FileName dz 'FLASH.ZX1'
; upgrade.asm
;
; Copyright (C) 2016, 2020, 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) 2016, 2020, 2021 Antonio Villena
;
; SPDX-License-Identifier: GPL-3.0-only
; Compatible compilers:
; SJAsmPlus, <https://github.com/sjasmplus/sjasmplus/>
output UPGRADE
define FA_READ 0x01
define M_GETSETDRV 0x89
define F_OPEN 0x9a
define F_CLOSE 0x9b
define F_READ 0x9d
define F_SEEK 0x9f
define zxuno_port $fc3b
define flash_spi 2
define flash_cs 48
macro wreg dir, dato
call rst28
defb dir, dato
endm
org $2000 ; comienzo de la ejecución de los comandos ESXDOS
Main xor a
rst $08
db 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)
rst $08
db F_OPEN
ld (handle+1), a
jr nc, FileFound
call Print
dz 'File FLASH not found'
ret
FileFound ld l, 0
ld bc, 0
ld de, 0
rst $08
db F_SEEK
call Print
dz 'No '
ld a, (puerto+2)
add a, $30
rst $10
call repe
jr nz, nfallo
; call hex
call Print
dz 'Flash error'
jr Next
nfallo halt
halt
;jr Verify;call hex
ld ixl, 0
ld de, $0000
exx
Bucle ld a, ixl
inc a
and $0f
jr nz, punto
ld a, '.'
exx
push de
rst $10
pop de
exx
punto ld hl, $8000
ld bc, $4000
handle ld a, 0
rst $08
db 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
halt
halt
Verify ld de, $8000
ld hl, $0040
ld a, 2
call rdflsh
ld de, $8000
ld hl, 0
Verify1 ex de, hl
ld c, (hl)
inc l
ld b, (hl)
inc hl
ex de, hl
add hl, bc
bit 1, d
jr z, Verify1
ld a, h
call hex
ld a, l
call hex
halt
halt
; ld de, $371a
; sbc hl, de
; jr z, Next
; call Print
; dz 'CRC Error'
Next ld a, 13
rst $10
ld a, (puerto+2)
inc a
ld (puerto+2), a
cp $10
ld a, (handle+1)
jp nz, FileFound
rst $08
db F_CLOSE
ret
Print pop hl
db $3e
Print1 rst $10
ld a, (hl)
inc hl
or a
jr nz, Print1
jp (hl)
; ------------------------
; Write to SPI flash
; Parameters:
; A: number of pages (256 bytes) to write
; DE: target address without last byte
; BC': zxuno_port+$100 (constant)
; HL': source address from memory
; ------------------------
wrflsh ex af, af'
wrfls1 call puerto
wreg flash_spi, 6 ; envío write enable
call flashcs
call puerto
wreg flash_spi, $20 ; envío sector erase
out (c), d
out (c), e
out (c), a
call flashcs
wrfls2 call waits5
call puerto
wreg flash_spi, 6 ; envío write enable
call flashcs
call puerto
wreg flash_spi, 2 ; page program
out (c), d
out (c), e
out (c), a
ld a, $20
exx
ld bc, zxuno_port+$100
wrfls3 inc b
outi
inc b
outi
inc b
outi
inc b
outi
inc b
outi
inc b
outi
inc b
outi
inc b
outi
dec a
jr nz, wrfls3
exx
call flashcs
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 call puerto
wreg flash_spi, 5 ; envío read status
in a, (c)
waits6 in a, (c)
and 1
jr nz, waits6
flashcs push af
ld a, (puerto+2)
rrca
jr c, flashcs1
wreg flash_cs, $ff
pop af
ret
flashcs1 wreg flash_cs+1, $ff
pop af
ret
puerto push af
ld a, 0
srl a
push af
ld bc, zxuno_port
ld a, flash_cs
adc a, 0
out (c), a
pop bc
inc b
ld a, $7f
puerto1 rlca
djnz puerto1
ld bc, zxuno_port + $100
out (c), a
pop af
ret
rst28 ld bc, zxuno_port + $100
pop hl
outi
ld b, (zxuno_port >> 8)+2
outi
jp (hl)
repe ld e, 0
repe1 call puerto
wreg flash_spi, 6 ; envío write enable
call flashcs
call puerto
wreg flash_spi, 1 ; envío write register status
out (c), 0
ld a, 2
out (c), a
call flashcs
call puerto
wreg flash_spi, $35 ; envío write register status
in a, (c)
in a, (c)
call flashcs
and 2
ret nz
dec e
jr nz, repe1
ret
; ------------------------
; Read from SPI flash
; Parameters:
; DE: destination address
; HL: source address without last byte
; A: number of pages (256 bytes) to read
; ------------------------
rdflsh ex af, af'
xor a
push hl
call puerto
wreg flash_spi, 3 ; envio flash_spi un 3, orden de lectura
pop hl
push hl
out (c), h
out (c), l
out (c), a
ex af, af'
ex de, hl
in f, (c)
rdfls1 ld e, $20
rdfls2 ini
inc b
ini
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
call flashcs
pop hl
ret
hex push af
and $f0
rrca
rrca
rrca
rrca
cp $0a
jr c, mayo
add a, 7
mayo add a, $30
rst $10
pop af
and $0f
cp $0a
jr c, maya
add a, 7
maya add a, $30
rst $10
ret
FileName dz 'FLASH.ZX1'