/* SPDX-License-Identifier: GPL-3.0-or-later */
#include <cmoc.h>
#include <decbfile.h>
#include "hello.h"

static DECBDrive drives[1];
static DECBFile file;
static byte words[256];

byte showDiskWords(void)
{
    byte status = decb_init(drives, 1);
    if (status != DECB_OK)
        return status;
    status = decb_registerDrive(0);
    if (status == DECB_OK)
        status = decb_openSectorFile(&file, 0, "WORDS.DAT");
    if (status == DECB_OK)
    {
        status = decb_readSector(&file, words, 0);
        words[255] = 0;
        if (status == DECB_OK)
            printf("%s\n", words);
        decb_closeSectorFile(&file);
    }
    decb_shutdown();
    return status;
}
