Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development updates #5

Merged
merged 3 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024.05.02
2024.05.04
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Changelog

## 2024.04.02
## 2024.05.04

* Very basic ADM-3 terminal emulation

* "Update random access pointer" call implemented

* "Printer" now outputs to VPD's printer

* Console status and reading working fine now

## 2024.05.02

* File leak fixed

Expand Down
7 changes: 5 additions & 2 deletions src/config.asm
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@

;; Replace ZINC_BASE to $40000 for using it from `/bin` path or as standalone application
;; Or keep it as usual moslet - emulator is really tiny and works fine here
ZINC_BASE: equ $B0000
ZINC_EXIT: equ ZINC_BASE + 4
ZINC_BASE: equ $B0000
ZINC_EXIT: equ ZINC_BASE + 4
ZINC_TERMOUT: equ ZINC_EXIT + 4

;; By changing this value you can change used memory page for CP/M application
EDOS_BASE: equ $A0000
;; Origin address for EDOS(BDOS equivalent in ZINC)
EDOS_ORG: equ EDOS_BASE + $F500
;; TPA area starts here
EDOS_TPA: equ EDOS_BASE + $100
;; MB pointer
EDOS_PAGE: equ EDOS_BASE / $10000

;; CP/M 2.2 is $22
;; Personal CP/M-80 is $28
Expand Down
1 change: 0 additions & 1 deletion src/edos/console.asm
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ raw_io:
ret z
jp CONIN


get_io_byte:
ld a, (IOBYTE)
ret
Expand Down
12 changes: 9 additions & 3 deletions src/edos/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
TDRIVE: equ $04
IOBYTE: equ $03
TFCB: equ $5c
DEFDMA: equ $80

NFUNC: equ 40

Expand Down Expand Up @@ -73,8 +74,8 @@ fun_table:
dw console_out ; 02 Console out

dw trace ; 03 Aux read
dw trace ; 04 Aux write
dw do_nothing ; 05 Printer write
dw print ; 04 Aux write
dw print ; 05 Printer write

dw raw_io ; 06 Raw IO
dw get_io_byte ; 07 Get IO Byte
Expand Down Expand Up @@ -106,7 +107,7 @@ fun_table:
dw fread_rnd ; 33 Random read
dw fwrite_rnd ; 34 Random write
dw calc_size ; 35 Compute file size
dw trace ; 36 Update random access pointer
dw calc_random_offset ; 36 Update random access pointer
dw do_nothing ; 37 reset selected disks
dw trace ; 38 not used in CP/M 2.2
dw trace ; 39 not used in CP/M 2.2
Expand All @@ -116,6 +117,11 @@ fun_table:
bye:
jp.lil ZINC_EXIT

;; Just send byte to VDP "Printer"
print:
ld c, e
jp list

do_nothing:
xor a
ld hl, 0
Expand Down
8 changes: 6 additions & 2 deletions src/edos/disk.asm
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,19 @@ catalog_scan_next:
jr scan_ok

nope:
ld a, $ff
ld a, -1
ld hl, -1
ld bc, -1
ret

scan_ok:
ld de, (dma_ptr)
ld hl, ffs_lfn
call ascciz_to_fcb

xor a
ld hl, 0
ld bc, 0
ret

;; Calculation file lenght
Expand Down
34 changes: 24 additions & 10 deletions src/edos/ebios/console.asm
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,52 @@
;;
;; All rights are reserved


;; Single source of truth is better
keycode:
db 0

bios_const:
ld.lil hl, (keycount_ptr)
ld.lil a, (hl)
and a
ret z

ld.lil hl, (keydown_ptr)
ld.lil a, (hl)
and a
ret z

ld.lil hl, (keycode_ptr)
ld.lil a, (hl)
or a
and $7f
ld (keycode), a
ret z

ld a, $ff
ret


bios_in:
;; You shouldn't use application stack(it will broke wordstar, for example)
;; So, using our BIOS-stack for all places where we'll need stack
LOCALSP
@rep:
MOSCALL MOS_GET_KEY
or a
call bios_const
and a
jr z, @rep

ld c, a

xor a
ld.lil hl, (keycode_ptr)
xor a
ld.lil hl, (keydown_ptr)
ld.lil (hl), a

ld a, c
ld a, (keycode)

RESTORESP
ret

bios_out:
LOCALSP
ld a, c
rst.lil $10
call.lil ZINC_TERMOUT
RESTORESP
ret
36 changes: 33 additions & 3 deletions src/edos/ebios/index.asm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CONST: JP bios_const
CONIN: JP bios_in
CONOUT: JP bios_out

LIST: JP nothing
LIST: JP list
PUNCH: JP nothing
READER: JP reader

Expand All @@ -33,6 +33,23 @@ nothing:
ld a, $ff
ret

list:
LOCALSP

ld a, c
ld (@char), a
ld hl, @vdu
ld bc, 4
rst.lil $18

RESTORESP
ret
@vdu:
db 2, 1
@char:
db 0
db 3

reader:
ld a, 26
ret
Expand Down Expand Up @@ -60,9 +77,17 @@ init:
rst.lil $18

MOSCALL MOS_SYS_VARS
lea.lil hl, ix + 5 ;; ASCII KEYCODE

lea.lil hl, ix + VAR_KEYASCII ;; ASCII KEYCODE
ld.lil (keycode_ptr), hl

lea.lil hl, ix + VAR_KEYDOWN ;; VKEYDOWN
ld.lil (keydown_ptr), hl

lea.lil hl, ix + VAR_VKEYCOUNT ;; VKEYCOUNT
ld.lil (keycount_ptr), hl


;; Cleaning last keypress on start - no waiting for key on start of some apps
xor a
ld.lil (hl), a
Expand All @@ -78,7 +103,7 @@ init:
ld hl, entrypoint
ld (6), hl

ld bc, $80
ld bc, DEFDMA
ld (dma_ptr), bc

ld a, 1
Expand All @@ -88,6 +113,7 @@ init:
jp bye

banner:
db 4
db 13,10, 17, 1
db "ZINC is Not CP/M", 13, 10, 17, 2
db "(c) 2024 Aleksandr Sharikhin", 13, 10, 17, 15
Expand All @@ -98,6 +124,10 @@ banner:
include "ebios/console.asm"
include "ebios/disk.asm"

keycount_ptr:
dl 0
keydown_ptr:
dl 0
keycode_ptr:
dl 0

Expand Down
19 changes: 19 additions & 0 deletions src/edos/fcb.asm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,25 @@ fcb_calc_offset:
pop ix
ret

calc_random_offset:
push ix
ld ix, (args)

ld l, (IX + FCB_EX)
ld h, $80
mlt hl

ld d, 0
ld e, (IX + FCB_CR)

add hl, de

ld (ix + FCB_RN), hl

pop ix
xor a
ret

; IX - FCB
fcb_next_record:
push ix
Expand Down
4 changes: 4 additions & 0 deletions src/edos/mos.asm
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ FA_WRITE: equ $02
FA_CREATE: equ $04
FA_CREATE_ALW: equ $08
FA_OPEN_ALW: equ $10

VAR_VKEYCOUNT: equ $19
VAR_KEYASCII: equ $05
VAR_KEYDOWN: equ $18
Loading