Skip to content

Commit

Permalink
New year release
Browse files Browse the repository at this point in the history
  • Loading branch information
nihirash authored Dec 28, 2023
1 parent 7945352 commit a8794ab
Show file tree
Hide file tree
Showing 25 changed files with 2,546 additions and 211 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-check.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: build-check
run-name: Build operating system with sjasmplus
run-name: Dry run of building and packing OS image
on:
push:
branches:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ cpm.sna
cpm.\$c
cpm.rom
cpm.trd
cpm.sys
autoexec.com
.DS_Store
*.zx7
page*.bin
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 2023.12.29
- ZCPR is no longer blob. Sources are included
- Autostart commands can be specified via PROFILE.SUB file
- Any order of volumes are acceptable
- Two SD cards are supported(implemented in compatible way with Z-Controller on ZXEvo TSConf)
- IOByte allows switch UART outputs(dual port ZiFi), first uart will be TTY, second - UC1

# 2023.12.11
- Memory usage optimised
- IDEDOS partitions work rewritten - up to 11 partitions supported
Expand Down
9 changes: 9 additions & 0 deletions apps/fast.z80
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ORG 100H
LD C,2
LD E,27
CALL 5
LD C,2
LD E,255
CALL 5
RST 0

9 changes: 9 additions & 0 deletions apps/slow.z80
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ORG 100H
LD C,2
LD E,27
CALL 5
LD C,2
LD E,254
CALL 5
RST 0

Binary file modified drive_image/sdcard.zip
Binary file not shown.
11 changes: 7 additions & 4 deletions system/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ SOURCES:=$(shell find bdos -type f -iname "*.z80") $(shell find bios -type f -i
BLOBS:=$(shell find blob -type f -iname "*.bin")
PACKER=zx7b

all: cpm.\$$c

autoexec.com: autoexec/autoexec.z80
$(ASM) autoexec/autoexec.z80

cpm.\$$c: page3.zx7 page7.zx7 loader.z80 config.z80
$(ASM) loader.z80

Expand All @@ -12,14 +17,12 @@ page3.zx7: page3.bin
page7.zx7: page7.bin
$(PACKER) page7.bin page7.zx7

page3.bin page7.bin: $(SOURCES) $(BLOBS) config.z80 .version
page3.bin page7.bin: $(SOURCES) $(BLOBS) config.z80 .version autoexec.com
git rev-parse --short HEAD >git_commit
$(ASM) $(FLAGS) cpm.z80

.version:
date '+%Y.%m.%d' >.version

all: cpm.\$$c

clean:
rm -rf page*.bin page*.zx7 cpm.sna cpm.\$$c
rm -rf page*.bin page*.zx7 cpm.sna cpm.\$$c autoexec.com
158 changes: 158 additions & 0 deletions system/autoexec/autoexec.z80
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
;; PROFILE.SUB on start processor :-)
;;
;; Simple way implement autostart in CP/M
;; (c) 2023 Aleksandr Sharikhin
;; Nihirash's Coffeeware License

org $100
output "autoexec.com"

BDOS_ENTRY EQU 5

CPM_EXIT EQU 0
CPM_OPEN EQU 15
CPM_CLOSE EQU 16
CPM_READ EQU 20
CPM_WRITE EQU 21
CPM_SETDMA EQU 26
CPM_DELETE EQU 19
CPM_CREATE EQU 22
CPM_RESET EQU 13
CPM_PRINT EQU 9

CPM_EOF EQU $1A

NEW_LINE EQU $0a
C_RETURN EQU $0d

macro BDOS_CALL n, arg
ld c, n
ld de, arg
call BDOS_ENTRY
endm

start:
ld sp, $80

;; Output buffer
ld hl, (BDOS_ENTRY + 1) : ld de, 512 : or a : sbc hl, de : ld l, 0 : ld (buf_ptr), hl

BDOS_CALL CPM_RESET, 0
BDOS_CALL CPM_SETDMA, buf

BDOS_CALL CPM_OPEN, fcb
;; If zero - no error happens
and a : jp nz, .exit

BDOS_CALL CPM_PRINT, banner
.read_loop
ld de, (dma_ptr) : ld c, CPM_SETDMA : call BDOS_ENTRY
BDOS_CALL CPM_READ, fcb
cp #1 : jr z, .done
cp #ff : jr z, .done
ld hl, (dma_ptr) : ld de, 128 : add hl, de : ld (dma_ptr), hl
jr .read_loop
.done
ld hl, (dma_ptr) : ld a, CPM_EOF : ld (hl), a

BDOS_CALL CPM_CLOSE, fcb

ld hl, buf
.loop
ld a, (hl)
cp CPM_EOF : jr z, .found
inc hl
jr nz, .loop
.found
dec l
ld a, l : ld (count), a

BDOS_CALL CPM_DELETE, fcb2
BDOS_CALL CPM_CREATE, fcb2
cp $ff : jr z, .exit
ld c, CPM_SETDMA : ld de, (buf_ptr) : call BDOS_ENTRY

;; Processing loop
ld hl, buf
.processing_loop:
ld a, (hl)
and a : jr z, .close
cp CPM_EOF : jr z, .close
push hl
call process_byte
pop hl
inc hl
jr .processing_loop
.close
ld de, (buf_ptr)
ld a, (record_count) : ld b, a
and a : jr z, .exit
.store_loop
inc d
push de
push bc
ld c, CPM_SETDMA : call BDOS_ENTRY
BDOS_CALL CPM_WRITE, fcb2
pop bc
pop de
djnz .store_loop

.exit
BDOS_CALL CPM_CLOSE, fcb2
rst 0

; A - byte to process
process_byte:
cp C_RETURN : jr z, .store
cp NEW_LINE : ret z
ld c, a

ld hl, (buf_ptr) : ld a, (record_fill) : ld l, a
inc hl

ld a, c : ld (hl), a
ld a, l : ld (record_fill), a

ret
.store:
ld hl, (buf_ptr) : ld l, 0
ld a, (record_fill)
ld (hl), a

ld l, a
inc hl : xor a : ld (hl), a
ld (record_fill), a

ld hl, buf_ptr+1 : dec (hl)
ld hl, record_count : inc (hl)
ret

record_fill db 0
record_count db 0
banner:
db C_RETURN, NEW_LINE
db "PROFILE.SUB was found - launching it!"
db C_RETURN, NEW_LINE
db '$'

;; File with autostart
fcb:
.start
db 00
db "PROFILE "
db "SUB"
ds 36-($ - .start), 0

;; CCP batch file
fcb2:
.start
db 00
db "$$$ "
db "SUB"
ds 36-($ - .start), 0

dma_ptr dw buf
buf_ptr dw 0

count: db 0
buf: equ $
3 changes: 1 addition & 2 deletions system/bdos/cpm.z80 → system/bdos/bdos.z80
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ DEL EQU 7FH ;rubout
;
;
CBASE:
display "CCP: ", $
incbin "../blob/zcpr.bin"
include "zcpr.z80"
;**************************************************************
;*
;* B D O S E N T R Y
Expand Down
Loading

0 comments on commit a8794ab

Please sign in to comment.