mirror of
https://github.com/buserror/mii_emu.git
synced 2024-11-22 01:30:51 +00:00
Added a mii_cycle_t type
Instead of using the sub-standard __int128 Signed-off-by: Michel Pollet <buserror@gmail.com>
This commit is contained in:
parent
af6ff70155
commit
cdca612df2
@ -10,6 +10,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "mii_types.h"
|
||||
#include "mii_65c02.h"
|
||||
#include "mii_dd.h"
|
||||
#include "mii_bank.h"
|
||||
@ -17,6 +18,7 @@
|
||||
#include "mii_video.h"
|
||||
#include "mii_speaker.h"
|
||||
#include "mii_mouse.h"
|
||||
#include "mii_analog.h"
|
||||
|
||||
enum {
|
||||
MII_BANK_MAIN = 0, // main 48K address space
|
||||
@ -76,12 +78,13 @@ typedef struct mii_trace_t {
|
||||
uint32_t step_inst;
|
||||
} mii_trace_t;
|
||||
|
||||
|
||||
/*
|
||||
* principal emulator state, for a faceless emulation
|
||||
*/
|
||||
typedef struct mii_t {
|
||||
unsigned int state;
|
||||
__uint128_t cycles;
|
||||
mii_cycles_t cycles;
|
||||
/* this is the video frame/VBL rate vs 60hz, default to 1.0 */
|
||||
float speed;
|
||||
float speed_current; // calculated speed
|
||||
@ -121,6 +124,7 @@ typedef struct mii_t {
|
||||
mii_speaker_t speaker;
|
||||
mii_mouse_t mouse;
|
||||
mii_dd_system_t dd;
|
||||
mii_analog_t analog;
|
||||
} mii_t;
|
||||
|
||||
enum {
|
||||
|
@ -156,7 +156,7 @@ mii_speaker_click(
|
||||
// if we've gone past the end of the frame, switch to the next one
|
||||
if (sample_index >= s->fsize) {
|
||||
sample_index = sample_index % s->fsize;
|
||||
__uint128_t newstart = s->mii->cycles - (sample_index * s->clk_per_sample);
|
||||
mii_cycles_t newstart = s->mii->cycles - (sample_index * s->clk_per_sample);
|
||||
s->findex = (s->findex + 1) % MII_SPEAKER_FRAME_COUNT;
|
||||
f = &s->frame[s->findex];
|
||||
f->start = newstart;
|
||||
|
@ -17,8 +17,8 @@ struct snd_pcm_t;
|
||||
typedef int16_t mii_audio_sample_t;
|
||||
|
||||
typedef struct mii_audio_frame_t {
|
||||
__uint128_t start;
|
||||
uint16_t fill;
|
||||
mii_cycles_t start;
|
||||
uint16_t fill;
|
||||
mii_audio_sample_t * audio;
|
||||
} mii_audio_frame_t;
|
||||
|
||||
|
14
src/mii_types.h
Normal file
14
src/mii_types.h
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* mii_types.h
|
||||
*
|
||||
* Copyright (C) 2023 Michel Pollet <buserror@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef __uint128_t mii_cycles_t;
|
@ -8,9 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "mii_types.h"
|
||||
|
||||
// TODO move VRAM stuff to somewhere else
|
||||
/*
|
||||
@ -32,14 +30,14 @@ enum {
|
||||
struct mii_t;
|
||||
|
||||
typedef struct mii_video_t {
|
||||
void * state; // protothread state in mii_video.c
|
||||
uint8_t line; // current line
|
||||
bool vbl_irq; // VBL IRQ emabled (set by mouse card)
|
||||
__uint128_t wait; // 'wait until' cycle marker
|
||||
uint32_t pixels[MII_VRAM_WIDTH * MII_VRAM_HEIGHT];
|
||||
uint32_t frame_count; // incremented every frame
|
||||
uint32_t frame_drawn;
|
||||
uint8_t color_mode; // color, green, amber
|
||||
void * state; // protothread state in mii_video.c
|
||||
uint8_t line; // current line
|
||||
bool vbl_irq; // VBL IRQ emabled (set by mouse card)
|
||||
mii_cycles_t wait; // 'wait until' cycle marker
|
||||
uint32_t pixels[MII_VRAM_WIDTH * MII_VRAM_HEIGHT];
|
||||
uint32_t frame_count; // incremented every frame
|
||||
uint32_t frame_drawn;
|
||||
uint8_t color_mode; // color, green, amber
|
||||
} mii_video_t;
|
||||
|
||||
bool
|
||||
|
Loading…
Reference in New Issue
Block a user