From c3e7832a8d3cb7c6d8c008c590d2b4543139a556 Mon Sep 17 00:00:00 2001 From: Alexander Sharihin Date: Sat, 22 Jun 2024 17:48:06 +0200 Subject: [PATCH] API mostly correct --- .version | 2 +- CHANGELOG.md | 4 +++- README.md | 10 ++++++---- src/zinc/edos/buffers.asm | 6 +----- src/zinc/edos/console.asm | 13 ++++++------ src/zinc/edos/core.asm | 7 +++++-- src/zinc/edos/disk.asm | 37 ++++++++++++++++++++--------------- src/zinc/edos/ebios/index.asm | 7 ------- 8 files changed, 44 insertions(+), 42 deletions(-) diff --git a/.version b/.version index 3cca204..d72b961 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -2024.06.17 +2024.06.22 diff --git a/CHANGELOG.md b/CHANGELOG.md index 6703810..49fca94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,11 @@ ## Upcoming + * BBC Basic partly working with files but still have issues + * Tracing of DOS calls removed - * Fill with zeros call implemented + * All API calls implemented * Fixed WordStar 3 file operations diff --git a/README.md b/README.md index 202c214..dbca6fe 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,6 @@ ZINC - ZINC is Not CP/M CP/M compatibility layer for Agon's MOS. -Requires ez80asm 1.6 or later for building it. - -**CAUTION** It is early development version - possibly unstable behavior or any issues, use it on your risk. - ## Usage Download from releases page `zinc.bin`(use only latest release) and copy it to `mos/` directory of your sd card. @@ -57,6 +53,12 @@ It also allows disable(and re-enable terminal emulation routines) with `27, 255` - `ESC`+`0xFF` - toggle terminal emulation(enable or disable it) +## Known incompatibilities + + * BBCBasic V - produces CP/M error on almost any non vanilla BDOS implementation(source code shows that it was developed mostly for runinng under RunCPM). + + Honestly, I think It will be easier port it to MOS than fix execution under ZINC. + ## Development You should use fresh version of [agon-ez80asm](https://github.com/envenomator/agon-ez80asm) for building system. diff --git a/src/zinc/edos/buffers.asm b/src/zinc/edos/buffers.asm index 3be1541..008796e 100644 --- a/src/zinc/edos/buffers.asm +++ b/src/zinc/edos/buffers.asm @@ -38,8 +38,4 @@ ffs_lfn: ds 256 bios_stack: ds 36 -stack: - -empty: - ds 128 -end_of_empty: \ No newline at end of file +stack: \ No newline at end of file diff --git a/src/zinc/edos/console.asm b/src/zinc/edos/console.asm index c7209d5..37849da 100644 --- a/src/zinc/edos/console.asm +++ b/src/zinc/edos/console.asm @@ -60,11 +60,7 @@ console_status: db 13, 10, "CTRL-C pressed, aborting execution", 13, 10, 0 @exit: - ld a, 0 -;; Fixes LU310.COM - ld l, a - ld h, a - ld c, a + xor a ld b, a ret @@ -81,7 +77,11 @@ raw_io: @out: ld a, (args) ld c, a - jp CONOUT + call CONOUT + + xor a + ld b, a + ret get_io_byte: ld a, (IOBYTE) @@ -155,6 +155,7 @@ read_buf: ld d, 0 xor a + ld b, a ret @err: ld a, -1 diff --git a/src/zinc/edos/core.asm b/src/zinc/edos/core.asm index a3629b7..e96fa61 100644 --- a/src/zinc/edos/core.asm +++ b/src/zinc/edos/core.asm @@ -12,7 +12,7 @@ entrypoint: edos: ld a, c ld (fun), a - cp NFUNC + cp NFUNC + 1 ret nc di @@ -49,6 +49,9 @@ bdos_return: pop ix ld sp, (user_stk) ei + + ld h, b + ld l, a ret fun_table: @@ -94,7 +97,7 @@ fun_table: dw do_nothing ; 37 reset selected disks dw do_nothing ; 38 not used in CP/M 2.2 dw do_nothing ; 39 not used in CP/M 2.2 - dw fwrite_zeros ; 40 fill random access block with zeros + dw fwrite_rnd ; 40 fill random access block with zeros dw do_nothing ; 41 bye: diff --git a/src/zinc/edos/disk.asm b/src/zinc/edos/disk.asm index 3c24285..eb2e22a 100644 --- a/src/zinc/edos/disk.asm +++ b/src/zinc/edos/disk.asm @@ -5,19 +5,29 @@ get_drives: ld hl,1 + xor a + ld b, a ret get_drive: xor a + + ld b, a ret set_dma: ld (dma_ptr), de + + xor a + ld b, a ret get_dpb: ld hl, dpb + + xor a + ld b, a ret catalog_get_first: @@ -77,8 +87,8 @@ catalog_scan_next: nope: ld a, -1 + ld b, a ld hl, -1 - ld bc, -1 ret scan_ok: @@ -87,8 +97,7 @@ scan_ok: call ascciz_to_fcb xor a - ld hl, 0 - ld bc, 0 + ld b, a ret ;; Calculation file lenght @@ -125,6 +134,7 @@ scan_ok: ld (ix + FCB_EX), a xor a + ld b, a ret mask: @@ -174,6 +184,7 @@ fopen: jp z, err xor a + ld b, a ret frename: @@ -194,6 +205,7 @@ frename: ld.lil de, dos_name MOSCALL MOS_RENAME or a + ld b, a ret z ld a, #ff @@ -216,7 +228,6 @@ fcreate: ld a, (hl) ld c, a - xor a ret @@ -234,17 +245,9 @@ fdelete: call fcb_to_asciiz_name ld hl, dos_name MOSCALL MOS_DELETE - ret - -fwrite_zeros: - call _open - or a - jr z, err - call set_rnd_offset - MOSCALL MOS_FSEEK - ld.lil hl, empty - jp do_write_pointer + xor a + ret ;; Random write fwrite_rnd: @@ -271,12 +274,11 @@ do_write_pointer: call fcb_next_record - ld hl, 0 - ld bc, 0 xor a ret err: ld a, #ff + ld b, a ret clean_dma: @@ -349,6 +351,7 @@ read_offset: call fcb_next_record xor a + ld b, a ret ;; DE - FCB @@ -380,7 +383,9 @@ calc_size: ld de, (@buff + 1) ld (hl), de + xor a + ld b, a ret @nope: ld a, $ff diff --git a/src/zinc/edos/ebios/index.asm b/src/zinc/edos/ebios/index.asm index 40ef308..d16cd09 100644 --- a/src/zinc/edos/ebios/index.asm +++ b/src/zinc/edos/ebios/index.asm @@ -71,13 +71,6 @@ init: call init_dir - ld hl, empty - ld de, empty + 1 - ld bc, 127 - xor a - ld (hl), a - ldir - ld hl, banner ld bc, 0 xor a