002
15.08.2010, 11:56 Uhr
Peter Dassow
|
Zitat: | hschuetz postete Hallo, interessante Sache... nur wie bekommt man das dann ins Bios?? Oder wer schreibt ein paar Progrämmchen dafür?? Hardware gibt es reichlich nur leider kaum Jemand kann die Sachen universell einbinden. Gruß Hans- Werner |
Das stimmt schon. In der comp.os.cpm hat schon jemand darauf mit einem Programmbeispiel geantwortet - der hat wohl das kleine Gerät schon mit seinem CP/M-Rechner in Betrieb genommen:
"James Moxham (Dr_Acula)" <moxhamj@internode.on.net> wrote in "comp.os.cpm": I can post a huge assembly program if you like that has all the udrive interface; erase, read, write, dir
It would need the uart ports changed to your machine. Below is a bit of the code - the write routine. Please let me know if you would like the full listing.
; ************************************************ ; UWRITE sends a file in fcb to the udrive ; declare local variables RECORDCOUNT: DW 0,0 ; number of records SIZESTRING: DB 'NNNN$' ; 4 bytes UERRSTRING: DB 13,10,'ERROR - RUN USTART.COM TO RESET$' BLOCKCOUNT: DB 0 ; 4 lots of 32 bytes in udrive per 128 byte recored DMACOUNT: DW 0,0 ; dma counter RECORDSTRING: DB 'RECORDS$' BYTESTRING: DB 'BYTES$'
UWRITE: CALL CONCLEAR ; clear the uart buffer ? not needed CALL GET_COMMAND_STRING ; user passes the filename CALL SPLIT_COMMAND ; returns filename and fileext CALL FILENAME_TO_FCB ; put filename and extension string to fcb CALL FILE_SIZE ; uses fcb, returns de records LD (RECORDCOUNT),DE ; store it for later
; CALL PRINT_DE ; LD DE,RECORDSTRING ; CALL WRITE_STRING_CR ; print number of records
LD DE,(RECORDCOUNT) ; number of records LD BC,128 ; get records CALL MUL16 ; BC*DE=DEHL number of bytes LD IX,SIZESTRING LD (IX+0),D ; store 4 size bytes LD (IX+1),E LD (IX+2),H LD (IX+3),L ; CALL PRINT_HL ; LD DE,BYTESTRING ; CALL WRITE_STRING_CR
LD IX,SIZESTRING CALL PRINT_COPY_TIME
LD DE,STRING1 CALL STRINGS_CLEAR ; clear the string LD DE,FILENAME LD HL,STRING1 CALL STRINGS_COPY ; filename to string1 LD A,'.' LD DE,STRING1 CALL STRINGS_ADD_CHAR ; add the . LD BC,STRING1 LD DE,FILEEXT LD HL,STRING2 CALL STRINGS_CONCAT ; answer in string2
CALL PORT_3 ; talk to udrive LD E,40H CALL WRITE_CONSOLE ; write @t packetsize filename 0 size wait packet1 wait packet2 LD E,74H CALL WRITE_CONSOLE LD E,32 ; 32 bytes per packet CALL WRITE_CONSOLE LD DE,STRING2 CALL WRITE_STRING ; filename myfile.ext LD E,0 CALL WRITE_CONSOLE ; 0 at end LD DE,SIZESTRING ; 4 bytes CALL WRITE_STRING ; send them out CALL OPEN_FILE ; open the file at the fcb
; note that up until here we have been printing via the fdos commands through cp/m ; from now on use local conin and conout as bypasses lcd display and keyboard checks so is faster CALL CONIN_TIMEOUT CP 15 ; error if NAK. Ok if times out or ACK JP Z,U_WRITE_ERR UWRITE1: CALL READ_SEQ ; get 128 bytes from drive A file 0=success 1=fail eg eof CP 1 ; is it the eof? JP Z,UWRITE4 LD A,4 ; count down from 4 for 32x4=128 LD (BLOCKCOUNT),A ; store it LD HL,80H ; setup dma counter LD (DMACOUNT),HL UWRITE2: ; send out 32 bytes LD B,32 ; 32 bytes UWRITE3: LD HL,(DMACOUNT) ; get the counter LD A,(HL) ; get the byte LD E,A ; ready to send out PUSH BC ; store the counter ; CALL WRITE_CONSOLE ; send it (fast local with conout, write_console has lcd etc) CALL CONOUT ; CONOUT needs a delay, ? how short (1ms is working) LD A,1 ; 1ms delay maybe it can go faster CALL DELAY_MILLISECOND ; sdelay is too fast though. ; CALL SDELAY POP BC LD HL,(DMACOUNT) ; get the counter INC HL ; add one LD (DMACOUNT),HL ; store it DJNZ UWRITE3 ; loop until counter =0 CALL CONIN_TIMEOUT ; get ack CP 15 ; error if NAK. Ok if times out or ACK JP Z,U_WRITE_ERR LD A,(BLOCKCOUNT) ; 1 of 4 blocks to send DEC A LD (BLOCKCOUNT),A ; store it CP 0 ; zero? JP NZ UWRITE2 ; no, so do 4 x ; is this the last record? LD DE,(RECORDCOUNT) DEC DE LD (RECORDCOUNT),DE JP UWRITE1 ; get the next record
UWRITE4: ; finish up CALL CLOSE_FILE CALL PORT_0 ; back to console CALL CONIN_TIMEOUT ; collect the final ^F if there is one RET U_WRITE_ERR: CALL PORT_0 LD DE,UERRSTRING CALL WRITE_STRING_CR CALL CLOSE_FILE RET |