<commit_before>/*
 * Copyright (c) 2012 <NAME>
 * See LICENSE for details.
 *
 * <NAME> <<EMAIL>>
 */

#include <vdp2.h>
#include <smpc.h>
#include <smpc/peripheral.h>

#include <cons/vdp2.h>

#include <stdio.h>
#include <stdbool.h>

int
main(void)
{
#define IS_BUTTON_PRESSED(p, s) ((p) ? "[1;37;0;42m"s"[m" : "*")

        static char text[2048];

        uint16_t blcs_color[] = {
                0x9C00
        };

        struct smpc_peripheral_digital *pad;
        struct cons cons;

        vdp2_init();
        vdp2_tvmd_blcs_set(/* lcclmd = */ false, VRAM_ADDR_4MBIT(3, 0x1FFFE),
            blcs_color, 0);

        smpc_init();

        cons_vdp2_init(&cons);

        pad = (struct smpc_peripheral_digital *)&smpc_peripheral_port1.info;

        while (true) {
                vdp2_tvmd_vblank_in_wait();
                vdp2_tvmd_vblank_out_wait();

                (void)sprintf(text,
                    "[1;32;1;45mConsole (cons) example[m\n"
                    "\n"
                    "PORT: %d        PORT: %d\n"
                    "TYPE: 0x%02X     TYPE: 0x%02X\n"
                    "SIZE: %dB       SIZE: %dB\n"
                    "DATA[ 0]: [1;46m0x%02X[m DATA[ 0]: [1;37;1;45m0x%02X[m\n"
                    "DATA[ 1]: [1;37;1;45m0x%02X[m DATA[ 1]: [1;37;1;45m0x%02X[m\n"
                    "DATA[ 2]: [1;37;1;40m0x%02X[m DATA[ 2]: [1;37;1;45m0x%02X[m\n"
                    "DATA[ 3]: [1;34;1;43m0x%02X[m DATA[ 3]: [1;37;1;45m0x%02X[m\n"
                    "DATA[ 4]: [1;34;1;42m0x%02X[m DATA[ 4]: [1;37;1;45m0x%02X[m\n"
                    "DATA[ 5]: [1;37;1;41m0x%02X[m DATA[ 5]: [1;37;1;45m0x%02X[m\n"
                    "DATA[ 6]: [1;37;1;45m0x%02X[m DATA[ 6]: [1;37;1;45m0x%02X[m\n"
                    "DATA[ 7]: [1;37;1;45m0x%02X[m DATA[ 7]: [1;37;1;45m0x%02X[m\n"
                    "DATA[ 8]: [1;37;1;44m0x%02X[m DATA[ 8]: [1;37;1;44m0x%02X[m\n"
                    "DATA[ 9]: [1;31;1;44m0x%02X[m DATA[ 9]: [1;31;1;44m0x%02X[m\n"
                    "DATA[10]: [1;31;1;44m0x%02X[m DATA[10]: [1;31;1;44m0x%02X[m\n"
                    "DATA[11]: [1;31;1;44m0x%02X[m DATA[11]: [1;31;1;44m0x%02X[m\n"
                    "DATA[12]: [1;31;1;44m0x%02X[m DATA[12]: [1;31;1;44m0x%02X[m\n"<commit_msg>Make cosmetic changes to output of cons example<commit_after>/*
 * Copyright (c) 2012 <NAME>
 * See LICENSE for details.
 *
 * <NAME> <<EMAIL>>
 */

#include <vdp2.h>
#include <smpc.h>
#include <smpc/peripheral.h>

#include <cons/vdp2.h>

#include <stdio.h>
#include <stdbool.h>

int
main(void)
{
#define IS_BUTTON_PRESSED(p, s) ((p) ? "[1;37;0;42m"s"[m" : "*")

        static char text[2048];

        uint16_t blcs_color[] = {
                0x9C00
        };

        struct smpc_peripheral_digital *pad;

        struct cons cons;

        vdp2_init();
        vdp2_tvmd_blcs_set(/* lcclmd = */ false, VRAM_ADDR_4MBIT(3, 0x1FFFE),
            blcs_color, 0);

        smpc_init();

        cons_vdp2_init(&cons);

        pad = (struct smpc_peripheral_digital *)&smpc_peripheral_port1.info;

        while (true) {
                vdp2_tvmd_vblank_in_wait();
                vdp2_tvmd_vblank_out_wait();

                (void)sprintf(text,
                    "[1;32;1;45m    *** Console (cons component) ***    [m\n"
                    "\n"
                    "PORT: %d        PORT: %d\n"
                    "TYPE: 0x%02X     TYPE: 0x%02X\n"
                    "SIZE: %dB       SIZE: %dB\n"
                    "DATA[ 0]: [1;46m0x%02X[m DATA[ 0]: [1;37;1;45m0x%02X[m\n"
                    "DATA[ 1]: [1;37;1;45m0x%02X[m DATA[ 1]: [1;37;1;45m0x%02X[m\n"
                    "DATA[ 2]: [1;37;1;40m0x%02X[m DATA[ 2]: [1;37;1;45m0x%02X[m\n"
                    "DATA[ 3]: [1;34;1;43m0x%02X[m DATA[ 3]: [1;37;1;45m0x%02X[m\n"
                    "DATA[ 4]: [1;34;1;42m0x%02X[m DATA[ 4]: [1;37;1;45m0x%02X[m\n"
                    "DATA[ 5]: [1;37;1;41m0x%02X[m DATA[ 5]: [1;37;1;45m0x%02X[m\n"
                    "DATA[ 6]: [1;37;1;45m0x%02X[m DATA[ 6]: [1;37;1;45m0x%02X[m\n"
                    "DATA[ 7]: [1;37;1;45m0x%02X[m DATA[ 7]: [1;37;1;45m0x%02X[m\n"
                    "DATA[ 8]: [1;37;1;44m0x%02X[m DATA[ 8]: [1;37;1;44m0x%02X[m\n"
                    "DATA[ 9]: [1;31;1;44m0x%02X[m DATA[ 9]: [1;31;1;44m0x%02X[m\n"
                    "DATA[10]: [1;31;1;44m0x%02X[m DATA[10]: [1;31;1;44m0x%02X[m\n"
                    "DATA[11]: [1;31;1;44m0x%02X[m DATA[11]: [1;31;1;44m0x%02X[m\n"
                    "DATA[12]: [1;31;1;44m0x%02X[m DATA[12]: [1;31;1;44m0x%02X[m\n"
{'fraction_non_alphanumeric': 0.21263748113004097, 'fraction_numerical': 0.13284451153763208, 'mean_word_length': 2.0333551340745584, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3668663', 'n_tokens_mistral': 2554, 'n_tokens_neox': 2121, 'n_words': 305}