Initial commit

This commit is contained in:
boykovra 2024-06-14 13:41:17 +03:00
parent 53a4f1da92
commit f88fc0e5ff
9 changed files with 2678 additions and 0 deletions

10
.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
*.dos
*.sna
*.lst
*.sld
*.obj
*.labels
*.tmp
*.EXE
*.exe
*.bin

10
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,10 @@
{
"recommendations": [
"maziac.asm-code-lens",
"maziac.dezog",
"maziac.hex-hover-converter",
"maziac.z80-instruction-set",
"maziac.sna-fileviewer",
"maziac.nex-fileviewer",
]
}

94
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,94 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "dezog",
"request": "launch",
"name": "Internal Simulator",
"remoteType": "zsim",
"zsim": {
"visualMemory": true,
"memoryModel": "CUSTOM",
"customMemory": {
"slots": [
{
"name": "PAGE0",
"range": ["0x0000","0x3FFF"],
"banks": [{"index": [0, 255]}],
"initialBank": 0
},
{
"name": "PAGE1",
"range": ["0x4000","0x7FFF"],
"banks": [{"index": [0, 255]}],
"initialBank": 1
},
{
"name": "PAGE2",
"range": ["0x8000","0xBFFF"],
"banks": [{"index": [0, 255]}],
"initialBank": 2
},
{
"name": "PAGE3",
"range": ["0xC000","0xFFFF"],
"banks": [{"index": [0, 255]}],
"initialBank": 3
}
],
"ioMmu": [
"if (portAddress == 0x82) {",
" bank = portValue;",
" PAGE0 = bank;",
"}",
"if (portAddress == 0xA2) {",
" bank = portValue;",
" PAGE1 = bank;",
"}",
"if (portAddress == 0xC2) {",
" bank = portValue;",
" PAGE2 = bank;",
"}",
"if (portAddress == 0xE2) {",
" bank = portValue;",
" PAGE3 = bank;",
"}"
]
},
"customCode": {
"debug": false,
"jsPath": "sim/ports.js"
//"uiPath": "simulation/ui.html"
},
//"ulaScreen": true,
//"zxBorderWidth": 20,
//"vsyncInterrupt": true,
//"zxKeyboard": true,
//"zxBeeper": true
},
"sjasmplus": [
{
"path": "unzip.sld"
}
],
"history": {
"reverseDebugInstructionCount": 1000000,
"spotCount": 10,
"codeCoverageEnabled": true
},
"startAutomatically": false,
"commandsAfterLaunch": [],
"rootFolder": "${workspaceFolder}",
"topOfStack": "STACK_TOP",
"loadObjs": [
{
"path": "unzip.obj",
"start": "0x0000"
}
],
"execAddress": "0x8100",
"smallValuesMaximum": 513,
"tmpDir": ".tmp"
}
]
}

41
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "make (sjasmplus)",
"type": "shell",
"command": "sjasmplus",
"args": [
"--sld=unzip.sld",
"--sym=unzip.labels",
"--raw=unzip.obj",
"--fullpath",
"unzip.asm"
],
"problemMatcher": {
"owner": "sjasmplus",
"fileLocation": "autoDetect",
"pattern": {
"regexp": "^(.*)\\((\\d+)\\):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"severity": 3,
"message": 4
}
},
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "start mame",
"type": "shell",
"command": "while true; do ./mame spectrum -window -debugger gdbstub -debug -debugger_port 12000 -verbose -resolution 512x384 ; sleep 2 ; done",
"options": {
"cwd": "${config:mame_dir}"
},
"problemMatcher": []
}
]
}

4
README.md Normal file
View File

@ -0,0 +1,4 @@
UNZIP for Sprinter
==================
Dizassembled code from UNZIP.EXE v0.7 for Sprinter computer.

189
bios.asm Normal file
View File

