├── .ackrc ├── .gitignore ├── editor ├── 12 ├── charrom.bin ├── kernal.bin ├── packed.prg ├── sidplayfp │ ├── reloc65.h │ ├── reloc65.cpp │ ├── c64 │ │ ├── CIA │ │ │ └── timer.h │ │ ├── c64sid.h │ │ ├── CPU │ │ │ └── mos6510debug.h │ │ ├── c64cpu.h │ │ ├── Banks │ │ │ ├── DisconnectedBusBank.h │ │ │ ├── NullSid.h │ │ │ ├── ColorRAMBank.h │ │ │ ├── IOBank.h │ │ │ ├── SystemRAMBank.h │ │ │ ├── SidBank.h │ │ │ ├── Bank.h │ │ │ └── ExtraSidBank.h │ │ ├── c64vic.h │ │ ├── c64env.h │ │ ├── mmu.cpp │ │ └── c64cia.h │ ├── utils │ │ ├── MD5 │ │ │ └── MD5_Defs.h │ │ ├── iniParser.h │ │ ├── SidDatabase.h │ │ ├── STILview │ │ │ └── stildefs.h │ │ └── iniParser.cpp │ ├── sidtune │ │ ├── SidTuneCfg.h │ │ ├── prg.h │ │ ├── p00.h │ │ ├── PSID.h │ │ ├── SidTuneTools.h │ │ ├── prg.cpp │ │ ├── MUS.h │ │ └── SidTuneTools.cpp │ ├── sidemu.cpp │ ├── component.h │ ├── sidrandom.h │ ├── SidConfig.cpp │ ├── EventScheduler.cpp │ ├── sidbuilder.cpp │ ├── sidmd5.h │ ├── SidInfo.h │ ├── siddefs.h │ ├── psiddrv.h │ ├── sidemu.h │ ├── stringutils.h │ ├── sidmemory.h │ ├── sidplayfp.cpp │ ├── SidInfoImpl.h │ ├── SidConfig.h │ └── SidTune.cpp ├── resources.qrc ├── main.cpp ├── residfp-builder │ ├── residfp │ │ ├── AUTHORS │ │ ├── README │ │ ├── Filter8580.cpp │ │ ├── Integrator.cpp │ │ ├── version.cc │ │ ├── Potentiometer.h │ │ ├── ExternalFilter.cpp │ │ ├── siddefs-fp.h │ │ ├── array.h │ │ ├── Spline.h │ │ ├── resample │ │ │ ├── Resampler.h │ │ │ ├── ZeroOrderResampler.h │ │ │ └── TwoPassSincResampler.h │ │ ├── Filter6581.cpp │ │ ├── Filter.cpp │ │ ├── OpAmp.cpp │ │ ├── Dac.h │ │ ├── Dac.cpp │ │ ├── ExternalFilter.h │ │ ├── Voice.h │ │ ├── OpAmp.h │ │ ├── Spline.cpp │ │ └── Filter.h │ ├── residfp-emu.h │ ├── residfp.h │ └── residfp-builder.cpp ├── sidplayer.h ├── vicpalette.h ├── animation.h ├── animationplayer.h ├── animationplayer.cpp ├── siddevice.h ├── mainwindow.h ├── mainwindow.cpp ├── putchar.h ├── sidplayer.cpp ├── mainwindow.ui ├── animation.cpp ├── screen.h ├── siddevice.cpp └── screen.cpp ├── src ├── loader.s ├── keybuf.c ├── screen.h ├── anim.h ├── keyframe.h ├── music.h ├── irq.h ├── rledec.h ├── disk.h ├── fastload.h ├── keybuf.h ├── music.s ├── movie.h ├── keys.h ├── screen.c ├── rotchars.h ├── keyhandler.h ├── rledec.c ├── fastload.s ├── irq.s ├── opt.s ├── main.c ├── rotchars.c ├── cfg_unp.s ├── nop.cfg ├── disk.c ├── cfg_2bit.s ├── rotchars_p.s └── movie.c ├── res └── lightforce ├── .editorconfig ├── .lvimrc ├── .github └── workflows │ └── build.yml ├── LICENSE ├── README.md ├── Makefile └── CHANGELOG.md /.ackrc: -------------------------------------------------------------------------------- 1 | --ignore-dir=build 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.d64 2 | *.lbl 3 | *.map 4 | build 5 | nop 6 | tags 7 | -------------------------------------------------------------------------------- /editor/12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkotlinski/noperator/HEAD/editor/12 -------------------------------------------------------------------------------- /src/loader.s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkotlinski/noperator/HEAD/src/loader.s -------------------------------------------------------------------------------- /res/lightforce: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkotlinski/noperator/HEAD/res/lightforce -------------------------------------------------------------------------------- /src/keybuf.c: -------------------------------------------------------------------------------- 1 | #include "keybuf.h" 2 | 3 | unsigned char* last_char = KEYS_START; 4 | -------------------------------------------------------------------------------- /editor/charrom.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkotlinski/noperator/HEAD/editor/charrom.bin -------------------------------------------------------------------------------- /editor/kernal.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkotlinski/noperator/HEAD/editor/kernal.bin -------------------------------------------------------------------------------- /editor/packed.prg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkotlinski/noperator/HEAD/editor/packed.prg -------------------------------------------------------------------------------- /editor/sidplayfp/reloc65.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkotlinski/noperator/HEAD/editor/sidplayfp/reloc65.h -------------------------------------------------------------------------------- /editor/sidplayfp/reloc65.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkotlinski/noperator/HEAD/editor/sidplayfp/reloc65.cpp -------------------------------------------------------------------------------- /editor/sidplayfp/c64/CIA/timer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkotlinski/noperator/HEAD/editor/sidplayfp/c64/CIA/timer.h -------------------------------------------------------------------------------- /src/screen.h: -------------------------------------------------------------------------------- 1 | #define SCREEN_REFRESH_RATE 50 // PAL 2 | 3 | void init_screen(void); 4 | void reset_screen_and_font_address(); 5 | -------------------------------------------------------------------------------- /src/anim.h: -------------------------------------------------------------------------------- 1 | #ifndef ANIM_H 2 | #define ANIM_H 3 | 4 | void anim_editor(void); 5 | void anim_reset(void); 6 | 7 | #endif /* ANIM_H */ 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.{c,h,s}] 4 | indent_style = space 5 | indent_size = 4 6 | 7 | [*] 8 | insert_final_newline = true 9 | -------------------------------------------------------------------------------- /src/keyframe.h: -------------------------------------------------------------------------------- 1 | #ifndef KF_H 2 | #define KF_H 3 | 4 | void keyframe_editor(void); 5 | 6 | #define KEYFRAME_SPEED_NONE 0x8f8fu /* Ad hoc. */ 7 | 8 | #endif /* KF_H */ 9 | -------------------------------------------------------------------------------- /src/music.h: -------------------------------------------------------------------------------- 1 | #ifndef MUSIC_H 2 | #define MUSIC_H 3 | 4 | void __fastcall__ init_music(void); 5 | 6 | extern unsigned char ticks_per_step; 7 | 8 | #endif /* MUSIC_H */ 9 | -------------------------------------------------------------------------------- /.lvimrc: -------------------------------------------------------------------------------- 1 | map :wall!:!ctags -R . &:make -j 2 && make run 2 | map :make run 3 | 4 | set tags+=~/.vim/cc65tags 5 | 6 | set errorformat=%f(%l):\ Error:\ %m 7 | -------------------------------------------------------------------------------- /src/irq.h: -------------------------------------------------------------------------------- 1 | void __fastcall__ setup_irq(void); 2 | void __fastcall__ start_playing(void); 3 | void __fastcall__ stop_playing(void); 4 | 5 | extern volatile unsigned char ticks; 6 | -------------------------------------------------------------------------------- /src/rledec.h: -------------------------------------------------------------------------------- 1 | /* Returns number of bytes that are available for 2 | * consumption through rlechar() after decoding ch. 3 | */ 4 | unsigned char rle_dec(unsigned char ch); 5 | extern unsigned char rle_char; 6 | -------------------------------------------------------------------------------- /src/disk.h: -------------------------------------------------------------------------------- 1 | #ifndef DISK_H 2 | #define DISK_H 3 | 4 | char mygets(char* buf); 5 | void ls(void); 6 | unsigned int prompt_load_anim(void); 7 | void prompt_save_anim(void); 8 | 9 | #endif /* DISK_H */ 10 | -------------------------------------------------------------------------------- /src/fastload.h: -------------------------------------------------------------------------------- 1 | void __fastcall__ loader_init(void); 2 | void __fastcall__ loader_load(const char* filename); 3 | void __fastcall__ loader_open(const char* filename); 4 | int __fastcall__ loader_getc(void); /* -1 = eof */ 5 | -------------------------------------------------------------------------------- /editor/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | kernal.bin 4 | packed.prg 5 | charrom.bin 6 | 12 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/keybuf.h: -------------------------------------------------------------------------------- 1 | #ifndef KEYBUF_H 2 | #define KEYBUF_H 3 | 4 | extern unsigned char _MAIN_LAST__; /* Defined by linker. */ 5 | #define KEYS_START (&_MAIN_LAST__) 6 | extern unsigned char* last_char; 7 | 8 | #endif /* KEYBUF_H */ 9 | -------------------------------------------------------------------------------- /editor/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | QApplication a(argc, argv); 7 | MainWindow w; 8 | w.show(); 9 | 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /editor/sidplayfp/utils/MD5/MD5_Defs.h: -------------------------------------------------------------------------------- 1 | #ifndef MD5_DEFS_H 2 | #define MD5_DEFS_H 3 | 4 | #include "sidplayfp/sidendian.h" 5 | 6 | #ifdef WORDS_BIGENDIAN 7 | # define MD5_WORDS_BIG_ENDIAN 8 | #endif 9 | 10 | #endif /* MD5_DEFS_H */ 11 | -------------------------------------------------------------------------------- /src/music.s: -------------------------------------------------------------------------------- 1 | .export _init_music 2 | .export _ticks_per_step 3 | 4 | _init_music: 5 | lda $1000 6 | cmp #$4c 7 | bne :+ 8 | lda #0 9 | tay 10 | jmp $1000 11 | : rts 12 | 13 | _ticks_per_step: 14 | .byte 7 ; lightforce 15 | -------------------------------------------------------------------------------- /src/movie.h: -------------------------------------------------------------------------------- 1 | #ifndef MOVIE_H 2 | #define MOVIE_H 3 | 4 | void write_movie(void); 5 | void scratch_movie(void); 6 | 7 | void select_music(void); 8 | void load_music(const char* filename); 9 | 10 | char play_movie(void); 11 | 12 | #endif /* MOVIE_H */ 13 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/AUTHORS: -------------------------------------------------------------------------------- 1 | Authors of reSIDfp. 2 | 3 | Dag Lem: Designed and programmed complete emulation engine. 4 | Antti S. Lankila: Distortion simulation and calculation of combined waveforms 5 | Ken Händel: source code conversion to Java 6 | Leandro Nini: port to c++ 7 | -------------------------------------------------------------------------------- /src/keys.h: -------------------------------------------------------------------------------- 1 | #ifndef KEYS_H 2 | #define KEYS_H 3 | 4 | #define CH_CLR 0x93 5 | 6 | #define CH_LEFTARROW 0x53 7 | 8 | #define CH_RUN 0x3 9 | #undef CH_STOP 10 | #define CH_STOP 0x83 11 | 12 | #define CH_RVS_ON 0x12 13 | #define CH_RVS_OFF 0x92 14 | 15 | #endif /* KEYS_H */ 16 | -------------------------------------------------------------------------------- /editor/sidplayer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class QAudioOutput; 4 | class SidDevice; 5 | 6 | class SidPlayer 7 | { 8 | public: 9 | SidPlayer(); 10 | ~SidPlayer(); 11 | 12 | void start(); 13 | 14 | private: 15 | QAudioOutput* audioOutput; 16 | SidDevice* sidDevice; 17 | }; 18 | -------------------------------------------------------------------------------- /src/screen.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void reset_screen_and_font_address() { 4 | *(char*)0xd018 = 0x1a; // screen = $400, font = $2800 5 | } 6 | 7 | void init_screen() { 8 | *(char*)0xd020 = 0; 9 | *(char*)0xd021 = 0; 10 | reset_screen_and_font_address(); 11 | memset((char*)0x400, ' ', 40 * 25); 12 | } 13 | -------------------------------------------------------------------------------- /src/rotchars.h: -------------------------------------------------------------------------------- 1 | #ifndef CHAR_ROT_H 2 | #define CHAR_ROT_H 3 | 4 | /* dir: 145=up, 17=down, 157=left, 29=right 5 | * speed: 0-9, where 0=off, 1=fastest, 9=slowest */ 6 | void rotate_char(unsigned char screencode, unsigned char dir, unsigned char period); 7 | 8 | void stop_char_rotations(void); 9 | 10 | void tick_rotate_chars(void); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /editor/vicpalette.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | static const QRgb vicPalette[16] = { // Pepto 6 | 0x000000u, 7 | 0xffffffu, 8 | 0x68372Bu, 9 | 0x70A4B2u, 10 | 0x6F3D86u, 11 | 0x588D43u, 12 | 0x352879u, 13 | 0xB8C76Fu, 14 | 0x6F4F25u, 15 | 0x433900u, 16 | 0x9A6759u, 17 | 0x444444u, 18 | 0x6C6C6Cu, 19 | 0x9AD284u, 20 | 0x6C5EB5u, 21 | 0x959595u 22 | }; 23 | -------------------------------------------------------------------------------- /editor/animation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class PutChar; 6 | class Screen; 7 | 8 | class Animation 9 | { 10 | public: 11 | Animation(); 12 | 13 | void step(Screen *screen); 14 | 15 | private: 16 | QByteArray data; 17 | size_t index = 2; // Skips adress. 18 | PutChar *putChar; 19 | int speed = 0; 20 | int getc(); 21 | 22 | int rleChar = 0; 23 | int rleLeft = 0; 24 | }; 25 | -------------------------------------------------------------------------------- /editor/animationplayer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class Animation; 6 | class Screen; 7 | 8 | class AnimationPlayer : public QObject 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | AnimationPlayer(Animation *animation, Screen *screen); 14 | 15 | void start(); 16 | 17 | public slots: 18 | void tick(); 19 | 20 | private: 21 | Animation *animation; 22 | Screen *screen; 23 | QTimer timer; 24 | }; 25 | -------------------------------------------------------------------------------- /src/keyhandler.h: -------------------------------------------------------------------------------- 1 | unsigned char handle(unsigned char ch, char first_keypress); 2 | void handle_rle(unsigned char ch); 3 | 4 | extern char playback_mode; // if set, some UI operations will be disabled 5 | extern char copy_mode; // don't allow playing in copy mode 6 | 7 | void cursor_home(void); 8 | unsigned char curx(void); 9 | unsigned char cury(void); 10 | extern unsigned char color; 11 | 12 | void show_cursor(void); 13 | void hide_cursor(void); 14 | 15 | void reset_keyhandler(void); 16 | 17 | #define MOVIE_START_MARKER 1 18 | -------------------------------------------------------------------------------- /editor/animationplayer.cpp: -------------------------------------------------------------------------------- 1 | #include "animationplayer.h" 2 | 3 | #include "animation.h" 4 | #include "screen.h" 5 | 6 | AnimationPlayer::AnimationPlayer(Animation *animation, Screen *screen) 7 | : animation(animation), 8 | screen(screen) { 9 | connect(&timer, SIGNAL(timeout()), this, SLOT(tick())); 10 | } 11 | 12 | void AnimationPlayer::start() { 13 | timer.start(); 14 | } 15 | 16 | void AnimationPlayer::tick() { 17 | animation->step(screen); 18 | screen->update(); // repaint hopefully not needed 19 | } 20 | -------------------------------------------------------------------------------- /editor/siddevice.h: -------------------------------------------------------------------------------- 1 | #ifndef SIDDEVICE_H 2 | #define SIDDEVICE_H 3 | 4 | #include 5 | #include 6 | 7 | class sidplayfp; 8 | class SidTune; 9 | 10 | class SidDevice : public QIODevice 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | SidDevice(); 16 | 17 | virtual void start() { 18 | open(ReadOnly); 19 | } 20 | 21 | virtual qint64 readData(char* buf, qint64 size); 22 | virtual qint64 writeData(const char*, qint64); 23 | 24 | private: 25 | sidplayfp* player; 26 | SidTune* tune; 27 | }; 28 | 29 | #endif // SIDDEVICE_H 30 | -------------------------------------------------------------------------------- /editor/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | class Animation; 7 | class AnimationPlayer; 8 | class SidPlayer; 9 | 10 | namespace Ui { 11 | class MainWindow; 12 | } 13 | 14 | class MainWindow : public QMainWindow 15 | { 16 | Q_OBJECT 17 | 18 | public: 19 | explicit MainWindow(QWidget *parent = 0); 20 | ~MainWindow(); 21 | 22 | private: 23 | Ui::MainWindow *ui; 24 | SidPlayer *sidPlayer; 25 | Animation *animation; 26 | AnimationPlayer *animationPlayer; 27 | }; 28 | 29 | #endif // MAINWINDOW_H 30 | -------------------------------------------------------------------------------- /src/rledec.c: -------------------------------------------------------------------------------- 1 | #define RLE_MARKER 0 2 | 3 | unsigned char rle_char; 4 | 5 | unsigned char rle_dec(unsigned char ch) 6 | { 7 | static char rle_mode; 8 | switch (rle_mode) { 9 | case 0: 10 | if (ch == RLE_MARKER) { 11 | rle_mode = 1; 12 | return 0; 13 | } 14 | /* Not RLE. */ 15 | rle_char = ch; 16 | return 1; 17 | case 1: 18 | rle_mode = 2; 19 | rle_char = ch; 20 | return 0; 21 | default: 22 | rle_mode = 0; 23 | return ch; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /editor/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "ui_mainwindow.h" 3 | 4 | #include "animation.h" 5 | #include "animationplayer.h" 6 | #include "sidplayer.h" 7 | 8 | MainWindow::MainWindow(QWidget *parent) : 9 | QMainWindow(parent), 10 | ui(new Ui::MainWindow), 11 | sidPlayer(new SidPlayer), 12 | animation(new Animation) 13 | { 14 | ui->setupUi(this); 15 | animationPlayer = new AnimationPlayer(animation, ui->centralWidget); 16 | animationPlayer->start(); 17 | } 18 | 19 | MainWindow::~MainWindow() 20 | { 21 | delete animationPlayer; 22 | delete animation; 23 | delete sidPlayer; 24 | delete ui; 25 | } 26 | -------------------------------------------------------------------------------- /editor/putchar.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class Screen; 4 | 5 | class PutChar 6 | { 7 | public: 8 | void put(unsigned char ch); 9 | 10 | void hideCursor(); 11 | void showCursor(); 12 | 13 | void setScreen(Screen *screen) { 14 | this->screen = screen; 15 | } 16 | 17 | private: 18 | int x = 0; 19 | int y = 0; 20 | int fgColor = 1; 21 | unsigned char reverse = 0; 22 | Screen *screen; 23 | 24 | void print(unsigned char ch); 25 | void cursorDown(); 26 | void cursorRight(); 27 | void cursorUp(); 28 | void cursorLeft(); 29 | 30 | int hiddenCursorColor = 0; 31 | int hiddenCursorChar = 0; 32 | }; 33 | -------------------------------------------------------------------------------- /src/fastload.s: -------------------------------------------------------------------------------- 1 | ; C interface for fastloader 2 | 3 | .export _loader_init 4 | .export _loader_getc 5 | .export _loader_open 6 | .export _loader_load 7 | 8 | .import initloader 9 | .import getbyte 10 | .import openfile 11 | .import loadfile 12 | 13 | .segment "CODE" 14 | 15 | _loader_init: 16 | jmp initloader 17 | 18 | _loader_load: 19 | pha 20 | txa 21 | tay 22 | pla 23 | tax 24 | jsr loadfile 25 | 26 | _loader_open: 27 | pha 28 | txa 29 | tay 30 | pla 31 | tax 32 | jsr openfile 33 | 34 | _loader_getc: 35 | jsr getbyte 36 | bcs @error 37 | ldx #0 38 | rts ; success, read byte to a 39 | @error: 40 | lda #$ff 41 | tax 42 | rts 43 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | pull_request: 7 | branches: [ "master" ] 8 | 9 | env: 10 | CC65_HOME: '/usr/share/cc65' 11 | 12 | jobs: 13 | build: 14 | # libflac8 (required by VICE) does not exist on 24.04. 15 | # change back to ubuntu-latest once this is resolved. 16 | runs-on: ubuntu-22.04 17 | 18 | steps: 19 | - uses: actions/checkout@v3 20 | 21 | - name: Install dependencies 22 | run: | 23 | sudo apt-get install cc65 24 | wget https://github.com/VICE-Team/svn-mirror/releases/download/3.8.0/headlessvice_3.8.deb 25 | sudo apt-get install ./headlessvice_3.8.deb 26 | 27 | - name: make 28 | run: make 29 | 30 | - name: Archive noperator 31 | uses: actions/upload-artifact@v3 32 | with: 33 | name: noperator 34 | path: deploy 35 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/README: -------------------------------------------------------------------------------- 1 | reSIDfp is a fork of Dag Lem's reSID 0.16, a reverse engineered software emulation 2 | of the MOS6581/8580 SID (Sound Interface Device). 3 | 4 | The project was started by Antti S. Lankila in order to improve SID emulation 5 | with special focus on the 6581 filter. 6 | The codebase has been later on ported to java by Ken Händel within the jsidplay2 project 7 | and has seen further work by Antti Lankila. 8 | It was then ported back to c++ and integrated with improvements from reSID 1.0 by Leandro Nini. 9 | 10 | 11 | Main differences from reSID: 12 | 13 | * combined waveforms are emulated by a parametrized model based on samplings from Kevtris 14 | * high quality resampling is done in two steps to allow computational savings using lower order filters 15 | * part of the calculations are don with floats instead of fixed point 16 | * Interpolation is accomplished with Fritsch-Carlson method to preserve monotonicity 17 | 18 | 19 | reSIDfp is free software. See the file COPYING for copying permission. 20 | -------------------------------------------------------------------------------- /editor/sidplayer.cpp: -------------------------------------------------------------------------------- 1 | #include "sidplayer.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "siddevice.h" 7 | 8 | SidPlayer::SidPlayer() 9 | : audioOutput(0) 10 | { 11 | QAudioFormat format; 12 | format.setSampleRate(44100); 13 | format.setChannelCount(1); 14 | format.setSampleSize(16); 15 | format.setCodec("audio/pcm"); 16 | format.setByteOrder(QAudioFormat::LittleEndian); 17 | format.setSampleType(QAudioFormat::SignedInt); 18 | 19 | QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice()); 20 | if (!info.isFormatSupported(format)) { 21 | qWarning() << "Audio format not supported"; 22 | return; 23 | } 24 | 25 | audioOutput = new QAudioOutput(format); 26 | sidDevice = new SidDevice; 27 | } 28 | 29 | SidPlayer::~SidPlayer() { 30 | delete sidDevice; 31 | delete audioOutput; 32 | } 33 | 34 | void SidPlayer::start() { 35 | sidDevice->start(); 36 | audioOutput->start(sidDevice); 37 | } 38 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/Filter8580.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2014 Leandro Nini 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #define FILTER8580_CPP 22 | 23 | #include "Filter8580.h" 24 | 25 | // This is needed when compiling with --disable-inline 26 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/Integrator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2014 Leandro Nini 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #define INTEGRATOR_CPP 22 | 23 | #include "Integrator.h" 24 | 25 | // This is needed when compiling with --disable-inline 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, Johan Kotlinski 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /editor/sidplayfp/sidtune/SidTuneCfg.h: -------------------------------------------------------------------------------- 1 | /* SidTuneCfg.h (template) */ 2 | 3 | #ifndef SIDTUNECFG_H 4 | #define SIDTUNECFG_H 5 | 6 | #ifdef HAVE_CONFIG_H 7 | # include "config.h" 8 | #endif 9 | 10 | /* Minimum load address for real c64 only tunes */ 11 | #define SIDTUNE_R64_MIN_LOAD_ADDR 0x07e8 12 | 13 | 14 | /* -------------------------------------------------------------------------- 15 | * Don't touch these! 16 | * -------------------------------------------------------------------------- 17 | */ 18 | #undef SIDTUNE_NO_STDIN_LOADER 19 | #undef SIDTUNE_REJECT_UNKNOWN_FIELDS 20 | 21 | 22 | /* Define the file/path separator(s) that your filesystem uses: 23 | SID_FS_IS_COLON_AND_BACKSLASH, SID_FS_IS_COLON_AND_SLASH, 24 | SID_FS_IS_BACKSLASH, SID_FS_IS_COLON, SID_FS_IS_SLASH */ 25 | #if defined(_WIN32) || defined(_MSDOS) || defined(_OS2) 26 | #define SID_FS_IS_COLON_AND_BACKSLASH_AND_SLASH 27 | #elif defined(__APPLE__) && defined(__MACH__) 28 | #define SID_FS_IS_COLON 29 | #elif defined(AMIGA) 30 | #define SID_FS_IS_COLON_AND_SLASH 31 | #else 32 | #define SID_FS_IS_SLASH 33 | #endif 34 | 35 | #endif /* SIDTUNECFG_H */ 36 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/version.cc: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------------- 2 | // This file is part of reSID, a MOS6581 SID emulator engine. 3 | // Copyright (C) 2004 Dag Lem 4 | // 5 | // This program is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation; either version 2 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | // --------------------------------------------------------------------------- 19 | 20 | #define __VERSION_CC__ 21 | #include "siddefs-fp.h" 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # noperator 2 | C64 movie maker similar to Letter Noperator. 3 | 4 | [![hits with tits](http://img.youtube.com/vi/iJZS8hvDWXc/0.jpg)](http://www.youtube.com/watch?v=iJZS8hvDWXc) 5 | 6 | ## Key Presses 7 | 8 | ### Animation Editor 9 | 10 | Creates original animations (letter noperator style) 11 | 12 | * F1: load animation 13 | * F2: save animation 14 | * F3: border color 15 | * F4: bg color 16 | * F5, move cursor, F5: Copy region 17 | * F6: Paste 18 | * F7, m: mirror characters vertically around cursor midpoint. Exit mirror mode by F7, m/M. 19 | * F7, M: mirror characters vertically around cursor right edge. Exit mirror mode by F7, m/M. 20 | * F7, cursor, 0-9, character: rotate character. 0-9 sets speed; 0 = off, 1 = fast, 9 = slow. 21 | * CLR/HOME: insert keyframe 22 | * run/stop: replay animation 23 | * shift+space: inverse space 24 | * Del: Delete (backspace) 25 | * Move screen: Move cursor to border, wait, move again 26 | 27 | ### Keyframe Editor 28 | 29 | * F2: save animation 30 | * 1-9: set duration between this and next keyframe, in number of beats 31 | * Space: jump to next keyframe 32 | * Shift+Space: jump to previous keyframe 33 | * Right: step key forward 34 | * Del: delete keyframe 35 | * Inst: insert keyframe 36 | * Run: preview play this segment 37 | * ←: go back to main menu 38 | -------------------------------------------------------------------------------- /src/irq.s: -------------------------------------------------------------------------------- 1 | .export _setup_irq 2 | .export _start_playing 3 | .export _stop_playing 4 | .export _ticks 5 | 6 | .import _tick_rotate_chars 7 | 8 | _ticks: 9 | .byte 0 10 | 11 | playing: 12 | .byte 0 13 | 14 | _setup_irq: 15 | sei 16 | lda #>irq1 17 | sta $0315 18 | lda # 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2000-2001 Simon White 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #include "sidemu.h" 24 | 25 | std::string sidemu::m_credit; 26 | 27 | bool sidemu::lock(EventContext *env) 28 | { 29 | if (m_locked) 30 | return false; 31 | 32 | m_locked = true; 33 | m_context = env; 34 | 35 | return true; 36 | } 37 | 38 | void sidemu::unlock() 39 | { 40 | m_locked = false; 41 | m_context = 0; 42 | } 43 | -------------------------------------------------------------------------------- /editor/mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 640 10 | 400 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 0 21 | 0 22 | 640 23 | 21 24 | 25 | 26 | 27 | 28 | 29 | TopToolBarArea 30 | 31 | 32 | false 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | Screen 41 | QWidget 42 |
screen.h
43 | 1 44 |
45 |
46 | 47 | 48 |
49 | -------------------------------------------------------------------------------- /editor/sidplayfp/sidtune/prg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2012-2013 Leandro Nini 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #ifndef PRG_H 22 | #define PRG_H 23 | 24 | #include "SidTuneBase.h" 25 | 26 | class prg : public SidTuneBase 27 | { 28 | protected: 29 | prg() {} 30 | 31 | private: 32 | void load(); 33 | 34 | public: 35 | static SidTuneBase* load(const char *fileName, buffer_t& dataBuf); 36 | 37 | virtual ~prg() {} 38 | 39 | private: 40 | // prevent copying 41 | prg(const prg&); 42 | prg& operator=(prg&); 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /editor/sidplayfp/c64/c64sid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2013 Leandro Nini 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #ifndef C64SID_H 22 | #define C64SID_H 23 | 24 | #include 25 | 26 | #include "Banks/Bank.h" 27 | 28 | /** 29 | * SID interface. 30 | */ 31 | class c64sid : public Bank 32 | { 33 | protected: 34 | virtual ~c64sid() {} 35 | 36 | public: 37 | virtual void reset(uint8_t volume) = 0; 38 | 39 | virtual void poke(uint_least16_t address, uint8_t value) = 0; 40 | virtual uint8_t peek(uint_least16_t address) = 0; 41 | }; 42 | 43 | #endif // C64SID_H 44 | -------------------------------------------------------------------------------- /editor/sidplayfp/c64/CPU/mos6510debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2000 Simon White 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef MOS6510DEBUG_H 24 | #define MOS6510DEBUG_H 25 | 26 | #ifdef HAVE_CONFIG_H 27 | # include "config.h" 28 | #endif 29 | 30 | #ifdef DEBUG 31 | 32 | #include "sidplayfp/EventScheduler.h" 33 | 34 | class MOS6510; 35 | 36 | class MOS6510Debug 37 | { 38 | public: 39 | static void DumpState (event_clock_t time, MOS6510 &cpu); 40 | }; 41 | 42 | #endif 43 | 44 | #endif // MOS6510DEBUG_H 45 | -------------------------------------------------------------------------------- /editor/animation.cpp: -------------------------------------------------------------------------------- 1 | #include "animation.h" 2 | 3 | #include 4 | 5 | #include "putchar.h" 6 | #include "screen.h" 7 | 8 | Animation::Animation() 9 | : putChar(new PutChar) 10 | { 11 | QFile f(":/12"); 12 | f.open(QFile::ReadOnly); 13 | data = f.readAll(); 14 | } 15 | 16 | void Animation::step(Screen *screen) { 17 | putChar->setScreen(screen); 18 | 19 | putChar->hideCursor(); 20 | 21 | if (rleLeft) { 22 | putChar->put(rleChar); 23 | --rleLeft; 24 | } else while (1) { 25 | const int ch = getc(); 26 | switch (ch) { 27 | case -1: // Done! 28 | return; 29 | case 0: // RLE 30 | rleChar = getc(); 31 | rleLeft = getc(); 32 | break; 33 | case 0x13: // HOME 34 | speed = getc(); 35 | speed |= getc() << 8; 36 | Q_ASSERT(speed > 0); 37 | break; 38 | default: 39 | rleChar = ch; 40 | rleLeft = 1; 41 | break; 42 | } 43 | if (rleLeft) { 44 | putChar->put(rleChar); 45 | --rleLeft; 46 | break; 47 | } 48 | } 49 | 50 | putChar->showCursor(); 51 | } 52 | 53 | int Animation::getc() { 54 | if (index == data.size()) 55 | return -1; 56 | return static_cast(data.at(index++)); 57 | } 58 | -------------------------------------------------------------------------------- /src/opt.s: -------------------------------------------------------------------------------- 1 | .export _screen_left_opt 2 | .export _screen_right_opt 3 | 4 | _screen_left_opt: 5 | ldx #0 6 | : lda $401, x 7 | sta $400, x 8 | lda $d801, x 9 | sta $d800, x 10 | inx 11 | bne :- 12 | : lda $501, x 13 | sta $500, x 14 | lda $d901, x 15 | sta $d900, x 16 | inx 17 | bne :- 18 | : lda $601, x 19 | sta $600, x 20 | lda $da01, x 21 | sta $da00, x 22 | inx 23 | bne :- 24 | : lda $701, x 25 | sta $700, x 26 | lda $db01, x 27 | sta $db00, x 28 | inx 29 | bne :- 30 | rts 31 | 32 | _screen_right_opt: 33 | ldx #$e6 34 | : lda $700, x 35 | sta $701, x 36 | lda $db00, x 37 | sta $db01, x 38 | dex 39 | bne :- 40 | 41 | lda $700 42 | sta $701 43 | lda $db00 44 | sta $db01 45 | dex 46 | 47 | : lda $600, x 48 | sta $601, x 49 | lda $da00, x 50 | sta $da01, x 51 | dex 52 | bne :- 53 | 54 | lda $600 55 | sta $601 56 | lda $da00 57 | sta $da01 58 | dex 59 | 60 | : lda $500, x 61 | sta $501, x 62 | lda $d900, x 63 | sta $d901, x 64 | dex 65 | bne :- 66 | 67 | lda $500 68 | sta $501 69 | lda $d900 70 | sta $d901 71 | dex 72 | 73 | : lda $400, x 74 | sta $401, x 75 | lda $d800, x 76 | sta $d801, x 77 | dex 78 | bne :- 79 | 80 | lda $400 81 | sta $401 82 | lda $d800 83 | sta $d801 84 | 85 | rts 86 | -------------------------------------------------------------------------------- /editor/sidplayfp/component.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2001 Simon White 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef COMPONENT_H 24 | #define COMPONENT_H 25 | 26 | #include 27 | 28 | class component 29 | { 30 | protected: 31 | virtual uint8_t read(uint_least8_t addr) = 0; 32 | virtual void write(uint_least8_t addr, uint8_t data) = 0; 33 | 34 | public: 35 | virtual void reset () = 0; 36 | virtual const char *credits() const = 0; 37 | 38 | protected: 39 | ~component() {} 40 | }; 41 | 42 | #endif // COMPONENT_H 43 | -------------------------------------------------------------------------------- /editor/sidplayfp/sidtune/p00.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2012-2013 Leandro Nini 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #ifndef P00_H 22 | #define P00_H 23 | 24 | #include "SidTuneBase.h" 25 | 26 | struct X00Header; 27 | 28 | class p00 : public SidTuneBase 29 | { 30 | protected: 31 | p00() {} 32 | 33 | private: 34 | void load(const char* format, const X00Header* pHeader); 35 | 36 | public: 37 | static SidTuneBase* load(const char *fileName, buffer_t& dataBuf); 38 | 39 | virtual ~p00() {} 40 | 41 | private: 42 | // prevent copying 43 | p00(const p00&); 44 | p00& operator=(p00&); 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /editor/sidplayfp/sidrandom.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2012-2013 Leandro Nini 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef SIDRANDOM_H 22 | #define SIDRANDOM_H 23 | 24 | /** 25 | * Simple thread-safe PRNG. 26 | */ 27 | class sidrandom 28 | { 29 | private: 30 | unsigned int m_seed; 31 | 32 | public: 33 | /** 34 | * Initialize PRNG. 35 | * 36 | * @param seed 37 | */ 38 | sidrandom(unsigned int seed) : 39 | m_seed(seed * 1103515245 + 12345) {} 40 | 41 | /** 42 | * Generate new pseudo-random number. 43 | */ 44 | unsigned int next() 45 | { 46 | m_seed = m_seed * 13 + 1; 47 | return m_seed; 48 | } 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /editor/sidplayfp/SidConfig.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2000-2001 Simon White 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #include "SidConfig.h" 24 | 25 | #include "mixer.h" 26 | 27 | SidConfig::SidConfig() : 28 | defaultC64Model(PAL), 29 | forceC64Model(false), 30 | defaultSidModel(MOS6581), 31 | forceSidModel(false), 32 | playback(MONO), 33 | frequency(DEFAULT_SAMPLING_FREQ), 34 | secondSidAddress(0), 35 | sidEmulation(0), 36 | leftVolume(Mixer::VOLUME_MAX), 37 | rightVolume(Mixer::VOLUME_MAX), 38 | powerOnDelay(DEFAULT_POWER_ON_DELAY), 39 | samplingMethod(RESAMPLE_INTERPOLATE), 40 | fastSampling(false) 41 | {} 42 | -------------------------------------------------------------------------------- /editor/sidplayfp/sidtune/PSID.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2012-2013 Leandro Nini 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #ifndef PSID_H 22 | #define PSID_H 23 | 24 | #include 25 | 26 | #include "SidTuneBase.h" 27 | 28 | #include "sidplayfp/SidTune.h" 29 | 30 | class PSID : public SidTuneBase 31 | { 32 | private: 33 | char m_md5[SidTune::MD5_LENGTH+1]; 34 | 35 | private: 36 | void tryLoad(buffer_t& dataBuf); 37 | 38 | protected: 39 | PSID() {} 40 | 41 | public: 42 | virtual ~PSID() {} 43 | 44 | static SidTuneBase* load(buffer_t& dataBuf); 45 | 46 | virtual const char *createMD5(char *md5); 47 | 48 | private: 49 | // prevent copying 50 | PSID(const PSID&); 51 | PSID& operator=(PSID&); 52 | }; 53 | 54 | #endif // PSID_H 55 | -------------------------------------------------------------------------------- /editor/sidplayfp/c64/c64cpu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright (C) 2012 Leandro Nini 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef C64CPU_H 22 | #define C64CPU_H 23 | 24 | #include "sidplayfp/c64/c64env.h" 25 | #include "CPU/mos6510.h" 26 | 27 | #ifdef HAVE_CONFIG_H 28 | # include "config.h" 29 | #endif 30 | 31 | class c64cpu: public MOS6510 32 | { 33 | private: 34 | c64env &m_env; 35 | 36 | public: 37 | c64cpu (c64env *env) : 38 | MOS6510(&(env->context ())), 39 | m_env(*env) {} 40 | 41 | uint8_t cpuRead(uint_least16_t addr) { return m_env.cpuRead (addr); } 42 | void cpuWrite(uint_least16_t addr, uint8_t data) { m_env.cpuWrite (addr, data); } 43 | 44 | #ifdef PC64_TESTSUITE 45 | void loadFile(const char *file) { m_env.loadFile (file); } 46 | #endif 47 | }; 48 | 49 | #endif // C64CPU_H 50 | 51 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/Potentiometer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright (C) 2004 Dag Lem 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef POTENTIOMETER_H 24 | #define POTENTIOMETER_H 25 | 26 | namespace reSIDfp 27 | { 28 | 29 | /** 30 | * Potentiometer representation. 31 | * 32 | * This class will probably never be implemented in any real way. 33 | * 34 | * @author Ken Händel 35 | * @author Dag Lem 36 | */ 37 | class Potentiometer 38 | { 39 | public: 40 | /** 41 | * Read paddle value. Not modeled. 42 | * 43 | * @return paddle value (always 0xff) 44 | */ 45 | unsigned char readPOT() const { return (unsigned char) 0xff; } 46 | }; 47 | 48 | } // namespace reSIDfp 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /editor/screen.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class Screen : public QWidget 6 | { 7 | Q_OBJECT 8 | public: 9 | explicit Screen(QWidget *parent = 0); 10 | 11 | void paintEvent(QPaintEvent *event); 12 | 13 | QSize minimumSizeHint() const; 14 | 15 | void init(); 16 | 17 | void moveUp(); 18 | void moveLeft(); 19 | void moveDown(); 20 | void moveRight(); 21 | 22 | void setColor(int x, int y, unsigned char color) { 23 | Q_ASSERT(x >= 0); 24 | Q_ASSERT(x < 40); 25 | Q_ASSERT(y >= 0); 26 | Q_ASSERT(y < 25); 27 | Q_ASSERT(color < 16); 28 | fgColor[x][y] = color; 29 | } 30 | 31 | void setChar(int x, int y, unsigned char ch) { 32 | Q_ASSERT(x >= 0); 33 | Q_ASSERT(x < 40); 34 | Q_ASSERT(y >= 0); 35 | Q_ASSERT(y < 25); 36 | chars[x][y] = ch; 37 | } 38 | 39 | int getColor(int x, int y) const { 40 | Q_ASSERT(x >= 0); 41 | Q_ASSERT(x < 40); 42 | Q_ASSERT(y >= 0); 43 | Q_ASSERT(y < 25); 44 | return fgColor[x][y]; 45 | } 46 | 47 | int getChar(int x, int y) const { 48 | Q_ASSERT(x >= 0); 49 | Q_ASSERT(x < 40); 50 | Q_ASSERT(y >= 0); 51 | Q_ASSERT(y < 25); 52 | return chars[x][y]; 53 | } 54 | 55 | signals: 56 | 57 | public slots: 58 | 59 | private: 60 | void draw(QImage *image, int column, int row); 61 | int bgColor = 0; 62 | unsigned char fgColor[40][25] = {{ 0 }}; 63 | int borderColor = 0; 64 | unsigned char chars[40][25] = {{ ' ' }}; 65 | }; 66 | -------------------------------------------------------------------------------- /src/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "anim.h" 4 | #include "irq.h" 5 | #include "keyframe.h" 6 | #include "movie.h" 7 | #include "music.h" 8 | 9 | static void print_ticks_per_step() { 10 | cputsxy(0, 4, "song speed [1-9]: "); 11 | cputc('0' + ticks_per_step); 12 | } 13 | 14 | void main_menu(void) { 15 | anim_reset(); 16 | textcolor(COLOR_YELLOW); 17 | cputsxy(0, 0, "movie noperator"); 18 | cputsxy(0, 2, "[a]nim edit"); 19 | cputsxy(0, 3, "[m]usic select"); 20 | print_ticks_per_step(); 21 | cputsxy(0, 5, "[k]eyframe edit"); 22 | cputsxy(0, 7, "[s]ave demo"); 23 | cputsxy(0, 8, "[r]eset autostart"); 24 | for (;;) { 25 | char ch; 26 | switch (ch = cgetc()) { 27 | case 'a': 28 | anim_editor(); 29 | break; 30 | case 'm': 31 | select_music(); 32 | main_menu(); 33 | break; 34 | case 'r': 35 | scratch_movie(); 36 | break; 37 | case 'k': 38 | keyframe_editor(); 39 | main_menu(); 40 | break; 41 | case 's': 42 | write_movie(); 43 | main_menu(); 44 | break; 45 | default: 46 | if (ch >= '1' && ch <= '9') { 47 | ticks_per_step = ch - '0'; 48 | print_ticks_per_step(); 49 | } 50 | } 51 | } 52 | } 53 | 54 | void main(void) { 55 | setup_irq(); 56 | if (!play_movie()) { 57 | load_music("lightforce"); 58 | } 59 | main_menu(); 60 | } 61 | -------------------------------------------------------------------------------- /editor/sidplayfp/utils/iniParser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2013 Leandro Nini 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef INIPARSER_H 20 | #define INIPARSER_H 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | class iniParser 27 | { 28 | private: 29 | typedef std::map keys_t; 30 | typedef std::map sections_t; 31 | 32 | class parseError {}; 33 | 34 | private: 35 | sections_t sections; 36 | 37 | sections_t::const_iterator curSection; 38 | 39 | private: 40 | std::string parseSection(const std::string &buffer); 41 | 42 | std::pair parseKey(const std::string &buffer); 43 | 44 | public: 45 | bool open(const char *fName); 46 | void close(); 47 | 48 | bool setSection(const char *section); 49 | const char *getValue(const char *key); 50 | }; 51 | 52 | #endif // INIPARSER_H 53 | -------------------------------------------------------------------------------- /editor/sidplayfp/c64/Banks/DisconnectedBusBank.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2012-2013 Leandro Nini 5 | * Copyright 2010 Antti Lankila 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef DISCONNECTEDBUSBANK_H 23 | #define DISCONNECTEDBUSBANK_H 24 | 25 | #include "Bank.h" 26 | 27 | /** 28 | * IO1/IO2 29 | * memory mapped registers or machine code routines of optional external devices 30 | * I/O Area #1 located at $DE00-$DEFF 31 | * I/O Area #2 located at $DF00-$DFFF 32 | */ 33 | class DisconnectedBusBank : public Bank 34 | { 35 | /** 36 | * No device is connected so this is a no-op. 37 | */ 38 | void poke(uint_least16_t addr SID_UNUSED, uint8_t data SID_UNUSED) {} 39 | 40 | // FIXME this should actually return last byte read from VIC 41 | uint8_t peek(uint_least16_t addr SID_UNUSED) { return 0; } 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /editor/sidplayfp/c64/Banks/NullSid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2012-2013 Leandro Nini 5 | * Copyright 2010 Antti Lankila 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef NULLSID_H 23 | #define NULLSID_H 24 | 25 | #include "sidplayfp/c64/c64sid.h" 26 | 27 | /** 28 | * SID chip placeholder which does nothing and returns 0xff on reading. 29 | */ 30 | class NullSid : public c64sid 31 | { 32 | private: 33 | NullSid() {} 34 | virtual ~NullSid() {} 35 | 36 | public: 37 | /** 38 | * Returns singleton instance. 39 | */ 40 | static NullSid *getInstance() 41 | { 42 | static NullSid nullsid; 43 | return &nullsid; 44 | } 45 | 46 | void reset(uint8_t) {} 47 | 48 | void poke(uint_least16_t address SID_UNUSED, uint8_t value SID_UNUSED) {} 49 | uint8_t peek(uint_least16_t address SID_UNUSED) { return 0xff; } 50 | }; 51 | 52 | #endif // NULLSID_H 53 | -------------------------------------------------------------------------------- /editor/sidplayfp/c64/Banks/ColorRAMBank.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2012-2013 Leandro Nini 5 | * Copyright 2010 Antti Lankila 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef COLORRAMBANK_H 23 | #define COLORRAMBANK_H 24 | 25 | #include 26 | #include 27 | 28 | #include "Bank.h" 29 | 30 | /** 31 | * Color RAM. 32 | * 1K x 4-bit Static RAM that stores text screen color information 33 | * located at $D800-$DBFF (last 24 bytes are unused) 34 | */ 35 | class ColorRAMBank : public Bank 36 | { 37 | private: 38 | uint8_t ram[0x400]; 39 | 40 | public: 41 | void reset() 42 | { 43 | memset(ram, 0, 0x400); 44 | } 45 | 46 | void poke(uint_least16_t address, uint8_t value) 47 | { 48 | ram[address & 0x3ff] = value & 0xf; 49 | } 50 | 51 | uint8_t peek(uint_least16_t address) 52 | { 53 | return ram[address & 0x3ff]; 54 | } 55 | }; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /editor/sidplayfp/EventScheduler.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright (C) 2011-2012 Leandro Nini 5 | * Copyright (C) 2009 Antti S. Lankila 6 | * Copyright (C) 2001 Simon White 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #include "EventScheduler.h" 24 | 25 | 26 | void EventScheduler::reset() 27 | { 28 | currentTime = 0; 29 | firstEvent = 0; 30 | } 31 | 32 | void EventScheduler::cancel(Event &event) 33 | { 34 | Event **scan = &firstEvent; 35 | 36 | while (*scan) 37 | { 38 | if (&event == *scan) 39 | { 40 | *scan = (*scan)->next; 41 | break; 42 | } 43 | scan = &((*scan)->next); 44 | } 45 | } 46 | 47 | bool EventScheduler::isPending(Event &event) const 48 | { 49 | Event *scan = firstEvent; 50 | while (scan) 51 | { 52 | if (&event == scan) 53 | { 54 | return true; 55 | } 56 | scan = scan->next; 57 | } 58 | return false; 59 | } 60 | -------------------------------------------------------------------------------- /editor/sidplayfp/sidtune/SidTuneTools.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright (C) Michael Schwendt 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #ifndef SIDTUNETOOLS_H 22 | #define SIDTUNETOOLS_H 23 | 24 | #include 25 | 26 | #ifdef HAVE_CONFIG_H 27 | # include "config.h" 28 | #endif 29 | 30 | class SidTuneTools 31 | { 32 | public: 33 | /** 34 | * Return pointer to file name position in complete path. 35 | */ 36 | static size_t fileNameWithoutPath(const char* s); 37 | 38 | /** 39 | * Return pointer to file name position in complete path. 40 | * Special version: file separator = forward slash. 41 | */ 42 | static size_t slashedFileNameWithoutPath(const char* s); 43 | 44 | /** 45 | * Return pointer to file name extension in path. 46 | * Searching backwards until first dot is found. 47 | */ 48 | static const char* fileExtOfPath(const char* s); 49 | }; 50 | 51 | #endif /* SIDTUNETOOLS_H */ 52 | -------------------------------------------------------------------------------- /src/rotchars.c: -------------------------------------------------------------------------------- 1 | #include "rotchars.h" 2 | 3 | #include 4 | 5 | unsigned char rotchar_dirs[16]; 6 | unsigned char rotchar_screencodes[16]; 7 | unsigned char rotchar_periods[16]; 8 | extern unsigned char _FONTRAM_START__; 9 | 10 | static void reset(unsigned char screencode) { 11 | unsigned char tmp = *(char*)1; 12 | unsigned char* dst = &_FONTRAM_START__ + screencode * 8; 13 | unsigned char* src = dst + (0xd000u - (unsigned int)&_FONTRAM_START__); 14 | asm("sei"); 15 | *(char*)1 = 0xfb; 16 | memcpy(dst, src, 8); 17 | *(char*)1 = tmp; 18 | asm("cli"); 19 | } 20 | 21 | void rotate_char(unsigned char screencode, unsigned char dir, unsigned char speed) { 22 | unsigned char i = 0; 23 | unsigned char period = (0xff >> (9 - speed)); 24 | 25 | if (!speed) { 26 | dir = 0; 27 | } 28 | 29 | // If ch is already in the table, update the direction. 30 | for (; i < sizeof(rotchar_dirs); ++i) { 31 | if (rotchar_screencodes[i] == screencode) { 32 | rotchar_dirs[i] = dir; 33 | rotchar_periods[i] = period; 34 | if (!speed) { 35 | reset(screencode); 36 | } 37 | return; 38 | } 39 | } 40 | // Find an empty spot in table and take it. 41 | for (i = 0; i < sizeof(rotchar_dirs); ++i) { 42 | if (rotchar_dirs[i] == 0) { 43 | rotchar_dirs[i] = dir; 44 | rotchar_periods[i] = period; 45 | rotchar_screencodes[i] = screencode; 46 | return; 47 | } 48 | } 49 | } 50 | 51 | void stop_char_rotations() { 52 | unsigned char i = 0; 53 | memset(rotchar_dirs, 0, sizeof(rotchar_dirs)); 54 | for (; i < sizeof(rotchar_screencodes); ++i) { 55 | reset(rotchar_screencodes[i]); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /editor/sidplayfp/c64/Banks/IOBank.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2012-2013 Leandro Nini 5 | * Copyright 2010 Antti Lankila 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef IOBANK_H 23 | #define IOBANK_H 24 | 25 | #include 26 | 27 | #include "Bank.h" 28 | 29 | /** 30 | * IO region handler. 4k region, 16 chips, 256b banks. 31 | * located at $D000-$DFFF 32 | * 33 | * @author Antti Lankila 34 | */ 35 | class IOBank : public Bank 36 | { 37 | private: 38 | Bank* map[16]; 39 | 40 | public: 41 | void setBank(int num, Bank* bank) 42 | { 43 | map[num] = bank; 44 | } 45 | 46 | Bank *getBank(int num) const 47 | { 48 | return map[num]; 49 | } 50 | 51 | uint8_t peek(uint_least16_t addr) 52 | { 53 | return map[addr >> 8 & 0xf]->peek(addr); 54 | } 55 | 56 | void poke(uint_least16_t addr, uint8_t data) 57 | { 58 | map[addr >> 8 & 0xf]->poke(addr, data); 59 | } 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /editor/siddevice.cpp: -------------------------------------------------------------------------------- 1 | #include "siddevice.h" 2 | 3 | #include 4 | 5 | #include "sidplayfp/sidplayfp.h" 6 | #include "sidplayfp/SidTune.h" 7 | #include "sidplayfp/SidConfig.h" 8 | #include "sidplayfp/sidtune/PSID.h" 9 | #include "residfp-builder/residfp.h" 10 | 11 | SidDevice::SidDevice() 12 | : player(new sidplayfp()) 13 | { 14 | SidConfig config = player->config(); 15 | config.sidEmulation = new ReSIDfpBuilder("resid"); 16 | config.sidEmulation->create(1); 17 | player->config(config); 18 | 19 | QFile kernal(":/kernal.bin"); 20 | kernal.open(ReadOnly); 21 | player->setRoms(reinterpret_cast(kernal.readAll().data())); 22 | 23 | const char psidHeader[] = { 24 | 'P', 'S', 'I', 'D', // id 25 | 0, 1, // version 26 | 0, 22, // offset 27 | 0, 0, // load address 28 | 0x10, 0, // init routine 29 | 0x10, 3, // play routine 30 | 0, 1, // number of songs 31 | 0, 1, // start song 32 | 0, 0, 0, 0 // speed info 33 | }; 34 | 35 | QFile sidFile(":/packed.prg"); 36 | sidFile.open(ReadOnly); 37 | QByteArray tuneData = sidFile.readAll(); 38 | tuneData.prepend(psidHeader, sizeof(psidHeader)); 39 | char* data = tuneData.data(); 40 | 41 | tune = new SidTune(reinterpret_cast(data), tuneData.length()); 42 | 43 | if (!tune->getStatus()) { 44 | qWarning() << "error: " << tune->statusString(); 45 | return; 46 | } 47 | 48 | player->load(tune); 49 | } 50 | 51 | qint64 SidDevice::readData(char* charBuf, qint64 size) { 52 | qint64 ret = player->play((short*)charBuf, size / sizeof(short)) * sizeof(short); 53 | return ret; 54 | } 55 | 56 | qint64 SidDevice::writeData(const char*, qint64) { 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/ExternalFilter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2004 Dag Lem 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #define EXTERNALFILTER_CPP 24 | 25 | #include "ExternalFilter.h" 26 | 27 | namespace reSIDfp 28 | { 29 | 30 | ExternalFilter::ExternalFilter() : 31 | Vlp(0), 32 | Vhp(0), 33 | w0lp_1_s7(0), 34 | w0hp_1_s17(0) 35 | { 36 | reset(); 37 | } 38 | 39 | void ExternalFilter::setClockFrequency(double frequency) 40 | { 41 | // Low-pass: R = 10kOhm, C = 1000pF; w0l = 1/RC = 1/(1e4*1e-9) = 100000 42 | // High-pass: R = 1kOhm, C = 10uF; w0h = 1/RC = 1/(1e3*1e-5) = 100 43 | w0lp_1_s7 = (int)(100000. / frequency * (1 << 7) + 0.5); 44 | w0hp_1_s17 = (int)(100. / frequency * (1 << 17) + 0.5); 45 | } 46 | 47 | void ExternalFilter::reset() 48 | { 49 | // State of filter. 50 | Vlp = 0; //1 << (15 + 11); 51 | Vhp = 0; 52 | } 53 | 54 | } // namespace reSIDfp 55 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | CRT0 = $(CC65_HOME)/lib/c64.o 2 | CLIB = $(CC65_HOME)/lib/c64.lib 3 | CC = cc65 -Or -O -Cl -tc64 -T -I $(CC65_HOME)/include/ 4 | # CC = cc65 --create-dep -Cl -tc64 -T -I $(CC65BASE)/include/ 5 | AS = ca65 --cpu 6502x # -l 6 | LD = ld65 -C src/nop.cfg -m build/nop.map -Ln build/nop.lbl 7 | PUCRUNCH = ~/bin/pucrunch 8 | C1541 = c1541 9 | DEPDIR = build 10 | 11 | 12 | all: build/nop 13 | 14 | # -------------------------------------------------------------------------- 15 | # Generic rules 16 | 17 | build/%.a : src/%.c 18 | @echo $< 19 | @mkdir -p build 20 | @$(CC) --create-dep $(DEPDIR)/$(notdir $(basename $<)).u \ 21 | -o build/$(notdir $(basename $<)).a \ 22 | $(basename $<).c 23 | 24 | build/%.o : build/%.a 25 | @$(AS) -o build/$(notdir $(basename $<)).o $(basename $<).a 26 | 27 | # Don't delete intermediate .a files. 28 | .PRECIOUS : build/%.a 29 | 30 | build/%.o : src/%.s 31 | @echo $< 32 | @$(AS) -o build/$(notdir $(basename $<)).o $< 33 | 34 | SRCS := $(wildcard src/*.c src/*.s) 35 | OBJS := $(addprefix build/,$(addsuffix .o,$(notdir $(basename ${SRCS})))) 36 | 37 | -include $(OBJS:build/%.o=build/%.u) 38 | 39 | # -------------------------------------------------------------------------- 40 | 41 | bin/nop.d64: 42 | @mkdir -p bin 43 | $(C1541) -format nop,AA d64 bin/nop.d64 > /dev/null 44 | 45 | build/nop: $(OBJS) $(CLIB) bin/nop.d64 46 | @$(LD) -o $@ $(OBJS) $(CLIB) 47 | $(C1541) -attach bin/nop.d64 -delete nop > /dev/null;\ 48 | $(C1541) -attach bin/nop.d64 -write build/nop > /dev/null;\ 49 | $(C1541) -attach bin/nop.d64 -delete lightforce > /dev/null;\ 50 | $(C1541) -attach bin/nop.d64 -write res/lightforce > /dev/null; 51 | 52 | run: bin/nop.d64 53 | x64sc bin/nop.d64 54 | 55 | # -------------------------------------------------------------------------- 56 | # Cleanup rules 57 | 58 | .PHONY: clean 59 | clean: 60 | rm -rf build bin 61 | 62 | # ------------------ 63 | 64 | -------------------------------------------------------------------------------- /editor/sidplayfp/c64/Banks/SystemRAMBank.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2012-2013 Leandro Nini 5 | * Copyright 2010 Antti Lankila 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef SYSTEMRAMBANK_H 23 | #define SYSTEMRAMBANK_H 24 | 25 | #include 26 | #include 27 | 28 | #include "Bank.h" 29 | 30 | /** 31 | * Area backed by RAM 32 | * 33 | * @author Antti Lankila 34 | */ 35 | class SystemRAMBank : public Bank 36 | { 37 | friend class MMU; 38 | 39 | private: 40 | /// C64 RAM area 41 | uint8_t ram[0x10000]; 42 | 43 | public: 44 | /** 45 | * Initialize RAM with powerup pattern. 46 | */ 47 | void reset() 48 | { 49 | memset(ram, 0, 0x10000); 50 | for (int i = 0x07c0; i < 0x10000; i += 128) 51 | { 52 | memset(ram+i, 0xff, 64); 53 | } 54 | } 55 | 56 | uint8_t peek(uint_least16_t address) 57 | { 58 | return ram[address]; 59 | } 60 | 61 | void poke(uint_least16_t address, uint8_t value) 62 | { 63 | ram[address] = value; 64 | } 65 | }; 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /editor/sidplayfp/c64/Banks/SidBank.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2012-2013 Leandro Nini 5 | * Copyright 2010 Antti Lankila 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef SIDBANK_H 23 | #define SIDBANK_H 24 | 25 | #include "Bank.h" 26 | #include "sidplayfp/c64/c64sid.h" 27 | 28 | #include "NullSid.h" 29 | 30 | /** 31 | * SID 32 | * located at $D400-$D7FF, mirrored each 32 bytes 33 | */ 34 | class SidBank : public Bank 35 | { 36 | private: 37 | /// SID chip 38 | c64sid *sid; 39 | 40 | public: 41 | SidBank() 42 | : sid(NullSid::getInstance()) 43 | {} 44 | 45 | void reset() 46 | { 47 | sid->reset(0xf); 48 | } 49 | 50 | uint8_t peek(uint_least16_t addr) 51 | { 52 | return sid->peek(addr); 53 | } 54 | 55 | void poke(uint_least16_t addr, uint8_t data) 56 | { 57 | sid->poke(addr, data); 58 | } 59 | 60 | /** 61 | * Set SID emulation. 62 | * 63 | * @param s the emulation 64 | */ 65 | void setSID(c64sid *s) { sid = (s != 0) ? s : NullSid::getInstance(); } 66 | }; 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/siddefs-fp.h: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------------- 2 | // This file is part of reSID, a MOS6581 SID emulator engine. 3 | // Copyright (C) 1999 Dag Lem 4 | // 5 | // This program is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation; either version 2 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | // --------------------------------------------------------------------------- 19 | 20 | #ifndef SIDDEFS_FP_H 21 | #define SIDDEFS_FP_H 22 | 23 | #ifndef M_PI 24 | # define M_PI 3.14159265358979323846 25 | #endif 26 | 27 | // Branch prediction macros, lifted off the Linux kernel. 28 | #if RESID_BRANCH_HINTS && HAVE_BUILTIN_EXPECT 29 | # define likely(x) __builtin_expect(!!(x), 1) 30 | # define unlikely(x) __builtin_expect(!!(x), 0) 31 | #else 32 | # define likely(x) (x) 33 | # define unlikely(x) (x) 34 | #endif 35 | 36 | namespace reSIDfp { 37 | 38 | typedef enum { MOS6581=1, MOS8580 } ChipModel; 39 | 40 | typedef enum { DECIMATE=1, RESAMPLE } SamplingMethod; 41 | } 42 | 43 | extern "C" 44 | { 45 | #ifndef __VERSION_CC__ 46 | extern const char* residfp_version_string; 47 | #else 48 | const char* residfp_version_string = "@PACKAGE_VERSION@"; 49 | #endif 50 | } 51 | 52 | #endif // SIDDEFS_FP_H 53 | -------------------------------------------------------------------------------- /src/cfg_unp.s: -------------------------------------------------------------------------------- 1 | ;------------------------------------------------------------------------------- 2 | ; Default configuration (everything included) 3 | ;------------------------------------------------------------------------------- 4 | 5 | .include "zeropage.inc" 6 | 7 | .define LONG_NAMES 1 ;Set to nonzero to use long names (pointer in 8 | ;X,Y) or zero to use 2-letter names (letters 9 | ;in X,Y) 10 | .define BORDER_FLASHING 0 ;Set to nonzero to enable border flashing 11 | ;when fastloading :) 12 | .define ADDITIONAL_ZEROPAGE 1 ;Set to nonzero to use additional zeropage 13 | ;variables to shorten loader code 14 | .define LOAD_UNDER_IO 0 ;Set to nonzero to enable possibility to load 15 | ;under I/O areas, and to load packed data 16 | ;under the Kernal ROM. 17 | .define LOADFILE_UNPACKED 1 ;Set to nonzero to include unpacked loading 18 | .define LOADFILE_EXOMIZER 0 ;Set to nonzero to include EXOMIZER loading 19 | .define LOADFILE_PUCRUNCH 0 ;Set to nonzero to include PUCRUNCH loading 20 | 21 | .define RETRIES 5 ;Retries when reading a sector 22 | 23 | .define loadbuffer $0f00 ;256 byte table used by fastloader & REU 24 | 25 | .define depackbuffer $0500 ;156 bytes for EXOMIZER tables, 31 for 26 | ;PUCRUNCH. 27 | 28 | .define zpbase tmp1 ;Zeropage base address. Loader needs 2 29 | ;addresses with unpacked, 3 with PUCRUNCH 30 | ;and 8 with EXOMIZER loading. 31 | 32 | .define zpbase2 tmp3 ;Additional 4 zeropage addresses for shortening 33 | ;the loader code (optional) 34 | -------------------------------------------------------------------------------- /editor/sidplayfp/c64/Banks/Bank.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2012-2013 Leandro Nini 5 | * Copyright 2010 Antti Lankila 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef BANK_H 23 | #define BANK_H 24 | 25 | #include 26 | 27 | #include "sidplayfp/siddefs.h" 28 | 29 | /** 30 | * Base interface for memory and I/O banks. 31 | */ 32 | class Bank 33 | { 34 | public: 35 | /** 36 | * Bank write. 37 | * 38 | * Override this method if you expect write operations on your bank. 39 | * Leave unimplemented if it's logically/operationally impossible for 40 | * writes to ever arrive to bank. 41 | * 42 | * @param address address to write to 43 | * @param value value to write 44 | */ 45 | virtual void poke(uint_least16_t address, uint8_t value) =0; 46 | 47 | /** 48 | * Bank read. You probably 49 | * should override this method, except if the Bank is only used in 50 | * write context. 51 | * 52 | * @param address value to read from 53 | * @return value at address 54 | */ 55 | virtual uint8_t peek(uint_least16_t address) =0; 56 | 57 | protected: 58 | ~Bank() {} 59 | }; 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /editor/sidplayfp/sidbuilder.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2000-2001 Simon White 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #include "sidbuilder.h" 24 | 25 | #include "sidemu.h" 26 | 27 | sidemu *sidbuilder::lock (EventContext *env, SidConfig::sid_model_t model) 28 | { 29 | m_status = true; 30 | 31 | for (emuset_t::iterator it=sidobjs.begin(); it != sidobjs.end(); ++it) 32 | { 33 | sidemu *sid = (*it); 34 | if (sid->lock (env)) 35 | { 36 | sid->model (model); 37 | return sid; 38 | } 39 | } 40 | 41 | // Unable to locate free SID 42 | m_status = false; 43 | m_errorBuffer.assign(name ()).append("ERROR: No available SIDs to lock"); 44 | return 0; 45 | } 46 | 47 | void sidbuilder::unlock (sidemu *device) 48 | { 49 | emuset_t::iterator it = sidobjs.find(device); 50 | if (it != sidobjs.end()) 51 | { 52 | (*it)->unlock (); 53 | } 54 | } 55 | 56 | void sidbuilder::remove () 57 | { 58 | for (emuset_t::iterator it=sidobjs.begin(); it != sidobjs.end(); ++it) 59 | delete (*it); 60 | 61 | sidobjs.clear(); 62 | } 63 | -------------------------------------------------------------------------------- /editor/sidplayfp/c64/c64vic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2001 Simon White 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef C64VIC_H 24 | #define C64VIC_H 25 | 26 | // The VIC emulation is very generic and here we need to effectively 27 | // wire it into the computer (like adding a chip to a PCB). 28 | 29 | #include "Banks/Bank.h" 30 | #include "sidplayfp/c64/c64env.h" 31 | #include "sidplayfp/sidendian.h" 32 | #include "VIC_II/mos656x.h" 33 | 34 | /** 35 | * VIC-II 36 | * located at $D000-$D3FF 37 | */ 38 | class c64vic: public MOS656X, public Bank 39 | { 40 | private: 41 | c64env &m_env; 42 | 43 | protected: 44 | void interrupt(bool state) 45 | { 46 | m_env.interruptIRQ (state); 47 | } 48 | 49 | void setBA(bool state) 50 | { 51 | m_env.setBA (state); 52 | } 53 | 54 | public: 55 | c64vic(c64env *env) : 56 | MOS656X(&(env->context ())), 57 | m_env(*env) {} 58 | 59 | void poke(uint_least16_t address, uint8_t value) 60 | { 61 | write(endian_16lo8(address), value); 62 | } 63 | 64 | uint8_t peek(uint_least16_t address) 65 | { 66 | return read(endian_16lo8(address)); 67 | } 68 | }; 69 | 70 | #endif // C64VIC_H 71 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/array.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright (C) 2011 Leandro Nini 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef ARRAY_H 22 | #define ARRAY_H 23 | 24 | /** 25 | */ 26 | class counter 27 | { 28 | private: 29 | unsigned int c; 30 | 31 | public: 32 | counter() : c(1) {} 33 | void increase() { ++c; } 34 | unsigned int decrease() { return --c; } 35 | }; 36 | 37 | /** 38 | * Reference counted pointer to array wrapper, for use with standard containers. 39 | */ 40 | template 41 | class array 42 | { 43 | private: 44 | counter* count; 45 | const unsigned int x, y; 46 | T* data; 47 | 48 | public: 49 | array(unsigned int x, unsigned int y) : 50 | count(new counter()), 51 | x(x), 52 | y(y), 53 | data(new T[x * y]) {} 54 | 55 | array(const array& p) : 56 | count(p.count), 57 | x(p.x), 58 | y(p.y), 59 | data(p.data) { count->increase(); } 60 | 61 | ~array() { if (count->decrease() == 0) { delete count; delete [] data; } } 62 | 63 | unsigned int length() const { return x * y; } 64 | 65 | T* operator[](unsigned int a) { return a < x ? &data[a * y] : 0; } 66 | 67 | T const* operator[](unsigned int a) const { return a < x ? &data[a * y] : 0; } 68 | }; 69 | 70 | typedef array matrix_t; 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /editor/sidplayfp/sidmd5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2012-2013 Leandro Nini 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #ifndef SIDMD5_H 22 | #define SIDMD5_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include "utils/MD5/MD5.h" 29 | 30 | /** 31 | * A wrapper around the md5 implementation that provides 32 | * an hex formatted digest 33 | */ 34 | class sidmd5 35 | { 36 | private: 37 | MD5 m_md5; 38 | 39 | public: 40 | /** 41 | * Append a string to the message. 42 | */ 43 | void append(const void* data, int nbytes) { m_md5.append(data, nbytes); } 44 | 45 | /** 46 | * Finish the message. 47 | */ 48 | void finish() { m_md5.finish(); } 49 | 50 | /** 51 | * Initialize the algorithm. Reset starting values. 52 | */ 53 | void reset() { m_md5.reset(); } 54 | 55 | /** 56 | * Return pointer to 32-byte hex fingerprint. 57 | * */ 58 | std::string getDigest() 59 | { 60 | // Construct fingerprint. 61 | std::ostringstream ss; 62 | ss.fill('0'); 63 | ss.flags(std::ios::hex); 64 | 65 | for (int di = 0; di < 16; ++di) 66 | { 67 | ss << std::setw(2) << (int) m_md5.getDigest()[di]; 68 | } 69 | 70 | return ss.str(); 71 | } 72 | }; 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /editor/sidplayfp/c64/c64env.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2001 Simon White 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef C64ENV_H 24 | #define C64ENV_H 25 | 26 | #include "sidplayfp/event.h" 27 | 28 | #ifdef HAVE_CONFIG_H 29 | # include "config.h" 30 | #endif 31 | 32 | /** 33 | * An implementation of of this class can be created to perform the C64 34 | * specifics. A pointer to this child class can then be passed to 35 | * each of the components so they can interact with it. 36 | */ 37 | class c64env 38 | { 39 | private: 40 | EventContext &m_context; 41 | 42 | public: 43 | c64env (EventContext *context) : 44 | m_context (*context) {} 45 | 46 | EventContext &context() const { return m_context; } 47 | 48 | virtual uint8_t cpuRead(uint_least16_t addr) =0; 49 | virtual void cpuWrite(uint_least16_t addr, uint8_t data) =0; 50 | 51 | #ifdef PC64_TESTSUITE 52 | virtual void loadFile(const char *file) =0; 53 | #endif 54 | 55 | virtual void interruptIRQ(bool state) = 0; 56 | virtual void interruptNMI() = 0; 57 | virtual void interruptRST() = 0; 58 | 59 | virtual void setBA (bool state) = 0; 60 | virtual void lightpen() = 0; 61 | 62 | protected: 63 | ~c64env() {} 64 | }; 65 | 66 | #endif // C64ENV_H 67 | -------------------------------------------------------------------------------- /src/nop.cfg: -------------------------------------------------------------------------------- 1 | FEATURES { 2 | STARTADDRESS: default = $0801; 3 | } 4 | SYMBOLS { 5 | __LOADADDR__: type = import; 6 | __EXEHDR__: type = import; 7 | __STACKSIZE__: type = weak, value = $0100; 8 | __HIMEM__: type = weak, value = $D000; 9 | } 10 | MEMORY { 11 | ZP: file = "", define = yes, start = $0002, size = $001A; 12 | # $400-$7e7: screen 13 | LOADADDR: file = %O, start = %S - 2, size = $0002; 14 | HEADER: file = %O, define = yes, start = %S, size = $000D; 15 | LORAM: file = %O, define = yes, start = __HEADER_LAST__, size = $f00 - __HEADER_LAST__, fill = yes; 16 | LOADRAM: file = %O, define = yes, start = $f00, size = $100, fill = yes; 17 | MUSICRAM: file = %O, define = yes, start = $1000, size = $1800, fill = yes; 18 | FONTRAM: file = %O, define = yes, start = $2800, size = $800, fill = yes; 19 | MAIN: file = %O, define = yes, start = $3000, size = __HIMEM__ - $3000; 20 | } 21 | SEGMENTS { 22 | ZEROPAGE: load = ZP, type = zp; 23 | LOADADDR: load = LOADADDR, type = ro; 24 | EXEHDR: load = HEADER, type = ro; 25 | STARTUP: load = LORAM, type = ro; 26 | LOWCODE: load = LORAM, type = ro, optional = yes; 27 | CODE: load = MAIN, type = ro; 28 | FONT: load = FONTRAM, type = rw; 29 | RODATA: load = LORAM, type = ro; 30 | DATA: load = LORAM, type = rw; 31 | INIT: load = LORAM, type = rw; 32 | ONCE: load = LORAM, type = ro, define = yes; 33 | BSS: load = MAIN, type = bss, define = yes; 34 | } 35 | FEATURES { 36 | CONDES: type = constructor, 37 | label = __CONSTRUCTOR_TABLE__, 38 | count = __CONSTRUCTOR_COUNT__, 39 | segment = ONCE; 40 | CONDES: type = destructor, 41 | label = __DESTRUCTOR_TABLE__, 42 | count = __DESTRUCTOR_COUNT__, 43 | segment = RODATA; 44 | CONDES: type = interruptor, 45 | label = __INTERRUPTOR_TABLE__, 46 | count = __INTERRUPTOR_COUNT__, 47 | segment = RODATA, 48 | import = __CALLIRQ__; 49 | } 50 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | ## Unreleased 9 | 10 | ### Added 11 | 12 | - Default music ("Lightforce" by GRG) 13 | - Animation editor 14 | - Set keyframe speed 1-9 directly. (1=slowest, 9=fastest) 15 | - Play back animation with music. 16 | - Flash border when RAM is about to get full. 17 | 18 | ### Changed 19 | 20 | - Keyframe editor key presses 21 | - Space: go to next keyframe 22 | - Shift+Space: go to previous keyframe 23 | - Right: go to next key 24 | - 1-9: set beat count 25 | 26 | ### Fixed 27 | 28 | - Directory listing for many files. 29 | - Undo any accidental C= upper/lower case change in animation editor. 30 | - Reset mirroring at movie start. 31 | - Disable playback operations while marking a copy region. 32 | 33 | ## v2.0.0 - 2016-12-17 34 | 35 | ### Fixed 36 | 37 | - Reset reverse, background colors and character rotation at movie start. 38 | 39 | ### Removed 40 | 41 | - Undocumented Ctrl+B keypress to reset cursor (?). 42 | 43 | ### Added 44 | 45 | New key presses: 46 | 47 | - F7, m: mirror characters vertically around cursor midpoint. Exit mirror mode by F7, m/M. 48 | - F7, M: mirror characters vertically around cursor right edge. Exit mirror mode by F7, m/M. 49 | - F7, cursor, 0-9, character: rotate character. 0-9 sets speed; 0 means off, 1 is fastest, 9 is slowest. 50 | 51 | ## v1.1.1 - 2016-12-04 52 | 53 | ### Fixed 54 | 55 | - Fixed crash when copy-pasting on bottom row. 56 | - Screen was erroneously cleared after loading animation. 57 | 58 | ## v1.1.0 - 2016-07-02 59 | 60 | ### Added 61 | 62 | It is now possible to rotate characters. These new key presses were added to animation editor: 63 | 64 | - F7, char: rotate char up 65 | - F7, F7, char: rotate char right 66 | - F7, F7, F7, char: rotate char down 67 | - F7, F7, F7, F7, char: rotate char left 68 | - F7, F7, F7, F7, F7, char: stop rotating char 69 | 70 | ## v1.0 - 2014-10-28 71 | 72 | ### Added 73 | 74 | - Initial release. 75 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/Spline.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2014 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef SPLINE_H 23 | #define SPLINE_H 24 | 25 | namespace reSIDfp 26 | { 27 | 28 | /** 29 | * Fritsch-Carlson monotone cubic spline interpolation. 30 | * 31 | * Based on the implementation from the wikipedia page: 32 | * https://en.wikipedia.org/wiki/Monotone_cubic_interpolation 33 | */ 34 | class Spline 35 | { 36 | public: 37 | typedef struct 38 | { 39 | double x; 40 | double y; 41 | } Point; 42 | 43 | typedef struct 44 | { 45 | double x1; 46 | double x2; 47 | double a; 48 | double b; 49 | double c; 50 | double d; 51 | } Param; 52 | 53 | private: 54 | const int paramsLength; 55 | Param *params; 56 | Param *c; 57 | 58 | private: 59 | /** 60 | * Calculate the slope of the line crossing the given points. 61 | */ 62 | inline double slope(const Point &a, const Point &b); 63 | 64 | public: 65 | Spline(const Point input[], int inputLength); 66 | ~Spline() { delete [] params; } 67 | 68 | /** 69 | * Evaluate y and its derivative at given point x. 70 | */ 71 | void evaluate(double x, Point &out); 72 | }; 73 | 74 | } // namespace reSIDfp 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/resample/Resampler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef RESAMPLER_H 23 | #define RESAMPLER_H 24 | 25 | namespace reSIDfp 26 | { 27 | 28 | /** 29 | * Abstraction of a resampling process. Given enough input, produces output. 30 | * Constructors take additional arguments that configure these objects. 31 | */ 32 | class Resampler 33 | { 34 | protected: 35 | virtual int output() const = 0; 36 | 37 | Resampler() {} 38 | 39 | public: 40 | virtual ~Resampler() {} 41 | 42 | /** 43 | * Input a sample into resampler. Output "true" when resampler is ready with new sample. 44 | * 45 | * @param sample input sample 46 | * @return true when a sample is ready 47 | */ 48 | virtual bool input(int sample) = 0; 49 | 50 | /** 51 | * Output a sample from resampler. 52 | * 53 | * @return resampled sample 54 | */ 55 | short getOutput() const 56 | { 57 | int value = output(); 58 | 59 | // Clip signed integer value into the -32768,32767 range. 60 | if (value < -32768) value = -32768; 61 | if (value > 32767) value = 32767; 62 | 63 | return value; 64 | } 65 | 66 | virtual void reset() = 0; 67 | }; 68 | 69 | } // namespace reSIDfp 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /src/disk.c: -------------------------------------------------------------------------------- 1 | #include "disk.h" 2 | 3 | #include 4 | 5 | #include "keybuf.h" 6 | 7 | char mygets(char* buf) { 8 | unsigned char i = 0; 9 | while (1) { 10 | const char ch = cgetc(); 11 | switch (ch) { 12 | case CH_ENTER: 13 | buf[i] = '\0'; 14 | return i; 15 | case CH_DEL: 16 | if (i) { 17 | --i; 18 | gotox(wherex() - 1); 19 | cputc(' '); 20 | gotox(wherex() - 1); 21 | } 22 | break; 23 | default: 24 | buf[i++] = ch; 25 | cputc(ch); 26 | } 27 | } 28 | } 29 | 30 | void ls() { 31 | struct cbm_dirent direntry; 32 | cbm_opendir(1, 8); 33 | clrscr(); 34 | textcolor(COLOR_WHITE); 35 | while (!cbm_readdir(1, &direntry)) { 36 | if (direntry.size) { 37 | if (wherey() == 24) { 38 | revers(1); 39 | cputs(""); 40 | revers(0); 41 | cgetc(); 42 | clrscr(); 43 | } 44 | cputs(direntry.name); 45 | if (wherex() < 20) { 46 | gotox(20); 47 | } else { 48 | gotoxy(0, wherey() + 1); 49 | } 50 | } 51 | } 52 | cbm_close(1); 53 | if (wherex()) { 54 | gotoxy(0, wherey() + 1); 55 | } 56 | } 57 | 58 | unsigned int prompt_load_anim(void) 59 | { 60 | unsigned int read = 0; 61 | char buf[16]; 62 | ls(); 63 | cputs("load anim> "); 64 | if (mygets(buf)) { 65 | read = cbm_load(buf, 8, KEYS_START); 66 | if (!read) { 67 | cputs(" err"); 68 | cgetc(); 69 | } 70 | } 71 | return read; 72 | } 73 | 74 | void prompt_save_anim() 75 | { 76 | char buf[18]; 77 | ls(); 78 | cputs("save anim> "); 79 | if (!mygets(buf + 2)) return; 80 | buf[0] = 's'; 81 | buf[1] = ':'; 82 | cbm_open(1, 8, 15, buf); /* scratch */ 83 | cbm_close(1); 84 | cputs(cbm_save(buf + 2, 8, KEYS_START, last_char - KEYS_START) 85 | ? " err" : " ok"); 86 | cgetc(); 87 | } 88 | -------------------------------------------------------------------------------- /editor/sidplayfp/sidtune/prg.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2000-2001 Simon White 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #include "prg.h" 24 | 25 | #include 26 | 27 | #include "SidTuneTools.h" 28 | #include "sidplayfp/SidTuneInfo.h" 29 | #include "sidplayfp/stringutils.h" 30 | 31 | const char TXT_FORMAT_PRG[] = "Tape image file (PRG)"; 32 | 33 | const char ERR_TRUNCATED[] = "ERROR: File is most likely truncated"; 34 | 35 | 36 | SidTuneBase* prg::load(const char *fileName, buffer_t& dataBuf) 37 | { 38 | const char *ext = SidTuneTools::fileExtOfPath(fileName); 39 | if ( (!stringutils::equal(ext, ".prg")) && 40 | (!stringutils::equal(ext, ".c64")) ) 41 | { 42 | return 0; 43 | } 44 | 45 | if (dataBuf.size() < 2) 46 | { 47 | throw loadError(ERR_TRUNCATED); 48 | } 49 | 50 | std::auto_ptr tune(new prg()); 51 | tune->load(); 52 | 53 | return tune.release(); 54 | } 55 | 56 | void prg::load() 57 | { 58 | info->m_formatString = TXT_FORMAT_PRG; 59 | 60 | // Automatic settings 61 | info->m_songs = 1; 62 | info->m_startSong = 1; 63 | info->m_compatibility = SidTuneInfo::COMPATIBILITY_BASIC; 64 | 65 | // Create the speed/clock setting table. 66 | convertOldStyleSpeedToTables(~0, info->m_clockSpeed); 67 | } 68 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/Filter6581.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2004,2010 Dag Lem 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #define FILTER6581_CPP 24 | 25 | #include "Filter6581.h" 26 | 27 | namespace reSIDfp 28 | { 29 | 30 | Filter6581::~Filter6581() 31 | { 32 | delete [] f0_dac; 33 | } 34 | 35 | void Filter6581::updatedCenterFrequency() 36 | { 37 | const unsigned short Vw = f0_dac[fc]; 38 | hpIntegrator->setVw(Vw); 39 | bpIntegrator->setVw(Vw); 40 | } 41 | 42 | void Filter6581::updatedMixing() 43 | { 44 | currentGain = gain[vol]; 45 | 46 | unsigned int ni = 0; 47 | unsigned int no = 0; 48 | 49 | (filt1 ? ni : no)++; 50 | 51 | (filt2 ? ni : no)++; 52 | 53 | if (filt3) 54 | { 55 | ni++; 56 | } 57 | else if (!voice3off) 58 | { 59 | no++; 60 | } 61 | 62 | (filtE ? ni : no)++; 63 | 64 | currentSummer = summer[ni]; 65 | 66 | if (lp) 67 | { 68 | no++; 69 | } 70 | 71 | if (bp) 72 | { 73 | no++; 74 | } 75 | 76 | if (hp) 77 | { 78 | no++; 79 | } 80 | 81 | currentMixer = mixer[no]; 82 | } 83 | 84 | void Filter6581::setFilterCurve(double curvePosition) 85 | { 86 | delete [] f0_dac; 87 | f0_dac = FilterModelConfig::getInstance()->getDAC(curvePosition); 88 | updatedCenterFrequency(); 89 | } 90 | 91 | } // namespace reSIDfp 92 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/resample/ZeroOrderResampler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef ZEROORDER_RESAMPLER_H 23 | #define ZEROORDER_RESAMPLER_H 24 | 25 | #include "Resampler.h" 26 | 27 | namespace reSIDfp 28 | { 29 | 30 | /** 31 | * Return sample with linear interpolation. 32 | * 33 | * @author Antti Lankila 34 | */ 35 | class ZeroOrderResampler : public Resampler 36 | { 37 | 38 | private: 39 | int cachedSample; 40 | 41 | const int cyclesPerSample; 42 | int sampleOffset; 43 | int outputValue; 44 | 45 | public: 46 | ZeroOrderResampler(double clockFrequency, double samplingFrequency) : 47 | cachedSample(0), 48 | cyclesPerSample((int)(clockFrequency / samplingFrequency * 1024.)), 49 | sampleOffset(0), 50 | outputValue(0) {} 51 | 52 | bool input(int sample) 53 | { 54 | bool ready = false; 55 | 56 | if (sampleOffset < 1024) 57 | { 58 | outputValue = cachedSample + (sampleOffset * (sample - cachedSample) >> 10); 59 | ready = true; 60 | sampleOffset += cyclesPerSample; 61 | } 62 | 63 | sampleOffset -= 1024; 64 | 65 | cachedSample = sample; 66 | 67 | return ready; 68 | } 69 | 70 | int output() const { return outputValue; } 71 | 72 | void reset() 73 | { 74 | sampleOffset = 0; 75 | cachedSample = 0; 76 | } 77 | }; 78 | 79 | } // namespace reSIDfp 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp-emu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2014 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2001 Simon White 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef RESIDFP_EMU_H 24 | #define RESIDFP_EMU_H 25 | 26 | #include 27 | 28 | #include "residfp/SID.h" 29 | #include "sidplayfp/SidConfig.h" 30 | #include "sidplayfp/sidemu.h" 31 | #include "sidplayfp/event.h" 32 | 33 | class sidbuilder; 34 | 35 | #define RESID_NAMESPACE reSIDfp 36 | 37 | class ReSIDfp: public sidemu 38 | { 39 | private: 40 | RESID_NAMESPACE::SID &m_sid; 41 | 42 | public: 43 | static const char* getCredits(); 44 | 45 | public: 46 | ReSIDfp(sidbuilder *builder); 47 | ~ReSIDfp(); 48 | 49 | // Standard component functions 50 | const char *credits() const { return getCredits(); } 51 | 52 | void reset() { sidemu::reset (); } 53 | void reset(uint8_t volume); 54 | 55 | uint8_t read(uint_least8_t addr); 56 | void write(uint_least8_t addr, uint8_t data); 57 | 58 | // Standard SID functions 59 | void clock(); 60 | void filter(bool enable); 61 | void voice(unsigned int num, bool mute) { m_sid.mute(num, mute); } 62 | 63 | bool getStatus() const { return m_status; } 64 | 65 | // Specific to resid 66 | void sampling(float systemclock, float freq, 67 | SidConfig::sampling_method_t method, bool fast); 68 | 69 | void filter6581Curve(double filterCurve); 70 | void filter8580Curve(double filterCurve); 71 | void model(SidConfig::sid_model_t model); 72 | }; 73 | 74 | #endif // RESIDFP_EMU_H 75 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2001 Simon White 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef RESIDFP_H 24 | #define RESIDFP_H 25 | 26 | #include "sidplayfp/sidbuilder.h" 27 | #include "sidplayfp/siddefs.h" 28 | 29 | /** 30 | * ReSIDfp Builder Class 31 | */ 32 | class SID_EXTERN ReSIDfpBuilder: public sidbuilder 33 | { 34 | public: 35 | ReSIDfpBuilder(const char * const name) : 36 | sidbuilder(name) {} 37 | ~ReSIDfpBuilder(); 38 | 39 | /** 40 | * Available sids. 41 | * 42 | * @return the number of available sids, 0 = endless. 43 | */ 44 | unsigned int availDevices() const { return 0; } 45 | 46 | /** 47 | * Create the sid emu. 48 | * 49 | * @param sids the number of required sid emu 50 | */ 51 | unsigned int create(unsigned int sids); 52 | 53 | const char *credits() const; 54 | 55 | /// @name global settings 56 | /// Settings that affect all SIDs. 57 | //@{ 58 | /** 59 | * enable/disable filter. 60 | */ 61 | void filter(bool enable); 62 | 63 | /** 64 | * Set 6581 filter curve. 65 | * 66 | * @param filterCurve from 0.0 (light) to 1.0 (dark) (default 0.5) 67 | */ 68 | void filter6581Curve(double filterCurve); 69 | 70 | /** 71 | * Set 8580 filter curve. 72 | * 73 | * @param filterCurve curve center frequency (default 12500) 74 | */ 75 | void filter8580Curve(double filterCurve); 76 | //@} 77 | }; 78 | 79 | #endif // RESIDFP_H 80 | -------------------------------------------------------------------------------- /editor/sidplayfp/SidInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2012 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2000 Simon White 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #ifndef SIDINFO_H 24 | #define SIDINFO_H 25 | 26 | #include 27 | 28 | /** 29 | * This interface is used to get sid engine informations. 30 | */ 31 | class SidInfo 32 | { 33 | public: 34 | /// Library name 35 | virtual const char *name() const =0; 36 | 37 | /// Library version 38 | virtual const char *version() const =0; 39 | 40 | /// Library credits 41 | //@{ 42 | virtual unsigned int numberOfCredits() const =0; 43 | virtual const char *credits(unsigned int i) const =0; 44 | //@} 45 | 46 | /// Number of SIDs supported by this library 47 | virtual unsigned int maxsids() const =0; 48 | 49 | /// Number of output channels (1-mono, 2-stereo) 50 | virtual unsigned int channels() const =0; 51 | 52 | /// Address of the driver 53 | virtual uint_least16_t driverAddr() const =0; 54 | 55 | /// Size of the driver in bytes 56 | virtual uint_least16_t driverLength() const =0; 57 | 58 | /// Power on delay 59 | virtual uint_least16_t powerOnDelay() const =0; 60 | 61 | /// Describes the speed current song is running at 62 | virtual const char *speedString() const =0; 63 | 64 | /// Description of the laoded ROM images 65 | //@{ 66 | virtual const char *kernalDesc() const =0; 67 | virtual const char *basicDesc() const =0; 68 | virtual const char *chargenDesc() const =0; 69 | //@} 70 | 71 | protected: 72 | ~SidInfo() {} 73 | }; 74 | 75 | #endif /* SIDINFO_H */ 76 | -------------------------------------------------------------------------------- /editor/sidplayfp/c64/mmu.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2000 Simon White 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #include "mmu.h" 24 | 25 | class Bank; 26 | 27 | MMU::MMU(EventContext *context, Bank* ioBank) : 28 | context(*context), 29 | loram(false), 30 | hiram(false), 31 | charen(false), 32 | ioBank(ioBank), 33 | zeroRAMBank(this, &ramBank) 34 | { 35 | cpuReadMap[0] = &zeroRAMBank; 36 | cpuWriteMap[0] = &zeroRAMBank; 37 | 38 | for (int i = 1; i < 16; i++) 39 | { 40 | cpuReadMap[i] = &ramBank; 41 | cpuWriteMap[i] = &ramBank; 42 | } 43 | } 44 | 45 | void MMU::setCpuPort (int state) 46 | { 47 | loram = (state & 1) != 0; 48 | hiram = (state & 2) != 0; 49 | charen = (state & 4) != 0; 50 | updateMappingPHI2(); 51 | } 52 | 53 | void MMU::updateMappingPHI2() 54 | { 55 | cpuReadMap[0xe] = cpuReadMap[0xf] = hiram ? (Bank*)&kernalRomBank : &ramBank; 56 | cpuReadMap[0xa] = cpuReadMap[0xb] = (loram && hiram) ? (Bank*)&basicRomBank : &ramBank; 57 | 58 | if (charen && (loram || hiram)) 59 | { 60 | cpuReadMap[0xd] = cpuWriteMap[0xd] = ioBank; 61 | } 62 | else 63 | { 64 | cpuReadMap[0xd] = (!charen && (loram || hiram)) ? (Bank*)&characterRomBank : &ramBank; 65 | cpuWriteMap[0xd] = &ramBank; 66 | } 67 | } 68 | 69 | void MMU::reset() 70 | { 71 | ramBank.reset(); 72 | zeroRAMBank.reset(); 73 | 74 | // Reset the ROMs to undo the hacks applied 75 | kernalRomBank.reset(); 76 | basicRomBank.reset(); 77 | 78 | updateMappingPHI2(); 79 | } 80 | -------------------------------------------------------------------------------- /editor/sidplayfp/siddefs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2000-2001 Simon White 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef SIDDEFS_H 24 | #define SIDDEFS_H 25 | 26 | /* DLL building support on win32 hosts */ 27 | #ifndef SID_EXTERN 28 | # ifdef DLL_EXPORT /* defined by libtool (if required) */ 29 | # define SID_EXTERN __declspec(dllexport) 30 | # endif 31 | # ifdef SID_DLL_IMPORT /* define if linking with this dll */ 32 | # define SID_EXTERN __declspec(dllimport) 33 | # endif 34 | # ifndef SID_EXTERN /* static linking or !_WIN32 */ 35 | # if defined(__GNUC__) && (__GNUC__ >= 4) 36 | # define SID_EXTERN __attribute__ ((visibility("default"))) 37 | # else 38 | # define SID_EXTERN 39 | # endif 40 | # endif 41 | #endif 42 | 43 | /* Deprecated attributes */ 44 | #if defined(_MSCVER) 45 | # define SID_DEPRECATED __declspec(deprecated) 46 | #elif defined(__GNUC__) 47 | # define SID_DEPRECATED __attribute__ ((deprecated)) 48 | #else 49 | # define SID_DEPRECATED 50 | #endif 51 | 52 | /* Unused attributes */ 53 | #if defined(__GNUC__) 54 | # define SID_UNUSED __attribute__ ((unused)) 55 | #else 56 | # define SID_UNUSED 57 | #endif 58 | 59 | /* Namespace support */ 60 | #define SIDPLAYFP_NAMESPACE __sidplayfp__ 61 | #ifdef SIDPLAYFP_NAMESPACE 62 | # define SIDPLAYFP_NAMESPACE_START \ 63 | namespace SIDPLAYFP_NAMESPACE \ 64 | { 65 | # define SIDPLAYFP_NAMESPACE_STOP \ 66 | } 67 | #else 68 | # define SIDPLAYFP_NAMESPACE_START 69 | # define SIDPLAYFP_NAMESPACE_STOP 70 | #endif 71 | 72 | #endif /* SIDDEFS_H */ 73 | -------------------------------------------------------------------------------- /editor/sidplayfp/sidtune/MUS.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2012-2013 Leandro Nini 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #ifndef MUS_H 22 | #define MUS_H 23 | 24 | #include 25 | 26 | #include "SidTuneBase.h" 27 | 28 | class sidmemory; 29 | template class SmartPtr_sidtt; 30 | 31 | class MUS : public SidTuneBase 32 | { 33 | private: 34 | /// Needed for MUS/STR player installation. 35 | uint_least16_t musDataLen; 36 | 37 | private: 38 | static bool detect(const uint_least8_t* buffer, uint_least32_t bufLen, 39 | uint_least32_t& voice3Index); 40 | 41 | bool mergeParts(buffer_t& musBuf, buffer_t& strBuf); 42 | 43 | void tryLoad(buffer_t& musBuf, 44 | buffer_t& strBuf, 45 | SmartPtr_sidtt &spPet, 46 | uint_least32_t voice3Index, 47 | bool init); 48 | 49 | protected: 50 | MUS() {} 51 | 52 | void installPlayer(sidmemory *mem); 53 | 54 | void setPlayerAddress(); 55 | 56 | virtual void acceptSidTune(const char* dataFileName, const char* infoFileName, 57 | buffer_t& buf, bool isSlashedFileName); 58 | 59 | public: 60 | virtual ~MUS() {} 61 | 62 | static SidTuneBase* load(buffer_t& dataBuf, bool init = false); 63 | static SidTuneBase* load(buffer_t& musBuf, 64 | buffer_t& strBuf, 65 | uint_least32_t fileOffset, 66 | bool init = false); 67 | 68 | virtual bool placeSidTuneInC64mem(sidmemory* mem); 69 | 70 | private: 71 | // prevent copying 72 | MUS(const MUS&); 73 | MUS& operator=(MUS&); 74 | }; 75 | 76 | #endif // MUS_H 77 | -------------------------------------------------------------------------------- /src/cfg_2bit.s: -------------------------------------------------------------------------------- 1 | ;------------------------------------------------------------------------------- 2 | ; 2-bit protocol configuration 3 | ;------------------------------------------------------------------------------- 4 | 5 | .include "zeropage.inc" 6 | 7 | TWOBIT_PROTOCOL = 1 ;Nonzero to use 2-bit protocol which may delay 8 | ;interrupts and does not allow sprites, but is 9 | ;faster. Zero to use 1-bit protocol which is 10 | ;the opposite. 11 | LONG_NAMES = 1 ;Set to nonzero to use long names (pointer in 12 | ;X,Y) or zero to use 2-letter names (letters 13 | ;in X,Y) 14 | BORDER_FLASHING = 0 ;Set to nonzero to enable border flashing 15 | ;when fastloading :) 16 | ADDITIONAL_ZEROPAGE = 1 ;Set to nonzero to use additional zeropage 17 | ;variables to shorten loader code 18 | LOAD_UNDER_IO = 0 ;Set to nonzero to enable possibility to load 19 | ;under I/O areas, and to load packed data 20 | ;under the Kernal ROM. 21 | LOADFILE_UNPACKED = 1 ;Set to nonzero to include unpacked loading 22 | LOADFILE_EXOMIZER = 0 ;Set to nonzero to include EXOMIZER loading 23 | LOADFILE_PUCRUNCH = 0 ;Set to nonzero to include PUCRUNCH loading 24 | 25 | LITERAL_SEQUENCES_NOT_USED = 0 ;(EXOMIZER only): set to nonzero for shorter 26 | ;depacker, if you use -c switch to disable 27 | ;literal sequences in Exomizer 2, or if you 28 | ;use Exomizer 1. 29 | FORWARD_DECRUNCHING = 0 ;(EXOMIZER only): set to nonzero if you use -f 30 | ;switch in Exomizer 2, zero for Exomizer 1. 31 | 32 | RETRIES = 5 ;Retries when reading a sector 33 | 34 | loadbuffer = $0f00 ;256 byte table used by fastloader 35 | 36 | depackbuffer = $0500 ;156 bytes for EXOMIZER tables, 31 for 37 | ;PUCRUNCH. 38 | 39 | zpbase = tmp1 ;Zeropage base address. Loader needs 2 40 | ;addresses with unpacked, 3 with PUCRUNCH 41 | ;and 8 with EXOMIZER loading. 42 | 43 | zpbase2 = tmp3 ;Additional 4 zeropage addresses for shortening 44 | ;the loader code (optional) 45 | -------------------------------------------------------------------------------- /editor/sidplayfp/utils/SidDatabase.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2000-2001 Simon White 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef SIDDATABASE_H 24 | #define SIDDATABASE_H 25 | 26 | #include 27 | 28 | #include "sidplayfp/siddefs.h" 29 | 30 | class SidTune; 31 | class iniParser; 32 | 33 | /** 34 | * SidDatabase 35 | * An utility class to deal with the songlength DataBase. 36 | */ 37 | class SID_EXTERN SidDatabase 38 | { 39 | private: 40 | class parseError {}; 41 | 42 | static const char *parseTime(const char *str, long &result); 43 | 44 | private: 45 | iniParser *m_parser; 46 | const char *errorString; 47 | 48 | public: 49 | SidDatabase(); 50 | ~SidDatabase(); 51 | 52 | /** 53 | * Open the songlength DataBase. 54 | * 55 | * @param filename songlengthDB file name with full path. 56 | * @return false in case of errors, true otherwise. 57 | */ 58 | bool open(const char *filename); 59 | 60 | /** 61 | * Close the songlength DataBase. 62 | */ 63 | void close(); 64 | 65 | /** 66 | * Get the length of the current subtune. 67 | * 68 | * @param tune 69 | * @return tune length in seconds, -1 in case of errors. 70 | */ 71 | int_least32_t length(SidTune &tune); 72 | 73 | /** 74 | * Get the length of the selected subtune. 75 | * 76 | * @param md5 the md5 hash of the tune. 77 | * @param song the subtune. 78 | * @return tune length in seconds, -1 in case of errors. 79 | */ 80 | int_least32_t length(const char *md5, unsigned int song); 81 | 82 | /** 83 | * Get descriptive error message. 84 | */ 85 | const char *error() const { return errorString; } 86 | }; 87 | 88 | #endif // SIDDATABASE_H 89 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/Filter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2004 Dag Lem 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #include "Filter.h" 24 | 25 | namespace reSIDfp 26 | { 27 | 28 | void Filter::enable(bool enable) 29 | { 30 | enabled = enable; 31 | 32 | if (enabled) 33 | { 34 | writeRES_FILT(filt); 35 | } 36 | else 37 | { 38 | filt1 = filt2 = filt3 = filtE = false; 39 | } 40 | } 41 | 42 | void Filter::setClockFrequency(double clock) 43 | { 44 | clockFrequency = clock; 45 | updatedCenterFrequency(); 46 | } 47 | 48 | void Filter::reset() 49 | { 50 | writeFC_LO(0); 51 | writeFC_HI(0); 52 | writeMODE_VOL(0); 53 | writeRES_FILT(0); 54 | } 55 | 56 | void Filter::writeFC_LO(unsigned char fc_lo) 57 | { 58 | fc = (fc & 0x7f8) | (fc_lo & 0x007); 59 | updatedCenterFrequency(); 60 | } 61 | 62 | void Filter::writeFC_HI(unsigned char fc_hi) 63 | { 64 | fc = (fc_hi << 3 & 0x7f8) | (fc & 0x007); 65 | updatedCenterFrequency(); 66 | } 67 | 68 | void Filter::writeRES_FILT(unsigned char res_filt) 69 | { 70 | filt = res_filt; 71 | 72 | res = res_filt >> 4 & 0x0f; 73 | updatedResonance(); 74 | 75 | if (enabled) 76 | { 77 | filt1 = (filt & 0x01) != 0; 78 | filt2 = (filt & 0x02) != 0; 79 | filt3 = (filt & 0x04) != 0; 80 | filtE = (filt & 0x08) != 0; 81 | } 82 | 83 | updatedMixing(); 84 | } 85 | 86 | void Filter::writeMODE_VOL(unsigned char mode_vol) 87 | { 88 | vol = mode_vol & 0x0f; 89 | lp = (mode_vol & 0x10) != 0; 90 | bp = (mode_vol & 0x20) != 0; 91 | hp = (mode_vol & 0x40) != 0; 92 | voice3off = (mode_vol & 0x80) != 0; 93 | 94 | updatedMixing(); 95 | } 96 | 97 | } // namespace reSIDfp 98 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp-builder.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2001 Simon White 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #include "residfp.h" 24 | 25 | #include 26 | #include 27 | 28 | #include "residfp-emu.h" 29 | 30 | ReSIDfpBuilder::~ReSIDfpBuilder() 31 | { // Remove all SID emulations 32 | remove(); 33 | } 34 | 35 | // Create a new sid emulation. 36 | unsigned int ReSIDfpBuilder::create(unsigned int sids) 37 | { 38 | m_status = true; 39 | 40 | // Check available devices 41 | unsigned int count = availDevices(); 42 | 43 | if (count && (count < sids)) 44 | sids = count; 45 | 46 | for (count = 0; count < sids; count++) 47 | { 48 | try 49 | { 50 | sidobjs.insert(new ReSIDfp(this)); 51 | } 52 | // Memory alloc failed? 53 | catch (std::bad_alloc const &) 54 | { 55 | m_errorBuffer.assign(name()).append(" ERROR: Unable to create ReSIDfp object"); 56 | m_status = false; 57 | break; 58 | } 59 | } 60 | return count; 61 | 62 | } 63 | 64 | const char *ReSIDfpBuilder::credits() const 65 | { 66 | return ReSIDfp::getCredits(); 67 | } 68 | 69 | void ReSIDfpBuilder::filter(bool enable) 70 | { 71 | std::for_each(sidobjs.begin(), sidobjs.end(), applyParameter(&ReSIDfp::filter, enable)); 72 | } 73 | 74 | void ReSIDfpBuilder::filter6581Curve(double filterCurve) 75 | { 76 | std::for_each(sidobjs.begin(), sidobjs.end(), applyParameter(&ReSIDfp::filter6581Curve, filterCurve)); 77 | } 78 | 79 | void ReSIDfpBuilder::filter8580Curve(double filterCurve) 80 | { 81 | std::for_each(sidobjs.begin(), sidobjs.end(), applyParameter(&ReSIDfp::filter8580Curve, filterCurve)); 82 | } 83 | -------------------------------------------------------------------------------- /editor/sidplayfp/c64/Banks/ExtraSidBank.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2012-2013 Leandro Nini 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #ifndef EXTRASIDBANK_H 22 | #define EXTRASIDBANK_H 23 | 24 | #include "Bank.h" 25 | #include "sidplayfp/c64/c64sid.h" 26 | 27 | #include "NullSid.h" 28 | 29 | /** 30 | * Extra SID bank 31 | */ 32 | class ExtraSidBank : public Bank 33 | { 34 | private: 35 | /** 36 | * Size of mapping table. Each 32 bytes another SID chip base address 37 | * can be assigned to. 38 | */ 39 | static const int MAPPER_SIZE = 8; 40 | 41 | private: 42 | /** 43 | * SID mapping table. 44 | * Maps a SID chip base address to a SID 45 | * or to the underlying bank. 46 | */ 47 | Bank *mapper[MAPPER_SIZE]; 48 | 49 | c64sid *sid; 50 | 51 | private: 52 | static unsigned int mapperIndex(int address) { return address >> 5 & (MAPPER_SIZE - 1); } 53 | 54 | public: 55 | ExtraSidBank() : 56 | sid(NullSid::getInstance()) 57 | {} 58 | 59 | void reset() 60 | { 61 | sid->reset(0xf); 62 | } 63 | 64 | void resetSIDMapper(Bank *bank) 65 | { 66 | for (int i = 0; i < MAPPER_SIZE; i++) 67 | mapper[i] = bank; 68 | } 69 | 70 | /** 71 | * Put a SID at desired location. 72 | * 73 | * @param address the address 74 | */ 75 | void setSIDMapping(int address) 76 | { 77 | mapper[mapperIndex(address)] = sid; 78 | } 79 | 80 | uint8_t peek(uint_least16_t addr) 81 | { 82 | return mapper[mapperIndex(addr)]->peek(addr); 83 | } 84 | 85 | void poke(uint_least16_t addr, uint8_t data) 86 | { 87 | mapper[mapperIndex(addr)]->poke(addr, data); 88 | } 89 | 90 | /** 91 | * Set SID emulation. 92 | * 93 | * @param s the emulation 94 | */ 95 | void setSID(c64sid *s) { sid = (s != 0) ? s : NullSid::getInstance(); } 96 | }; 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/resample/TwoPassSincResampler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef TWOPASSSINCRESAMPLER_H 23 | #define TWOPASSSINCRESAMPLER_H 24 | 25 | #include 26 | 27 | #include "Resampler.h" 28 | #include "SincResampler.h" 29 | 30 | namespace reSIDfp 31 | { 32 | 33 | /** 34 | * Compose a more efficient SINC from chaining two other SINCs. 35 | */ 36 | class TwoPassSincResampler : public Resampler 37 | { 38 | private: 39 | SincResampler* s1; 40 | SincResampler* s2; 41 | 42 | public: 43 | TwoPassSincResampler(double clockFrequency, double samplingFrequency, 44 | double highestAccurateFrequency) 45 | { 46 | /* Calculation according to Laurent Ganier. It evaluates to about 120 kHz at typical settings. 47 | * Some testing around the chosen value seems to confirm that this does work. */ 48 | const double intermediateFrequency = 2. * highestAccurateFrequency 49 | + sqrt(2. * highestAccurateFrequency * clockFrequency 50 | * (samplingFrequency - 2. * highestAccurateFrequency) / samplingFrequency); 51 | s1 = new SincResampler(clockFrequency, intermediateFrequency, highestAccurateFrequency); 52 | s2 = new SincResampler(intermediateFrequency, samplingFrequency, highestAccurateFrequency); 53 | } 54 | 55 | ~TwoPassSincResampler() 56 | { 57 | delete s1; 58 | delete s2; 59 | } 60 | 61 | bool input(int sample) 62 | { 63 | return s1->input(sample) && s2->input(s1->output()); 64 | } 65 | 66 | int output() const 67 | { 68 | return s2->output(); 69 | } 70 | 71 | void reset() 72 | { 73 | s1->reset(); 74 | s2->reset(); 75 | } 76 | }; 77 | 78 | } // namespace reSIDfp 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/OpAmp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2014 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #include "OpAmp.h" 23 | 24 | #include 25 | 26 | #include "siddefs-fp.h" 27 | 28 | namespace reSIDfp 29 | { 30 | 31 | const double OpAmp::EPSILON = 1e-8; 32 | 33 | double OpAmp::solve(double n, double vi) 34 | { 35 | // Start off with an estimate of x and a root bracket [ak, bk]. 36 | // f is decreasing, so that f(ak) > 0 and f(bk) < 0. 37 | double ak = vmin; 38 | double bk = vmax; 39 | 40 | const double a = n + 1.; 41 | const double b = kVddt; 42 | double b_vi = (b - vi); 43 | if (b_vi < 0.) b_vi = 0.; 44 | const double c = n * (b_vi * b_vi); 45 | 46 | for (;;) 47 | { 48 | const double xk = x; 49 | 50 | // Calculate f and df. 51 | 52 | Spline::Point out; 53 | 54 | opamp->evaluate(x, out); 55 | const double vo = out.x; 56 | const double dvo = out.y; 57 | 58 | double b_vx = b - x; 59 | if (b_vx < 0.) b_vx = 0.; 60 | double b_vo = b - vo; 61 | if (b_vo < 0.) b_vo = 0.; 62 | 63 | // f = a*(b - vx)^2 - c - (b - vo)^2 64 | const double f = a * (b_vx * b_vx) - c - (b_vo * b_vo); 65 | 66 | // df = 2*((b - vo)*dvo - a*(b - vx)) 67 | const double df = 2. * (b_vo * dvo - a * b_vx); 68 | 69 | // Newton-Raphson step: xk1 = xk - f(xk)/f'(xk) 70 | x -= f / df; 71 | 72 | if (unlikely(fabs(x - xk) < EPSILON)) 73 | { 74 | opamp->evaluate(x, out); 75 | return out.x; 76 | } 77 | 78 | // Narrow down root bracket. 79 | (f < 0. ? bk : ak) = xk; 80 | 81 | if (unlikely(x <= ak) || unlikely(x >= bk)) 82 | { 83 | // Bisection step (ala Dekker's method). 84 | x = (ak + bk) * 0.5; 85 | } 86 | } 87 | } 88 | 89 | } // namespace reSIDfp 90 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/Dac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2004,2010 Dag Lem 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef DAC_H 24 | #define DAC_H 25 | 26 | namespace reSIDfp 27 | { 28 | 29 | /** 30 | * Estimate DAC nonlinearity. 31 | * The SID DACs are built up as R-2R ladder as follows: 32 | * 33 | * n n-1 2 1 0 VGND 34 | * | | | | | | Termination 35 | * 2R 2R 2R 2R 2R 2R only for 36 | * | | | | | | MOS 8580 37 | * Vo --R---R--...--R---R-- --- 38 | * 39 | * 40 | * All MOS 6581 DACs are missing a termination resistor at bit 0. This causes 41 | * pronounced errors for the lower 4 - 5 bits (e.g. the output for bit 0 is 42 | * actually equal to the output for bit 1), resulting in DAC discontinuities 43 | * for the lower bits. 44 | * In addition to this, the 6581 DACs exhibit further severe discontinuities 45 | * for higher bits, which may be explained by a less than perfect match between 46 | * the R and 2R resistors, or by output impedance in the NMOS transistors 47 | * providing the bit voltages. A good approximation of the actual DAC output is 48 | * achieved for 2R/R ~ 2.20. 49 | * 50 | * The MOS 8580 DACs, on the other hand, do not exhibit any discontinuities. 51 | * These DACs include the correct termination resistor, and also seem to have 52 | * very accurately matched R and 2R resistors (2R/R = 2.00). 53 | */ 54 | class Dac 55 | { 56 | public: 57 | /** 58 | * @param dac an array to be filled with the resulting analog values 59 | * @param dacLength the dac array length 60 | * @param _2R_div_R nonlinearity parameter, 1.0 for perfect linearity. 61 | * @param term is the dac terminated by a 2R resistor? (6581 DACs are not) 62 | */ 63 | static void kinkedDac(double* dac, int dacLength, double _2R_div_R, bool term); 64 | }; 65 | 66 | } // namespace reSIDfp 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /editor/sidplayfp/sidtune/SidTuneTools.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright (C) Michael Schwendt 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #include "SidTuneTools.h" 22 | 23 | #include "SidTuneCfg.h" 24 | 25 | // Return pointer to file name position in complete path. 26 | size_t SidTuneTools::fileNameWithoutPath(const char* s) 27 | { 28 | size_t last_slash_pos = -1; 29 | const size_t length = strlen(s); 30 | for (size_t pos = 0; pos < length; pos++) 31 | { 32 | #if defined(SID_FS_IS_COLON_AND_BACKSLASH_AND_SLASH) 33 | if (s[pos] == ':' || s[pos] == '\\' 34 | || s[pos] == '/') 35 | #elif defined(SID_FS_IS_COLON_AND_SLASH) 36 | if (s[pos] == ':' || s[pos] == '/') 37 | #elif defined(SID_FS_IS_SLASH) 38 | if (s[pos] == '/') 39 | #elif defined(SID_FS_IS_BACKSLASH) 40 | if (s[pos] == '\\') 41 | #elif defined(SID_FS_IS_COLON) 42 | if (s[pos] == ':') 43 | #else 44 | # error Missing file/path separator definition. 45 | #endif 46 | { 47 | last_slash_pos = pos; 48 | } 49 | } 50 | return last_slash_pos + 1; 51 | } 52 | 53 | // Return pointer to file name position in complete path. 54 | // Special version: file separator = forward slash. 55 | size_t SidTuneTools::slashedFileNameWithoutPath(const char* s) 56 | { 57 | size_t last_slash_pos = -1; 58 | const size_t length = strlen(s); 59 | for (size_t pos = 0; pos < length; pos++) 60 | { 61 | if ( s[pos] == '/' ) 62 | { 63 | last_slash_pos = pos; 64 | } 65 | } 66 | return last_slash_pos + 1; 67 | } 68 | 69 | // Return pointer to file name extension in path. 70 | // The backwards-version. 71 | const char* SidTuneTools::fileExtOfPath(const char* s) 72 | { 73 | size_t last_dot_pos = strlen(s); // assume no dot and append 74 | for (size_t pos = last_dot_pos; pos > 0; pos--) 75 | { 76 | if (s[pos-1] == '.') 77 | { 78 | last_dot_pos = pos - 1; 79 | break; 80 | } 81 | } 82 | return &s[last_dot_pos]; 83 | } 84 | -------------------------------------------------------------------------------- /editor/sidplayfp/psiddrv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2012-2014 Leandro Nini 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #ifndef PSIDDRV_H 22 | #define PSIDDRV_H 23 | 24 | #include 25 | 26 | class SidTuneInfo; 27 | class sidmemory; 28 | 29 | class psiddrv 30 | { 31 | private: 32 | const SidTuneInfo *m_tuneInfo; 33 | const char *m_errorString; 34 | 35 | uint8_t *reloc_driver; 36 | int reloc_size; 37 | 38 | uint_least16_t m_driverAddr; 39 | uint_least16_t m_driverLength; 40 | uint_least16_t m_powerOnDelay; 41 | 42 | private: 43 | static uint8_t psid_driver[]; 44 | 45 | private: 46 | /** 47 | * Get required I/O map to reach address 48 | * 49 | * @param addr a 16-bit effective address 50 | * @return a default bank-select value for $01 51 | */ 52 | uint8_t iomap(uint_least16_t addr) const; 53 | 54 | /** 55 | * Copy power on pattern in memory. 56 | */ 57 | void copyPoweronPattern(sidmemory *mem) const; 58 | 59 | public: 60 | psiddrv(const SidTuneInfo *tuneInfo) : 61 | m_tuneInfo(tuneInfo), 62 | m_powerOnDelay(0) {} 63 | 64 | /** 65 | * Set the power on delay cycles. 66 | * 67 | * @param delay the delay 68 | */ 69 | void powerOnDelay(uint_least16_t delay) { m_powerOnDelay = delay; } 70 | 71 | /** 72 | * Relocate the driver. 73 | */ 74 | bool drvReloc(); 75 | 76 | /** 77 | * Install the driver. 78 | * Must be called after the tune has been placed in memory. 79 | * 80 | * @param mem the c64 memory interface 81 | * @param video the PAL/NTSC switch value, 0: NTSC, 1: PAL 82 | */ 83 | void install(sidmemory *mem, uint8_t video) const; 84 | 85 | /** 86 | * Get a detailed error message. 87 | * 88 | * @return a pointer to the string 89 | */ 90 | const char* errorString() const { return m_errorString; } 91 | 92 | uint_least16_t driverAddr() const { return m_driverAddr; } 93 | uint_least16_t driverLength() const { return m_driverLength; } 94 | }; 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/Dac.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2004,2010 Dag Lem 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #include "Dac.h" 24 | 25 | namespace reSIDfp 26 | { 27 | 28 | void Dac::kinkedDac(double* dac, int dacLength, double _2R_div_R, bool term) 29 | { 30 | const double R_INFINITY = 1e6; 31 | 32 | // Calculate voltage contribution by each individual bit in the R-2R ladder. 33 | for (int set_bit = 0; set_bit < dacLength; set_bit++) 34 | { 35 | double Vn = 1.; // Normalized bit voltage. 36 | double R = 1.; // Normalized R 37 | const double _2R = _2R_div_R * R; // 2R 38 | double Rn = term ? // Rn = 2R for correct termination, 39 | _2R : R_INFINITY; // INFINITY for missing termination. 40 | 41 | int bit; 42 | 43 | // Calculate DAC "tail" resistance by repeated parallel substitution. 44 | for (bit = 0; bit < set_bit; bit++) 45 | { 46 | Rn = (Rn == R_INFINITY) ? 47 | R + _2R : 48 | R + _2R * Rn / (_2R + Rn); // R + 2R || Rn 49 | } 50 | 51 | // Source transformation for bit voltage. 52 | if (Rn == R_INFINITY) 53 | { 54 | Rn = _2R; 55 | } 56 | else 57 | { 58 | Rn = _2R * Rn / (_2R + Rn); // 2R || Rn 59 | Vn = Vn * Rn / _2R; 60 | } 61 | 62 | // Calculate DAC output voltage by repeated source transformation from 63 | // the "tail". 64 | 65 | for (++bit; bit < dacLength; bit++) 66 | { 67 | Rn += R; 68 | const double I = Vn / Rn; 69 | Rn = _2R * Rn / (_2R + Rn); // 2R || Rn 70 | Vn = Rn * I; 71 | } 72 | 73 | dac[set_bit] = Vn; 74 | } 75 | 76 | /* Normalize to integerish behavior */ 77 | double Vsum = 0.; 78 | 79 | for (int i = 0; i < dacLength; i ++) 80 | { 81 | Vsum += dac[i]; 82 | } 83 | 84 | Vsum /= 1 << dacLength; 85 | 86 | for (int i = 0; i < dacLength; i ++) 87 | { 88 | dac[i] /= Vsum; 89 | } 90 | } 91 | 92 | } // namespace reSIDfp 93 | -------------------------------------------------------------------------------- /editor/sidplayfp/utils/STILview/stildefs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 1998, 2002 by LaLa 5 | * Copyright 2012-2013 Leandro Nini 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | // 23 | // STIL - Common defines 24 | // 25 | 26 | #ifndef STILDEFS_H 27 | #define STILDEFS_H 28 | 29 | /* DLL building support on win32 hosts */ 30 | #ifndef STIL_EXTERN 31 | # ifdef DLL_EXPORT /* defined by libtool (if required) */ 32 | # define STIL_EXTERN __declspec(dllexport) 33 | # endif 34 | # ifdef STIL_DLL_IMPORT /* define if linking with this dll */ 35 | # define STIL_EXTERN __declspec(dllimport) 36 | # endif 37 | # ifndef STIL_EXTERN /* static linking or !_WIN32 */ 38 | # if defined(__GNUC__) && (__GNUC__ >= 4) 39 | # define STIL_EXTERN __attribute__ ((visibility("default"))) 40 | # else 41 | # define STIL_EXTERN 42 | # endif 43 | # endif 44 | #endif 45 | 46 | /* Deprecated attributes */ 47 | #if defined(_MSCVER) 48 | # define STIL_DEPRECATED __declspec(deprecated) 49 | #elif defined(__GNUC__) 50 | # define STIL_DEPRECATED __attribute__ ((deprecated)) 51 | #else 52 | # define STIL_DEPRECATED 53 | #endif 54 | 55 | #if defined(__linux__) || defined(__FreeBSD__) || defined(solaris2) || defined(sun) || defined(sparc) || defined(sgi) 56 | # define UNIX 57 | #endif 58 | 59 | #if defined(__MACOS__) 60 | # define MAC 61 | #endif 62 | 63 | #if defined(__amigaos__) 64 | # define AMIGA 65 | #endif 66 | 67 | // 68 | // Here you should define: 69 | // - what the pathname separator is on your system (attempted to be defined 70 | // automatically), 71 | // - what function compares strings case-insensitively, 72 | // - what function compares portions of strings case-insensitively. 73 | // 74 | 75 | #ifdef UNIX 76 | # define SLASH '/' 77 | #elif MAC 78 | # define SLASH ':' 79 | #elif AMIGA 80 | # define SLASH '/' 81 | #else // WinDoze 82 | # define SLASH '\\' 83 | #endif 84 | 85 | // Unused, will be removed in future version 86 | #define STIL_MAX_LINE_SIZE 91 87 | 88 | // Unused, will be removed in future version 89 | #define STIL_MAX_ENTRY_SIZE STIL_MAX_LINE_SIZE*100 90 | 91 | // HVSC path to STIL. 92 | const char DEFAULT_PATH_TO_STIL[]="/DOCUMENTS/STIL.txt"; 93 | 94 | // HVSC path to BUGlist. 95 | const char DEFAULT_PATH_TO_BUGLIST[]="/DOCUMENTS/BUGlist.txt"; 96 | 97 | #endif // STILDEFS_H 98 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/ExternalFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2004 Dag Lem 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef EXTERNALFILTER_H 24 | #define EXTERNALFILTER_H 25 | 26 | #include "siddefs-fp.h" 27 | 28 | namespace reSIDfp 29 | { 30 | 31 | /** 32 | * The audio output stage in a Commodore 64 consists of two STC networks, a 33 | * low-pass filter with 3-dB frequency 16kHz followed by a high-pass filter with 34 | * 3-dB frequency 16Hz (the latter provided an audio equipment input impedance 35 | * of 1kOhm). 36 | *

