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

#include <vdp2/scrn.h>

#include <assert.h>

#include "vdp2-internal.h"

void
vdp2_scrn_reduction_set(uint8_t scrn, uint16_t horz_reduction)
{
#ifdef DEBUG
        /* Check if the background passed is valid */
        assert((scrn == SCRN_NBG0) ||
               (scrn == SCRN_NBG1));

        assert((horz_reduction == SCRN_REDUCTION_NONE) ||
               (horz_reduction == SCRN_REDUCTION_HALF) ||
               (horz_reduction == SCRN_REDUCTION_QUARTER));
#endif /* DEBUG */

        switch (scrn) {
        case SCRN_NBG0:
                vdp2_state.buffered_regs.zmctl &= 0xFFFC;
                vdp2_state.buffered_regs.zmctl |= horz_reduction;
                break;
        case SCRN_NBG1:
                vdp2_state.buffered_regs.zmctl &= 0xFCFF;
                vdp2_state.buffered_regs.zmctl |= horz_reduction << 8;
                break;
        default:
                return;
        }

        /* Write to memory */
        MEMORY_WRITE(16, VDP2(MZCTL), vdp2_state.buffered_regs.zmctl);
}<commit_msg>Fix writing to wrong register<commit_after>/*
 * Copyright (c) 2012-2016 <NAME>
 * See LICENSE for details.
 *
 * <NAME> <<EMAIL>>
 */

#include <vdp2/scrn.h>

#include <assert.h>

#include "vdp2-internal.h"

void
vdp2_scrn_reduction_set(uint8_t scrn, uint16_t horz_reduction)
{
#ifdef DEBUG
        /* Check if the background passed is valid */
        assert((scrn == SCRN_NBG0) ||
               (scrn == SCRN_NBG1));

        assert((horz_reduction == SCRN_REDUCTION_NONE) ||
               (horz_reduction == SCRN_REDUCTION_HALF) ||
               (horz_reduction == SCRN_REDUCTION_QUARTER));
#endif /* DEBUG */

        switch (scrn) {
        case SCRN_NBG0:
                vdp2_state.buffered_regs.zmctl &= 0xFFFC;
                vdp2_state.buffered_regs.zmctl |= horz_reduction;
                break;
        case SCRN_NBG1:
                vdp2_state.buffered_regs.zmctl &= 0xFCFF;
                vdp2_state.buffered_regs.zmctl |= horz_reduction << 8;
                break;
        default:
                return;
        }

        /* Write to memory */
        MEMORY_WRITE(16, VDP2(ZMCTL), vdp2_state.buffered_regs.zmctl);
}
{'fraction_non_alphanumeric': 0.11365638766519824, 'fraction_numerical': 0.02555066079295154, 'mean_word_length': 2.0565275908479137, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 15, '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': '3624472', 'n_tokens_mistral': 853, 'n_tokens_neox': 783, 'n_words': 140}