;* readsector takes a handle an buffer an address and number of bytes to read, ;* should be a multiple of 512. ;* FIX: buffers should be checked (de readsector (handle buffer address bytes drive offset) (setq handle (cdr (strtok (car handle) "/"))) (setq drive (eval (string_to_atom (car handle)))) (setq handle (cddr handle)) (cond ((nilp address) (setq address (strtol (car handle) 10)))) (cond ((nilp bytes) (setq bytes (strtol (cdar handle) 10)))) (cond ((nilp address) (setq address 0))) (cond ((nilp bytes) (setq bytes 512))) (setq offset 0) (while (gt bytes 0) (cond ((nilp (array drive address)) (array drive address (new 512))) ) (cond ((lt bytes 512) (memcpy (add buffer offset) (array drive address) bytes)) (t (memcpy (add buffer offset) (array drive address) 512)) ) (setq address (add address 1)) (setq bytes (sub bytes 512)) (setq offset (add offset 512)) ) ) ;* writesector takes a handle an buffer an address and number of bytes to write, ;* should be a multiple of 512. ;* FIX: buffers should be checked (de writesector (handle buffer address bytes) (setq handle (cdr (strtok (car handle) "/"))) (setq drive (eval (string_to_atom (car handle)))) (setq handle (cddr handle)) (cond ((nilp address) (setq address (strtol (car handle) 10)))) (cond ((nilp bytes) (setq bytes (strtol (cdar handle) 10)))) (cond ((nilp address) (setq address 0))) (cond ((nilp bytes) (setq bytes 512))) (setq offset 0) (while (gt bytes 0) (cond ((nilp (array drive address)) (array drive address (new 512))) ) (cond ((lt bytes 512) (memcpy (array drive address) (add buffer offset) bytes)) (t (memcpy (array drive address) (add buffer offset) 512)) ) (setq address (add address 1)) (setq bytes (sub bytes 512)) (setq offset (add offset 512)) ) bytes )