|
Post by mirkosoft on May 6, 2015 7:54:55 GMT
Hi!
I want to recognize if is not disk in floppy drive or is there and is not formatted or had corrupted/unsupported format... At check to use recognizing CBMDOS disk and CP/M disk, if no match output message: DISK IN DRIVE IS NOT FORMATTED! FORMAT IT NOW?
Thank you for all ideas how to do it.
Miro
|
|
|
Post by cbmguy on May 14, 2015 18:16:31 GMT
It is possible to check if there is a disk in the drive by monitoring a memory location in the said drive (I cannot remember the exact location ATM). It is impossible to monitor the drive door in such a way, however. Assuming that you want to automate things somewhat in your program for the disk swapping and such: IMHO, since you can tell that there is a disk inserted or not, it would best to approach it like so: monitor the location for a disk inserted, loop back and wait if it's not. When true, wait a second or two to allow the user to close the drive door, then read from the drive. If it errors, ask the user a question: Did you close the drive door? Format disk? or go back to monitoring the disk insert and do it again until there is no error (which might end up looping infinitely), and then when everything is right (drive in and door shut) go on about the action with that returned event. I'll post the drive locations when I get home later in the day.
|
|
|
Post by mirkosoft on May 16, 2015 9:45:54 GMT
ok,thank you for this. please reply like you wrote.
many thanks, Miro
|
|
|
Post by cbmguy on May 19, 2015 13:29:59 GMT
; Check for the write protect byte/nibble in drive to monitor disk swap ;
print" please change disks." open 15,8,15 : gosub writeProtectCheck: if a<>0 then :- ; rem wait for disk to be removed : gosub writeProtectCheck: if a<>16 then :- ; rem wait for no disk in drive : gosub writeProtectCheck: if a<>0 then :- ; rem wait for disk to be inserted for d = "I to 1500: next: close 15 print "ok, thanks!" end
writeProtectCheck: print#15,"m-r";chr$(0)chr$(28)chr$(1):get#15,a$:a = asc(a$)and16 return
Hope this helps. Still not fool proof... It never will be unless you access the drive and check the error channel or disk ID or whatever, but this does remove the user tapping a key, etc.
|
|
|
Post by hydrophilic on May 20, 2015 6:33:46 GMT
Wow, cbmguy, I've written lots of CBM disk code (BASIC/ML software and 15x1 firmware), but this is the first time I have seen code like yours!! I must study...
Obviously, thanks for sharing your wisdom with the rest of us!
|
|
badco
Windows User
Posts: 8
|
Post by badco on Jun 19, 2015 14:42:09 GMT
Here are the bit breakdowns for 1C00
$1C00 DSKCNT
DISK CONTROLLER 6522 ($1C00-$1C0F)
DATA PORT B - Disk controller I/O
Bit. 0 - $01 Bit.s 0 & 1 are cycled to
Bit. 1 - $02 step t.he head
Bit 2 - $04 Motor on (1) or off (0)
Bit- 3 - $08 Drive active LED on/off
Bit 4 - $10 Write protect sense
Bit 5 - $20 Density select (0)
Bit 6 - $40 Density select (1)
Bit 7 - $80 SYNC detect line
|
|
wegi
KIM-1 User
Posts: 35
|
Post by wegi on Nov 29, 2017 9:45:05 GMT
!to "check.prg" , CBM
;===========================
;=== basiline 0 sys 2061 ===
;===========================
*=$0801
!byte $0b,$08,$00,$00,$9e,$32
!byte $30,$36,$31,$00,$00,$00
;-------------
;======================
;--------
rerun
lda $ba
cmp #8
bcs cnt1
cnt2 lda #$08
sta $ba
cnt1 cmp #12
bcs cnt2
jsr listen
bit $90
bpl okay
lda #<tx_dnot
ldy #>tx_dnot
repaint
jsr $ab1e
lda #$00
sta $c6
cnt3 lda $c6
beq cnt3
jmp rerun
okay
lda #$49 ;"I"
jsr $ffa8
jsr $ffae
lda #$0d
jsr $ffd2
lda $ba
jsr $ffb4
lda #$6f
jsr $ff96
jsr $ffa5
pha
jsr $ffd2
cnt5 jsr $ffa5
cmp #$0d
beq cnt4
jsr $ffd2
jmp cnt5
cnt4 jsr $ffd2
jsr $ffab
pla
cmp #$30
bne cnt6
lda #$00
sta $c6
clc
rts
cnt6 lda #<tx_what
ldy #>tx_what
jmp repaint
;========
listen
lda $ba
jsr $ffb1
lda #$00
sta $90
lda #$6f
jmp $ff93
;--------
tx_what
!byte 13,13
!text "WHAT NOW DUDE ?"
!byte 13
!text "PRESS ANY KEY TO RESTART"
!byte 13,13,0
tx_dnot
!byte 147
!text "DEVICE NOT PRESENT"
!byte 13
!text "PLEASSE TURN ON THE DRIVE"
!byte 13
!text "AND PRESS ANY KEY"
!byte 0
|
|