@ -0,0 +1,189 @@
ORG 0x0000
RESET:
JP NOT_IMPL
DS 5, 0xFF
RST08:
JP NOT_IMPL
DS 5, 0xFF
ORG 0x0010
RST10:
JP DSS_HANDLER
DS 5, 0xFF
RST18:
JP NOT_IMPL
DS 5, 0xFF
RST20:
JP NOT_IMPL
DS 5, 0xFF
RST28:
JP NOT_IMPL
DS 5, 0xFF
RST30:
JP NOT_IMPL
DS 5, 0xFF
RST38:
JP NOT_IMPL
DS 5, 0xFF
DSS_HANDLER
PUSH HL
PUSH BC
LD A, C
CP 0x0B
JP Z, _CREATE_FILE
CP 0x11
JP Z, _OPEN_FILE
CP 0x12
JP Z, _CLOSE_FILE
CP 0x13
JP Z, _READ_FILE
CP 0x14
JP Z, _WRITE_FILE
CP 0x5C
JP Z, _PCHARS
CP 0x41
JP Z, _EXIT
POP BC
POP HL
NOT_IMPL
LD A,0x01
SCF
RET
_PCHARS
LD BC, 0x9000
NXT_PCHAR
LD A, (HL)
OUT (C),A
INC HL
OR A
JR NZ, NXT_PCHAR
NORM_EXIT
CCF
POP BC
POP HL
RET
BAD_EXIT
SCF
POP BC
POP HL
RET
; Входные значения:
; HL - указатель на файловую спецификацию
; A - атрибут файла
; Выходные значения:
; A — код ошибки, если CF=1
; A - файловый манипулятор, если CF=0
_CREATE_FILE
JP DSS_OPEN_FILE
; Входные значения:
; HL - указатель на файловую спецификацию
; A - режим доступа
; A=0 чтение/запись
; A=1 чтение
; A=2 запись
; Выходные значения:
; A - код ошибки, если CF=1
; A - файловый манипулятор, если CF=0
CUR_FILE_MAN
DB 0x4F
_OPEN_FILE
LD HL, CUR_FILE_MAN
INC (HL)
LD A, (HL)
JP NORM_EXIT
_CLOSE_FILE
JP NORM_EXIT
CUR_F_PTR
DW ZIP_FILE
REMAINS_IN_ZIP
DW 0
; Входные значения:
; A - файловый манипулятор
; HL - адрес в памяти
; DE - количество читаемых байт
; Выходные значения:
; A - код ошибки, если CF=1
; DE - реальное количество прочитанных байт
; если CF=0:
; A = 0 прочитаны все байты
; A = 0FFh прочитано меньшее число байт
_READ_FILE
OR A
JP Z, BAD_EXIT
PUSH DE
POP BC ; BC - bytes to read
PUSH HL
LD HL, (CUR_F_PTR) ; HL -> IN ZIP_FILE
LD DE, ZIP_FILE_END
EX HL, DE
SUB HL, DE ; HL = remain bytes
LD (REMAINS_IN_ZIP), HL
SBC HL, BC
LD A, 0
JR NC, NO_OUT_OF_ZIP
DEC A
LD HL,(REMAINS_IN_ZIP)
LD BC, HL
NO_OUT_OF_ZIP
LD HL, (CUR_F_PTR)
POP DE ; DE - Buffer to write
PUSH BC
LDIR
POP DE ; DE = bytes read, A = 0 or 0xFF
LD (CUR_F_PTR), HL
JP NORM_EXIT
; Входные значения:
; A - файловый манипулятор
; HL - адрес в памяти
; DE - количество записываемых байт
; Выходные значения:
; A - код ошибки, если CF=1
; DE - реальное количество записанных байт
_WRITE_FILE
PUSH DE
POP BC
LD DE,UNZIP_FILE
PUSH BC
LDIR
POP DE
JP NORM_EXIT
_EXIT
; LOGPOINT STOPPED!
HALT
JP _EXIT
ALIGN 16384, 0

44
sim/ports.js Normal file
View File

