-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit adf201a
Showing
7 changed files
with
722 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# RUNZ80 pentru Cobra | ||
|
||
RUNZ80 este un utilitar CP/M pentru microcalculatorul Cobra care încărcă și | ||
execută snapshot-uri ZX Spectrum în [formatul .z80][z80format] folosit de mulți | ||
emulatori Spectrum. | ||
|
||
[z80format]: https://worldofspectrum.org/faq/reference/z80format.htm | ||
|
||
Suportă versiuni 1, 2, și 3 a formatului .z80, dar ignoră orice informație care | ||
nu se aplică Spectrum 48K sau Cobra. | ||
|
||
## Mulțumiri | ||
|
||
Metoda de săltare în un snapshot de memorie și restaurare statul CPU-ului a | ||
fost luat din [pagina BASIC+NMI a cobrasov.com][BASIC+NMI]. Codul în | ||
LOADER.Z81 și RESTORE.Z80 a fost luat direct de acolo cu modificări minime. | ||
Multe mulțumiri autorului anonim al cobrasov.com! | ||
|
||
[BASIC+NMI]: http://cobrasov.com/CoBra%20Project/basic+nmi-ro.html | ||
|
||
## Rezumat | ||
|
||
`RUNZ80 SNAPSHOT[.Z80]` | ||
|
||
***NOTĂ: RUNZ80 va încerca să restaureze registrele cipului de sunet AY-3. Din | ||
cauza conflictului de adrese între AY-3-ul Spectrumului 128K și interfața de | ||
floppy disk Cobra-ului, acest lucru poate cauza coruperea dischetelor dacă ei | ||
nu sunt scoase mai întâi sau dacă unitățile nu sunt dezactivat după încărcarea | ||
snapshot-ului.*** | ||
|
||
Când RUNZ80 a terminat să încarce fișierul, se va întrerupe și va aștepta | ||
intrare de tastatură. Odată ce apăsați o tastă, va relua execuția din | ||
snapshot-ul. Pauza îți da oportunitatea să scoateți dischete din unități sau | ||
le dezactivați altfel să evitați corupere. | ||
|
||
RUNZ80 execută o rutină pentru restaurare statul CPU-ului din fundul memoriei | ||
video, deci când se încărcă un snapshot va exista niște gunoi în partea de sus | ||
a ecranului. | ||
|
||
## Assamblând | ||
|
||
RUNZ80 a fost scris în asamblarea Z80 pentru SLR Systems Z80ASM Rel 1.32. | ||
Puteți asambla propriul RUNZ80.COM rulând: | ||
|
||
`Z80ASM RUNZ80` | ||
|
||
## Ce e Cobra? | ||
|
||
(Este destul de obscur). Cobra este un calculator Românesc din anii 1980. | ||
Este compatibil cu ZX Spectrum 48K dar poate rula și CP/M. Cele mai extinsă | ||
sursă de informații este [cobrasov.com]. | ||
|
||
[cobrasov.com]: http://cobrasov.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
(Vezi [README-ro.md](README-ro.md) pentru o traducere greșită în română.) | ||
|
||
# RUNZ80 for Cobra | ||
|
||
RUNZ80 is a CP/M utility for the Cobra microcomputer which loads and executes | ||
ZX Spectrum snapshots in the [.z80 format][z80format] used by many Spectrum | ||
emulators. | ||
|
||
It supports .z80 snapshot versions 1, 2, and 3, but it ignores any information | ||
that isn't applicable to Spectrum 48K or Cobra. | ||
|
||
[z80format]: https://worldofspectrum.org/faq/reference/z80format.htm | ||
|
||
## Acknowledgments | ||
|
||
The method for jumping into a memory snapshot and restoring CPU state was taken | ||
from [the BASIC+NMI page of cobrasov.com][BASIC+NMI]. The code in LOADER.Z80 | ||
and RESTORE.Z80 was taken directly from there with minimal modifications. Many | ||
thanks to the anonymous author of cobrasov.com! | ||
|
||
[BASIC+NMI]: http://cobrasov.com/CoBra%20Project/basic+nmi.html | ||
|
||
## Synopsis | ||
|
||
`RUNZ80 SNAPSHOT[.Z80]` | ||
|
||
***NOTE: RUNZ80 attempts to restore AY-3 sound chip registers. Because of the | ||
address conflict between the Spectrum 128K's AY-3 and the Cobra floppy | ||
controller, this may cause corruption of floppy disks if they are not removed | ||
or if the drives are not disabled after loading the snapshot.*** | ||
|
||
When RUNZ80 is finished loading the snapshot file it will pause and wait for | ||
keyboard input. Once you press a key, it will resume execution from the | ||
snapshot. The pause gives you an opportunity to remove your floppy disks from | ||
the drives or otherwise disable them to avoid corruption. | ||
|
||
RUNZ80 runs the CPU restore routine from the bottom of video memory, so when a | ||
snapshot starts, there will be some garbage at the top of the screen. | ||
|
||
## Building | ||
|
||
RUNZ80 was written in Z80 assembly for SLR Systems Z80ASM Rel 1.32. You can | ||
assemble your own RUNZ80.COM by running: | ||
|
||
`Z80ASM RUNZ80` | ||
|
||
## What's Cobra? | ||
|
||
(It's pretty obscure). Cobra is a Romanian home computer from the 1980s. It's | ||
compatible with the ZX Spectrum 48K but can also run CP/M. The most extensive | ||
source of information is [cobrasov.com]. | ||
|
||
[cobrasov.com]: http://cobrasov.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
; FILL IN RESTORE CODE VALUES FROM .Z80 HEADER | ||
; DOES NOT USE V2/V3 PC | ||
|
||
GENRST: | ||
LD DE,RST_BORDER | ||
LD HL,BORDER | ||
LDI | ||
LD DE,RST_R | ||
LD HL,HDR1_R | ||
LDI | ||
LD DE,RST_I | ||
LD HL,HDR1_I | ||
LDI | ||
LD DE,RST_A_ | ||
LD HL,HDR1_A_ | ||
LDI | ||
LD DE,RST_F_ | ||
LD HL,HDR1_F_ | ||
LDI | ||
LD DE,RST_A | ||
LD HL,HDR1_A | ||
LDI | ||
LD DE,RST_F | ||
LD HL,HDR1_F | ||
LDI | ||
LD DE,RST_BC | ||
LD HL,HDR1_BC | ||
LDI | ||
LDI | ||
LD DE,RST_DE | ||
LD HL,HDR1_DE | ||
LDI | ||
LDI | ||
LD DE,RST_HL | ||
LD HL,HDR1_HL | ||
LDI | ||
LDI | ||
LD DE,RST_SP | ||
LD HL,HDR1_SP | ||
LDI | ||
LDI | ||
LD DE,RST_IX | ||
LD HL,HDR1_IX | ||
LDI | ||
LDI | ||
LD DE,RST_IY | ||
LD HL,HDR1_IY | ||
LDI | ||
LDI | ||
LD DE,RST_BC_ | ||
LD HL,HDR1_BC_ | ||
LDI | ||
LDI | ||
LD DE,RST_DE_ | ||
LD HL,HDR1_DE_ | ||
LDI | ||
LDI | ||
LD DE,RST_HL_ | ||
LD HL,HDR1_HL_ | ||
LDI | ||
LDI | ||
LD DE,RST_EIDI | ||
LD A,(HDR1_IFF1) | ||
AND A | ||
JR Z,GENRST_DI ; ALREADY DI | ||
LD A,0FBH ; EI | ||
LD (DE),A | ||
GENRST_DI: | ||
LD DE,RST_IM | ||
LD A,(HDR1_FLAGSB) | ||
AND 03H ; INTERRUPT MODE | ||
LD C,A | ||
LD B,0 | ||
LD HL,GENRST_IMS ; IM SECOND BYTE TABLE | ||
ADD HL,BC | ||
LDI | ||
LD DE,RST_PC | ||
LD HL,HDR1_PC | ||
LDI | ||
LDI | ||
RET | ||
|
||
GENRST_IMS: DB 46H,56H,5EH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
; .Z80 SNAPSHOT HEADER | ||
; DOCUMENTED AT https://worldofspectrum.org/faq/reference/z80format.htm | ||
|
||
HEADER_LEN EQU 87 | ||
|
||
HEADER1: | ||
HDR1_A: DB 0 | ||
HDR1_F: DB 0 | ||
HDR1_BC: DW 0 | ||
HDR1_HL: DW 0 | ||
HDR1_PC: DW 0 | ||
HDR1_SP: DW 0 | ||
HDR1_I: DB 0 | ||
HDR1_R: DB 0 | ||
HDR1_FLAGSA: DB 0 | ||
HDR1_DE: DW 0 | ||
HDR1_BC_: DW 0 | ||
HDR1_DE_: DW 0 | ||
HDR1_HL_: DW 0 | ||
HDR1_A_: DB 0 | ||
HDR1_F_: DB 0 | ||
HDR1_IY: DW 0 | ||
HDR1_IX: DW 0 | ||
HDR1_IFF1: DB 0 | ||
HDR1_IFF2: DB 0 | ||
HDR1_FLAGSB: DB 0 | ||
|
||
HEADER23: ; ADDITIONAL HEADER FOR VERSION 2/3 | ||
HDR2_LEN: DW 0 | ||
HDR2_PC: DW 0 | ||
HDR2_HWMODE: DB 0 | ||
DB 0 ; NOT FOR COBRA | ||
DB 0 ; NOT FOR COBRA | ||
HDR2_FLAGSC: DB 0 | ||
HDR2_OUTFFFD: DB 0 | ||
HDR2_SNDREGS: DB 0,0,0,0,0,0,0,0 | ||
DB 0,0,0,0,0,0,0,0 | ||
HDR2_TLO: DW 0 | ||
HDR2_THI: DB 0 | ||
DS 28 ; NOT FOR COBRA | ||
HDR2_OUT1FFD: DB 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
; THIS CODE WAS COPIED ALMOST ENTIRELY FROM COBRASOV.COM. | ||
; | ||
; THE ORIGINAL CODE IS EXTENSIVELY DOCUMENTED HERE: | ||
; http://cobrasov.com/CoBra%20Project/basic+nmi-ro.html | ||
; http://cobrasov.com/CoBra%20Project/basic+nmi.html | ||
; | ||
; THE ROUTINE COPIES SNAPSHOT MEMORY INTO PLACE BEFORE JUMPING TO THE RESTORE | ||
; ROUTINE IN SPECTRUM-COMPTABILITY MODE. I HAVE MODIFIED IT TO WORK WITH | ||
; RUNZ80 AND TO RESTORE AY-3 STATE AND BORDER COLOR. | ||
|
||
LOADER: | ||
DI | ||
LD HL,Z80MEMEND | ||
LD DE,0FFFFH | ||
LD BC,0C000H | ||
LDDR | ||
LD BC,1B00H | ||
LD HL,4000H | ||
LOADER_LOOP1: | ||
LD D,(HL) | ||
LD A,40H | ||
OUT (0FEH),A | ||
LD (HL),D | ||
XOR A | ||
OUT (0FEH),A | ||
INC HL | ||
DEC BC | ||
LD A,B | ||
OR C | ||
JR NZ,LOADER_LOOP1 | ||
LD A,03H | ||
OUT (0E3H),A | ||
OUT (0EBH),A | ||
OUT (0F3H),A | ||
OUT (0FBH),A | ||
XOR A | ||
OUT (0FDH),A | ||
LD A,(BORDER) ; SET BORDER | ||
OUT (0FEH),A | ||
LOADER_LOOP2: | ||
LD A,0 | ||
IN A,(0FEH) | ||
AND 3FH | ||
CP 3FH | ||
JR NZ,LOADER_SKIP | ||
JR LOADER_LOOP2 | ||
LOADER_SKIP: | ||
LD HL,AY3REGS+16 ; RESTORE AY3 REGISTERS | ||
LD A,16 | ||
LOADER_AY3LOOP: | ||
DEC HL | ||
DEC A | ||
LD D,(HL) | ||
LD BC,0FFFDH | ||
OUT (C),A | ||
LD BC,0BFFDH | ||
OUT (C),D | ||
AND A | ||
JR NZ,LOADER_AY3LOOP | ||
DEC HL | ||
LD A,(HL) | ||
LD BC,0FFFDH | ||
OUT (C),A | ||
LD BC,0 | ||
LD SP,Z80RESTORE ; MOVING ON | ||
LD HL,Z80RESTORE | ||
EXX | ||
LD HL,0038H | ||
LD A,(BORDER) | ||
OR 0C0H | ||
OUT (0FEH),A | ||
LD R,A | ||
JP (HL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
; THIS CODE WAS COPIED ALMOST ENTIRELY FROM COBRASOV.COM. | ||
; | ||
; THE ORIGINAL CODE IS EXTENSIVELY DOCUMENTED HERE: | ||
; http://cobrasov.com/CoBra%20Project/basic+nmi-ro.html | ||
; http://cobrasov.com/CoBra%20Project/basic+nmi.html | ||
; | ||
; I HAVE MODIFIED THE ORIGINAL WITH PLACEHOLDER VALUES (0) SO THAT IT CAN BE | ||
; ASSEMBLED. THE CODE IN GENRST.Z80 MODIFIES THE MACHINE CODE AT RUNTIME TO | ||
; FILL IN THE REGISTER VALUES FROM THE SNAPSHOT. | ||
|
||
RESTORE: | ||
_RST_BORDER: LD A,0 | ||
OUT (0FEH),A | ||
_RST_R: LD A,0 | ||
LD R,A | ||
_RST_I: LD A,0 | ||
LD I,A | ||
_RST_AF_: LD HL,0 | ||
PUSH HL | ||
_RST_AF: LD HL,0 | ||
PUSH HL | ||
POP AF | ||
EX AF,AF' | ||
POP AF | ||
EX AF,AF' | ||
_RST_BC: LD BC,0 | ||
_RST_DE: LD DE,0 | ||
_RST_HL: LD HL,0 | ||
_RST_SP: LD SP,0 | ||
_RST_IX: LD IX,0 | ||
_RST_IY: LD IY,0 | ||
EXX | ||
_RST_BC_: LD BC,0 | ||
_RST_DE_: LD DE,0 | ||
_RST_HL_: LD HL,0 | ||
EXX | ||
RST_EIDI: DI | ||
_RST_IM: IM 0 | ||
_RST_PC: JP 0 | ||
|
||
; ADDRESSES OF OPERANDS IN THE ASSEMBLED CODE | ||
RST_BORDER EQU _RST_BORDER + 1 | ||
RST_R EQU _RST_R + 1 | ||
RST_I EQU _RST_I + 1 | ||
RST_F_ EQU _RST_AF_ + 1 | ||
RST_A_ EQU _RST_AF_ + 2 | ||
RST_F EQU _RST_AF + 1 | ||
RST_A EQU _RST_AF + 2 | ||
RST_BC EQU _RST_BC + 1 | ||
RST_DE EQU _RST_DE + 1 | ||
RST_HL EQU _RST_HL + 1 | ||
RST_SP EQU _RST_SP + 1 | ||
RST_IX EQU _RST_IX + 2 | ||
RST_IY EQU _RST_IY + 2 | ||
RST_BC_ EQU _RST_BC_ + 1 | ||
RST_DE�_ EQU _RST_DE_ + 1 | ||
RST_HL_ EQU _RST_HL_ + 1 | ||
RST_IM EQU _RST_IM + 1 | ||
RST_PC EQU _RST_PC + 1 | ||
RESTOREEND: |
Oops, something went wrong.