X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp-cpm3.git/blobdiff_plain/f4471ef90f63448efdf36c4e3a5406641e2353bd..1e1c17d3fc07e3783873a621d8f165a3f56ff01f:/cbios/boot.180 diff --git a/cbios/boot.180 b/cbios/boot.180 index 99a8733..2a43b75 100644 --- a/cbios/boot.180 +++ b/cbios/boot.180 @@ -6,7 +6,7 @@ public f_cpu - extrn ?boot,?conin + extrn boot,?conin extrn pr.inln,pr.crlf,pr.dec,pr.decl extrn ioini1l,msginit,mmuinit,intinit,cpu_frq extrn prt0ini,gs_rtc @@ -17,10 +17,18 @@ include z180reg.inc -bdos equ 5 - ccpsize equ 0c80h + ; CP/M BDOS Function Interfaces + +resetdsk equ 13 +open equ 15 +read equ 20 +setdma equ 26 +setmulti equ 44 +bdos equ 5 + + if banked tpa$bank equ 1 else @@ -37,11 +45,10 @@ hwinit: ld hl,hwini_tab call ioini1l ld a,0c3h - ld hl,?boot + ld hl,boot ld (0),a ld (1),hl hwini_skip: - call mmuinit ; setup mmu registers call msginit call cpu_frq ld (f_cpu),hl @@ -49,7 +56,8 @@ hwini_skip: ret ?init: - ld hl,0100000000000000b ; assign console to ASCI1: +; ld hl,1000000000000000b ; assign console to AVRCON: + ld hl,0100000000000000b ; assign console to ASCI0: ld (@civec),hl ld (@covec),hl ld hl,0000000000000000b ; assign printer to nothing: @@ -59,11 +67,11 @@ hwini_skip: ld (@aovec),hl - ld c,2 - call gs_rtc ; get time and date call intinit ; setup interrupts and vectors call prt0ini ; init timer ei + ld c,2 + call gs_rtc ; get time and date xor a ld (@cbnk),a ; right now in bank 0 @@ -72,7 +80,7 @@ hwini_skip: db 13,10,13,10,'CP/M Version 3.0, Z180-Stamp BIOS',13,10,0 call pr.inln - db 'CPU clock [Hz]: ',0 + db 'Estimated CPU clock [Hz]: ',0 ld hl,(f_cpu) ld de,(f_cpu+2) @@ -89,21 +97,26 @@ hwini_skip: ?ldccp: ; First time, load the A:CCP.COM file into TPA - call resetdsk + ld c,resetdsk + call bdos xor a ld (ccp$fcb+15),a ; zero extent ld hl,0 ld (fcb$nr),hl ; start at beginning of file ld de,ccp$fcb - call open ; open file containing CCP + ld c,open ; open file containing CCP + call bdos inc a jp z,no$ccp ; error if no file... ld de,0100h - call setdma ; start of TPA + ld c,setdma ; start of TPA + call bdos ld de,128 - call setmulti ; allow up to 16k bytes + ld c,setmulti ; allow up to 16k bytes + call bdos ld de,ccp$fcb - call read ; load the thing + ld c,read ; load the thing + call bdos ; read records ; now, ; copy CCP to bank 0 for reloading ld hl,0100h @@ -119,11 +132,8 @@ ld$1: call ?bnksl ; select extra bank pop af ld (hl),a ; save the byte - inc hl - dec bc ; bump pointer, drop count - ld a,b - or c ; test for done - jp nz,ld$1 + cpi ; bump pointer, drop count + jp pe,ld$1 pop af call ?bnksl ; restore original bank ret @@ -142,44 +152,17 @@ no$ccp: ; here if we couldn't find the file rl$1: ld a,2 call ?bnksl ; select extra bank - ld a,(hl) - push af ; get a byte + ld a,(hl) ; get a byte + ex af,af' ld a,tpa$bank call ?bnksl ; select TPA - pop af + ex af,af' ld (hl),a ; save the byte - inc hl - dec bc ; bump pointer, drop count - ld a,b - or c ; test for done - jp nz,rl$1 + cpi ; bump pointer, drop count + jp pe,rl$1 ret - ; CP/M BDOS Function Interfaces - -resetdsk: - ld c,13 - jp bdos ; reset disk system - -open: - ld c,15 - jp bdos ; open file control block - -setdma: - ld c,26 - jp bdos ; set data transfer address - -setmulti: - ld c,44 - jp bdos ; set record count - -read: - ld c,20 - jp bdos ; read records - - - ccp$fcb:db 1,'CCP ','COM',0,0,0,0 ds 16 fcb$nr: db 0,0,0