@ -0,0 +1,44 @@
port_p0 = 0;
port_p1 = 1;
port_p2 = 2;
port_p3 = 3;
message = "";
// This function is called when time (t-states) advances.
API.tick = () => {
}
// This function is called when an 'out' is executed in Z80.
API.writePort = (port, value) => {
// Go through all ports
if (port == 0x9000) {
if (value != 0) {
message += String.fromCharCode(value);
} else {
API.log("> " + message);
message = "";
}
} else if (port == 0x82) {
port_p0 = value;
} else if (port == 0xA2) {
port_p1 = value;
} else if (port == 0xC2) {
port_p2 = value;
} else if (port == 0xE2) {
port_p3 = value;
}
}
API.readPort = (port) => {
if (port == 0x82) {
return port_p0;
} else if (port == 0xA2) {
return port_p1;
} else if (port == 0xC2) {
return port_p2;
} else if (port == 0xE2) {
return port_p3;
}
}

37
test_data.asm Normal file
View File

@ -0,0 +1,37 @@
ORG 0x4000
ZIP_FILE
DB 0x50, 0x4B, 0x03, 0x04, 0x14, 0x00, 0x04, 0x00, 0x08, 0x00, 0xC9, 0xA3, 0xBA, 0x58, 0xA0, 0xE8, 0xCD, 0xD3, 0xEA, 0x00
DB 0x00, 0x00, 0x7B, 0x02, 0x00, 0x00, 0x05, 0x00, 0x1C, 0x00, 0x31, 0x2E, 0x61, 0x73, 0x6D, 0x55, 0x54, 0x09, 0x00, 0x03
DB 0xA9, 0x71, 0x53, 0x66, 0xE6, 0x58, 0x68, 0x66, 0x75, 0x78, 0x0B, 0x00, 0x01, 0x04, 0xE8, 0x03, 0x00, 0x00, 0x04, 0xE8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46, 0x22, 0xD6, 0xDE, 0xB3, 0x26, 0xA4, 0xC9, 0x88, 0xC4, 0x20, 0xE5, 0x9B, 0x94, 0x65, 0xF4, 0x69, 0x9E, 0x66, 0xB8
DB 0xCB, 0x55, 0x7A, 0x2D, 0x85, 0x57, 0x43, 0xB8, 0xBB, 0xF1, 0x69, 0xE3, 0xB5, 0x20, 0xB5, 0x5A, 0x77, 0x9C, 0x5D, 0x1F
DB 0x0C, 0x8E, 0x9C, 0x99, 0x19, 0xD1, 0x1C, 0x7D, 0x59, 0xFD, 0xB4, 0xBF, 0xFF, 0x2E, 0xAC, 0xE8, 0x17, 0x50, 0x4B, 0x01
DB 0x02, 0x1E, 0x03, 0x14, 0x00, 0x04, 0x00, 0x08, 0x00, 0xC9, 0xA3, 0xBA, 0x58, 0xA0, 0xE8, 0xCD, 0xD3, 0xEA, 0x00, 0x00
DB 0x00, 0x7B, 0x02, 0x00, 0x00, 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xB4, 0x81, 0x00
DB 0x00, 0x00, 0x00, 0x31, 0x2E, 0x61, 0x73, 0x6D, 0x55, 0x54, 0x05, 0x00, 0x03, 0xA9, 0x71, 0x53, 0x66, 0x75, 0x78, 0x0B
DB 0x00, 0x01, 0x04, 0xE8, 0x03, 0x00, 0x00, 0x04, 0xE8, 0x03, 0x00, 0x00, 0x50, 0x4B, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00
DB 0x01, 0x00, 0x01, 0x00, 0x4B, 0x00, 0x00, 0x00, 0x29, 0x01, 0x00, 0x00, 0x00, 0x00
ZIP_FILE_END
CMD_LINE1
DB 20, " C:\\FOLDER\\ FILE.ZIP", 0
CMD_LINE2
DB 19, " C:\\FOLDER\\FILE.ZIP", 0
UNZIP_FILE
DS 1024, 0
ALIGN 16384, 0

2249
unzip.asm Normal file

File diff suppressed because it is too large Load Diff