Browse Source

CP/M 3 Cleanup

pull/90/head
Wayne Warthen 6 years ago
parent
commit
c83cd1cb2d
  1. 9
      Source/CPM3/Build.cmd
  2. 117
      Source/CPM3/boot.z80
  3. 133
      Source/CPM3/util.z80

9
Source/CPM3/Build.cmd

@ -35,7 +35,8 @@ zx Z80ASM -CHARIO/MF
zx Z80ASM -MOVE/MF
zx Z80ASM -DRVTBL/MF
zx Z80ASM -DISKIO/MF
zx LINK -BIOS3[OS]=BIOSKRNL,SCB,BOOT,CHARIO,MOVE,DRVTBL,DISKIO
zx Z80ASM -UTIL/MF
zx LINK -BIOS3[OS]=BIOSKRNL,SCB,BOOT,CHARIO,MOVE,DRVTBL,DISKIO,UTIL
zx GENCPM -AUTO -DISPLAY
copy cpm3.sys cpm3res.sys
rem pause
@ -54,7 +55,8 @@ zx Z80ASM -CHARIO/MF
zx Z80ASM -MOVE/MF
zx Z80ASM -DRVTBL/MF
zx Z80ASM -DISKIO/MF
zx LINK -BNKBIOS3[B]=BIOSKRNL,SCB,BOOT,CHARIO,MOVE,DRVTBL,DISKIO
zx Z80ASM -UTIL/MF
zx LINK -BNKBIOS3[B]=BIOSKRNL,SCB,BOOT,CHARIO,MOVE,DRVTBL,DISKIO,UTIL
zx GENCPM -AUTO -DISPLAY
copy cpm3.sys cpm3bnk.sys
rem pause
@ -73,7 +75,8 @@ zx Z80ASM -CHARIO/MF
zx Z80ASM -MOVE/MF
zx Z80ASM -DRVTBL/MF
zx Z80ASM -DISKIO/MF
zx LINK -ZPMBIOS3[B]=BIOSKRNL,SCB,BOOT,CHARIO,MOVE,DRVTBL,DISKIO
zx Z80ASM -UTIL/MF
zx LINK -ZPMBIOS3[B]=BIOSKRNL,SCB,BOOT,CHARIO,MOVE,DRVTBL,DISKIO,UTIL
rem zx GENCPM -AUTO -DISPLAY
rem copy cpm3.sys zpm3.sys
rem pause

117
Source/CPM3/boot.z80

@ -13,6 +13,7 @@
extrn @dtbl,@ctbl
extrn @date,@hour,@min,@sec
extrn @srch1
extrn addhla, bcd2bin, bin2bcd
include ver.inc
@ -570,50 +571,6 @@ read:
ld c,20
jp bdos
addhla:
add a,l
ld l,a
ret nc
inc h
ret
bcd2bin:
; convert A from packed bcd to binary
push bc
ld c,a
and 0F0h
srl a
ld b,a
srl a
srl a
add a,b
ld b,a
ld a,c
and 0Fh
add a,b
pop bc
ret
bin2bcd:
; convert A from binary to packed bcd
push bc
ld b,10
ld c,-1
bin2bcd1:
inc c
sub b
jr nc,bin2bcd1
add a,b
ld b,a
ld a,c
add a,a
add a,a
add a,a
add a,a
or b
pop bc
ret
if zpm
signon$msg db 13,10,'ZPM3'
@ -667,76 +624,4 @@ drvtbladr dw @dtbl ; drive map address (filled in later)
dphtbladr dw dph0 ; dpb map address
cbxsiz equ $ - cbx
if 0
;
; Print the hex word value in HL
;
phex16:
push af
ld a,h
call phex8
ld a,l
call phex8
pop af
ret
;
; Print the hex byte value in A
;
phex8:
push af
push de
call hexascii
ld a,d
call cout
ld a,e
call cout
pop de
pop af
ret
;
; Convert binary value in A to ascii hex characters in DE
;
hexascii:
ld d,a
call hexconv
ld e,a
ld a,d
rlca
rlca
rlca
rlca
call hexconv
ld d,a
ret
;
; convert low nibble of A to ascii hex
;
hexconv:
and 0fh ;low nibble only
add a,90h
daa
adc a,40h
daa
ret
;
; output character from A
;
cout:
; save all incoming registers
push af
push bc
push de
push hl
ld e,a
ld bc,0100h
rst 08
pop hl
pop de
pop bc
pop af
ret
endif
end

133
Source/CPM3/util.z80

@ -0,0 +1,133 @@
title 'Utility module for RomWBW'
maclib options.lib
public addhla, bcd2bin, bin2bcd
public phex16, phex8, cout
cseg
addhla:
add a,l
ld l,a
ret nc
inc h
ret
bcd2bin:
; convert A from packed bcd to binary
push bc
ld c,a
and 0F0h
srl a
ld b,a
srl a
srl a
add a,b
ld b,a
ld a,c
and 0Fh
add a,b
pop bc
ret
bin2bcd:
; convert A from binary to packed bcd
push bc
ld b,10
ld c,-1
bin2bcd1:
inc c
sub b
jr nc,bin2bcd1
add a,b
ld b,a
ld a,c
add a,a
add a,a
add a,a
add a,a
or b
pop bc
ret
if 0
;
; Print the hex word value in HL
;
phex16:
push af
ld a,h
call phex8
ld a,l
call phex8
pop af
ret
;
; Print the hex byte value in A
;
phex8:
push af
push de
call hexascii
ld a,d
call cout
ld a,e
call cout
pop de
pop af
ret
;
; Convert binary value in A to ascii hex characters in DE
;
hexascii:
ld d,a
call hexconv
ld e,a
ld a,d
rlca
rlca
rlca
rlca
call hexconv
ld d,a
ret
;
; convert low nibble of A to ascii hex
;
hexconv:
and 0Fh ;low nibble only
add a,90h
daa
adc a,40h
daa
ret
;
; output character from A
;
cout:
; save all incoming registers
push af
push bc
push de
push hl
ld e,a
ld bc,0100h
rst 08
pop hl
pop de
pop bc
pop af
ret
else
phex16:
phex8:
cout:
halt
endif
end
Loading…
Cancel
Save