pcw8256: Continued work
authorAlan Cox <alan@etchedpixels.co.uk>
Tue, 18 Nov 2014 11:55:33 +0000 (11:55 +0000)
committerAlan Cox <alan@etchedpixels.co.uk>
Tue, 18 Nov 2014 11:55:33 +0000 (11:55 +0000)
This fixes parts of the floppy logic and moves kernel_flag as per core
changes.

We now load the superblock correctly but things to castors up when we start
to load init. We appear to be asking for the right track/sector but more
debugging is needed.

Kernel/platform-pcw8256/fdc765.s
Kernel/platform-pcw8256/pcw8256.s

index 5f76b8a..bbd40bc 100644 (file)
@@ -92,13 +92,14 @@ _fd765_intwait:
                ;
                ;       Check what is pending on the interrupt side
                ;
+               ld hl, #0xffff                  ; report -1 if not pending
                in a, (0xF8)
                bit 5, a
                ret z                           ; wait for the 765 int to go off
                ;
                ;       Send the sense command, get the status back
                ;
-               ld hl, #fd765_sense             ; a suitable 0x08 in the code
+               ld hl, #fd765_sense             ; sense command
                call fd765_sendcmd
                call fd765_status_a
                bit 7, a                        ; error
@@ -223,11 +224,12 @@ read_kern:
                ld b, #0                        ; 512 bytes
                call fd765_xfer_in
                jr nz, read_failed
-               call fd765_status_a
-               and #0xCB
-               jr nz, read_out
-               ; read ok
+read_status:                                   ; clean up is shared
+               call fd765_status_a             ; with write method
                ld hl, #0
+               and #0xF8
+               jr nz, read_failed
+               ; read ok
 read_out:
                call map_kernel
                pop af
@@ -235,7 +237,7 @@ read_out:
                ei
                ret
 read_failed:
-               ld hl, #-1
+               dec hl
                jr read_out
 
 ;
@@ -265,12 +267,7 @@ write_kern:
                ld b, #0                        ; 512 bytes
                call fd765_xfer_out
                jr nz, read_failed
-               call fd765_status_a
-               and #0xCB               ; FIXME - correct error mask ?
-               jr nz, read_out
-               ; write ok
-               ld hl, #0
-               jr read_out
+               jr read_status
 
 _fd765_cmd2:   call _fd765_intwait
                ld b, #2
index 4400f11..cd649c5 100644 (file)
@@ -127,6 +127,8 @@ init_hardware:
 
             .area _COMMONMEM
 
+_kernel_flag:
+           .db 1
 
 _program_vectors:
             ; we are called, with interrupts disabled, by both newproc() and crt0