import "io" let fill_block(b, letter) be // fills a 512 byte buffer with as many copies of the // alphabet as will fit, but starts from the given letter // instead of 'a', so we can make many recognisably // different patterns. Then writes it to block b of the disc. { let buffer = vec 128; let x; for i = 0 to 511 do { byte i of buffer := letter; test letter = 'z' \/ letter = 'Z' then letter -:= 25 else letter +:= 1 } x := devctl(DC_DISC_WRITE, 1, b, 1, buffer); out("status of write to block %d: %d\n", b, x) } let show_block(b) be // reads the indicated block from disc into a buffer just // bigger than is needed. Assuming the block contains just // printable characters, it puts a zero after the end to // make it a proper string, then prints it. { let buffer = vec 129; devctl(DC_DISC_READ, 1, b, 1, buffer); byte 512 of buffer := 0; out("from block %d: \"%s\"\n", b, buffer) } let start() be { fill_block(1, 'a'); fill_block(2, 'A'); fill_block(3, 'm'); show_block(1); show_block(2); show_block(3) }