37 | * The STC networks are connected with a BJT supposedly meant to act 38 | * as a unity gain buffer, which is not really how it works. 39 | * A more elaborate model would include the BJT, however DC circuit analysis 40 | * yields BJT base-emitter and emitter-base impedances sufficiently low 41 | * to produce additional low-pass and high-pass 3dB-frequencies 42 | * in the order of hundreds of kHz. This calls for a sampling frequency 43 | * of several MHz, which is far too high for practical use. 44 | */ 45 | class ExternalFilter 46 | { 47 | private: 48 | /// lowpass 49 | int Vlp; 50 | 51 | /// highpass 52 | int Vhp; 53 | 54 | int w0lp_1_s7; 55 | 56 | int w0hp_1_s17; 57 | 58 | public: 59 | /** 60 | * SID clocking. 61 | * 62 | * @param Vi 63 | */ 64 | int clock(int Vi); 65 | 66 | /** 67 | * Constructor. 68 | */ 69 | ExternalFilter(); 70 | 71 | /** 72 | * Setup of the external filter sampling parameters. 73 | * 74 | * @param frequency 75 | */ 76 | void setClockFrequency(double frequency); 77 | 78 | /** 79 | * SID reset. 80 | */ 81 | void reset(); 82 | }; 83 | 84 | } // namespace reSIDfp 85 | 86 | #if RESID_INLINING || defined(EXTERNALFILTER_CPP) 87 | 88 | namespace reSIDfp 89 | { 90 | 91 | int ExternalFilter::clock(int Vi) 92 | { 93 | const int dVlp = (w0lp_1_s7 * ((Vi << 11) - Vlp) >> 7); 94 | const int dVhp = (w0hp_1_s17 * (Vlp - Vhp) >> 17); 95 | Vlp += dVlp; 96 | Vhp += dVhp; 97 | return (Vlp - Vhp) >> 11; 98 | } 99 | 100 | } // namespace reSIDfp 101 | 102 | #endif 103 | 104 | #endif 105 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/Voice.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2004 Dag Lem 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef VOICE_H 24 | #define VOICE_H 25 | 26 | #include "siddefs-fp.h" 27 | #include "WaveformGenerator.h" 28 | #include "EnvelopeGenerator.h" 29 | 30 | namespace reSIDfp 31 | { 32 | 33 | /** 34 | * Representation of SID voice block. 35 | */ 36 | class Voice 37 | { 38 | private: 39 | WaveformGenerator* waveformGenerator; 40 | 41 | EnvelopeGenerator* envelopeGenerator; 42 | 43 | public: 44 | /** 45 | * Amplitude modulated waveform output. 46 | * 47 | * The waveform DAC generates a voltage between 5 and 12 V corresponding 48 | * to oscillator state 0 .. 4095. 49 | * 50 | * The envelope DAC generates a voltage between waveform gen output and 51 | * the 5V level, corresponding to envelope state 0 .. 255. 52 | * 53 | * Ideal range [-2048*255, 2047*255]. 54 | * 55 | * @param ringModulator Ring-modulator for waveform 56 | * @return waveformgenerator output 57 | */ 58 | int output(const WaveformGenerator* ringModulator) const 59 | { 60 | return waveformGenerator->output(ringModulator) * envelopeGenerator->output(); 61 | } 62 | 63 | /** 64 | * Constructor. 65 | */ 66 | Voice() : 67 | waveformGenerator(new WaveformGenerator()), 68 | envelopeGenerator(new EnvelopeGenerator()) {} 69 | 70 | ~Voice() 71 | { 72 | delete waveformGenerator; 73 | delete envelopeGenerator; 74 | } 75 | 76 | WaveformGenerator* wave() const { return waveformGenerator; } 77 | 78 | EnvelopeGenerator* envelope() const { return envelopeGenerator; } 79 | 80 | /** 81 | * Write control register. 82 | * 83 | * @param control Control register value. 84 | */ 85 | void writeCONTROL_REG(unsigned char control) 86 | { 87 | waveformGenerator->writeCONTROL_REG(control); 88 | envelopeGenerator->writeCONTROL_REG(control); 89 | } 90 | 91 | /** 92 | * SID reset. 93 | */ 94 | void reset() 95 | { 96 | waveformGenerator->reset(); 97 | envelopeGenerator->reset(); 98 | } 99 | }; 100 | 101 | } // namespace reSIDfp 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /editor/screen.cpp: -------------------------------------------------------------------------------- 1 | #include "screen.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "vicpalette.h" 10 | 11 | const int borderMargin = 64; 12 | 13 | Screen::Screen(QWidget *parent) : 14 | QWidget(parent) 15 | { 16 | } 17 | 18 | void Screen::draw(QImage *image, int column, int row) { 19 | static QByteArray charrom; 20 | if (charrom.isEmpty()) { 21 | QFile f(":/charrom.bin"); 22 | f.open(QFile::ReadOnly); 23 | charrom = f.readAll(); 24 | Q_ASSERT(charrom.size() == 2 * 256 * 8); 25 | } 26 | const QRgb bg(vicPalette[bgColor & 15]); 27 | const QRgb fg(vicPalette[fgColor[column][row] & 15]); 28 | for (int y = row * 8; y < row * 8 + 8; ++y) { 29 | const char romchar = charrom.at(chars[column][row] * 8 + y % 8); 30 | for (int x = column * 8; x < column * 8 + 8; ++x) { 31 | const bool set = (0x80 >> (x % 8)) & romchar; 32 | image->setPixel(x, y, set ? fg : bg); 33 | } 34 | } 35 | } 36 | 37 | void Screen::paintEvent(QPaintEvent *event) { 38 | (void)event; 39 | 40 | QImage image(320, 200, QImage::Format_RGB32); 41 | for (int y = 0; y < 25; ++y) { 42 | for (int x = 0; x < 40; ++x) { 43 | draw(&image, x, y); 44 | } 45 | } 46 | 47 | QPainter painter(this); 48 | painter.fillRect(0, 0, width(), height(), vicPalette[borderColor]); 49 | painter.translate(borderMargin, borderMargin); 50 | painter.scale((width() - borderMargin * 2) / 320.f, (height() - borderMargin * 2) / 200.f); 51 | painter.drawImage(0, 0, image); 52 | } 53 | 54 | QSize Screen::minimumSizeHint() const { 55 | return QSize(640 + borderMargin * 2, 400 + borderMargin * 2); 56 | } 57 | 58 | void Screen::init() { 59 | bgColor = 0; 60 | borderColor = 0; 61 | memset(fgColor, 0, sizeof(fgColor)); 62 | memset(chars, ' ', sizeof(chars)); 63 | } 64 | 65 | void Screen::moveUp() { 66 | for (int x = 0; x < 40; ++x) { 67 | for (int y = 0; y < 24; ++y) { 68 | chars[x][y] = chars[x][y + 1]; 69 | fgColor[x][y] = fgColor[x][y + 1]; 70 | } 71 | } 72 | for (int x = 0; x < 40; ++x) { 73 | chars[x][24] = ' '; 74 | } 75 | } 76 | 77 | void Screen::moveLeft() { 78 | for (int x = 0; x < 39; ++x) { 79 | for (int y = 0; y < 25; ++y) { 80 | chars[x][y] = chars[x + 1][y]; 81 | fgColor[x][y] = fgColor[x + 1][y]; 82 | } 83 | } 84 | for (int y = 0; y < 25; ++y) { 85 | chars[39][y] = ' '; 86 | } 87 | } 88 | 89 | void Screen::moveDown() { 90 | for (int x = 0; x < 40; ++x) { 91 | for (int y = 24; y > 0; --y) { 92 | chars[x][y] = chars[x][y - 1]; 93 | fgColor[x][y] = fgColor[x][y - 1]; 94 | } 95 | } 96 | for (int x = 0; x < 40; ++x) { 97 | chars[x][0] = ' '; 98 | } 99 | } 100 | 101 | void Screen::moveRight() { 102 | for (int x = 39; x > 0; --x) { 103 | for (int y = 0; y < 25; ++y) { 104 | chars[x][y] = chars[x - 1][y]; 105 | fgColor[x][y] = fgColor[x - 1][y]; 106 | } 107 | } 108 | for (int y = 0; y < 25; ++y) { 109 | chars[0][y] = ' '; 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /editor/sidplayfp/sidemu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2014 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2000-2001 Simon White 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef SIDEMU_H 24 | #define SIDEMU_H 25 | 26 | #include 27 | 28 | #include "component.h" 29 | #include "SidConfig.h" 30 | #include "siddefs.h" 31 | #include "event.h" 32 | #include "c64/c64sid.h" 33 | 34 | class sidbuilder; 35 | class EventContext; 36 | 37 | /** 38 | * Buffer size. 5000 is roughly 5 ms at 96 kHz 39 | */ 40 | enum 41 | { 42 | OUTPUTBUFFERSIZE = 5000 43 | }; 44 | 45 | /** 46 | * Inherit this class to create a new SID emulation. 47 | */ 48 | class sidemu : public c64sid, public component 49 | { 50 | private: 51 | sidbuilder *m_builder; 52 | 53 | protected: 54 | static std::string m_credit; 55 | 56 | protected: 57 | EventContext *m_context; 58 | 59 | event_clock_t m_accessClk; 60 | 61 | short *m_buffer; 62 | int m_bufferpos; 63 | 64 | bool m_status; 65 | bool m_locked; 66 | 67 | std::string m_error; 68 | 69 | public: 70 | sidemu(sidbuilder *builder) : 71 | m_builder (builder), 72 | m_context(0), 73 | m_buffer(0), 74 | m_bufferpos(0), 75 | m_status(true), 76 | m_locked(false), 77 | m_error("N/A") {} 78 | virtual ~sidemu() {} 79 | 80 | // Standard component functions 81 | void reset() { reset(0); } 82 | 83 | virtual void reset(uint8_t volume) = 0; 84 | 85 | virtual void clock() = 0; 86 | 87 | /// Set execution environment and lock sid to it 88 | virtual bool lock(EventContext *env); 89 | 90 | /// Unlock sid 91 | virtual void unlock(); 92 | 93 | const char *error() const { return m_error.c_str(); } 94 | 95 | // Standard SID functions 96 | virtual void voice(unsigned int num, bool mute) = 0; 97 | virtual void model(SidConfig::sid_model_t model) = 0; 98 | 99 | sidbuilder *builder() const { return m_builder; } 100 | 101 | virtual void sampling(float systemfreq SID_UNUSED, float outputfreq SID_UNUSED, 102 | SidConfig::sampling_method_t method SID_UNUSED, bool fast SID_UNUSED) {} 103 | 104 | int bufferpos() const { return m_bufferpos; } 105 | void bufferpos(int pos) { m_bufferpos = pos; } 106 | short *buffer() const { return m_buffer; } 107 | 108 | void poke(uint_least16_t address, uint8_t value) { write(address & 0x1f, value); } 109 | uint8_t peek(uint_least16_t address) { return read(address & 0x1f); } 110 | }; 111 | 112 | #endif // SIDEMU_H 113 | -------------------------------------------------------------------------------- /editor/sidplayfp/stringutils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2013 Leandro Nini 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef STRINGUTILS_H 22 | #define STRINGUTILS_H 23 | 24 | #ifdef HAVE_CONFIG_H 25 | # include "config.h" 26 | #endif 27 | 28 | #if defined(HAVE_STRCASECMP) || defined (HAVE_STRNCASECMP) 29 | # include 30 | #endif 31 | 32 | #if defined(HAVE_STRICMP) || defined (HAVE_STRNICMP) 33 | # include 34 | #endif 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | 41 | class stringutils 42 | { 43 | private: 44 | static bool casecompare(char c1, char c2) { return (tolower(c1)==tolower(c2)); } 45 | 46 | public: 47 | /** 48 | * Compares two strings case insensitively and returns true if they are equal. 49 | */ 50 | static bool equal(const std::string& s1, const std::string& s2) 51 | { 52 | return s1.size() == s2.size() 53 | && std::equal(s1.begin(), s1.end(), s2.begin(), casecompare); 54 | } 55 | 56 | /** 57 | * Compares two strings case insensitively and returns true if they are equal. 58 | */ 59 | static bool equal(const char* s1, const char* s2) 60 | { 61 | 62 | #if defined(HAVE_STRCASECMP) 63 | return strcasecmp(s1, s2) == 0; 64 | #elif defined(HAVE_STRICMP) 65 | return stricmp(s1, s2) == 0; 66 | #else 67 | if (s1 == s2) 68 | return true; 69 | 70 | if (s1 == 0 || s2 == 0) 71 | return false; 72 | 73 | while ((*s1 != '\0') || (*s2 != '\0')) 74 | { 75 | if (!casecompare(*s1, *s2)) 76 | return false; 77 | ++s1; 78 | ++s2; 79 | } 80 | 81 | return true; 82 | #endif 83 | } 84 | 85 | /** 86 | * Compares first n characters of two strings case insensitively and returns true if they are equal. 87 | */ 88 | static bool equal(const char* s1, const char* s2, size_t n) 89 | { 90 | 91 | #if defined(HAVE_STRNCASECMP) 92 | return strncasecmp(s1, s2, n) == 0; 93 | #elif defined(HAVE_STRNICMP) 94 | return strnicmp(s1, s2, n) == 0; 95 | #else 96 | if (s1 == s2 || n == 0) 97 | return true; 98 | 99 | if (s1 == 0 || s2 == 0) 100 | return false; 101 | 102 | while (n-- && ((*s1 != '\0') || (*s2 != '\0'))) 103 | { 104 | if (!casecompare(*s1, *s2)) 105 | return false; 106 | ++s1; 107 | ++s2; 108 | } 109 | 110 | return true; 111 | #endif 112 | } 113 | }; 114 | 115 | #endif 116 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/OpAmp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2014 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2004,2010 Dag Lem 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef OPAMP_H 24 | #define OPAMP_H 25 | 26 | #include "Spline.h" 27 | 28 | namespace reSIDfp 29 | { 30 | 31 | /** 32 | * Find output voltage in inverting gain and inverting summer SID op-amp 33 | * circuits, using a combination of Newton-Raphson and bisection. 34 | * 35 | * ---R2-- 36 | * | | 37 | * vi ---R1-----[A>----- vo 38 | * vx 39 | * 40 | * From Kirchoff's current law it follows that 41 | * 42 | * IR1f + IR2r = 0 43 | * 44 | * Substituting the triode mode transistor model K*W/L*(Vgst^2 - Vgdt^2) 45 | * for the currents, we get: 46 | * 47 | * n*((Vddt - vx)^2 - (Vddt - vi)^2) + (Vddt - vx)^2 - (Vddt - vo)^2 = 0 48 | * 49 | * Our root function f can thus be written as: 50 | * 51 | * f = (n + 1)*(Vddt - vx)^2 - n*(Vddt - vi)^2 - (Vddt - vo)^2 = 0 52 | * 53 | * Using substitution constants 54 | * 55 | * a = n + 1 56 | * b = Vddt 57 | * c = n*(Vddt - vi)^2 58 | * 59 | * the equations for the root function and its derivative can be written as: 60 | * 61 | * f = a*(b - vx)^2 - c - (b - vo)^2 62 | * df = 2*((b - vo)*dvo - a*(b - vx)) 63 | */ 64 | class OpAmp 65 | { 66 | private: 67 | static const double EPSILON; 68 | 69 | /// Current root position (cached as guess to speed up next iteration) 70 | double x; 71 | 72 | const double kVddt, vmin, vmax; 73 | 74 | Spline* opamp; 75 | 76 | public: 77 | /** 78 | * Opamp input -> output voltage conversion 79 | * 80 | * @param opamp opamp mapping table as pairs of points (in -> out) 81 | * @param opamplength length of the opamp array 82 | * @param kVddt transistor dt parameter (in volts) 83 | */ 84 | OpAmp(const Spline::Point opamp[], int opamplength, double kVddt) : 85 | x(0.), 86 | kVddt(kVddt), 87 | vmin(opamp[0].x), 88 | vmax(opamp[opamplength - 1].x), 89 | opamp(new Spline(opamp, opamplength)) {} 90 | 91 | ~OpAmp() { delete opamp; } 92 | 93 | void reset() 94 | { 95 | x = vmin; 96 | } 97 | 98 | /** 99 | * Solve the opamp equation for input vi in loading context n 100 | * 101 | * @param n the ratio of input/output loading 102 | * @param vi input 103 | * @return vo 104 | */ 105 | double solve(double n, double vi); 106 | }; 107 | 108 | } // namespace reSIDfp 109 | 110 | #endif 111 | -------------------------------------------------------------------------------- /src/rotchars_p.s: -------------------------------------------------------------------------------- 1 | 2 | .export _tick_rotate_chars 3 | 4 | .import _rotchar_dirs 5 | .import _rotchar_screencodes 6 | .import _rotchar_periods 7 | .importzp ptr1, ptr2 8 | 9 | ptr1_save: 10 | .word 0 11 | ptr2_save: 12 | .word 0 13 | ticks: 14 | .byte 0 15 | 16 | _tick_rotate_chars: 17 | lda ptr1 18 | sta ptr1_save 19 | lda ptr1 + 1 20 | sta ptr1_save + 1 21 | lda ptr2 22 | sta ptr2_save 23 | lda ptr2 + 1 24 | sta ptr2_save + 1 25 | 26 | inc ticks 27 | 28 | ldy #$f 29 | loop: 30 | lda _rotchar_dirs, y 31 | beq continue 32 | tax 33 | lda _rotchar_periods, y 34 | and ticks 35 | bne continue 36 | 37 | lda #(($2800 / 8) >> 8) 38 | sta ptr1 + 1 39 | lda _rotchar_screencodes, y 40 | sta ptr1 41 | 42 | ; *= 8 43 | asl ptr1 44 | rol ptr1 + 1 45 | asl ptr1 46 | rol ptr1 + 1 47 | asl ptr1 48 | rol ptr1 + 1 49 | 50 | txa ; a = direction 51 | cmp #145 52 | beq up 53 | cmp #29 54 | beq right 55 | cmp #17 56 | beq down 57 | 58 | ; left 59 | tya 60 | tax 61 | 62 | ldy #7 63 | @loop: 64 | lda (ptr1),y 65 | asl a 66 | bcc :+ 67 | ora #1 68 | : sta (ptr1),y 69 | dey 70 | bpl @loop 71 | 72 | txa 73 | tay 74 | 75 | continue: 76 | dey 77 | bpl loop 78 | 79 | lda ptr1_save 80 | sta ptr1 81 | lda ptr1_save + 1 82 | sta ptr1 + 1 83 | lda ptr2_save 84 | sta ptr2 85 | lda ptr2_save + 1 86 | sta ptr2 + 1 87 | rts 88 | 89 | right: 90 | tya 91 | tax 92 | 93 | ldy #7 94 | @loop: 95 | lda (ptr1),y 96 | lsr a 97 | bcc :+ 98 | ora #$80 99 | : sta (ptr1),y 100 | dey 101 | bpl @loop 102 | 103 | txa 104 | tay 105 | jmp continue 106 | 107 | up: 108 | tya 109 | pha 110 | 111 | ldy ptr1 112 | iny 113 | sty ptr2 114 | ldy ptr1+1 115 | sty ptr2+1 116 | 117 | ; copy from ptr2 to ptr1 118 | ldy #0 119 | lda (ptr1),y 120 | tax 121 | lda (ptr2),y 122 | sta (ptr1),y ; 1 => 0 123 | 124 | iny 125 | lda (ptr2),y 126 | sta (ptr1),y ; 2 => 1 127 | iny 128 | lda (ptr2),y 129 | sta (ptr1),y ; 3 => 2 130 | iny 131 | lda (ptr2),y 132 | sta (ptr1),y ; 4 => 3 133 | iny 134 | lda (ptr2),y 135 | sta (ptr1),y ; 5 => 4 136 | iny 137 | lda (ptr2),y 138 | sta (ptr1),y ; 6 => 5 139 | iny 140 | lda (ptr2),y 141 | sta (ptr1),y ; 7 => 6 142 | txa 143 | sta (ptr2),y ; 0 => 7 144 | 145 | pla 146 | tay 147 | jmp continue 148 | 149 | down: 150 | tya 151 | pha 152 | 153 | ldy ptr1 154 | iny 155 | sty ptr2 156 | ldy ptr1+1 157 | sty ptr2+1 158 | 159 | ; copy from ptr1 to ptr2 160 | ldy #6 161 | lda (ptr2),y 162 | tax 163 | lda (ptr1),y 164 | sta (ptr2),y ; 6 => 7 165 | 166 | dey 167 | lda (ptr1),y 168 | sta (ptr2),y ; 5 => 6 169 | dey 170 | lda (ptr1),y 171 | sta (ptr2),y ; 4 => 5 172 | dey 173 | lda (ptr1),y 174 | sta (ptr2),y ; 3 => 4 175 | dey 176 | lda (ptr1),y 177 | sta (ptr2),y ; 2 => 3 178 | dey 179 | lda (ptr1),y 180 | sta (ptr2),y ; 1 => 2 181 | dey 182 | lda (ptr1),y 183 | sta (ptr2),y ; 0 => 1 184 | 185 | txa 186 | sta (ptr1),y ; 7 => 0 187 | 188 | pla 189 | tay 190 | jmp continue 191 | -------------------------------------------------------------------------------- /editor/sidplayfp/utils/iniParser.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2013 Leandro Nini 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #include "iniParser.h" 20 | 21 | #include 22 | 23 | std::string iniParser::parseSection(const std::string &buffer) 24 | { 25 | const size_t pos = buffer.find(']'); 26 | 27 | if (pos == std::string::npos) 28 | { 29 | throw parseError(); 30 | } 31 | 32 | return buffer.substr(1, pos-1); 33 | } 34 | 35 | std::pair iniParser::parseKey(const std::string &buffer) 36 | { 37 | const size_t pos = buffer.find('='); 38 | 39 | if (pos == std::string::npos) 40 | { 41 | throw parseError(); 42 | } 43 | 44 | const std::string key = buffer.substr(0, buffer.find_last_not_of(' ', pos-1) + 1); 45 | const std::string value = buffer.substr(pos + 1); 46 | return make_pair(key, value); 47 | } 48 | 49 | bool iniParser::open(const char *fName) 50 | { 51 | std::ifstream iniFile(fName); 52 | 53 | if (iniFile.fail()) 54 | { 55 | return false; 56 | } 57 | 58 | sections_t::iterator mIt; 59 | 60 | while (iniFile.good()) 61 | { 62 | std::string buffer; 63 | getline(iniFile, buffer); 64 | 65 | if (buffer.empty()) 66 | continue; 67 | 68 | switch (buffer.at(0)) 69 | { 70 | case ';': 71 | case '#': 72 | // skip comments 73 | break; 74 | 75 | case '[': 76 | { 77 | try 78 | { 79 | const std::string section = parseSection(buffer); 80 | const keys_t keys; 81 | std::pair it = sections.insert(make_pair(section, keys)); 82 | mIt = it.first; 83 | } 84 | catch (parseError const &e) {}; 85 | } 86 | break; 87 | 88 | default: 89 | try 90 | { 91 | (*mIt).second.insert(parseKey(buffer)); 92 | } 93 | catch (parseError const &e) {}; 94 | 95 | break; 96 | } 97 | } 98 | 99 | return true; 100 | } 101 | 102 | void iniParser::close() 103 | { 104 | sections.clear(); 105 | } 106 | 107 | bool iniParser::setSection(const char *section) 108 | { 109 | curSection = sections.find(std::string(section)); 110 | return (curSection != sections.end()); 111 | } 112 | 113 | const char *iniParser::getValue(const char *key) 114 | { 115 | keys_t::const_iterator keyIt = (*curSection).second.find(std::string(key)); 116 | return (keyIt != (*curSection).second.end()) ? keyIt->second.c_str() : 0; 117 | } 118 | -------------------------------------------------------------------------------- /editor/sidplayfp/c64/c64cia.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2001 Simon White 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef C64CIA_H 24 | #define C64CIA_H 25 | 26 | // The CIA emulations are very generic and here we need to effectively 27 | // wire them into the computer (like adding a chip to a PCB). 28 | 29 | #include "Banks/Bank.h" 30 | #include "sidplayfp/c64/c64env.h" 31 | #include "sidplayfp/sidendian.h" 32 | #include "CIA/mos6526.h" 33 | 34 | /** 35 | * CIA 1 36 | * Generates IRQs 37 | * located at $DC00-$DCFF 38 | */ 39 | class c64cia1: public MOS6526, public Bank 40 | { 41 | private: 42 | c64env &m_env; 43 | uint_least16_t last_ta; 44 | uint8_t lp; 45 | 46 | protected: 47 | void interrupt(bool state) 48 | { 49 | m_env.interruptIRQ (state); 50 | } 51 | 52 | void portB() 53 | { 54 | const uint8_t lp = (prb | ~ddrb) & 0x10; 55 | if (lp != this->lp) 56 | { 57 | m_env.lightpen(); 58 | this->lp = lp; 59 | } 60 | } 61 | 62 | public: 63 | c64cia1(c64env *env) : 64 | MOS6526(&(env->context ())), 65 | m_env(*env) {} 66 | 67 | void poke(uint_least16_t address, uint8_t value) 68 | { 69 | write(endian_16lo8(address), value); 70 | 71 | // Save the value written to Timer A 72 | if (address == 0xDC04 || address == 0xDC05) 73 | { 74 | if (timerA.getTimer() != 0) 75 | last_ta = timerA.getTimer(); 76 | } 77 | } 78 | 79 | uint8_t peek(uint_least16_t address) 80 | { 81 | return read(endian_16lo8(address)); 82 | } 83 | 84 | void reset() 85 | { 86 | last_ta = 0; 87 | lp = 0x10; 88 | MOS6526::reset (); 89 | } 90 | 91 | uint_least16_t getTimerA() const { return last_ta; } 92 | }; 93 | 94 | /** 95 | * CIA 2 96 | * Generates NMIs 97 | * located at $DD00-$DDFF 98 | */ 99 | class c64cia2: public MOS6526, public Bank 100 | { 101 | private: 102 | c64env &m_env; 103 | 104 | protected: 105 | void interrupt(bool state) 106 | { 107 | if (state) 108 | m_env.interruptNMI (); 109 | } 110 | 111 | public: 112 | c64cia2(c64env *env) : 113 | MOS6526(&(env->context ())), 114 | m_env(*env) {} 115 | 116 | void poke(uint_least16_t address, uint8_t value) 117 | { 118 | write(address, value); 119 | } 120 | 121 | uint8_t peek(uint_least16_t address) 122 | { 123 | return read(address); 124 | } 125 | }; 126 | 127 | #endif // C64CIA_H 128 | -------------------------------------------------------------------------------- /editor/sidplayfp/sidmemory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2012-2013 Leandro Nini 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #ifndef SIDMEMORY_H 22 | #define SIDMEMORY_H 23 | 24 | #include 25 | 26 | /** 27 | * An interface that allows access to c64 memory 28 | * for loading tunes and apply sid specific hacks. 29 | */ 30 | class sidmemory 31 | { 32 | public: 33 | /** 34 | * Read one byte from memory. 35 | * 36 | * @param addr the memory location from which to read from 37 | */ 38 | virtual uint8_t readMemByte(uint_least16_t addr) =0; 39 | 40 | /** 41 | * Read two contiguous bytes from memory. 42 | * 43 | * @param addr the memory location from which to read from 44 | */ 45 | virtual uint_least16_t readMemWord(uint_least16_t addr) =0; 46 | 47 | /** 48 | * Write one byte to memory. 49 | * 50 | * @param addr the memory location where to write 51 | * @param value the value to write 52 | */ 53 | virtual void writeMemByte(uint_least16_t addr, uint8_t value) =0; 54 | 55 | /** 56 | * Write two contiguous bytes to memory. 57 | * 58 | * @param addr the memory location where to write 59 | * @param value the value to write 60 | */ 61 | virtual void writeMemWord(uint_least16_t addr, uint_least16_t value) =0; 62 | 63 | /** 64 | * Fill ram area with a constant value. 65 | * 66 | * @param start the start of memory location where to write 67 | * @param value the value to write 68 | * @param size the number of bytes to fill 69 | */ 70 | virtual void fillRam(uint_least16_t start, uint8_t value, unsigned int size) =0; 71 | 72 | /** 73 | * Copy a buffer into a ram area. 74 | * 75 | * @param start the start of memory location where to write 76 | * @param source the source buffer 77 | * @param size the number of bytes to copy 78 | */ 79 | virtual void fillRam(uint_least16_t start, const uint8_t* source, unsigned int size) =0; 80 | 81 | /** 82 | * Change the RESET vector. 83 | * 84 | * @param addr the new addres to point to 85 | */ 86 | virtual void installResetHook(uint_least16_t addr) =0; 87 | 88 | /** 89 | * Set BASIC Warm Start address. 90 | * 91 | * @param addr the new addres to point to 92 | */ 93 | virtual void installBasicTrap(uint_least16_t addr) =0; 94 | 95 | /** 96 | * Set the start tune. 97 | * 98 | * @param tune the tune number 99 | */ 100 | virtual void setBasicSubtune(uint8_t tune) =0; 101 | 102 | protected: 103 | ~sidmemory() {} 104 | }; 105 | 106 | #endif 107 | -------------------------------------------------------------------------------- /src/movie.c: -------------------------------------------------------------------------------- 1 | #include "movie.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "anim.h" 7 | #include "disk.h" 8 | #include "fastload.h" 9 | #include "keyhandler.h" 10 | #include "irq.h" 11 | #include "keyframe.h" 12 | #include "keys.h" 13 | #include "music.h" 14 | #include "rledec.h" 15 | 16 | static struct Movie 17 | { 18 | char music_path[16]; 19 | char ticks_per_step; 20 | char anim_path[16]; 21 | }; 22 | static struct Movie movie = { 23 | "lightforce" 24 | }; 25 | 26 | #define MOVIE_CONFIG "movrc" 27 | 28 | void scratch_movie() 29 | { 30 | cbm_open(1, 8, 15, "s:" MOVIE_CONFIG); 31 | cbm_close(1); 32 | } 33 | 34 | void write_movie() 35 | { 36 | ls(); 37 | cputs("anim> "); 38 | while (!mygets(movie.anim_path)); 39 | movie.ticks_per_step = ticks_per_step; 40 | scratch_movie(); 41 | cbm_save(MOVIE_CONFIG, 8, &movie, sizeof(movie)); 42 | play_movie(); 43 | } 44 | 45 | void load_music(const char* filename) 46 | { 47 | unsigned int read = cbm_load(filename, 8, (void*)0x1000); 48 | if (read > 0x1800) { 49 | cputs("too big:("); 50 | while (1) ++*(char*)0xd020; 51 | } 52 | } 53 | 54 | void select_music() 55 | { 56 | ls(); 57 | cputs("music> "); 58 | mygets(movie.music_path); 59 | load_music(movie.music_path); 60 | } 61 | 62 | char play_movie() 63 | { 64 | unsigned int acc = 1 << 12; 65 | unsigned int speed = KEYFRAME_SPEED_NONE; 66 | unsigned char rle_left = 0; 67 | 68 | if (cbm_load(MOVIE_CONFIG, 8, &movie) != sizeof(movie)) 69 | return 0; 70 | anim_reset(); 71 | loader_init(); 72 | loader_load(movie.music_path); 73 | init_music(); 74 | ticks_per_step = movie.ticks_per_step; 75 | loader_open(movie.anim_path); 76 | loader_getc(); /* skip address */ 77 | 78 | ticks = 0; 79 | start_playing(); 80 | while (1) { 81 | /* Wait for tick. */ 82 | if (!ticks) { 83 | show_cursor(); 84 | while (ticks == 0); 85 | hide_cursor(); 86 | } 87 | --ticks; 88 | 89 | acc += speed; 90 | while (acc >= (1 << 12)) { 91 | if (rle_left) { 92 | handle(rle_char, 1); 93 | --rle_left; 94 | } else while (1) { 95 | int ch = loader_getc(); 96 | switch (ch) { 97 | case -1: /* Reached file end, restart. */ 98 | loader_open(movie.anim_path); 99 | loader_getc(); /* skip address */ 100 | continue; 101 | case CH_HOME: 102 | speed = loader_getc(); 103 | speed |= loader_getc() << 8; 104 | acc = 1 << 12; 105 | break; 106 | case 0: /* RLE */ 107 | rle_dec(0); 108 | rle_dec(loader_getc()); 109 | rle_left = rle_dec(loader_getc()); 110 | break; 111 | default: 112 | rle_char = ch; 113 | rle_left = 1; 114 | } 115 | if (rle_left) { 116 | handle(rle_char, 1); 117 | --rle_left; 118 | break; 119 | } 120 | } 121 | acc -= (1 << 12); 122 | } 123 | } 124 | return 1; 125 | } 126 | 127 | -------------------------------------------------------------------------------- /editor/sidplayfp/sidplayfp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2000-2001 Simon White 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | 24 | //--------------------------------------------------------------------------------------------- 25 | //--------------------------------------------------------------------------------------------- 26 | // Redirection to private version of sidplayer (This method is called Cheshire Cat) 27 | // [ms: which is J. Carolan's name for a degenerate 'bridge'] 28 | // This interface can be directly replaced with a libsidplay1 or C interface wrapper. 29 | //--------------------------------------------------------------------------------------------- 30 | //--------------------------------------------------------------------------------------------- 31 | 32 | #include "sidplayfp.h" 33 | 34 | #include "player.h" 35 | 36 | sidplayfp::sidplayfp() : 37 | sidplayer(*(new SIDPLAYFP_NAMESPACE::Player)) {} 38 | 39 | sidplayfp::~sidplayfp() 40 | { 41 | if (&sidplayer) delete &sidplayer; 42 | } 43 | 44 | bool sidplayfp::config(const SidConfig &cfg) 45 | { 46 | return sidplayer.config(cfg); 47 | } 48 | 49 | const SidConfig &sidplayfp::config() const 50 | { 51 | return sidplayer.config(); 52 | } 53 | 54 | void sidplayfp::stop() 55 | { 56 | sidplayer.stop(); 57 | } 58 | 59 | uint_least32_t sidplayfp::play(short *buffer, uint_least32_t count) 60 | { 61 | return sidplayer.play(buffer, count); 62 | } 63 | 64 | bool sidplayfp::load(SidTune *tune) 65 | { 66 | return sidplayer.load(tune); 67 | } 68 | 69 | const SidInfo &sidplayfp::info() const 70 | { 71 | return sidplayer.info(); 72 | } 73 | 74 | uint_least32_t sidplayfp::time() const 75 | { 76 | return sidplayer.time(); 77 | } 78 | 79 | const char *sidplayfp::error() const 80 | { 81 | return sidplayer.error(); 82 | } 83 | 84 | bool sidplayfp::fastForward(unsigned int percent) 85 | { 86 | return sidplayer.fastForward(percent); 87 | } 88 | 89 | void sidplayfp::mute(unsigned int sidNum, unsigned int voice, bool enable) 90 | { 91 | sidplayer.mute(sidNum, voice, enable); 92 | } 93 | 94 | void sidplayfp::debug(bool enable, FILE *out) 95 | { 96 | sidplayer.debug(enable, out); 97 | } 98 | 99 | bool sidplayfp::isPlaying() const 100 | { 101 | return sidplayer.isPlaying(); 102 | } 103 | 104 | void sidplayfp::setRoms(const uint8_t* kernal, const uint8_t* basic, const uint8_t* character) 105 | { 106 | sidplayer.setRoms(kernal, basic, character); 107 | } 108 | 109 | EventContext *sidplayfp::getEventContext() 110 | { 111 | return sidplayer.getEventScheduler(); 112 | } 113 | 114 | uint_least16_t sidplayfp::getCia1TimerA() const 115 | { 116 | return sidplayer.getCia1TimerA(); 117 | } 118 | -------------------------------------------------------------------------------- /editor/sidplayfp/SidInfoImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2012 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2000 Simon White 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #ifndef SIDINFOIMPL_H 24 | #define SIDINFOIMPL_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include "sidplayfp/SidInfo.h" 31 | 32 | #include "c64/c64.h" 33 | 34 | #ifdef HAVE_CONFIG_H 35 | # include "config.h" 36 | #endif 37 | 38 | #ifndef PACKAGE_NAME 39 | # define PACKAGE_NAME "libsidplayfp" 40 | #endif 41 | 42 | #ifndef PACKAGE_VERSION 43 | # define PACKAGE_VERSION "1.5.3" 44 | #endif 45 | 46 | /** 47 | * The implementation of the SidInfo interface. 48 | */ 49 | class SidInfoImpl : public SidInfo 50 | { 51 | public: 52 | const std::string m_name; 53 | const std::string m_version; 54 | std::vector m_credits; 55 | 56 | std::string m_speedString; 57 | 58 | std::string m_kernalDesc; 59 | std::string m_basicDesc; 60 | std::string m_chargenDesc; 61 | 62 | const unsigned int m_maxsids; 63 | 64 | unsigned int m_channels; 65 | 66 | uint_least16_t m_driverAddr; 67 | uint_least16_t m_driverLength; 68 | 69 | uint_least16_t m_powerOnDelay; 70 | 71 | private: 72 | // prevent copying 73 | SidInfoImpl(const SidInfoImpl&); 74 | SidInfoImpl& operator=(SidInfoImpl&); 75 | 76 | public: 77 | SidInfoImpl() : 78 | m_name(PACKAGE_NAME), 79 | m_version(PACKAGE_VERSION), 80 | m_maxsids(c64::MAX_SIDS), 81 | m_channels(1), 82 | m_driverAddr(0), 83 | m_driverLength(0), 84 | m_powerOnDelay(0) 85 | { 86 | m_credits.push_back(PACKAGE_NAME " V" PACKAGE_VERSION " Engine:\n" 87 | "\tCopyright (C) 2000 Simon White\n" 88 | "\tCopyright (C) 2007-2010 Antti Lankila\n" 89 | "\tCopyright (C) 2010-2014 Leandro Nini\n" 90 | "\thttp://sourceforge.net/projects/sidplay-residfp/\n"); 91 | } 92 | 93 | const char *name() const { return m_name.c_str(); } 94 | const char *version() const { return m_version.c_str(); } 95 | 96 | unsigned int numberOfCredits() const { return m_credits.size(); } 97 | const char *credits(unsigned int i) const { return i 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2000-2001 Simon White 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef SIDCONFIG_H 24 | #define SIDCONFIG_H 25 | 26 | #include 27 | 28 | #include "sidplayfp/siddefs.h" 29 | 30 | 31 | class sidbuilder; 32 | 33 | /** 34 | * SidConfig 35 | * 36 | * An instance of this class is used to transport emulator settings 37 | * to and from the interface class. 38 | */ 39 | class SID_EXTERN SidConfig 40 | { 41 | public: 42 | typedef enum {MONO = 1, STEREO} playback_t; 43 | typedef enum {MOS6581, MOS8580} sid_model_t; 44 | typedef enum {PAL, NTSC, OLD_NTSC, DREAN} c64_model_t; 45 | typedef enum {INTERPOLATE, RESAMPLE_INTERPOLATE} sampling_method_t; 46 | 47 | public: 48 | /** 49 | * Maximum power on delay. 50 | * - Delays <= MAX produce constant results 51 | * - Delays > MAX produce random results 52 | */ 53 | static const uint_least16_t MAX_POWER_ON_DELAY = 0x1FFF; 54 | static const uint_least16_t DEFAULT_POWER_ON_DELAY = MAX_POWER_ON_DELAY + 1; 55 | 56 | static const uint_least32_t DEFAULT_SAMPLING_FREQ = 44100; 57 | 58 | public: 59 | /** 60 | * Intended c64 model when unknown or forced. 61 | * - PAL 62 | * - NTSC 63 | * - OLD_NTSC 64 | * - DREAN 65 | */ 66 | c64_model_t defaultC64Model; 67 | 68 | /** 69 | * Force the model to #defaultC64Model ignoring tune's clock setting. 70 | */ 71 | bool forceC64Model; 72 | 73 | /** 74 | * Intended sid model when unknown or forced. 75 | * - MOS6581 76 | * - MOS8580 77 | */ 78 | sid_model_t defaultSidModel; 79 | 80 | /** 81 | * Force the sid model to #defaultSidModel. 82 | */ 83 | bool forceSidModel; 84 | 85 | /** 86 | * Playbak mode. 87 | * - MONO 88 | * - STEREO 89 | */ 90 | playback_t playback; 91 | 92 | /** 93 | * Sampling frequency. 94 | */ 95 | uint_least32_t frequency; 96 | 97 | /** 98 | * Install a second SID chip at this address. 99 | */ 100 | uint_least16_t secondSidAddress; 101 | 102 | /** 103 | * Pointer to selected emulation, 104 | * reSIDfp, reSID or hardSID. 105 | */ 106 | sidbuilder *sidEmulation; 107 | 108 | /** 109 | * Left channel volume. 110 | */ 111 | uint_least32_t leftVolume; 112 | 113 | /** 114 | * Right channel volume. 115 | */ 116 | uint_least32_t rightVolume; 117 | 118 | /** 119 | * Power on delay cycles. 120 | */ 121 | uint_least16_t powerOnDelay; 122 | 123 | /** 124 | * Sampling method. 125 | * - INTERPOLATE 126 | * - RESAMPLE_INTERPOLATE 127 | */ 128 | sampling_method_t samplingMethod; 129 | 130 | /** 131 | * Faster low-quality emulation, 132 | * available only for reSID. 133 | */ 134 | bool fastSampling; 135 | 136 | public: 137 | SidConfig(); 138 | }; 139 | 140 | #endif // SIDCONFIG_H 141 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/Spline.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2014 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #include "Spline.h" 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace reSIDfp 29 | { 30 | 31 | double Spline::slope(const Point &a, const Point &b) 32 | { 33 | return (b.y - a.y) / (b.x - a.x); 34 | } 35 | 36 | Spline::Spline(const Point input[], int inputLength) : 37 | paramsLength(inputLength), 38 | params(new Param[paramsLength]), 39 | c(¶ms[0]) 40 | { 41 | assert(inputLength > 2); 42 | 43 | std::vector dxs(inputLength - 1); 44 | std::vector ms(inputLength - 1); 45 | 46 | // Get consecutive differences and slopes 47 | for (int i = 0; i < inputLength - 1; i++) 48 | { 49 | assert(input[i].x < input[i + 1].x); 50 | 51 | const double dx = input[i + 1].x - input[i].x; 52 | const double dy = input[i + 1].y - input[i].y; 53 | dxs[i] = dx; 54 | ms[i] = dy/dx; 55 | } 56 | 57 | // Get degree-1 coefficients 58 | params[0].c = ms[0]; 59 | for (int i = 1; i < inputLength - 1; i++) 60 | { 61 | const double m = ms[i - 1]; 62 | const double mNext = ms[i]; 63 | if (m * mNext <= 0) { 64 | params[i].c = 0.0; 65 | } else { 66 | const double dx = dxs[i - 1]; 67 | const double dxNext = dxs[i]; 68 | const double common = dx + dxNext; 69 | params[i].c = 3.0 * common / ((common + dxNext) / m + (common + dx) / mNext); 70 | } 71 | } 72 | params[inputLength - 1].c = ms[inputLength - 2]; 73 | 74 | // Get degree-2 and degree-3 coefficients 75 | for (int i = 0; i < inputLength - 1; i++) 76 | { 77 | params[i].x1 = input[i].x; 78 | params[i].x2 = input[i + 1].x; 79 | params[i].d = input[i].y; 80 | 81 | const double c1 = params[i].c; 82 | const double m = ms[i]; 83 | const double invDx = 1.0 / dxs[i]; 84 | const double common = c1 + params[i + 1].c - m - m; 85 | params[i].b = (m - c1 - common) * invDx; 86 | params[i].a = common * invDx * invDx; 87 | } 88 | 89 | // Fix the value ranges, because we interpolate outside original bounds if necessary. 90 | params[0].x1 = std::numeric_limits::min(); 91 | params[inputLength - 2].x2 = std::numeric_limits::max(); 92 | } 93 | 94 | void Spline::evaluate(double x, Point &out) 95 | { 96 | if (x < c->x1 || x > c->x2) 97 | { 98 | for (int i = 0; i < paramsLength; i++) 99 | { 100 | if (x <= params[i].x2) 101 | { 102 | c = ¶ms[i]; 103 | break; 104 | } 105 | } 106 | } 107 | 108 | // Interpolate 109 | const double diff = x - c->x1; 110 | 111 | // y = a*x^3 + b*x^2 + c*x + d 112 | out.x = ((c->a * diff + c->b) * diff + c->c) * diff + c->d; 113 | 114 | // dy = 3*a*x^2 + 2*b*x + c 115 | out.y = (3.0 * c->a * diff + 2.0 * c->b) * diff + c->c; 116 | } 117 | 118 | } // namespace reSIDfp 119 | -------------------------------------------------------------------------------- /editor/residfp-builder/residfp/Filter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2011-2013 Leandro Nini 5 | * Copyright 2007-2010 Antti Lankila 6 | * Copyright 2004 Dag Lem 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FILTER_H 24 | #define FILTER_H 25 | 26 | namespace reSIDfp 27 | { 28 | 29 | /** 30 | * SID filter base class 31 | */ 32 | class Filter 33 | { 34 | private: 35 | /// Filter enabled. 36 | bool enabled; 37 | 38 | /// Selects which inputs to route through filter. 39 | unsigned char filt; 40 | 41 | protected: 42 | /// Current clock frequency. 43 | double clockFrequency; 44 | 45 | /// Filter cutoff frequency. 46 | unsigned int fc; 47 | 48 | /// Filter resonance. 49 | unsigned char res; 50 | 51 | /// Current volume. 52 | unsigned char vol; 53 | 54 | /// Routing to filter or outside filter 55 | bool filt1, filt2, filt3, filtE; 56 | 57 | /// Switch voice 3 off. 58 | bool voice3off; 59 | 60 | /// Highpass, bandpass, and lowpass filter modes. 61 | bool hp, bp, lp; 62 | 63 | protected: 64 | /** 65 | * Set filter cutoff frequency. 66 | */ 67 | virtual void updatedCenterFrequency() = 0; 68 | 69 | /** 70 | * Set filter resonance. 71 | */ 72 | virtual void updatedResonance() = 0; 73 | 74 | /** 75 | * Mixing configuration modified (offsets change) 76 | */ 77 | virtual void updatedMixing() = 0; 78 | 79 | public: 80 | Filter() : 81 | enabled(true), 82 | filt(0), 83 | clockFrequency(0.), 84 | fc(0), 85 | res(0), 86 | vol(0), 87 | filt1(false), 88 | filt2(false), 89 | filt3(false), 90 | filtE(false), 91 | voice3off(false), 92 | hp(false), 93 | bp(false), 94 | lp(false) {} 95 | 96 | virtual ~Filter() {} 97 | 98 | /** 99 | * SID clocking - 1 cycle 100 | * 101 | * @param v1 voice 1 in 102 | * @param v2 voice 2 in 103 | * @param v3 voice 3 in 104 | * @return filtered output 105 | */ 106 | virtual int clock(int v1, int v2, int v3) = 0; 107 | 108 | /** 109 | * Enable filter. 110 | * 111 | * @param enable 112 | */ 113 | void enable(bool enable); 114 | 115 | void setClockFrequency(double clock); 116 | 117 | /** 118 | * SID reset. 119 | */ 120 | void reset(); 121 | 122 | /** 123 | * Write Frequency Cutoff Low register. 124 | * 125 | * @param fc_lo Frequency Cutoff Low-Byte 126 | */ 127 | void writeFC_LO(unsigned char fc_lo); 128 | 129 | /** 130 | * Write Frequency Cutoff High register. 131 | * 132 | * @param fc_hi Frequency Cutoff High-Byte 133 | */ 134 | void writeFC_HI(unsigned char fc_hi); 135 | 136 | /** 137 | * Write Resonance/Filter register. 138 | * 139 | * @param res_filt Resonance/Filter 140 | */ 141 | void writeRES_FILT(unsigned char res_filt); 142 | 143 | /** 144 | * Write filter Mode/Volume register. 145 | * 146 | * @param mode_vol Filter Mode/Volume 147 | */ 148 | void writeMODE_VOL(unsigned char mode_vol); 149 | 150 | virtual void input(int input) = 0; 151 | }; 152 | 153 | } // namespace reSIDfp 154 | 155 | #endif 156 | -------------------------------------------------------------------------------- /editor/sidplayfp/SidTune.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of libsidplayfp, a SID player engine. 3 | * 4 | * Copyright 2012-2013 Leandro Nini 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #include "SidTune.h" 22 | 23 | #include "sidtune/SidTuneBase.h" 24 | 25 | const char MSG_NO_ERRORS[] = "No errors"; 26 | 27 | // Default sidtune file name extensions. This selection can be overriden 28 | // by specifying a custom list in the constructor. 29 | const char* defaultFileNameExt[] = 30 | { 31 | // Preferred default file extension for single-file sidtunes 32 | // or sidtune description files in SIDPLAY INFOFILE format. 33 | ".sid", ".SID", 34 | // File extensions used (and created) by various C64 emulators and 35 | // related utilities. These extensions are recommended to be used as 36 | // a replacement for ".dat" in conjunction with two-file sidtunes. 37 | ".c64", ".prg", ".p00", ".C64", ".PRG", ".P00", 38 | // Stereo Sidplayer (.mus/.MUS ought not be included because 39 | // these must be loaded first; it sometimes contains the first 40 | // credit lines of a MUS/STR pair). 41 | ".str", ".STR", ".mus", ".MUS", 42 | // End. 43 | 0 44 | }; 45 | 46 | const char** SidTune::fileNameExtensions = defaultFileNameExt; 47 | 48 | SidTune::SidTune(const char* fileName, const char **fileNameExt, bool separatorIsSlash) 49 | { 50 | setFileNameExtensions(fileNameExt); 51 | load(fileName, separatorIsSlash); 52 | } 53 | 54 | SidTune::SidTune(const uint_least8_t* oneFileFormatSidtune, uint_least32_t sidtuneLength) 55 | { 56 | read(oneFileFormatSidtune, sidtuneLength); 57 | } 58 | 59 | void SidTune::setFileNameExtensions(const char **fileNameExt) 60 | { 61 | fileNameExtensions = ((fileNameExt != 0) ? fileNameExt : defaultFileNameExt); 62 | } 63 | 64 | void SidTune::load(const char* fileName, bool separatorIsSlash) 65 | { 66 | try 67 | { 68 | tune.reset(SidTuneBase::load(fileName, fileNameExtensions, separatorIsSlash)); 69 | m_status = true; 70 | m_statusString = MSG_NO_ERRORS; 71 | } 72 | catch (loadError const &e) 73 | { 74 | m_status = false; 75 | m_statusString = e.message(); 76 | } 77 | } 78 | 79 | void SidTune::read(const uint_least8_t* sourceBuffer, uint_least32_t bufferLen) 80 | { 81 | try 82 | { 83 | tune.reset(SidTuneBase::read(sourceBuffer, bufferLen)); 84 | m_status = true; 85 | m_statusString = MSG_NO_ERRORS; 86 | } 87 | catch (loadError const &e) 88 | { 89 | m_status = false; 90 | m_statusString = e.message(); 91 | } 92 | } 93 | 94 | unsigned int SidTune::selectSong(unsigned int songNum) 95 | { 96 | return tune.get() ? tune->selectSong(songNum) : 0; 97 | } 98 | 99 | const SidTuneInfo* SidTune::getInfo() const 100 | { 101 | return tune.get() ? tune->getInfo() : 0; 102 | } 103 | 104 | const SidTuneInfo* SidTune::getInfo(unsigned int songNum) 105 | { 106 | return tune.get() ? tune->getInfo(songNum) : 0; 107 | } 108 | 109 | bool SidTune::getStatus() const { return m_status; } 110 | 111 | const char* SidTune::statusString() const { return m_statusString; } 112 | 113 | bool SidTune::placeSidTuneInC64mem(sidmemory* mem) 114 | { 115 | return tune.get()?tune->placeSidTuneInC64mem(mem):false; 116 | } 117 | 118 | const char* SidTune::createMD5(char *md5) 119 | { 120 | return tune.get()?tune->createMD5(md5):0; 121 | } 122 | --------------------------------------------------------------------------------