.comment % ######################################################### # # # Kaypro 10 Floppy Diskette Format Program # # for Single and Double Sided Diskettes. # # # # begun 04-Apr-83 # # by Matthew Sherman. # # # #=======================================================# # # # Current Revision: 1.0 19-Oct-83 # # Previous Revision: 0.1 04-Apr-83 # # Previous Revision: None. # # # # Changes, version 1.0 - Allowed lower case input # # from main menu, simplified disk format exiting # # (M. Sherman, 19-Oct-83) # # Changes: None. # # # #=======================================================# # # # Based on (and main body of code from) # # "Double density diskette format program" # # by Gilbert Ohnysty, Copyright (C) 1982 # # by Non-Linear Systems, Inc. # # # ######################################################### % title Kaypro 10 Floppy Format Program. extrn getc, getc1r, getc2r, getc3r, puta, putc, putstr0 extrn fmtfpy, thnsd, fmt1tk, vfy1tk public start, mmenu ; system equates wboot equ 0000h ; warm boot entry point stack equ 0b000h ; stack location for this module ; terminal equates cr equ 0dh ; carriage return lf equ 0ah ; line feed tab equ 09h ; tab esc equ 1bh ; escape clrscr equ 1ah ; clear screen .Z80 mmenu: start: ld sp,stack call putstr0 db clrscr ; clear the screen, db 'Kaypro 10 Floppy Diskette Format Program ( Version 1.0 )' db cr,lf,lf,tab,'F = format an entire disk' db cr,lf,lf,tab,'S = format a single track' db cr,lf,lf,tab,'C = Return to CP/M' db cr,lf,lf,'Which do you want to do ? ' db 00 ; end of message. inpwait: ; get a keyboard character call getc and 11011111b ; convert to lower case cp 'S' jr nz,inpw2 call puta ; echo it jr single ; go format a single track inpw2: cp 'F' jr nz,inpw3 call puta jp fmtfpy ; go format a double sided disk inpw3: cp 'C' jr nz,inpwait ; no good, get another call puta ; echo chara in a acc. jp wboot ; exit single: call putstr0 db cr,lf,lf,'Track to Format ( 0-79 ) or an ESC to Abort ? ' db 00 ld de,'0'*256+'9' ; range of 0 to 9 ld hl,esc*256+esc ; abort range call getc2r cp esc ; abort? jp z,start ; start over call puta ; echo it sub '0' ld c,a push bc ld bc,cr*256+cr call getc3r ; pop bc cp esc jp z,start cp cr jr nz,sngl2 ld a,c jr sngl3 sngl2: call puta sub '0' ld e,a ld a,c or a jr z,sngl5 ld b,a ld c,10 xor a sngl4: add a,c djnz sngl4 sngl5: add a,e sngl3: ld c,a push bc call fmt1tk call putstr0 db cr,lf,'Now Verifying',cr,lf db 00 pop bc call vfy1tk ld b,50 call thnsd jp start ; start over defw 0000h END