Skip to content

Commit

Permalink
API mostly correct
Browse files Browse the repository at this point in the history
  • Loading branch information
nihirash committed Jun 22, 2024
1 parent d882007 commit c3e7832
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024.06.17
2024.06.22
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 1 addition & 5 deletions src/zinc/edos/buffers.asm
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,4 @@ ffs_lfn: ds 256
bios_stack:

ds 36
stack:

empty:
ds 128
end_of_empty:
stack:
13 changes: 7 additions & 6 deletions src/zinc/edos/console.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down Expand Up @@ -155,6 +155,7 @@ read_buf:
ld d, 0
xor a
ld b, a
ret
@err:
ld a, -1
Expand Down
7 changes: 5 additions & 2 deletions src/zinc/edos/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ entrypoint:
edos:
ld a, c
ld (fun), a
cp NFUNC
cp NFUNC + 1
ret nc

di
Expand Down Expand Up @@ -49,6 +49,9 @@ bdos_return:
pop ix
ld sp, (user_stk)
ei

ld h, b
ld l, a
ret

fun_table:
Expand Down Expand Up @@ -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:
Expand Down
37 changes: 21 additions & 16 deletions src/zinc/edos/disk.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -77,8 +87,8 @@ catalog_scan_next:

nope:
ld a, -1
ld b, a
ld hl, -1
ld bc, -1
ret

scan_ok:
Expand All @@ -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
Expand Down Expand Up @@ -125,6 +134,7 @@ scan_ok:
ld (ix + FCB_EX), a

xor a
ld b, a
ret

mask:
Expand Down Expand Up @@ -174,6 +184,7 @@ fopen:
jp z, err

xor a
ld b, a
ret

frename:
Expand All @@ -194,6 +205,7 @@ frename:
ld.lil de, dos_name
MOSCALL MOS_RENAME
or a
ld b, a
ret z

ld a, #ff
Expand All @@ -216,7 +228,6 @@ fcreate:
ld a, (hl)
ld c, a


xor a
ret

Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -349,6 +351,7 @@ read_offset:
call fcb_next_record
xor a
ld b, a
ret

;; DE - FCB
Expand Down Expand Up @@ -380,7 +383,9 @@ calc_size:

ld de, (@buff + 1)
ld (hl), de
xor a
ld b, a
ret
@nope:
ld a, $ff
Expand Down
7 changes: 0 additions & 7 deletions src/zinc/edos/ebios/index.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c3e7832

Please sign in to comment.