1
0
mirror of https://github.com/fruit-bat/pico-zxspectrum.git synced 2025-04-19 00:04:01 +03:00
pico-zxspectrum/src/PulseProcStdByteStream.cpp
2022-10-30 15:20:25 +00:00

48 lines
787 B
C++

#include "PulseProcStdByteStream.h"
PulseProcStdByteStream::PulseProcStdByteStream(PulseProcStdByte* ppb) :
_ppb(ppb),
_l(0)
{}
void PulseProcStdByteStream::init(PulseProc *nxt, uint32_t l) {
next(nxt);
_l = l;
_ts0 = 855;
_ts1 = 1710;
_blb = 8;
}
void PulseProcStdByteStream::init(
PulseProc *nxt,
uint32_t l,
uint32_t ts0,
uint32_t ts1,
uint32_t blb
) {
next(nxt);
_l = l;
_ts0 = ts0;
_ts1 = ts1;
_blb = blb;
}
int32_t __not_in_flash_func(PulseProcStdByteStream::advance)(
InputStream *is,
bool *pstate,
PulseProc **top
) {
if (_l == 0) return PP_COMPLETE;
int32_t r = is->readByte();
if (r < 0) return PP_ERROR;
_ppb->init(
this,
r,
--_l == 0 ? _blb : 8,
_ts0,
_ts1
);
*top = _ppb;
return PP_CONTINUE;
}