Merge Preview v6.x to master

V5 now lives in a separate repo: https://github.com/BlitterStudio/amiberry-lite
This commit is contained in:
Dimitris Panokostas 2024-09-23 19:42:29 +02:00
parent b382b083f7
commit d0056f77cd
No known key found for this signature in database
GPG Key ID: 330156A68E9E0929
494 changed files with 1191014 additions and 258512 deletions

View File

@ -34,7 +34,7 @@ jobs:
run: |
brew update
brew upgrade
brew install autoconf sdl2 mpg123 sdl2_ttf sdl2_image flac libmpeg2 libserialport portmidi dylibbundler wget
brew install sdl2 mpg123 sdl2_ttf sdl2_image flac libmpeg2 libserialport portmidi dylibbundler
- name: make for macOS X64
run: make -j4 PLATFORM=osx-x86
@ -73,7 +73,7 @@ jobs:
run: |
brew update
brew upgrade
brew install autoconf sdl2 mpg123 sdl2_ttf sdl2_image flac libmpeg2 libserialport portmidi dylibbundler wget
brew install sdl2 mpg123 sdl2_ttf sdl2_image flac libmpeg2 libserialport portmidi dylibbundler
- name: make for macOS Apple Silicon
run: make -j4 PLATFORM=osx-m1
@ -104,8 +104,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Run the build process with Docker
uses: addnab/docker-run-action@v3
@ -113,47 +111,19 @@ jobs:
image: midwan/amiberry-debian-x86_64:bullseye
options: -v ${{ github.workspace }}:/build
run: |
make -j8 PLATFORM=x86-64
cmake -B build && cmake --build build -j4
cpack --config build/CPackConfig.cmake
- name: Upload artifact
if: github.ref_type != 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bullseye-x86_64
path: |
amiberry
cdroms/**
conf/**
controllers/**
data/**
floppies/**
harddrives/**
inputrecordings/**
kickstarts/**
lha/**
nvram/**
plugins/**
savestates/**
screenshots/**
whdboot/**
- name: ZIP binaries
if: github.ref_type == 'tag'
run: zip -r amiberry-${{ github.ref_name }}-debian-bullseye-x86_64.zip amiberry cdroms conf controllers data floppies harddrives kickstarts lha nvram plugins savestates screenshots whdboot
- name: Upload artifact
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bullseye-x86_64
path: amiberry-${{ github.ref_name }}-debian-bullseye-x86_64.zip
path: amiberry_*.deb
build-debian-bookworm-x86_64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Run the build process with Docker
uses: addnab/docker-run-action@v3
@ -161,47 +131,19 @@ jobs:
image: midwan/amiberry-debian-x86_64:bookworm
options: -v ${{ github.workspace }}:/build
run: |
make -j8 PLATFORM=x86-64
cmake -B build && cmake --build build -j4
cpack --config build/CPackConfig.cmake
- name: Upload artifact
if: github.ref_type != 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bookworm-x86_64
path: |
amiberry
cdroms/**
conf/**
controllers/**
data/**
floppies/**
harddrives/**
inputrecordings/**
kickstarts/**
lha/**
nvram/**
plugins/**
savestates/**
screenshots/**
whdboot/**
path: amiberry_*.deb
- name: ZIP binaries
if: github.ref_type == 'tag'
run: zip -r amiberry-${{ github.ref_name }}-debian-bookworm-x86_64.zip amiberry cdroms conf controllers data floppies harddrives kickstarts lha nvram plugins savestates screenshots whdboot
- name: Upload artifact
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bookworm-x86_64
path: amiberry-${{ github.ref_name }}-debian-bookworm-x86_64.zip
build-debian-bookworm-aarch64-rpi5:
build-debian-bookworm-aarch64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Run the build process with Docker
uses: addnab/docker-run-action@v3
@ -209,48 +151,19 @@ jobs:
image: midwan/amiberry-debian-aarch64:bookworm
options: -v ${{ github.workspace }}:/build
run: |
make -j8 PLATFORM=rpi5-64-sdl2
cmake -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-aarch64-linux-gnu.cmake -B build && cmake --build build -j4
cpack --config build/CPackConfig.cmake
- name: Upload artifact
if: github.ref_type != 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bookworm-aarch64-rpi5
path: |
amiberry
cdroms/**
conf/**
controllers/**
data/**
floppies/**
harddrives/**
inputrecordings/**
kickstarts/**
lha/**
nvram/**
plugins/**
savestates/**
screenshots/**
whdboot/**
name: amiberry-debian-bookworm-aarch64
path: amiberry_*.deb
- name: ZIP binaries
if: github.ref_type == 'tag'
run: zip -r amiberry-${{ github.ref_name }}-debian-bookworm-aarch64-rpi5.zip amiberry cdroms conf controllers data floppies harddrives kickstarts lha nvram plugins savestates screenshots whdboot
- name: Upload artifact
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bookworm-aarch64-rpi5
path: amiberry-${{ github.ref_name }}-debian-bookworm-aarch64-rpi5.zip
build-debian-bookworm-armhf-rpi5:
if: (github.ref == 'refs/heads/master') || (github.ref_type == 'tag' && startsWith(github.ref_name, 'v'))
build-debian-bookworm-armhf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Run the build process with Docker
uses: addnab/docker-run-action@v3
@ -258,47 +171,19 @@ jobs:
image: midwan/amiberry-debian-armhf:bookworm
options: -v ${{ github.workspace }}:/build
run: |
make -j8 PLATFORM=rpi5-sdl2
cmake -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-arm-linux-gnueabihf.cmake -B build && cmake --build build -j4
cpack --config build/CPackConfig.cmake
- name: Upload artifact
if: github.ref_type != 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bookworm-armhf-rpi5
path: |
amiberry
cdroms/**
conf/**
controllers/**
data/**
floppies/**
harddrives/**
inputrecordings/**
kickstarts/**
lha/**
nvram/**
plugins/**
savestates/**
screenshots/**
whdboot/**
name: amiberry-debian-bookworm-armhf
path: amiberry_*.deb
- name: ZIP binaries
if: github.ref_type == 'tag'
run: zip -r amiberry-${{ github.ref_name }}-debian-bookworm-armhf-rpi5.zip amiberry cdroms conf controllers data floppies harddrives kickstarts lha nvram plugins savestates screenshots whdboot
- name: Upload artifact
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bookworm-armhf-rpi5
path: amiberry-${{ github.ref_name }}-debian-bookworm-armhf-rpi5.zip
build-debian-bullseye-aarch64-rpi4:
build-debian-bullseye-aarch64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Run the build process with Docker
uses: addnab/docker-run-action@v3
@ -306,48 +191,19 @@ jobs:
image: midwan/amiberry-debian-aarch64:bullseye
options: -v ${{ github.workspace }}:/build
run: |
make -j8 PLATFORM=rpi4-64-sdl2
cmake -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-aarch64-linux-gnu.cmake -B build && cmake --build build -j4
cpack --config build/CPackConfig.cmake
- name: Upload artifact
if: github.ref_type != 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bullseye-aarch64-rpi4
path: |
amiberry
cdroms/**
conf/**
controllers/**
data/**
floppies/**
harddrives/**
inputrecordings/**
kickstarts/**
lha/**
nvram/**
plugins/**
savestates/**
screenshots/**
whdboot/**
name: amiberry-debian-bullseye-aarch64
path: amiberry_*.deb
- name: ZIP binaries
if: github.ref_type == 'tag'
run: zip -r amiberry-${{ github.ref_name }}-debian-bullseye-aarch64-rpi4.zip amiberry cdroms conf controllers data floppies harddrives kickstarts lha nvram plugins savestates screenshots whdboot
- name: Upload artifact
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bullseye-aarch64-rpi4
path: amiberry-${{ github.ref_name }}-debian-bullseye-aarch64-rpi4.zip
build-debian-bullseye-armhf-rpi4:
if: (github.ref == 'refs/heads/master') || (github.ref_type == 'tag' && startsWith(github.ref_name, 'v'))
build-debian-bullseye-armhf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Run the build process with Docker
uses: addnab/docker-run-action@v3
@ -355,336 +211,17 @@ jobs:
image: midwan/amiberry-debian-armhf:bullseye
options: -v ${{ github.workspace }}:/build
run: |
make -j8 PLATFORM=rpi4-sdl2
cmake -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-arm-linux-gnueabihf.cmake -B build && cmake --build build -j4
cpack --config build/CPackConfig.cmake
- name: Upload artifact
if: github.ref_type != 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bullseye-armhf-rpi4
path: |
amiberry
cdroms/**
conf/**
controllers/**
data/**
floppies/**
harddrives/**
inputrecordings/**
kickstarts/**
lha/**
nvram/**
plugins/**
savestates/**
screenshots/**
whdboot/**
- name: ZIP binaries
if: github.ref_type == 'tag'
run: zip -r amiberry-${{ github.ref_name }}-debian-bullseye-armhf-rpi4.zip amiberry cdroms conf controllers data floppies harddrives kickstarts lha nvram plugins savestates screenshots whdboot
- name: Upload artifact
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bullseye-armhf-rpi4
path: amiberry-${{ github.ref_name }}-debian-bullseye-armhf-rpi4.zip
build-debian-bookworm-aarch64-rpi4:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Run the build process with Docker
uses: addnab/docker-run-action@v3
with:
image: midwan/amiberry-debian-aarch64:bookworm
options: -v ${{ github.workspace }}:/build
run: |
make -j8 PLATFORM=rpi4-64-sdl2
- name: Upload artifact
if: github.ref_type != 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bookworm-aarch64-rpi4
path: |
amiberry
cdroms/**
conf/**
controllers/**
data/**
floppies/**
harddrives/**
inputrecordings/**
kickstarts/**
lha/**
nvram/**
plugins/**
savestates/**
screenshots/**
whdboot/**
- name: ZIP binaries
if: github.ref_type == 'tag'
run: zip -r amiberry-${{ github.ref_name }}-debian-bookworm-aarch64-rpi4.zip amiberry cdroms conf controllers data floppies harddrives kickstarts lha nvram plugins savestates screenshots whdboot
- name: Upload artifact
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bookworm-aarch64-rpi4
path: amiberry-${{ github.ref_name }}-debian-bookworm-aarch64-rpi4.zip
build-debian-bookworm-armhf-rpi4:
if: (github.ref == 'refs/heads/master') || (github.ref_type == 'tag' && startsWith(github.ref_name, 'v'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Run the build process with Docker
uses: addnab/docker-run-action@v3
with:
image: midwan/amiberry-debian-armhf:bookworm
options: -v ${{ github.workspace }}:/build
run: |
make -j8 PLATFORM=rpi4-sdl2
- name: Upload artifact
if: github.ref_type != 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bookworm-armhf-rpi4
path: |
amiberry
cdroms/**
conf/**
controllers/**
data/**
floppies/**
harddrives/**
inputrecordings/**
kickstarts/**
lha/**
nvram/**
plugins/**
savestates/**
screenshots/**
whdboot/**
- name: ZIP binaries
if: github.ref_type == 'tag'
run: zip -r amiberry-${{ github.ref_name }}-debian-bookworm-armhf-rpi4.zip amiberry cdroms conf controllers data floppies harddrives kickstarts lha nvram plugins savestates screenshots whdboot
- name: Upload artifact
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bookworm-armhf-rpi4
path: amiberry-${{ github.ref_name }}-debian-bookworm-armhf-rpi4.zip
build-debian-bullseye-aarch64-rpi3:
if: (github.ref == 'refs/heads/master') || (github.ref_type == 'tag' && startsWith(github.ref_name, 'v'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Run the build process with Docker
uses: addnab/docker-run-action@v3
with:
image: midwan/amiberry-debian-aarch64:bullseye
options: -v ${{ github.workspace }}:/build
run: |
make -j8 PLATFORM=rpi3-64-sdl2
- name: Upload artifact
if: github.ref_type != 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bullseye-aarch64-rpi3
path: |
amiberry
cdroms/**
conf/**
controllers/**
data/**
floppies/**
harddrives/**
inputrecordings/**
kickstarts/**
lha/**
nvram/**
plugins/**
savestates/**
screenshots/**
whdboot/**
- name: ZIP binaries
if: github.ref_type == 'tag'
run: zip -r amiberry-${{ github.ref_name }}-debian-bullseye-aarch64-rpi3.zip amiberry cdroms conf controllers data floppies harddrives kickstarts lha nvram plugins savestates screenshots whdboot
- name: Upload artifact
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bullseye-aarch64-rpi3
path: amiberry-${{ github.ref_name }}-debian-bullseye-aarch64-rpi3.zip
build-debian-bullseye-armhf-rpi3:
if: (github.ref == 'refs/heads/master') || (github.ref_type == 'tag' && startsWith(github.ref_name, 'v'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Run the build process with Docker
uses: addnab/docker-run-action@v3
with:
image: midwan/amiberry-debian-armhf:bullseye
options: -v ${{ github.workspace }}:/build
run: |
make -j8 PLATFORM=rpi3-sdl2
- name: Upload artifact
if: github.ref_type != 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bullseye-armhf-rpi3
path: |
amiberry
cdroms/**
conf/**
controllers/**
data/**
floppies/**
harddrives/**
inputrecordings/**
kickstarts/**
lha/**
nvram/**
plugins/**
savestates/**
screenshots/**
whdboot/**
- name: ZIP binaries
if: github.ref_type == 'tag'
run: zip -r amiberry-${{ github.ref_name }}-debian-bullseye-armhf-rpi3.zip amiberry cdroms conf controllers data floppies harddrives kickstarts lha nvram plugins savestates screenshots whdboot
- name: Upload artifact
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bullseye-armhf-rpi3
path: amiberry-${{ github.ref_name }}-debian-bullseye-armhf-rpi3.zip
build-debian-bookworm-aarch64-rpi3:
if: (github.ref == 'refs/heads/master') || (github.ref_type == 'tag' && startsWith(github.ref_name, 'v'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Run the build process with Docker
uses: addnab/docker-run-action@v3
with:
image: midwan/amiberry-debian-aarch64:bookworm
options: -v ${{ github.workspace }}:/build
run: |
make -j8 PLATFORM=rpi3-64-sdl2
- name: Upload artifact
if: github.ref_type != 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bookworm-aarch64-rpi3
path: |
amiberry
cdroms/**
conf/**
controllers/**
data/**
floppies/**
harddrives/**
inputrecordings/**
kickstarts/**
lha/**
nvram/**
plugins/**
savestates/**
screenshots/**
whdboot/**
- name: ZIP binaries
if: github.ref_type == 'tag'
run: zip -r amiberry-${{ github.ref_name }}-debian-bookworm-aarch64-rpi3.zip amiberry cdroms conf controllers data floppies harddrives kickstarts lha nvram plugins savestates screenshots whdboot
- name: Upload artifact
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bookworm-aarch64-rpi3
path: amiberry-${{ github.ref_name }}-debian-bookworm-aarch64-rpi3.zip
build-debian-bookworm-armhf-rpi3:
if: (github.ref == 'refs/heads/master') || (github.ref_type == 'tag' && startsWith(github.ref_name, 'v'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Run the build process with Docker
uses: addnab/docker-run-action@v3
with:
image: midwan/amiberry-debian-armhf:bookworm
options: -v ${{ github.workspace }}:/build
run: |
make -j8 PLATFORM=rpi3-sdl2
- name: Upload artifact
if: github.ref_type != 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bookworm-armhf-rpi3
path: |
amiberry
cdroms/**
conf/**
controllers/**
data/**
floppies/**
harddrives/**
inputrecordings/**
kickstarts/**
lha/**
nvram/**
plugins/**
savestates/**
screenshots/**
whdboot/**
- name: ZIP binaries
if: github.ref_type == 'tag'
run: zip -r amiberry-${{ github.ref_name }}-debian-bookworm-armhf-rpi3.zip amiberry cdroms conf controllers data floppies harddrives kickstarts lha nvram plugins savestates screenshots whdboot
- name: Upload artifact
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v4
with:
name: amiberry-debian-bookworm-armhf-rpi3
path: amiberry-${{ github.ref_name }}-debian-bookworm-armhf-rpi3.zip
name: amiberry-debian-bullseye-armhf
path: amiberry_*.deb
create-release:
needs: [build-macOS-x86_64, build-macOS-apple-silicon, build-debian-bullseye-x86_64, build-debian-bookworm-x86_64, build-debian-bookworm-aarch64-rpi5, build-debian-bookworm-armhf-rpi5, build-debian-bullseye-aarch64-rpi4, build-debian-bullseye-armhf-rpi4, build-debian-bookworm-aarch64-rpi4, build-debian-bookworm-armhf-rpi4, build-debian-bullseye-aarch64-rpi3, build-debian-bullseye-armhf-rpi3, build-debian-bookworm-aarch64-rpi3, build-debian-bookworm-armhf-rpi3]
needs: [build-macOS-x86_64, build-macOS-apple-silicon, build-debian-bookworm-x86_64, build-debian-bookworm-aarch64, build-debian-bookworm-armhf, build-debian-bullseye-x86_64, build-debian-bullseye-aarch64, build-debian-bullseye-armhf]
runs-on: ubuntu-latest
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
steps:
@ -711,21 +248,15 @@ jobs:
artifacts: |
amiberry-macOS-64bit-intel/amiberry-${{ github.ref_name }}-macOS-x86_64.zip
amiberry-macOS-64bit-apple-silicon/amiberry-${{ github.ref_name }}-macOS-apple-silicon.zip
amiberry-debian-bullseye-x86_64/amiberry-${{ github.ref_name }}-debian-bullseye-x86_64.zip
amiberry-debian-bookworm-x86_64/amiberry-${{ github.ref_name }}-debian-bookworm-x86_64.zip
amiberry-debian-bookworm-aarch64-rpi5/amiberry-${{ github.ref_name }}-debian-bookworm-aarch64-rpi5.zip
amiberry-debian-bookworm-armhf-rpi5/amiberry-${{ github.ref_name }}-debian-bookworm-armhf-rpi5.zip
amiberry-debian-bullseye-aarch64-rpi4/amiberry-${{ github.ref_name }}-debian-bullseye-aarch64-rpi4.zip
amiberry-debian-bullseye-armhf-rpi4/amiberry-${{ github.ref_name }}-debian-bullseye-armhf-rpi4.zip
amiberry-debian-bookworm-aarch64-rpi4/amiberry-${{ github.ref_name }}-debian-bookworm-aarch64-rpi4.zip
amiberry-debian-bookworm-armhf-rpi4/amiberry-${{ github.ref_name }}-debian-bookworm-armhf-rpi4.zip
amiberry-debian-bullseye-aarch64-rpi3/amiberry-${{ github.ref_name }}-debian-bullseye-aarch64-rpi3.zip
amiberry-debian-bullseye-armhf-rpi3/amiberry-${{ github.ref_name }}-debian-bullseye-armhf-rpi3.zip
amiberry-debian-bookworm-aarch64-rpi3/amiberry-${{ github.ref_name }}-debian-bookworm-aarch64-rpi3.zip
amiberry-debian-bookworm-armhf-rpi3/amiberry-${{ github.ref_name }}-debian-bookworm-armhf-rpi3.zip
amiberry-debian-bookworm-x86_64/amiberry_*.deb
amiberry-debian-bookworm-aarch64/amiberry_*.deb
amiberry-debian-bookworm-armhf/amiberry_*.deb
amiberry-debian-bullseye-x86_64/amiberry_*.deb
amiberry-debian-bullseye-aarch64/amiberry_*.deb
amiberry-debian-bullseye-armhf/amiberry_*.deb
create-prerelease:
needs: [build-macOS-x86_64, build-macOS-apple-silicon, build-debian-bullseye-x86_64, build-debian-bookworm-x86_64, build-debian-bookworm-aarch64-rpi5, build-debian-bullseye-aarch64-rpi4, build-debian-bookworm-aarch64-rpi4]
needs: [build-macOS-x86_64, build-macOS-apple-silicon, build-debian-bookworm-x86_64, build-debian-bookworm-aarch64, build-debian-bookworm-armhf, build-debian-bullseye-x86_64, build-debian-bullseye-aarch64, build-debian-bullseye-armhf]
runs-on: ubuntu-latest
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'preview-v')
steps:
@ -753,8 +284,9 @@ jobs:
artifacts: |
amiberry-macOS-64bit-intel/amiberry-${{ github.ref_name }}-macOS-x86_64.zip
amiberry-macOS-64bit-apple-silicon/amiberry-${{ github.ref_name }}-macOS-apple-silicon.zip
amiberry-debian-bullseye-x86_64/amiberry-${{ github.ref_name }}-debian-bullseye-x86_64.zip
amiberry-debian-bookworm-x86_64/amiberry-${{ github.ref_name }}-debian-bookworm-x86_64.zip
amiberry-debian-bookworm-aarch64-rpi5/amiberry-${{ github.ref_name }}-debian-bookworm-aarch64-rpi5.zip
amiberry-debian-bullseye-aarch64-rpi4/amiberry-${{ github.ref_name }}-debian-bullseye-aarch64-rpi4.zip
amiberry-debian-bookworm-aarch64-rpi4/amiberry-${{ github.ref_name }}-debian-bookworm-aarch64-rpi4.zip
amiberry-debian-bookworm-x86_64/amiberry_*.deb
amiberry-debian-bookworm-aarch64/amiberry_*.deb
amiberry-debian-bookworm-armhf/amiberry_*.deb
amiberry-debian-bullseye-x86_64/amiberry_*.deb
amiberry-debian-bullseye-aarch64/amiberry_*.deb
amiberry-debian-bullseye-armhf/amiberry_*.deb

0
.gitmodules vendored
View File

View File

@ -1,15 +1,13 @@
cmake_minimum_required(VERSION 3.16)
project(amiberry)
enable_language(C CXX ASM)
project(amiberry VERSION 6.3.5)
enable_language(C CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_C_FLAGS_RELEASE "-O3 -pipe")
set(CMAKE_C_FLAGS_DEBUG "-Og -g -rdynamic -funwind-tables -DDEBUG -Wl,--export-dynamic -pipe")
set(CMAKE_C_FLAGS_RELEASE "-O3 -pipe -fno-pie -no-pie")
set(CMAKE_C_FLAGS_DEBUG "-Og -g -funwind-tables -DDEBUG -pipe -fno-pie -no-pie")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
set(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}")
set(CMAKE_ASM_COMPILER_ARG1 "${CMAKE_C_COMPILER_ARG1}")
# Use libgpiod to control GPIO LEDs?
option(USE_GPIOD "Use GPIOD" OFF)
@ -33,330 +31,405 @@ endif ()
# Needed so that cmake uses our find modules.
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(CheckSymbolExists)
function(detect_architecture symbol arch)
if (NOT DEFINED ARCHITECTURE)
set(CMAKE_REQUIRED_QUIET 1)
check_symbol_exists("${symbol}" "" ARCHITECTURE_${arch})
unset(CMAKE_REQUIRED_QUIET)
# The output variable needs to be unique across invocations otherwise
# CMake's crazy scope rules will keep it defined
if (ARCHITECTURE_${arch})
set(ARCHITECTURE "${arch}" PARENT_SCOPE)
endif ()
endif ()
endfunction()
detect_architecture("__x86_64__" x86_64)
detect_architecture("__aarch64__" arm64)
detect_architecture("__arm__" arm32)
message(STATUS "Target architecture: ${ARCHITECTURE}")
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(MACOS TRUE)
message(STATUS "macOS platform detected")
if (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR ARCHITECTURE MATCHES "arm64")
set(CMAKE_EXE_LINKER_FLAGS "-L/usr/local/lib external/libguisan/dylib/libguisan.dylib -L/opt/homebrew/lib/ -framework IOKit -framework Foundation")
if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
include_directories("/opt/homebrew/include")
set(CMAKE_EXE_LINKER_FLAGS "-L/opt/homebrew/lib -framework IOKit -framework Foundation -liconv")
else ()
set(CMAKE_EXE_LINKER_FLAGS "-L/usr/local/lib external/libguisan/dylib/libguisan.dylib -framework IOKit -framework Foundation")
include_directories("/usr/local/include")
set(CMAKE_EXE_LINKER_FLAGS "-L/usr/local/lib -framework IOKit -framework Foundation -liconv")
endif ()
endif ()
add_executable(${PROJECT_NAME}
src/a2065.cpp
src/a2091.cpp
src/akiko.cpp
src/amax.cpp
src/ar.cpp
src/arcadia.cpp
src/audio.cpp
src/autoconf.cpp
src/blitfunc.cpp
src/blittable.cpp
src/blitter.cpp
src/blkdev.cpp
src/blkdev_cdimage.cpp
src/bsdsocket.cpp
src/calc.cpp
src/cd32_fmv.cpp
src/cd32_fmv_genlock.cpp
src/cdrom.cpp
src/cdtv.cpp
src/cdtvcr.cpp
src/cfgfile.cpp
src/cia.cpp
src/consolehook.cpp
src/cpuboard.cpp
src/crc32.cpp
src/custom.cpp
src/debug.cpp
src/def_icons.cpp
src/devices.cpp
src/disk.cpp
src/diskutil.cpp
src/dlopen.cpp
src/dongle.cpp
src/draco.cpp
src/drawing.cpp
src/driveclick.cpp
src/ethernet.cpp
src/events.cpp
src/expansion.cpp
src/fdi2raw.cpp
src/filesys.cpp
src/flashrom.cpp
src/fpp.cpp
src/fsdb.cpp
src/fsusage.cpp
src/gayle.cpp
src/gfxboard.cpp
src/gfxutil.cpp
src/hardfile.cpp
src/hrtmon.rom.cpp
src/ide.cpp
src/idecontrollers.cpp
src/identify.cpp
src/ini.cpp
src/inputdevice.cpp
src/inputrecord.cpp
src/isofs.cpp
src/keybuf.cpp
src/main.cpp
src/memory.cpp
src/midiemu.cpp
src/native2amiga.cpp
src/ncr9x_scsi.cpp
src/ncr_scsi.cpp
src/parser.cpp
src/rommgr.cpp
src/rtc.cpp
src/sampler.cpp
src/savestate.cpp
src/scp.cpp
src/scsi.cpp
src/scsiemul.cpp
src/scsitape.cpp
src/specialmonitors.cpp
src/statusline.cpp
src/tabletlibrary.cpp
src/test_card.cpp
src/tinyxml2.cpp
src/traps.cpp
src/uaeexe.cpp
src/uaelib.cpp
src/uaenative.cpp
src/uaeresource.cpp
src/uaeserial.cpp
src/zfile.cpp
src/zfile_archive.cpp
src/archivers/7z/7zAlloc.c
src/archivers/7z/7zArcIn.c
src/archivers/7z/7zBuf.c
src/archivers/7z/7zBuf2.c
src/archivers/7z/7zCrc.c
src/archivers/7z/7zCrcOpt.c
src/archivers/7z/7zDec.c
src/archivers/7z/7zFile.c
src/archivers/7z/7zStream.c
src/archivers/7z/Aes.c
src/archivers/7z/AesOpt.c
src/archivers/7z/Alloc.c
src/archivers/7z/Bcj2.c
src/archivers/7z/Bra.c
src/archivers/7z/Bra86.c
src/archivers/7z/BraIA64.c
src/archivers/7z/CpuArch.c
src/archivers/7z/Delta.c
src/archivers/7z/LzFind.c
src/archivers/7z/Lzma2Dec.c
src/archivers/7z/Lzma2Enc.c
src/archivers/7z/Lzma86Dec.c
src/archivers/7z/Lzma86Enc.c
src/archivers/7z/LzmaDec.c
src/archivers/7z/LzmaEnc.c
src/archivers/7z/LzmaLib.c
src/archivers/7z/Ppmd7.c
src/archivers/7z/Ppmd7Dec.c
src/archivers/7z/Ppmd7Enc.c
src/archivers/7z/Sha256.c
src/archivers/7z/Sort.c
src/archivers/7z/Xz.c
src/archivers/7z/XzCrc64.c
src/archivers/7z/XzCrc64Opt.c
src/archivers/7z/XzDec.c
src/archivers/7z/XzEnc.c
src/archivers/7z/XzIn.c
src/archivers/chd/avhuff.cpp
src/archivers/chd/bitmap.cpp
src/archivers/chd/cdrom.cpp
src/archivers/chd/chd.cpp
src/archivers/chd/chdcd.cpp
src/archivers/chd/chdcodec.cpp
src/archivers/chd/corealloc.cpp
src/archivers/chd/corefile.cpp
src/archivers/chd/corestr.cpp
src/archivers/chd/flac.cpp
src/archivers/chd/harddisk.cpp
src/archivers/chd/hashing.cpp
src/archivers/chd/huffman.cpp
src/archivers/chd/md5.cpp
src/archivers/chd/osdcore.cpp
src/archivers/chd/osdlib_unix.cpp
src/archivers/chd/osdsync.cpp
src/archivers/chd/palette.cpp
src/archivers/chd/posixdir.cpp
src/archivers/chd/posixfile.cpp
src/archivers/chd/posixptty.cpp
src/archivers/chd/posixsocket.cpp
src/archivers/chd/strconv.cpp
src/archivers/chd/strformat.cpp
src/archivers/chd/unicode.cpp
src/archivers/chd/vecstream.cpp
src/archivers/chd/utf8proc.c
src/archivers/dms/crc_csum.cpp
src/archivers/dms/getbits.cpp
src/archivers/dms/maketbl.cpp
src/archivers/dms/pfile.cpp
src/archivers/dms/tables.cpp
src/archivers/dms/u_deep.cpp
src/archivers/dms/u_heavy.cpp
src/archivers/dms/u_init.cpp
src/archivers/dms/u_medium.cpp
src/archivers/dms/u_quick.cpp
src/archivers/dms/u_rle.cpp
src/archivers/lha/crcio.cpp
src/archivers/lha/dhuf.cpp
src/archivers/lha/header.cpp
src/archivers/lha/huf.cpp
src/archivers/lha/larc.cpp
src/archivers/lha/lhamaketbl.cpp
src/archivers/lha/lharc.cpp
src/archivers/lha/shuf.cpp
src/archivers/lha/shuf.cpp
src/archivers/lha/slide.cpp
src/archivers/lha/uae_lha.cpp
src/archivers/lha/util.cpp
src/archivers/lzx/unlzx.cpp
src/archivers/mp2/kjmp2.cpp
src/archivers/wrp/warp.cpp
src/archivers/zip/unzip.cpp
src/caps/caps_amiberry.cpp
src/machdep/support.cpp
external/floppybridge/src/floppybridge_lib.cpp
src/osdep/ahi_v1.cpp
src/osdep/bsdsocket_host.cpp
src/osdep/cda_play.cpp
src/osdep/charset.cpp
src/osdep/fsdb_host.cpp
src/osdep/clipboard.cpp
src/osdep/amiberry_hardfile.cpp
src/osdep/keyboard.cpp
src/osdep/midi.cpp
src/osdep/mp3decoder.cpp
src/osdep/picasso96.cpp
src/osdep/writelog.cpp
src/osdep/amiberry.cpp
src/osdep/ahi_v2.cpp
src/osdep/amiberry_dbus.cpp
src/osdep/amiberry_filesys.cpp
src/osdep/amiberry_input.cpp
src/osdep/amiberry_gfx.cpp
src/osdep/amiberry_gui.cpp
src/osdep/amiberry_mem.cpp
src/osdep/amiberry_serial.cpp
src/osdep/amiberry_uaenet.cpp
src/osdep/amiberry_whdbooter.cpp
src/osdep/ioport.cpp
src/osdep/sigsegv_handler.cpp
src/osdep/socket.cpp
src/osdep/retroarch.cpp
src/osdep/vpar.cpp
src/sounddep/sound.cpp
src/threaddep/threading.cpp
src/osdep/gui/ControllerMap.cpp
src/osdep/gui/CreateFolder.cpp
src/osdep/gui/SelectorEntry.cpp
src/osdep/gui/ShowCustomFields.cpp
src/osdep/gui/ShowHelp.cpp
src/osdep/gui/ShowMessage.cpp
src/osdep/gui/ShowDiskInfo.cpp
src/osdep/gui/SelectFolder.cpp
src/osdep/gui/SelectFile.cpp
src/osdep/gui/CreateFilesysHardfile.cpp
src/osdep/gui/EditFilesysVirtual.cpp
src/osdep/gui/EditFilesysHardfile.cpp
src/osdep/gui/EditFilesysHardDrive.cpp
src/osdep/gui/EditTapeDrive.cpp
src/osdep/gui/PanelAbout.cpp
src/osdep/gui/PanelPaths.cpp
src/osdep/gui/PanelQuickstart.cpp
src/osdep/gui/PanelConfig.cpp
src/osdep/gui/PanelCPU.cpp
src/osdep/gui/PanelChipset.cpp
src/osdep/gui/PanelCustom.cpp
src/osdep/gui/PanelROM.cpp
src/osdep/gui/PanelRAM.cpp
src/osdep/gui/PanelFloppy.cpp
src/osdep/gui/PanelExpansions.cpp
src/osdep/gui/PanelHD.cpp
src/osdep/gui/PanelRTG.cpp
src/osdep/gui/PanelHWInfo.cpp
src/osdep/gui/PanelInput.cpp
src/osdep/gui/PanelIOPorts.cpp
src/osdep/gui/PanelDisplay.cpp
src/osdep/gui/PanelSound.cpp
src/osdep/gui/PanelDiskSwapper.cpp
src/osdep/gui/PanelMisc.cpp
src/osdep/gui/PanelPrio.cpp
src/osdep/gui/PanelSavestate.cpp
src/osdep/gui/PanelVirtualKeyboard.cpp
src/osdep/gui/PanelWHDLoad.cpp
src/osdep/gui/main_window.cpp
src/osdep/gui/Navigation.cpp
src/osdep/vkbd/vkbd.cpp
src/newcpu.cpp
src/newcpu_common.cpp
src/readcpu.cpp
src/cpudefs.cpp
src/cpustbl.cpp
src/cpuemu_0.cpp
src/cpuemu_4.cpp
src/cpuemu_11.cpp
src/cpuemu_13.cpp
src/cpuemu_40.cpp
src/cpuemu_44.cpp
# Define the list of source files
set(SOURCE_FILES
src/a2065.cpp
src/a2091.cpp
src/akiko.cpp
src/amax.cpp
src/ar.cpp
src/arcadia.cpp
src/audio.cpp
src/autoconf.cpp
src/blitfunc.cpp
src/blittable.cpp
src/blitter.cpp
src/blkdev.cpp
src/blkdev_cdimage.cpp
src/bsdsocket.cpp
src/calc.cpp
src/catweasel.cpp
src/cd32_fmv.cpp
src/cd32_fmv_genlock.cpp
src/cdrom.cpp
src/cdtv.cpp
src/cdtvcr.cpp
src/cfgfile.cpp
src/cia.cpp
src/consolehook.cpp
src/cpuboard.cpp
src/crc32.cpp
src/custom.cpp
src/debug.cpp
src/debugmem.cpp
src/def_icons.cpp
src/devices.cpp
src/disasm.cpp
src/disk.cpp
src/diskutil.cpp
src/dlopen.cpp
src/dongle.cpp
src/draco.cpp
src/drawing.cpp
src/driveclick.cpp
src/enforcer.cpp
src/ethernet.cpp
src/events.cpp
src/expansion.cpp
src/fdi2raw.cpp
src/filesys.cpp
src/flashrom.cpp
src/fpp.cpp
src/fpp_native.cpp
src/framebufferboards.cpp
src/fsdb.cpp
src/fsusage.cpp
src/gayle.cpp
src/gfxboard.cpp
src/gfxlib.cpp
src/gfxutil.cpp
src/hardfile.cpp
src/hrtmon.rom.cpp
src/ide.cpp
src/idecontrollers.cpp
src/identify.cpp
src/ini.cpp
src/inputdevice.cpp
src/inputrecord.cpp
src/isofs.cpp
src/keybuf.cpp
src/luascript.cpp
src/main.cpp
src/memory.cpp
src/midiemu.cpp
src/native2amiga.cpp
src/ncr9x_scsi.cpp
src/ncr_scsi.cpp
src/parser.cpp
src/pci.cpp
src/rommgr.cpp
src/rtc.cpp
src/sampler.cpp
src/sana2.cpp
src/savestate.cpp
src/scp.cpp
src/scsi.cpp
src/scsiemul.cpp
src/scsitape.cpp
src/slirp_uae.cpp
src/sndboard.cpp
src/specialmonitors.cpp
src/statusline.cpp
src/tabletlibrary.cpp
src/test_card.cpp
src/tinyxml2.cpp
src/traps.cpp
src/uaeexe.cpp
src/uaelib.cpp
src/uaenative.cpp
src/uaeresource.cpp
src/uaeserial.cpp
src/vm.cpp
src/x86.cpp
src/zfile.cpp
src/zfile_archive.cpp
src/archivers/7z/7zAlloc.c
src/archivers/7z/7zArcIn.c
src/archivers/7z/7zBuf.c
src/archivers/7z/7zBuf2.c
src/archivers/7z/7zCrc.c
src/archivers/7z/7zCrcOpt.c
src/archivers/7z/7zDec.c
src/archivers/7z/7zFile.c
src/archivers/7z/7zStream.c
src/archivers/7z/Aes.c
src/archivers/7z/AesOpt.c
src/archivers/7z/Alloc.c
src/archivers/7z/Bcj2.c
src/archivers/7z/Bra.c
src/archivers/7z/Bra86.c
src/archivers/7z/BraIA64.c
src/archivers/7z/CpuArch.c
src/archivers/7z/Delta.c
src/archivers/7z/LzFind.c
src/archivers/7z/Lzma2Dec.c
src/archivers/7z/Lzma2Enc.c
src/archivers/7z/Lzma86Dec.c
src/archivers/7z/Lzma86Enc.c
src/archivers/7z/LzmaDec.c
src/archivers/7z/LzmaEnc.c
src/archivers/7z/LzmaLib.c
src/archivers/7z/Ppmd7.c
src/archivers/7z/Ppmd7Dec.c
src/archivers/7z/Ppmd7Enc.c
src/archivers/7z/Sha256.c
src/archivers/7z/Sort.c
src/archivers/7z/Xz.c
src/archivers/7z/XzCrc64.c
src/archivers/7z/XzCrc64Opt.c
src/archivers/7z/XzDec.c
src/archivers/7z/XzEnc.c
src/archivers/7z/XzIn.c
src/archivers/chd/avhuff.cpp
src/archivers/chd/bitmap.cpp
src/archivers/chd/cdrom.cpp
src/archivers/chd/chd.cpp
src/archivers/chd/chdcd.cpp
src/archivers/chd/chdcodec.cpp
src/archivers/chd/corealloc.cpp
src/archivers/chd/corefile.cpp
src/archivers/chd/corestr.cpp
src/archivers/chd/flac.cpp
src/archivers/chd/harddisk.cpp
src/archivers/chd/hashing.cpp
src/archivers/chd/huffman.cpp
src/archivers/chd/md5.cpp
src/archivers/chd/osdcore.cpp
src/archivers/chd/osdlib_unix.cpp
src/archivers/chd/osdsync.cpp
src/archivers/chd/palette.cpp
src/archivers/chd/posixdir.cpp
src/archivers/chd/posixfile.cpp
src/archivers/chd/posixptty.cpp
src/archivers/chd/posixsocket.cpp
src/archivers/chd/strconv.cpp
src/archivers/chd/strformat.cpp
src/archivers/chd/unicode.cpp
src/archivers/chd/vecstream.cpp
src/archivers/chd/utf8proc.c
src/archivers/dms/crc_csum.cpp
src/archivers/dms/getbits.cpp
src/archivers/dms/maketbl.cpp
src/archivers/dms/pfile.cpp
src/archivers/dms/tables.cpp
src/archivers/dms/u_deep.cpp
src/archivers/dms/u_heavy.cpp
src/archivers/dms/u_init.cpp
src/archivers/dms/u_medium.cpp
src/archivers/dms/u_quick.cpp
src/archivers/dms/u_rle.cpp
src/archivers/lha/crcio.cpp
src/archivers/lha/dhuf.cpp
src/archivers/lha/header.cpp
src/archivers/lha/huf.cpp
src/archivers/lha/larc.cpp
src/archivers/lha/lhamaketbl.cpp
src/archivers/lha/lharc.cpp
src/archivers/lha/shuf.cpp
src/archivers/lha/shuf.cpp
src/archivers/lha/slide.cpp
src/archivers/lha/uae_lha.cpp
src/archivers/lha/util.cpp
src/archivers/lzx/unlzx.cpp
src/archivers/mp2/kjmp2.cpp
src/archivers/wrp/warp.cpp
src/archivers/zip/unzip.cpp
src/caps/caps_amiberry.cpp
src/dsp3210/dsp_glue.cpp
src/dsp3210/DSP3210_emulation.cpp
src/machdep/support.cpp
src/mame/a2410.cpp
src/mame/tm34010/tms34010.cpp
external/floppybridge/src/floppybridge_lib.cpp
src/osdep/ahi_v1.cpp
src/osdep/bsdsocket_host.cpp
src/osdep/cda_play.cpp
src/osdep/charset.cpp
src/osdep/fsdb_host.cpp
src/osdep/clipboard.cpp
src/osdep/amiberry_hardfile.cpp
src/osdep/keyboard.cpp
src/osdep/midi.cpp
src/osdep/mp3decoder.cpp
src/osdep/picasso96.cpp
src/osdep/writelog.cpp
src/osdep/amiberry.cpp
src/osdep/ahi_v2.cpp
src/osdep/amiberry_dbus.cpp
src/osdep/amiberry_filesys.cpp
src/osdep/amiberry_input.cpp
src/osdep/amiberry_gfx.cpp
src/osdep/amiberry_gui.cpp
src/osdep/amiberry_mem.cpp
src/osdep/amiberry_serial.cpp
src/osdep/amiberry_uaenet.cpp
src/osdep/amiberry_whdbooter.cpp
src/osdep/ioport.cpp
src/osdep/sigsegv_handler.cpp
src/osdep/socket.cpp
src/osdep/retroarch.cpp
src/osdep/vpar.cpp
src/pcem/386.cpp
src/pcem/386_common.cpp
src/pcem/386_dynarec.cpp
src/pcem/808x.cpp
src/pcem/cpu.cpp
src/pcem/dosbox/dbopl.cpp
src/pcem/dma.cpp
src/pcem/keyboard.cpp
src/pcem/keyboard_at.cpp
src/pcem/keyboard_at_draco.cpp
src/pcem/mem.cpp
src/pcem/mouse_ps2.cpp
src/pcem/mouse_serial.cpp
src/pcem/dosbox/nukedopl.cpp
src/pcem/nvr.cpp
src/pcem/pcemglue.cpp
src/pcem/pcemrtc.cpp
src/pcem/pic.cpp
src/pcem/pit.cpp
src/pcem/serial.cpp
src/pcem/sound_cms.cpp
src/pcem/sound_dbopl.cpp
src/pcem/sound_mpu401_uart.cpp
src/pcem/sound_opl.cpp
src/pcem/sound_sb.cpp
src/pcem/sound_sb_dsp.cpp
src/pcem/sound_speaker.cpp
src/pcem/timer.cpp
src/pcem/vid_bt482_ramdac.cpp
src/pcem/vid_cl5429.cpp
src/pcem/vid_et4000.cpp
src/pcem/vid_et4000w32.cpp
src/pcem/vid_inmos.cpp
src/pcem/vid_ncr.cpp
src/pcem/vid_permedia2.cpp
src/pcem/vid_s3.cpp
src/pcem/vid_s3_virge.cpp
src/pcem/vid_sc1502x_ramdac.cpp
src/pcem/vid_sdac_ramdac.cpp
src/pcem/vid_svga.cpp
src/pcem/vid_svga_render.cpp
src/pcem/vid_voodoo.cpp
src/pcem/vid_voodoo_banshee.cpp
src/pcem/vid_voodoo_banshee_blitter.cpp
src/pcem/vid_voodoo_blitter.cpp
src/pcem/vid_voodoo_display.cpp
src/pcem/vid_voodoo_fb.cpp
src/pcem/vid_voodoo_fifo.cpp
src/pcem/vid_voodoo_reg.cpp
src/pcem/vid_voodoo_render.cpp
src/pcem/vid_voodoo_setup.cpp
src/pcem/vid_voodoo_texture.cpp
src/pcem/x86seg.cpp
src/pcem/x87.cpp
src/pcem/x87_timings.cpp
src/ppc/ppc.cpp
src/ppc/ppcd.cpp
src/qemuvga/cirrus_vga.cpp
src/qemuvga/es1370.cpp
src/qemuvga/esp.cpp
src/qemuvga/lsi53c710.cpp
src/qemuvga/lsi53c895a.cpp
src/qemuvga/ne2000.cpp
src/qemuvga/qemu.cpp
src/qemuvga/qemuuaeglue.cpp
src/qemuvga/vga.cpp
src/sounddep/sound.cpp
src/threaddep/threading.cpp
src/osdep/gui/ControllerMap.cpp
src/osdep/gui/CreateFolder.cpp
src/osdep/gui/SelectorEntry.cpp
src/osdep/gui/ShowCustomFields.cpp
src/osdep/gui/ShowHelp.cpp
src/osdep/gui/ShowMessage.cpp
src/osdep/gui/ShowDiskInfo.cpp
src/osdep/gui/SelectFolder.cpp
src/osdep/gui/SelectFile.cpp
src/osdep/gui/CreateFilesysHardfile.cpp
src/osdep/gui/EditFilesysVirtual.cpp
src/osdep/gui/EditFilesysHardfile.cpp
src/osdep/gui/EditFilesysHardDrive.cpp
src/osdep/gui/EditTapeDrive.cpp
src/osdep/gui/PanelAbout.cpp
src/osdep/gui/PanelPaths.cpp
src/osdep/gui/PanelQuickstart.cpp
src/osdep/gui/PanelConfig.cpp
src/osdep/gui/PanelCPU.cpp
src/osdep/gui/PanelChipset.cpp
src/osdep/gui/PanelCustom.cpp
src/osdep/gui/PanelROM.cpp
src/osdep/gui/PanelRAM.cpp
src/osdep/gui/PanelFloppy.cpp
src/osdep/gui/PanelExpansions.cpp
src/osdep/gui/PanelHD.cpp
src/osdep/gui/PanelRTG.cpp
src/osdep/gui/PanelHWInfo.cpp
src/osdep/gui/PanelInput.cpp
src/osdep/gui/PanelIOPorts.cpp
src/osdep/gui/PanelDisplay.cpp
src/osdep/gui/PanelSound.cpp
src/osdep/gui/PanelDiskSwapper.cpp
src/osdep/gui/PanelMisc.cpp
src/osdep/gui/PanelPrio.cpp
src/osdep/gui/PanelSavestate.cpp
src/osdep/gui/PanelVirtualKeyboard.cpp
src/osdep/gui/PanelWHDLoad.cpp
src/osdep/gui/main_window.cpp
src/osdep/gui/Navigation.cpp
src/osdep/vkbd/vkbd.cpp
src/newcpu.cpp
src/newcpu_common.cpp
src/readcpu.cpp
src/cpudefs.cpp
src/cpustbl.cpp
src/cpummu.cpp
src/cpummu30.cpp
src/cpuemu_0.cpp
src/cpuemu_11.cpp
src/cpuemu_13.cpp
src/cpuemu_20.cpp
src/cpuemu_21.cpp
src/cpuemu_22.cpp
src/cpuemu_23.cpp
src/cpuemu_24.cpp
src/cpuemu_31.cpp
src/cpuemu_32.cpp
src/cpuemu_33.cpp
src/cpuemu_34.cpp
src/cpuemu_35.cpp
src/cpuemu_40.cpp
src/cpuemu_50.cpp
src/jit/compemu.cpp
src/jit/compstbl.cpp
src/jit/compemu_fpp.cpp
src/jit/compemu_support.cpp
)
target_compile_options(${PROJECT_NAME} PRIVATE -fno-pie)
if (APPLE)
add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${SOURCE_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/Info.plist
)
else ()
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
endif()
target_compile_definitions(${PROJECT_NAME} PRIVATE _FILE_OFFSET_BITS=64)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR ARCHITECTURE MATCHES "arm64")
if (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
target_compile_definitions(${PROJECT_NAME} PRIVATE CPU_AARCH64)
target_sources(${PROJECT_NAME} PRIVATE
src/osdep/aarch64_helper.s
src/jit/compemu.cpp
src/jit/compstbl.cpp
src/jit/compemu_fpp.cpp
src/jit/compemu_support.cpp
)
endif ()
if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm" OR ARCHITECTURE MATCHES "arm32")
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
target_compile_definitions(${PROJECT_NAME} PRIVATE CPU_arm ARMV6_ASSEMBLY ARMV6T2 USE_ARMNEON ARM_HAS_DIV)
target_sources(${PROJECT_NAME} PRIVATE
src/osdep/neon_helper.s
src/jit/compemu.cpp
src/jit/compstbl.cpp
src/jit/compemu_fpp.cpp
src/jit/compemu_support.cpp
)
endif ()
find_package(SDL2 REQUIRED CONFIG REQUIRED COMPONENTS SDL2)
find_package(SDL2_image REQUIRED)
find_package(SDL2_ttf REQUIRED)
find_package(SDL2 CONFIG REQUIRED)
find_package(SDL2_image MODULE REQUIRED)
find_package(SDL2_ttf MODULE REQUIRED)
include_directories(${SDL2_INCLUDE_DIR} ${SDL2_IMAGE_INCLUDE_DIR} ${SDL2_TTF_INCLUDE_DIR})
if (USE_GPIOD)
target_compile_definitions(${PROJECT_NAME} PRIVATE USE_GPIOD)
@ -389,9 +462,8 @@ add_subdirectory(external/libguisan)
# Add dependencies to ensure external libraries are built
add_dependencies(${PROJECT_NAME} mt32emu floppybridge capsimage guisan)
target_include_directories(${PROJECT_NAME} PRIVATE ${SDL2_INCLUDE_DIRS} src src/osdep src/include src/threaddep src/archivers external/libguisan/include external/mt32emu/src external/floppybridge/src)
target_link_libraries(${PROJECT_NAME} PRIVATE SDL2 SDL2_image SDL2_ttf guisan mt32emu ${DBUS_LIBRARIES} FLAC portmidi png mpg123 mpeg2convert mpeg2 serialport z)
target_link_options(${PROJECT_NAME} PRIVATE "LINKER:-as-needed,-no-pie")
target_include_directories(${PROJECT_NAME} PRIVATE src src/osdep src/include src/threaddep src/archivers src/ppc/pearpc external/libguisan/include external/mt32emu/src external/floppybridge/src)
target_link_libraries(${PROJECT_NAME} PRIVATE SDL2 SDL2_image SDL2_ttf guisan mt32emu ${DBUS_LIBRARIES} FLAC portmidi png MPG123::libmpg123 mpeg2convert mpeg2 serialport z pthread dl)
if (USE_OPENGL)
target_compile_definitions(${PROJECT_NAME} PRIVATE USE_OPENGL)
@ -453,58 +525,93 @@ add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
DEPENDS external/capsimage)
# Install the executable
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
if (APPLE)
install(TARGETS ${PROJECT_NAME} BUNDLE DESTINATION .)
else ()
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
# Install additional directories
install(DIRECTORY ${CMAKE_SOURCE_DIR}/cdroms
DESTINATION share/${PROJECT_NAME}
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/conf
DESTINATION share/${PROJECT_NAME}
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/controllers
DESTINATION share/${PROJECT_NAME}
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/data
DESTINATION share/${PROJECT_NAME}
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/floppies
DESTINATION share/${PROJECT_NAME}
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/harddrives
DESTINATION share/${PROJECT_NAME}
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/inputrecordings
DESTINATION share/${PROJECT_NAME}
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/kickstarts
DESTINATION share/${PROJECT_NAME}
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/lha
DESTINATION share/${PROJECT_NAME}
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/nvram
DESTINATION share/${PROJECT_NAME}
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/plugins
DESTINATION share/${PROJECT_NAME}
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/savestates
DESTINATION share/${PROJECT_NAME}
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/screenshots
DESTINATION share/${PROJECT_NAME}
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/whdboot
DESTINATION share/${PROJECT_NAME}
)
# Install additional directories
install(DIRECTORY ${CMAKE_SOURCE_DIR}/cdroms
DESTINATION share/${PROJECT_NAME}/cdroms
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/conf
DESTINATION share/${PROJECT_NAME}/conf
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/controllers
DESTINATION share/${PROJECT_NAME}/controllers
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/data
DESTINATION share/${PROJECT_NAME}/data
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/floppies
DESTINATION share/${PROJECT_NAME}/floppies
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/harddrives
DESTINATION share/${PROJECT_NAME}/harddrives
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/inputrecordings
DESTINATION share/${PROJECT_NAME}/inputrecordings
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/kickstarts
DESTINATION share/${PROJECT_NAME}/kickstarts
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/lha
DESTINATION share/${PROJECT_NAME}/lha
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/nvram
DESTINATION share/${PROJECT_NAME}/nvram
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/plugins
DESTINATION share/${PROJECT_NAME}/plugins
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/savestates
DESTINATION share/${PROJECT_NAME}/savestates
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/screenshots
DESTINATION share/${PROJECT_NAME}/screenshots
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/whdboot
DESTINATION share/${PROJECT_NAME}/whdboot
)
# Install shared libraries
install(FILES ${CMAKE_BINARY_DIR}/external/floppybridge/libfloppybridge.so
DESTINATION share/${PROJECT_NAME}/plugins
)
install(FILES ${CMAKE_BINARY_DIR}/external/capsimage/libcapsimage.so
DESTINATION share/${PROJECT_NAME}/plugins
)
# Install shared libraries
install(FILES ${CMAKE_BINARY_DIR}/external/floppybridge/libfloppybridge.so
DESTINATION share/${PROJECT_NAME}/plugins
)
install(FILES ${CMAKE_BINARY_DIR}/external/capsimage/libcapsimage.so
DESTINATION share/${PROJECT_NAME}/plugins
)
# Install desktop file
install(FILES ${CMAKE_SOURCE_DIR}/data/Amiberry.desktop
DESTINATION share/applications
)
endif ()
include(CPack)
include(InstallRequiredSystemLibraries)
if(APPLE)
set(CPACK_GENERATOR "Bundle")
set(CPACK_BUNDLE_NAME "Amiberry")
set(CPACK_BUNDLE_PLIST ${CMAKE_SOURCE_DIR}/Info.plist)
set(CPACK_BUNDLE_APPLE_ENTITLEMENTS ${CMAKE_SOURCE_DIR}/Entitlements.plist)
set(CPACK_BUNDLE_ICON ${CMAKE_SOURCE_DIR}/data/amiberry.png)
else()
set(CPACK_GENERATOR "DEB")
set(CPACK_SOURCE_IGNORE_FILES .git/ .github/ .vscode/ _CPack_Packages/)
SET(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
SET(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
SET(CPACK_PACKAGE_VENDOR "BlitterStudio")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
SET(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/docs/README.md")
SET(CPACK_DEBIAN_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://amiberry.com")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Dimitris Panokostas <midwan@gmail.com>") # Required
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.27), libstdc++6 (>= 8.3.0), libsdl2-2.0-0, libsdl2-image-2.0-0, libsdl2-ttf-2.0-0, flac, libmpg123-0, libpng16-16, zlib1g, libserialport0, libportmidi0, libmpeg2-4") # Adjust dependencies as needed
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Amiberry is an optimized Amiga emulator various platforms.")
set(CPACK_DEBIAN_PACKAGE_SECTION "games")
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
endif()
include(CPack)

152
Makefile
View File

@ -43,11 +43,11 @@ SDL_CONFIG ?= sdl2-config
export SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
export SDL_LDFLAGS := $(shell $(SDL_CONFIG) --libs)
CPPFLAGS = -MD -MT $@ -MF $(@:%.o=%.d) $(SDL_CFLAGS) -Iexternal/libguisan/include -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Isrc/archivers -Iexternal/floppybridge/src -Iexternal/mt32emu/src -D_FILE_OFFSET_BITS=64
CPPFLAGS = -MD -MT $@ -MF $(@:%.o=%.d) $(SDL_CFLAGS) -Iexternal/libguisan/include -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Isrc/archivers -Isrc/ppc/pearpc -Iexternal/floppybridge/src -Iexternal/mt32emu/src -D_FILE_OFFSET_BITS=64
CFLAGS=-pipe -Wno-shift-overflow -Wno-narrowing -fno-pie
LDFLAGS = $(SDL_LDFLAGS) -lSDL2_image -lSDL2_ttf -lserialport -lportmidi -lguisan -Lexternal/libguisan/lib -lmt32emu -Lexternal/mt32emu
LDFLAGS += -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lpthread -lz -lpng -lrt -lFLAC -lmpg123 -ldl -lmpeg2convert -lmpeg2 -lstdc++fs -no-pie
LDFLAGS += -Wl,-O1 -lpthread -lz -lpng -lFLAC -lmpg123 -ldl -lmpeg2convert -lmpeg2 -no-pie
ifdef USE_OPENGL
CFLAGS += -DUSE_OPENGL
@ -76,21 +76,21 @@ endif
ifndef DEBUG
CFLAGS += -O3
else
CFLAGS += -g -rdynamic -funwind-tables -DDEBUG -Wl,--export-dynamic
CFLAGS += -g -rdynamic -funwind-tables -DDEBUG
endif
ifdef USE_OLDGCC
CFLAGS += -DUSE_OLDGCC
endif
#Common flags for all 32bit targets
CPPFLAGS32=-DARMV6_ASSEMBLY -DARMV6T2
#Common flags for all ARM 32bit targets
CPPFLAGS32=-DARMV6T2
#Common flags for all 64bit targets
#Common flags for all ARM 64bit targets
CPPFLAGS64=-DCPU_AARCH64
#Neon flags
NEON_FLAGS=-DUSE_ARMNEON -DARM_HAS_DIV
NEON_FLAGS=-DARM_HAS_DIV
# Raspberry Pi 2 CPU flags
ifneq (,$(findstring rpi2,$(PLATFORM)))
@ -239,16 +239,17 @@ else ifeq ($(PLATFORM),oga)
# macOS Apple Silicon (SDL2, 64-bit, Apple Silicon)
else ifeq ($(PLATFORM),osx-m1)
LDFLAGS = -L/usr/local/lib external/libguisan/dylib/libguisan.dylib -Lexternal/mt32emu -lSDL2_image -lSDL2_ttf -lpng -liconv -lz -lFLAC -L/opt/homebrew/lib/ -lmpg123 -lmpeg2 -lmpeg2convert -lserialport -lportmidi -lmt32emu $(SDL_LDFLAGS) -framework IOKit -framework Foundation
CPPFLAGS = -MD -MT $@ -MF $(@:%.o=%.d) $(SDL_CFLAGS) -I/opt/homebrew/include -Iexternal/libguisan/include -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Isrc/archivers -Iexternal/floppybridge/src -Iexternal/mt32emu/src -D_FILE_OFFSET_BITS=64 -DCPU_AARCH64 $(SDL_CFLAGS)
LDFLAGS += -L/opt/homebrew/lib/ -framework IOKit -framework Foundation -liconv
CPPFLAGS += $(CPPFLAGS64)
CPPFLAGS += -I/opt/homebrew/include
CXX=/usr/bin/c++
# DEBUG=1
APPBUNDLE=1
# macOS intel (SDL2, 64-bit, x86-64)
else ifeq ($(PLATFORM),osx-x86)
LDFLAGS = -L/usr/local/lib external/libguisan/dylib/libguisan.dylib -Lexternal/mt32emu -lSDL2_image -lSDL2_ttf -lpng -liconv -lz -lFLAC -lmpg123 -lmpeg2 -lmpeg2convert -lserialport -lportmidi -lmt32emu $(SDL_LDFLAGS) -framework IOKit -framework Foundation
CPPFLAGS = -MD -MT $@ -MF $(@:%.o=%.d) $(SDL_CFLAGS) -I/usr/local/include -Iexternal/libguisan/include -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Isrc/archivers -Iexternal/floppybridge/src -Iexternal/mt32emu/src -D_FILE_OFFSET_BITS=64 $(SDL_CFLAGS)
LDFLAGS += -L/usr/local/lib -framework IOKit -framework Foundation -liconv
CPPFLAGS += -I/usr/local/include
CXX=/usr/bin/c++
# DEBUG=1
APPBUNDLE=1
@ -420,6 +421,7 @@ OBJS = \
src/blkdev_cdimage.o \
src/bsdsocket.o \
src/calc.o \
src/catweasel.o \
src/cd32_fmv.o \
src/cd32_fmv_genlock.o \
src/cdrom.o \
@ -432,8 +434,10 @@ OBJS = \
src/crc32.o \
src/custom.o \
src/debug.o \
src/debugmem.o \
src/def_icons.o \
src/devices.o \
src/disasm.o \
src/disk.o \
src/diskutil.o \
src/dlopen.o \
@ -441,6 +445,7 @@ OBJS = \
src/draco.o \
src/drawing.o \
src/driveclick.o \
src/enforcer.o \
src/ethernet.o \
src/events.o \
src/expansion.o \
@ -448,10 +453,13 @@ OBJS = \
src/filesys.o \
src/flashrom.o \
src/fpp.o \
src/fpp_native.o \
src/framebufferboards.o \
src/fsdb.o \
src/fsusage.o \
src/gayle.o \
src/gfxboard.o \
src/gfxlib.o \
src/gfxutil.o \
src/hardfile.o \
src/hrtmon.rom.o \
@ -463,6 +471,7 @@ OBJS = \
src/inputrecord.o \
src/isofs.o \
src/keybuf.o \
src/luascript.o \
src/main.o \
src/memory.o \
src/midiemu.o \
@ -470,14 +479,18 @@ OBJS = \
src/ncr9x_scsi.o \
src/ncr_scsi.o \
src/parser.o \
src/pci.o \
src/rommgr.o \
src/rtc.o \
src/sampler.o \
src/sana2.o \
src/savestate.o \
src/scp.o \
src/scsi.o \
src/scsiemul.o \
src/scsitape.o \
src/slirp_uae.o \
src/sndboard.o \
src/specialmonitors.o \
src/statusline.o \
src/tabletlibrary.o \
@ -489,6 +502,8 @@ OBJS = \
src/uaenative.o \
src/uaeresource.o \
src/uaeserial.o \
src/vm.o \
src/x86.o \
src/zfile.o \
src/zfile_archive.o \
src/archivers/chd/avhuff.o \
@ -544,7 +559,11 @@ OBJS = \
src/archivers/wrp/warp.o \
src/archivers/zip/unzip.o \
src/caps/caps_amiberry.o \
src/dsp3210/dsp_glue.o \
src/dsp3210/DSP3210_emulation.o \
src/machdep/support.o \
src/mame/a2410.o \
src/mame/tm34010/tms34010.o \
external/floppybridge/src/floppybridge_lib.o \
src/osdep/ahi_v1.o \
src/osdep/bsdsocket_host.o \
@ -574,6 +593,72 @@ OBJS = \
src/osdep/socket.o \
src/osdep/retroarch.o \
src/osdep/vpar.o \
src/pcem/386.o \
src/pcem/386_common.o \
src/pcem/386_dynarec.o \
src/pcem/808x.o \
src/pcem/cpu.o \
src/pcem/dosbox/dbopl.o \
src/pcem/dma.o \
src/pcem/keyboard.o \
src/pcem/keyboard_at.o \
src/pcem/keyboard_at_draco.o \
src/pcem/mem.o \
src/pcem/mouse_ps2.o \
src/pcem/mouse_serial.o \
src/pcem/dosbox/nukedopl.o \
src/pcem/nvr.o \
src/pcem/pcemglue.o \
src/pcem/pcemrtc.o \
src/pcem/pic.o \
src/pcem/pit.o \
src/pcem/serial.o \
src/pcem/sound_cms.o \
src/pcem/sound_dbopl.o \
src/pcem/sound_mpu401_uart.o \
src/pcem/sound_opl.o \
src/pcem/sound_sb.o \
src/pcem/sound_sb_dsp.o \
src/pcem/sound_speaker.o \
src/pcem/timer.o \
src/pcem/vid_bt482_ramdac.o \
src/pcem/vid_cl5429.o \
src/pcem/vid_et4000.o \
src/pcem/vid_et4000w32.o \
src/pcem/vid_inmos.o \
src/pcem/vid_ncr.o \
src/pcem/vid_permedia2.o \
src/pcem/vid_s3.o \
src/pcem/vid_s3_virge.o \
src/pcem/vid_sc1502x_ramdac.o \
src/pcem/vid_sdac_ramdac.o \
src/pcem/vid_svga.o \
src/pcem/vid_svga_render.o \
src/pcem/vid_voodoo.o \
src/pcem/vid_voodoo_banshee.o \
src/pcem/vid_voodoo_banshee_blitter.o \
src/pcem/vid_voodoo_blitter.o \
src/pcem/vid_voodoo_display.o \
src/pcem/vid_voodoo_fb.o \
src/pcem/vid_voodoo_fifo.o \
src/pcem/vid_voodoo_reg.o \
src/pcem/vid_voodoo_render.o \
src/pcem/vid_voodoo_setup.o \
src/pcem/vid_voodoo_texture.o \
src/pcem/x86seg.o \
src/pcem/x87.o \
src/pcem/x87_timings.o \
src/ppc/ppc.o \
src/ppc/ppcd.o \
src/qemuvga/cirrus_vga.o \
src/qemuvga/es1370.o \
src/qemuvga/esp.o \
src/qemuvga/lsi53c710.o \
src/qemuvga/lsi53c895a.o \
src/qemuvga/ne2000.o \
src/qemuvga/qemu.o \
src/qemuvga/qemuuaeglue.o \
src/qemuvga/vga.o \
src/sounddep/sound.o \
src/threaddep/threading.o \
src/osdep/gui/ControllerMap.o \
@ -622,40 +707,27 @@ OBJS = \
src/readcpu.o \
src/cpudefs.o \
src/cpustbl.o \
src/cpummu.o \
src/cpummu30.o \
src/cpuemu_0.o \
src/cpuemu_4.o \
src/cpuemu_11.o \
src/cpuemu_13.o \
src/cpuemu_20.o \
src/cpuemu_21.o \
src/cpuemu_22.o \
src/cpuemu_23.o \
src/cpuemu_24.o \
src/cpuemu_31.o \
src/cpuemu_32.o \
src/cpuemu_33.o \
src/cpuemu_34.o \
src/cpuemu_35.o \
src/cpuemu_40.o \
src/cpuemu_44.o
USE_JIT=1
ifdef AARCH64
OBJS += src/osdep/aarch64_helper.o
src/osdep/aarch64_helper.o: src/osdep/aarch64_helper.s
$(AS) $(CPUFLAGS) -o src/osdep/aarch64_helper.o -c src/osdep/aarch64_helper.s
else ifeq ($(PLATFORM),$(filter $(PLATFORM),osx-m1))
USE_JIT = 0
OBJS += src/osdep/aarch64_helper_osx.o
else ifeq ($(PLATFORM),$(filter $(PLATFORM),osx-x86))
USE_JIT = 0
else ifeq ($(PLATFORM),$(filter $(PLATFORM),x86-64))
USE_JIT = 0
else ifeq ($(PLATFORM),$(filter $(PLATFORM),riscv64))
USE_JIT = 0
else
OBJS += src/osdep/neon_helper.o
src/osdep/neon_helper.o: src/osdep/neon_helper.s
$(AS) $(CPUFLAGS) -o src/osdep/neon_helper.o -c src/osdep/neon_helper.s
endif
ifeq ($(USE_JIT),1)
OBJS += src/jit/compemu.o \
src/cpuemu_50.o \
src/jit/compemu.o \
src/jit/compstbl.o \
src/jit/compemu_fpp.o \
src/jit/compemu_support.o
endif
src/jit/compemu_support.o \
src/jit/compemu_fpp.o
DEPS = $(OBJS:%.o=%.d) $(C_OBJS:%.o=%.d)

View File

@ -1,31 +1,58 @@
# - Find mpg123
# Find the native mpg123 includes and libraries
#
# MPG123_INCLUDE_DIRS - where to find mpg123.h, etc.
# MPG123_LIBRARIES - List of libraries when using mpg123.
# MPG123_FOUND - True if Mpg123 found.
#[=======================================================================[.rst:
Findmpg123
-------
if (MPG123_INCLUDE_DIR)
Finds the mpg123 library.
Imported Targets
^^^^^^^^^^^^^^^^
This module provides the following imported targets, if found:
``MPG123::libmpg123``
The mpg123 library
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables:
``mpg123_FOUND``
True if the system has the mpg123 package.
``mpg123_VERSION``
The version of mpg123 that was found on the system.
Cache Variables
^^^^^^^^^^^^^^^
The following cache variables may also be set:
``mpg123_INCLUDE_DIR``
The directory containing ``mpg123.h``.
``mpg123_LIBRARY``
The path to the mpg123 library.
#]=======================================================================]
if (mpg123_INCLUDE_DIR)
# Already in cache, be silent
set(MPG123_FIND_QUIETLY TRUE)
set(mpg123_FIND_QUIETLY TRUE)
endif ()
find_package (PkgConfig QUIET)
pkg_check_modules(PC_MPG123 QUIET libmpg123>=1.25.10)
set (MPG123_VERSION ${PC_MPG123_VERSION})
find_path (MPG123_INCLUDE_DIR mpg123.h
find_path (mpg123_INCLUDE_DIR mpg123.h
HINTS
${PC_MPG123_INCLUDEDIR}
${PC_MPG123_INCLUDE_DIRS}
${MPG123_ROOT}
${mpg123_ROOT}
)
# MSVC built mpg123 may be named mpg123_static.
# The provided project files name the library with the lib prefix.
find_library (MPG123_LIBRARY
find_library (mpg123_LIBRARY
NAMES
mpg123
mpg123_static
@ -34,31 +61,35 @@ find_library (MPG123_LIBRARY
HINTS
${PC_MPG123_LIBDIR}
${PC_MPG123_LIBRARY_DIRS}
${MPG123_ROOT}
${mpg123_ROOT}
)
# Handle the QUIETLY and REQUIRED arguments and set MPG123_FOUND
if (PC_MPG123_FOUND)
set (mpg123_VERSION ${PC_MPG123_VERSION})
elseif (mpg123_INCLUDE_DIR)
file (READ "${mpg123_INCLUDE_DIR}/mpg123.h" _mpg123_h)
string (REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" _mpg123_version_re "${_mpg123_h}")
set (mpg123_VERSION "${_mpg123_version_re}")
endif ()
# Handle the QUIETLY and REQUIRED arguments and set mpg123_FOUND
# to TRUE if all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args (mpg123
REQUIRED_VARS
MPG123_LIBRARY
MPG123_INCLUDE_DIR
mpg123_LIBRARY
mpg123_INCLUDE_DIR
VERSION_VAR
MPG123_VERSION
mpg123_VERSION
)
if (MPG123_FOUND)
set (MPG123_LIBRARIES ${MPG123_LIBRARY})
set (MPG123_INCLUDE_DIRS ${MPG123_INCLUDE_DIR})
if (NOT TARGET MPG123::libmpg123)
add_library (MPG123::libmpg123 UNKNOWN IMPORTED)
set_target_properties (MPG123::libmpg123 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${MPG123_INCLUDE_DIRS}"
IMPORTED_LOCATION "${MPG123_LIBRARIES}"
if (mpg123_FOUND AND NOT TARGET MPG123::libmpg123)
add_library (MPG123::libmpg123 UNKNOWN IMPORTED)
set_target_properties (MPG123::libmpg123
PROPERTIES
IMPORTED_LOCATION "${mpg123_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${mpg123_INCLUDE_DIR}"
)
endif ()
endif ()
mark_as_advanced(MPG123_INCLUDE_DIR MPG123_LIBRARY)
mark_as_advanced(mpg123_INCLUDE_DIR mpg123_LIBRARY)

View File

@ -0,0 +1,6 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_CROSSCOMPILING TRUE)
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE arm64)

View File

@ -0,0 +1,6 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_CROSSCOMPILING TRUE)
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE armhf)

View File

@ -50,4 +50,4 @@ default_vkbd_language=US
default_vkbd_style=Warm
default_vkbd_transparency=0
default_vkbd_toggle=guide
default_retroarch_vkbd=no
default_retroarch_vkbd=no

28
data/Amiberry.desktop Normal file
View File

@ -0,0 +1,28 @@
[Desktop Entry]
# The type of the Desktop Entry, usually Application
Type = Application
# The version of the Desktop Entry specification to which this file complies
Version = 1.0
# The name of the application
Name = Amiberry
# A comment which can/will be used as a tooltip
Comment = Amiga Emulator
# The executable of the application, possibly with arguments
Exec = /usr/bin/amiberry
# The name of the icon that will be used to display this entry
Icon = /usr/share/amiberry/data/amiberry.png
# Describes whether this application needs to be run in a terminal or not
Terminal = false
# Describes the categories in which this entry should be shown
Categories = Game;Emulator;
# Describes the encoding for the desktop entry
Encoding=UTF-8

5
debian/changelog vendored
View File

@ -1,5 +0,0 @@
amiberry (6.3.5-1) UNRELEASED; urgency=low
* Initial release. (Closes: #XXXXXX)
-- Dimitris Panokostas <midwan@gmail.com> Wed, 11 Sep 2024 18:53:49 +0200

12
debian/control vendored
View File

@ -1,12 +0,0 @@
Source: amiberry
Maintainer: Dimitris Panokostas <midwan@gmail.com>
Section: games
Priority: optional
Standards-Version: 4.6.2
Build-Depends: debhelper-compat (= 13)
Package: amiberry
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: An optimized Amiga emulator
Amiberry is an optimized multi-platform Amiga emulator

7
debian/copyright vendored
View File

@ -1,7 +0,0 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Amiberry
Upstream-Contact: Dimitris Panokostas <midwan@gmail.com>
Source: https://github.com/BlitterStudio/amiberry
Files: *
License: GPL-3

3
debian/rules vendored
View File

@ -1,3 +0,0 @@
#!/usr/bin/make -f
%:
dh $@

View File

@ -1 +0,0 @@
3.0 (quilt)

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.3)
cmake_minimum_required(VERSION 3.16)
project(capsimage)
set(PROJECT_TITLE CAPSImage)
@ -71,9 +71,9 @@ install(TARGETS ${PROJECT_NAME}
FRAMEWORK DESTINATION "/Library/Frameworks"
PUBLIC_HEADER DESTINATION include/caps${INCLUDE_SUFFIX})
if (NOT APPLE OR NOT BUILD_FRAMEWORK)
install(FILES ${API_HEADERS} DESTINATION include/caps${INCLUDE_SUFFIX})
endif()
#if (NOT APPLE OR NOT BUILD_FRAMEWORK)
# install(FILES ${API_HEADERS} DESTINATION include/caps${INCLUDE_SUFFIX})
#endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT BUILD_FRAMEWORK)
message(STATUS "macOS platform detected")

View File

@ -55,12 +55,6 @@ add_library(guisan STATIC
src/widgets/textfield.cpp
src/widgets/togglebutton.cpp
src/widgets/window.cpp)
target_include_directories(${PROJECT_NAME} PRIVATE ${SDL2_INCLUDE_DIRS} ./include)
target_include_directories(${PROJECT_NAME} PRIVATE include)
target_link_libraries(${PROJECT_NAME} SDL2 SDL2_ttf SDL2_image)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SDL2IMAGE_LIBRARIES})
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)

View File

@ -8,14 +8,6 @@ SOURCE = $(foreach dir,$(DIRS),$(wildcard $(dir)/*.cpp))
OBJS = $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SOURCE)))
DEPS = $(SOURCE:%.cpp=%.d)
ifneq (,$(findstring osx,$(PLATFORM)))
# Create DYLIB on OS X
TARGET=dylib/libguisan.dylib
LDFLAGS += -lsdl2 -no_branch_islands
AR=$(CXX) -dynamiclib -std=c++14 -install_name libguisan.dylib -fvisibility=hidden -undefined dynamic_lookup -o
ARARGS=
endif
CPPFLAGS +=-I./include $(SDL_CFLAGS) -MD -MT $@ -MF $(@:%.o=%.d)
.PHONY : all clean

View File

@ -133,7 +133,7 @@ namespace gcn
startRow = 0;
}
const auto inactive_color = Color(170, 170, 170);
const auto inactive_color = getSelectionColor() - 0x303030;
// The y coordinate where we start to draw the text is
// simply the y coordinate multiplied with the font height.

View File

@ -323,63 +323,64 @@ target_include_directories(mt32emu
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME Runtime)
set(libmt32emu_COMPONENT_DEVEL COMPONENT Devel)
install(TARGETS mt32emu EXPORT MT32EmuTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ${libmt32emu_COMPONENT_DEVEL}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} NAMELINK_SKIP
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
# TODO: Use NAMELINK_COMPONENT with CMake 3.12 instead.
if(libmt32emu_SHARED)
install(TARGETS mt32emu EXPORT MT32EmuTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ${libmt32emu_COMPONENT_DEVEL} NAMELINK_ONLY
)
endif()
install(TARGETS mt32emu EXPORT MT32EmuTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ${libmt32emu_COMPONENT_DEVEL}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} NAMELINK_SKIP
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
# TODO: Use NAMELINK_COMPONENT with CMake 3.12 instead.
install(DIRECTORY
"${CMAKE_CURRENT_BINARY_DIR}/include/mt32emu"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
${libmt32emu_COMPONENT_DEVEL}
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/include/mt32emu.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
${libmt32emu_COMPONENT_DEVEL}
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/mt32emu.pc
DESTINATION ${libmt32emu_PKGCONFIG_INSTALL_DIR}
${libmt32emu_COMPONENT_DEVEL}
)
install(EXPORT MT32EmuTargets
DESTINATION ${libmt32emu_CMAKE_PACKAGE_INSTALL_DIR}
NAMESPACE MT32Emu::
${libmt32emu_COMPONENT_DEVEL}
)
configure_file(cmake/MT32EmuConfig.cmake.in cmake/MT32EmuConfig.cmake @ONLY)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(cmake/MT32EmuConfigVersion.cmake
VERSION ${libmt32emu_VERSION}
COMPATIBILITY SameMajorVersion
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/cmake/MT32EmuConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/cmake/MT32EmuConfigVersion.cmake
DESTINATION ${libmt32emu_CMAKE_PACKAGE_INSTALL_DIR}
${libmt32emu_COMPONENT_DEVEL}
)
if(libmt32emu_EXT_MODULE)
install(FILES
cmake/CheckDependencies.cmake
cmake/${libmt32emu_EXT_MODULE}
DESTINATION ${libmt32emu_CMAKE_PACKAGE_INSTALL_DIR}
${libmt32emu_COMPONENT_DEVEL}
)
endif()
install(TARGETS mt32emu EXPORT MT32EmuTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ${libmt32emu_COMPONENT_DEVEL} NAMELINK_ONLY
)
install(FILES
AUTHORS.txt COPYING.txt COPYING.LESSER.txt NEWS.txt README.md TODO.txt
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/munt/${PROJECT_NAME}
)
install(DIRECTORY
"${CMAKE_CURRENT_BINARY_DIR}/include/mt32emu"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
${libmt32emu_COMPONENT_DEVEL}
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/include/mt32emu.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
${libmt32emu_COMPONENT_DEVEL}
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/mt32emu.pc
DESTINATION ${libmt32emu_PKGCONFIG_INSTALL_DIR}
${libmt32emu_COMPONENT_DEVEL}
)
install(EXPORT MT32EmuTargets
DESTINATION ${libmt32emu_CMAKE_PACKAGE_INSTALL_DIR}
NAMESPACE MT32Emu::
${libmt32emu_COMPONENT_DEVEL}
)
configure_file(cmake/MT32EmuConfig.cmake.in cmake/MT32EmuConfig.cmake @ONLY)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(cmake/MT32EmuConfigVersion.cmake
VERSION ${libmt32emu_VERSION}
COMPATIBILITY SameMajorVersion
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/cmake/MT32EmuConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/cmake/MT32EmuConfigVersion.cmake
DESTINATION ${libmt32emu_CMAKE_PACKAGE_INSTALL_DIR}
${libmt32emu_COMPONENT_DEVEL}
)
if(libmt32emu_EXT_MODULE)
install(FILES
cmake/CheckDependencies.cmake
cmake/${libmt32emu_EXT_MODULE}
DESTINATION ${libmt32emu_CMAKE_PACKAGE_INSTALL_DIR}
${libmt32emu_COMPONENT_DEVEL}
)
endif()
install(FILES
AUTHORS.txt COPYING.txt COPYING.LESSER.txt NEWS.txt README.md TODO.txt
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/munt/${PROJECT_NAME}
)
endif()
# Facilitates usage of the library in another project either through
# an imported target or directly from the build tree.

View File

@ -44,16 +44,16 @@
</screenshot>
</screenshots>
<releases>
<release version="5.7.4" date="2024-09-01"/>
<release version="5.7.3" date="2024-06-19"/>
<release version="5.7.2" date="2024-06-06"/>
<release version="5.7.1" date="2024-06-03"/>
<release version="5.7.0" date="2024-04-20"/>
<release version="5.6.8" date="2024-02-29"/>
<release version="5.6.7" date="2024-02-14"/>
<release version="5.6.6" date="2024-01-14"/>
<release version="5.6.5" date="2023-12-15"/>
<release version="5.6.4" date="2023-11-19"/>
<release version="5.6.3" date="2023-11-12"/>
<release version="v6.3.4" date="2024-09-01"/>
<release version="v6.3.3" date="2024-06-19"/>
<release version="v6.3.2" date="2024-06-06"/>
<release version="v6.3.1" date="2024-06-03"/>
<release version="v6.3.0" date="2024-04-20"/>
<release version="v6.2.0" date="2024-02-24"/>
<release version="v6.1.3" date="2024-01-19"/>
<release version="v6.1.2" date="2023-12-20"/>
<release version="v6.1.1" date="2023-12-17"/>
<release version="v6.1.0" date="2023-12-15"/>
<release version="v6.0.0" date="2023-11-20"/>
</releases>
</component>

View File

@ -99,8 +99,8 @@ modules:
sources:
- type: git
url: https://github.com/BlitterStudio/amiberry
tag: flatpak-stable
commit: db4e1210bcd4e89a462e2cd64896acf0546b4ee0
tag: flatpak-preview
commit: 730906a44483d922b2db3c7642c61b675543a70f
- type: script
dest-filename: amiberry.sh

View File

@ -16,10 +16,8 @@ mkdir -p Amiberry.app/Contents/Frameworks
mkdir -p Amiberry.app/Contents/Resources
# Copy executable into App bundle
cp amiberry Amiberry.app/Contents/MacOS/Amiberry
# Copy capsimg.so into App bundle
cp plugins/capsimg.so Amiberry.app/Contents/Resources/capsimg.so
# Copy floppybridge lib into App bundle
cp plugins/libfloppybridge.so Amiberry.app/Contents/Resources/libfloppybridge.so
# Copy plugin libs into App bundle
cp plugins/*.so Amiberry.app/Contents/Resources/
# Copy init script into the bundle
cp macos_init_amiberry.zsh Amiberry.app/Contents/Resources
chmod +x Amiberry.app/Contents/Resources/macos_init_amiberry.zsh
@ -46,9 +44,3 @@ cp -R whdboot Amiberry.app/Contents/Resources/Whdboot
# Overwrite default conf with OSX specific one
cat conf/amiberry-osx.conf | sed -e "s#USERDIR#$USERDIR#g" >Amiberry.app/Contents/Resources/Configurations/amiberry.conf
# Use dylibbundler to install into app if exists
dylibbundler -od -b -x Amiberry.app/Contents/MacOS/Amiberry -d Amiberry.app/Contents/libs/ -s external/libguisan/dylib/
if [ $? -gt 0 ]; then
echo "Can't find dylibbundler, use brew to install it, or manually copy external/libguisan/dylib/libguisan.dylib into /usr/local/lib (you'll need sudo)"
fi

View File

@ -1520,9 +1520,9 @@ uae_u16 audio_dmal(void)
for (int nr = 0; nr < AUDIO_CHANNELS_PAULA; nr++) {
struct audio_channel_data *cdp = audio_channel + nr;
if (cdp->dr)
dmal |= 1 << (nr * 2);
if (cdp->dsr)
dmal |= 1 << (nr * 2 + 1);
if (cdp->dsr)
dmal |= 1 << (nr * 2 + 0);
cdp->dr = cdp->dsr = false;
}
return dmal;

File diff suppressed because it is too large Load Diff

View File

@ -49,7 +49,7 @@ static TCHAR *parsedvaluess[MAX_VALUES];
// 2 * / % left to right
// 3 + - left to right
// 4 = right to left
static int op_preced(const TCHAR c)
static int op_preced(const unsigned char c)
{
switch(c) {
case 0xf0: case 0xf1: case 0xf2:
@ -70,7 +70,7 @@ static int op_preced(const TCHAR c)
return 0;
}
static bool op_left_assoc(const TCHAR c)
static bool op_left_assoc(const unsigned char c)
{
switch(c) {
// left to right
@ -85,7 +85,7 @@ static bool op_left_assoc(const TCHAR c)
return false;
}
static unsigned int op_arg_count(const TCHAR c)
static unsigned int op_arg_count(const unsigned char c)
{
switch(c) {
case '?':
@ -310,7 +310,7 @@ static TCHAR *stacktostring(struct calcstack *st)
}
static TCHAR *docalcxs(TCHAR op, TCHAR *v1, TCHAR *v2, double *voutp)
static TCHAR *docalcxs(unsigned char op, TCHAR *v1, TCHAR *v2, double *voutp)
{
TCHAR tmp[MAX_DPATH];
tmp[0] = 0;
@ -348,7 +348,7 @@ static TCHAR *docalcxs(TCHAR op, TCHAR *v1, TCHAR *v2, double *voutp)
return my_strdup(tmp);
}
static bool docalcx(TCHAR op, double v1, double v2, double *valp)
static bool docalcx(unsigned char op, double v1, double v2, double *valp)
{
double v = 0;
switch (op)
@ -422,7 +422,7 @@ static bool docalcx(TCHAR op, double v1, double v2, double *valp)
static bool docalc2(TCHAR op, struct calcstack *sv1, struct calcstack *sv2, double *valp, TCHAR *sp)
{
*sp = NULL;
sp = NULL;
*valp = 0;
if (isstackstring(sv1) || isstackstring(sv2)) {
TCHAR *v1 = stacktostring(sv1);
@ -481,7 +481,7 @@ static TCHAR *chartostack(TCHAR c)
return s;
}
static struct calcstack stack[STACK_SIZE];
static struct calcstack calc_stack[STACK_SIZE];
static bool execution_order(const TCHAR *input, double *outval, TCHAR *outstring, int maxlen)
{
@ -506,7 +506,7 @@ static bool execution_order(const TCHAR *input, double *outval, TCHAR *outstring
// If the token is a value or identifier
if(is_ident(c)) {
// Push it onto the stack.
stack[sl].s = chartostack (c);
calc_stack[sl].s = chartostack (c);
++sl;
}
// Otherwise, the token is an operator (operator here includes both operators, and functions).
@ -526,7 +526,7 @@ static bool execution_order(const TCHAR *input, double *outval, TCHAR *outstring
if(is_function(c)) {
calc_log ((_T("%c("), c));
while(nargs > 0){
sc = &stack[sl - nargs]; // to remove reverse order of arguments
sc = &calc_stack[sl - nargs]; // to remove reverse order of arguments
if(nargs > 1) {
calc_log ((_T("%s, "), sc));
}
@ -539,25 +539,25 @@ static bool execution_order(const TCHAR *input, double *outval, TCHAR *outstring
}
else {
if(nargs == 1) {
sc = &stack[sl - 1];
sc = &calc_stack[sl - 1];
sl--;
docalc1 (c, sc, val, &val, vals);
calc_log ((_T("%c %s = %f;\n"), c, stacktostr(sc), val));
}
else if (nargs == 2) {
sc = &stack[sl - 2];
sc = &calc_stack[sl - 2];
calc_log ((_T("%s %c "), stacktostr(sc), c));
sc2 = &stack[sl - 1];
sc2 = &calc_stack[sl - 1];
docalc2 (c, sc, sc2, &val, vals);
sl--;sl--;
calc_log ((_T("%s = %f;\n"), stacktostr(sc2), val));
} else if (nargs == 3) {
// ternary
sc = &stack[sl - 3];
sc = &calc_stack[sl - 3];
if (sc->val != 0) {
sc2 = &stack[sl - 2];
sc2 = &calc_stack[sl - 2];
} else {
sc2 = &stack[sl - 1];
sc2 = &calc_stack[sl - 1];
}
sl--;sl--;sl--;
if (isstackstring(sc2)) {
@ -569,11 +569,11 @@ static bool execution_order(const TCHAR *input, double *outval, TCHAR *outstring
}
}
// Push the returned results, if any, back onto the stack.
stack[sl].val = val;
xfree(stack[sl].vals);
stack[sl].vals = my_strdup(vals);
xfree(stack[sl].s);
stack[sl].s = NULL;
calc_stack[sl].val = val;
xfree(calc_stack[sl].vals);
calc_stack[sl].vals = my_strdup(vals);
xfree(calc_stack[sl].s);
calc_stack[sl].s = NULL;
++sl;
}
++strpos;
@ -581,7 +581,7 @@ static bool execution_order(const TCHAR *input, double *outval, TCHAR *outstring
// If there is only one value in the stack
// That value is the result of the calculation.
if(sl == 1) {
sc = &stack[sl - 1];
sc = &calc_stack[sl - 1];
sl--;
calc_log ((_T("result = %f\n"), val));
if (outval)
@ -595,10 +595,10 @@ static bool execution_order(const TCHAR *input, double *outval, TCHAR *outstring
ok = true;
}
for (i = 0; i < STACK_SIZE; i++) {
xfree(stack[i].s);
stack[i].s = NULL;
xfree(stack[i].vals);
stack[i].vals = NULL;
xfree(calc_stack[i].s);
calc_stack[i].s = NULL;
xfree(calc_stack[i].vals);
calc_stack[i].vals = NULL;
}
// If there are more values in the stack
@ -684,20 +684,64 @@ static bool parse_values(const TCHAR *ins, TCHAR *out)
*in = '@' | 0x80;
*(in + 1) = ' ';
}
if (_istdigit (*in)) {
if (_totupper (*in) == 'R') {
if (ident >= MAX_VALUES)
return false;
TCHAR *tmpp = in + 1;
int idx = getregidx(&tmpp);
if (idx >= 0) {
*p++ = ident + 'a';
uae_u32 val = returnregx(idx);
parsedvaluesd[ident++] = val;
in = tmpp;
} else {
in++;
}
op = 0;
} else if (_istxdigit(*in) || *in == '$') {
if (ident >= MAX_VALUES)
return false;
if (op > 1 && (in[-1] == '-' || in[-1] == '+')) {
instart--;
p--;
}
*p++ = ident + 'a';
while (_istdigit (*in) || *in == '.')
in++;
tmp = *in;
*in = 0;
parsedvaluesd[ident++] = _tstof (instart);
*in = tmp;
if (op > 1 && (in[-1] == '-' || in[-1] == '+')) {
instart--;
p--;
}
*p++ = ident + 'a';
bool hex = false;
if (*in == '$') {
in++;
hex = true;
}
if (!hex) {
TCHAR *tmpp = in;
while (_istxdigit(*tmpp)) {
tmp = _totupper(*tmpp);
if (tmp >= 'A' && tmp <= 'F') {
hex = true;
}
tmpp++;
}
}
if (hex) {
uae_u32 val = 0;
while (_istxdigit(*in)) {
val *= 16;
TCHAR c = _totupper(*in);
if (_istdigit(c)) {
val += c - '0';
} else {
val += c - 'A' + 10;
}
in++;
}
parsedvaluesd[ident++] = val;
} else {
while (_istdigit(*in) || *in == '.')
in++;
tmp = *in;
*in = 0;
parsedvaluesd[ident++] = _tstof(instart);
*in = tmp;
}
op = 0;
} else {
if (is_operator(*in))
@ -721,7 +765,7 @@ int calc(const TCHAR *input, double *outval, TCHAR *outstring, int maxlen)
outstring[0] = 0;
}
for (int i = 0; i < STACK_SIZE; i++) {
struct calcstack *s = &stack[i];
struct calcstack *s = &calc_stack[i];
memset(s, 0, sizeof(struct calcstack));
}
if (parse_values(input, output2)) {
@ -744,7 +788,7 @@ int calc(const TCHAR *input, double *outval, TCHAR *outstring, int maxlen)
parsedvaluess[i] = NULL;
}
for (int i = 0; i < STACK_SIZE; i++) {
struct calcstack *s = &stack[i];
struct calcstack *s = &calc_stack[i];
xfree(s->vals);
xfree(s->s);
memset(s, 0, sizeof(struct calcstack));

717
src/catweasel.cpp Normal file
View File

@ -0,0 +1,717 @@
#include <stdio.h>
#include "sysconfig.h"
#include "sysdeps.h"
#ifdef CATWEASEL
#include "options.h"
#include "memory.h"
#include "ioport.h"
#include "catweasel.h"
#include "uae.h"
#include "zfile.h"
#define DRIVER
#include <catweasl_usr.h>
struct catweasel_contr cwc;
static int cwhsync, cwmk3buttonsync;
static int cwmk3port, cwmk3port1, cwmk3port2;
static int handshake;
static int mouse_x[2], mouse_y[2], mouse_px[2], mouse_py[2];
static HANDLE handle = INVALID_HANDLE_VALUE;
int catweasel_isjoystick (void)
{
uae_u8 b = cwc.can_joy;
if (!cwc.direct_access)
return 0;
if (b) {
if (cwc.type == CATWEASEL_TYPE_MK3 && cwc.sid[0])
b |= 0x80;
if (cwc.type >= CATWEASEL_TYPE_MK4)
b |= 0x80;
}
return b;
}
int catweasel_ismouse (void)
{
if (!cwc.direct_access)
return 0;
return cwc.can_mouse;
}
static int hsync_requested;
static void hsync_request (void)
{
hsync_requested = 10;
};
static void sid_write (uae_u8 reg, uae_u8 val, int sidnum)
{
if (sidnum >= cwc.can_sid)
return;
catweasel_do_bput(0xd8, val);
catweasel_do_bput(0xdc, reg | (sidnum << 7));
catweasel_do_bget(0xd8); // dummy read
catweasel_do_bget(0xd8); // dummy read
}
static uae_u8 sid_read (uae_u8 reg, int sidnum)
{
if (sidnum >= cwc.can_sid)
return 0;
catweasel_do_bput(0xdc, 0x20 | reg | (sidnum << 7));
catweasel_do_bget(0xd8); // dummy read
catweasel_do_bget(0xd8); // dummy read
return catweasel_do_bget(0xd8);
}
static uae_u8 get_buttons (void)
{
uae_u8 b, b2;
b = 0;
if (cwc.type < CATWEASEL_TYPE_MK3 || !cwc.direct_access)
return b;
hsync_request();
b2 = catweasel_do_bget(0xc8) & (0x80 | 0x40);
if (!(b2 & 0x80))
b |= 0x80;
if (!(b2 & 0x40))
b |= 0x08;
if (cwc.type >= CATWEASEL_TYPE_MK4) {
b &= ~0x80;
catweasel_do_bput(3, 0x81);
if (!(catweasel_do_bget(0x07) & 0x10))
b |= 0x80;
b2 = catweasel_do_bget(0xd0) ^ 15;
catweasel_do_bput(3, 0x41);
if (cwc.sid[0]) {
b2 &= ~(1 | 2);
if (sid_read(0x19, 0) > 0x7f)
b2 |= 2;
if (sid_read(0x1a, 0) > 0x7f)
b2 |= 1;
}
if (cwc.sid[1]) {
b2 &= ~(4 | 8);
if (sid_read(0x19, 1) > 0x7f)
b2 |= 8;
if (sid_read(0x1a, 1) > 0x7f)
b2 |= 4;
}
} else {
b2 = cwmk3port1 | (cwmk3port2 << 2);
}
b |= (b2 & (8 | 4)) << 3;
b |= (b2 & (1 | 2)) << 1;
return b;
}
int catweasel_read_mouse (int port, int *dx, int *dy, int *buttons)
{
if (!cwc.can_mouse || !cwc.direct_access)
return 0;
hsync_request();
*dx = mouse_x[port];
mouse_x[port] = 0;
*dy = mouse_y[port];
mouse_y[port] = 0;
*buttons = (get_buttons() >> (port * 4)) & 15;
return 1;
}
static void sid_reset (void)
{
int i;
for (i = 0; i < 0x19; i++) {
sid_write(i, 0, 0);
sid_write(i, 0, 1);
}
}
static void catweasel_detect_sid (void)
{
int i, j;
uae_u8 b1, b2;
cwc.sid[0] = cwc.sid[1] = 0;
if (!cwc.can_sid || !cwc.direct_access)
return;
sid_reset();
if (cwc.type >= CATWEASEL_TYPE_MK4) {
catweasel_do_bput(3, 0x81);
b1 = catweasel_do_bget(0xd0);
for (i = 0; i < 100; i++) {
sid_read(0x19, 0); // delay
b2 = catweasel_do_bget(0xd0);
if ((b1 & 3) != (b2 & 3))
cwc.sid[0] = 6581;
if ((b1 & 12) != (b2 & 12))
cwc.sid[1] = 6581;
}
}
catweasel_do_bput(3, 0x41);
for (i = 0; i < 2 ;i++) {
sid_reset();
sid_write(0x0f, 0xff, i);
sid_write(0x12, 0x10, i);
for(j = 0; j != 1000; j++) {
sid_write(0, 0, i);
if((sid_read(0x1b, i) & 0x80) != 0) {
cwc.sid[i] = 6581;
break;
}
}
sid_reset();
sid_write(0x0f, 0xff, i);
sid_write(0x12, 0x30, i);
for(j = 0; j != 1000; j++) {
sid_write(0, 0, i);
if((sid_read(0x1b, i) & 0x80) != 0) {
cwc.sid[i] = 8580;
break;
}
}
}
sid_reset();
}
void catweasel_hsync (void)
{
int i;
if (cwc.type < CATWEASEL_TYPE_MK3 || !cwc.direct_access)
return;
cwhsync--;
if (cwhsync > 0)
return;
cwhsync = 10;
if (handshake) {
/* keyboard handshake */
catweasel_do_bput (0xd0, 0);
handshake = 0;
}
if (hsync_requested < 0)
return;
hsync_requested--;
if (cwc.type == CATWEASEL_TYPE_MK3 && cwc.sid[0]) {
uae_u8 b;
cwmk3buttonsync--;
if (cwmk3buttonsync <= 0) {
cwmk3buttonsync = 30;
b = 0;
if (sid_read (0x19, 0) > 0x7f)
b |= 2;
if (sid_read (0x1a, 0) > 0x7f)
b |= 1;
if (cwmk3port == 0) {
cwmk3port1 = b;
catweasel_do_bput (0xd4, 0); // select port2
cwmk3port = 1;
} else {
cwmk3port2 = b;
catweasel_do_bget (0xd4); // select port1
cwmk3port = 0;
}
}
}
if (!cwc.can_mouse)
return;
/* read MK4 mouse counters */
catweasel_do_bput (3, 0x81);
for (i = 0; i < 2; i++) {
int x, y, dx, dy;
x = (uae_s8)catweasel_do_bget (0xc4 + i * 8);
y = (uae_s8)catweasel_do_bget (0xc0 + i * 8);
dx = mouse_px[i] - x;
if (dx > 127)
dx = 255 - dx;
if (dx < -128)
dx = 255 + dx;
dy = mouse_py[i] - y;
if (dy > 127)
dy = 255 - dy;
if (dy < -128)
dy = 255 + dy;
mouse_x[i] -= dx;
mouse_y[i] -= dy;
mouse_px[i] = x;
mouse_py[i] = y;
}
catweasel_do_bput (3, 0x41);
}
int catweasel_read_joystick (uae_u8 *dir, uae_u8 *buttons)
{
if (!cwc.can_joy || !cwc.direct_access)
return 0;
hsync_request ();
*dir = catweasel_do_bget (0xc0);
*buttons = get_buttons ();
return 1;
}
int catweasel_read_keyboard (uae_u8 *keycode)
{
uae_u8 v;
if (!cwc.can_kb || !cwc.direct_access)
return 0;
if (!currprefs.catweasel)
return 0;
v = catweasel_do_bget (0xd4);
if (!(v & 0x80))
return 0;
if (handshake)
return 0;
*keycode = catweasel_do_bget (0xd0);
catweasel_do_bput (0xd0, 0);
handshake = 1;
return 1;
}
uae_u32 catweasel_do_bget (uaecptr addr)
{
DWORD did_read = 0;
uae_u8 buf1[1], buf2[1];
if (addr >= 0x100)
return 0;
buf1[0] = (uae_u8)addr;
if (handle != INVALID_HANDLE_VALUE) {
if (!DeviceIoControl (handle, CW_PEEKREG_FULL, buf1, 1, buf2, 1, &did_read, 0))
write_log (_T("catweasel_do_bget %02x fail err=%d\n"), buf1[0], GetLastError ());
} else {
buf2[0] = ioport_read (cwc.iobase + addr);
}
//write_log (_T("G %02X %02X %d\n"), buf1[0], buf2[0], did_read);
return buf2[0];
}
void catweasel_do_bput (uaecptr addr, uae_u32 b)
{
uae_u8 buf[2];
DWORD did_read = 0;
if (addr >= 0x100)
return;
buf[0] = (uae_u8)addr;
buf[1] = b;
if (handle != INVALID_HANDLE_VALUE) {
if (!DeviceIoControl (handle, CW_POKEREG_FULL, buf, 2, 0, 0, &did_read, 0))
write_log (_T("catweasel_do_bput %02x=%02x fail err=%d\n"), buf[0], buf[1], GetLastError ());
} else {
ioport_write (cwc.iobase + addr, b);
}
//write_log (_T("P %02X %02X %d\n"), (uae_u8)addr, (uae_u8)b, did_read);
}
#include "core.cw4.cpp"
static int cw_config_done (void)
{
return ioport_read (cwc.iobase + 7) & 4;
}
static int cw_fpga_ready (void)
{
return ioport_read (cwc.iobase + 7) & 8;
}
static void cw_resetFPGA (void)
{
ioport_write (cwc.iobase + 2, 227);
ioport_write (cwc.iobase + 3, 0);
sleep_millis (10);
ioport_write (cwc.iobase + 3, 65);
}
static int catweasel3_configure (void)
{
ioport_write (cwc.iobase, 241);
ioport_write (cwc.iobase + 1, 0);
ioport_write (cwc.iobase + 2, 0);
ioport_write (cwc.iobase + 4, 0);
ioport_write (cwc.iobase + 5, 0);
ioport_write (cwc.iobase + 0x29, 0);
ioport_write (cwc.iobase + 0x2b, 0);
return 1;
}
static int catweasel4_configure (void)
{
struct zfile *f;
time_t t;
ioport_write (cwc.iobase, 241);
ioport_write (cwc.iobase + 1, 0);
ioport_write (cwc.iobase + 2, 227);
ioport_write (cwc.iobase + 3, 65);
ioport_write (cwc.iobase + 4, 0);
ioport_write (cwc.iobase + 5, 0);
ioport_write (cwc.iobase + 0x29, 0);
ioport_write (cwc.iobase + 0x2b, 0);
sleep_millis(10);
if (cw_config_done()) {
write_log (_T("CW: FPGA already configured, skipping core upload\n"));
return 1;
}
cw_resetFPGA();
sleep_millis(10);
if (cw_config_done()) {
write_log (_T("CW: FPGA failed to reset!\n"));
return 0;
}
f = zfile_fopen(_T("core.cw4"), _T("rb"), ZFD_NORMAL);
if (!f) {
f = zfile_fopen_data (_T("core.cw4.gz"), core_len, core);
f = zfile_gunzip (f);
}
write_log (_T("CW: starting core upload, this will take few seconds\n"));
t = time(NULL) + 10; // give up if upload takes more than 10s
for (;;) {
uae_u8 b;
if (zfile_fread (&b, 1, 1, f) != 1)
break;
ioport_write (cwc.iobase + 3, (b & 1) ? 67 : 65);
while (!cw_fpga_ready()) {
if (time(NULL) >= t) {
write_log (_T("CW: FPGA core upload got stuck!?\n"));
cw_resetFPGA();
return 0;
}
}
ioport_write (cwc.iobase + 192, b);
}
if (!cw_config_done()) {
write_log (_T("CW: FPGA didn't accept the core!\n"));
cw_resetFPGA();
return 0;
}
sleep_millis(10);
write_log (_T("CW: core uploaded successfully\n"));
return 1;
}
#include <setupapi.h>
#include <cfgmgr32.h>
#define PCI_CW_MK3 _T("PCI\\VEN_E159&DEV_0001&SUBSYS_00021212")
#define PCI_CW_MK4 _T("PCI\\VEN_E159&DEV_0001&SUBSYS_00035213")
#define PCI_CW_MK4_BUG _T("PCI\\VEN_E159&DEV_0001&SUBSYS_00025213")
int force_direct_catweasel;
static int direct_detect(void)
{
HDEVINFO devs;
SP_DEVINFO_LIST_DETAIL_DATA devInfoListDetail;
SP_DEVINFO_DATA devInfo;
int devIndex;
int cw = 0;
devs = SetupDiGetClassDevsEx(NULL, NULL, NULL, DIGCF_ALLCLASSES | DIGCF_PRESENT, NULL, NULL, NULL);
if (devs == INVALID_HANDLE_VALUE)
return 0;
devInfoListDetail.cbSize = sizeof(devInfoListDetail);
if(SetupDiGetDeviceInfoListDetail(devs,&devInfoListDetail)) {
devInfo.cbSize = sizeof(devInfo);
for(devIndex=0;SetupDiEnumDeviceInfo(devs,devIndex,&devInfo);devIndex++) {
TCHAR devID[MAX_DEVICE_ID_LEN];
if(CM_Get_Device_ID_Ex(devInfo.DevInst,devID,MAX_DEVICE_ID_LEN,0,devInfoListDetail.RemoteMachineHandle)!=CR_SUCCESS)
devID[0] = TEXT('\0');
if (!_tcsncmp (devID, PCI_CW_MK3, _tcslen (PCI_CW_MK3))) {
if (cw > 3)
break;
cw = 3;
}
if (!_tcsncmp (devID, PCI_CW_MK4, _tcslen (PCI_CW_MK4)) ||
!_tcsncmp (devID, PCI_CW_MK4_BUG, _tcslen (PCI_CW_MK4_BUG)))
cw = 4;
if (cw) {
SP_DEVINFO_LIST_DETAIL_DATA devInfoListDetail;
ULONG status = 0;
ULONG problem = 0;
LOG_CONF config = 0;
BOOL haveConfig = FALSE;
ULONG dataSize;
PBYTE resDesData;
RES_DES prevResDes, resDes;
RESOURCEID resId = ResType_IO;
devInfoListDetail.cbSize = sizeof(devInfoListDetail);
if((!SetupDiGetDeviceInfoListDetail(devs,&devInfoListDetail)) ||
(CM_Get_DevNode_Status_Ex(&status,&problem,devInfo.DevInst,0,devInfoListDetail.RemoteMachineHandle)!=CR_SUCCESS))
break;
if(!(status & DN_HAS_PROBLEM)) {
if (CM_Get_First_Log_Conf_Ex(&config,
devInfo.DevInst,
ALLOC_LOG_CONF,
devInfoListDetail.RemoteMachineHandle) == CR_SUCCESS) {
haveConfig = TRUE;
}
}
if(!haveConfig) {
if (CM_Get_First_Log_Conf_Ex(&config,
devInfo.DevInst,
FORCED_LOG_CONF,
devInfoListDetail.RemoteMachineHandle) == CR_SUCCESS) {
haveConfig = TRUE;
}
}
if(!haveConfig) {
if(!(status & DN_HAS_PROBLEM) || (problem != CM_PROB_HARDWARE_DISABLED)) {
if (CM_Get_First_Log_Conf_Ex(&config,
devInfo.DevInst,
BOOT_LOG_CONF,
devInfoListDetail.RemoteMachineHandle) == CR_SUCCESS) {
haveConfig = TRUE;
}
}
}
if(!haveConfig)
break;
prevResDes = (RES_DES)config;
resDes = 0;
while(CM_Get_Next_Res_Des_Ex(&resDes,prevResDes,ResType_IO,&resId,0,NULL)==CR_SUCCESS) {
if(prevResDes != config)
CM_Free_Res_Des_Handle(prevResDes);
prevResDes = resDes;
if(CM_Get_Res_Des_Data_Size_Ex(&dataSize,resDes,0,NULL)!=CR_SUCCESS)
continue;
resDesData = (PBYTE)malloc (dataSize);
if(!resDesData)
continue;
if(CM_Get_Res_Des_Data_Ex(resDes,resDesData,dataSize,0,NULL)!=CR_SUCCESS) {
free (resDesData);
continue;
}
if (resId == ResType_IO) {
PIO_RESOURCE pIoData = (PIO_RESOURCE)resDesData;
if(pIoData->IO_Header.IOD_Alloc_End-pIoData->IO_Header.IOD_Alloc_Base+1) {
write_log (_T("CW: PCI SCAN: CWMK%d @%I64X - %I64X\n"), cw,
pIoData->IO_Header.IOD_Alloc_Base,pIoData->IO_Header.IOD_Alloc_End);
cwc.iobase = (int)pIoData->IO_Header.IOD_Alloc_Base;
cwc.direct_type = cw;
}
}
free (resDesData);
}
if(prevResDes != config)
CM_Free_Res_Des_Handle(prevResDes);
CM_Free_Log_Conf_Handle(config);
}
}
}
SetupDiDestroyDeviceInfoList(devs);
if (cw) {
if (!ioport_init ())
cw = 0;
}
return cw;
}
static int detected;
int catweasel_init(void)
{
TCHAR name[32], tmp[1000], *s;
int i;
DWORD len;
uae_u8 buffer[10000];
uae_u32 model, base;
int detect = 0;
if (cwc.type)
return 1;
if (force_direct_catweasel >= 100) {
cwc.iobase = force_direct_catweasel & 0xffff;
if (force_direct_catweasel > 0xffff) {
cwc.direct_type = force_direct_catweasel >> 16;
} else {
cwc.direct_type = force_direct_catweasel >= 0x400 ? 3 : 1;
}
cwc.direct_access = 1;
} else {
for (i = 0; i < 4; i++) {
int j = i;
if (currprefs.catweasel > 0)
j = currprefs.catweasel + i;
if (currprefs.catweasel < 0)
j = -currprefs.catweasel + 1 + i;
_stprintf (name, _T("\\\\.\\CAT%d_F0"), j);
handle = CreateFile (name, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (handle != INVALID_HANDLE_VALUE || currprefs.catweasel)
break;
}
if (handle == INVALID_HANDLE_VALUE)
catweasel_detect();
cwc.direct_access = 0;
if (currprefs.catweasel < 0)
cwc.direct_access = 1;
}
if (handle == INVALID_HANDLE_VALUE) {
_tcscpy (name, _T("[DIRECT]"));
if (cwc.direct_type && ioport_init()) {
cwc.direct_access = 1;
if (cwc.direct_type == 4 && catweasel4_configure()) {
cwc.type = 4;
cwc.can_joy = 2;
cwc.can_sid = 2;
cwc.can_kb = 1;
cwc.can_mouse = 2;
} else if (cwc.direct_type == 3 && catweasel3_configure()) {
cwc.type = 3;
cwc.can_joy = 1;
cwc.can_sid = 1;
cwc.can_kb = 1;
cwc.can_mouse = 0;
}
}
if (cwc.type == 0) {
write_log (_T("CW: No Catweasel detected\n"));
goto fail;
}
}
if (!cwc.direct_type) {
if (!DeviceIoControl (handle, CW_GET_VERSION, 0, 0, buffer, sizeof (buffer), &len, 0)) {
write_log (_T("CW: CW_GET_VERSION failed %d\n"), GetLastError ());
goto fail;
}
s = au ((char*)buffer);
write_log (_T("CW driver version string '%s'\n"), s);
xfree (s);
if (!DeviceIoControl (handle, CW_GET_HWVERSION, 0, 0, buffer, sizeof (buffer), &len, 0)) {
write_log (_T("CW: CW_GET_HWVERSION failed %d\n"), GetLastError ());
goto fail;
}
write_log (_T("CW: v=%d 14=%d 28=%d 56=%d joy=%d dpm=%d sid=%d kb=%d sidfifo=%d\n"),
buffer[0], buffer[1], buffer[2], buffer[3], buffer[4], buffer[5],
buffer[6], buffer[7], ((uae_u32*)(buffer + 8))[0]);
cwc.can_joy = (buffer[4] & 1) ? 2 : 0;
cwc.can_sid = buffer[6] ? 1 : 0;
cwc.can_kb = buffer[7] & 1;
cwc.can_mouse = (buffer[4] & 2) ? 2 : 0;
if (!DeviceIoControl (handle, CW_LOCK_EXCLUSIVE, 0, 0, buffer, sizeof (buffer), &len, 0)) {
write_log (_T("CW: CW_LOCK_EXCLUSIVE failed %d\n"), GetLastError ());
goto fail;
}
model = *((uae_u32*)(buffer + 4));
base = *((uae_u32*)(buffer + 0));
cwc.type = model == 0 ? 1 : model == 2 ? 4 : 3;
cwc.iobase = base;
if (!cwc.direct_access) {
if (!DeviceIoControl (handle, CW_UNLOCK_EXCLUSIVE, 0, 0, 0, 0, &len, 0)) {
write_log (_T("CW: CW_UNLOCK_EXCLUSIVE failed %d\n"), GetLastError ());
}
}
if (cwc.type == CATWEASEL_TYPE_MK4 && cwc.can_sid)
cwc.can_sid = 2;
}
if (cwc.direct_access) {
if (cwc.type == CATWEASEL_TYPE_MK4) {
if (cwc.can_mouse) {
int i;
catweasel_do_bput (3, 0x81);
catweasel_do_bput (0xd0, 4|8); // amiga mouse + pullups
// clear mouse counters
for (i = 0; i < 2; i++) {
catweasel_do_bput (0xc4 + i * 8, 0);
catweasel_do_bput (0xc0 + i * 8, 0);
}
}
catweasel_do_bput (3, 0x41); /* enable MK3-mode */
}
if (cwc.can_joy)
catweasel_do_bput (0xcc, 0); // joystick buttons = input
}
//catweasel_init_controller(&cwc);
_stprintf (tmp, _T("CW: Catweasel MK%d @%08x (%s) enabled. %s."),
cwc.type, (int)cwc.iobase, name, cwc.direct_access ? _T("DIRECTIO"): _T("API"));
if (cwc.direct_access) {
if (cwc.can_sid) {
TCHAR *p = tmp + _tcslen (tmp);
catweasel_detect_sid ();
_stprintf (p, _T(" SID0=%d"), cwc.sid[0]);
if (cwc.can_sid > 1) {
p += _tcslen (p);
_stprintf (p, _T(" SID1=%d"), cwc.sid[1]);
}
}
}
write_log (_T("%s\n"), tmp);
detected = 1;
return 1;
fail:
catweasel_free ();
return 0;
}
void catweasel_free (void)
{
if (cwc.direct_access) {
if (cwc.type == CATWEASEL_TYPE_MK4)
catweasel_do_bput(3, 0x61); // enable floppy passthrough
}
if (handle != INVALID_HANDLE_VALUE)
CloseHandle (handle);
handle = INVALID_HANDLE_VALUE;
ioport_free ();
memset (&cwc, 0, sizeof cwc);
mouse_x[0] = mouse_x[1] = mouse_y[0] = mouse_y[1] = 0;
mouse_px[0] = mouse_px[1] = mouse_py[0] = mouse_py[1] = 0;
cwmk3port = cwmk3port1 = cwmk3port2 = 0;
cwhsync = cwmk3buttonsync = 0;
}
int catweasel_detect (void)
{
TCHAR name[32];
int i;
HANDLE h;
if (detected)
return detected < 0 ? 0 : 1;
detected = -1;
for (i = 0; i < 4; i++) {
_stprintf (name, _T("\\\\.\\CAT%u_F0"), i);
h = CreateFile (name, GENERIC_READ, FILE_SHARE_WRITE|FILE_SHARE_READ, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (h != INVALID_HANDLE_VALUE) {
CloseHandle (h);
write_log (_T("CW: Windows driver device detected '%s'\n"), name);
detected = 1;
return TRUE;
}
}
if (h == INVALID_HANDLE_VALUE) {
if (force_direct_catweasel >= 100) {
if (ioport_init ())
return TRUE;
return FALSE;
}
if (direct_detect ()) {
detected = 1;
return TRUE;
}
}
return FALSE;
}
#endif

View File

@ -18,7 +18,7 @@
#include "events.h"
#include "custom.h"
#include "inputdevice.h"
//#include "gfxfilter.h"
#include "gfxfilter.h"
#include "savestate.h"
#include "memory.h"
#include "autoconf.h"
@ -327,7 +327,7 @@ static const TCHAR *obsolete[] = {
_T("gfx_immediate_blits"), _T("gfx_ntsc"), _T("win32"), _T("gfx_filter_bits"),
_T("sound_pri_cutoff"), _T("sound_pri_time"), _T("sound_min_buff"), _T("sound_bits"),
_T("gfx_test_speed"), _T("gfxlib_replacement"), _T("enforcer"), _T("catweasel_io"),
_T("kickstart_key_file"), _T("sound_adjust"), _T("sound_latency"),
_T("kickstart_key_file"), _T("fast_copper"), _T("sound_adjust"), _T("sound_latency"),
_T("serial_hardware_dtrdsr"), _T("gfx_filter_upscale"),
_T("gfx_autoscale"), _T("parallel_sampler"), _T("parallel_ascii_emulation"),
_T("avoid_vid"), _T("avoid_dga"), _T("z3chipmem_size"), _T("state_replay_buffer"), _T("state_replay"),
@ -2551,7 +2551,6 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
cfgfile_dwrite_strarr(f, _T("waiting_blits"), waitblits, p->waiting_blits);
cfgfile_dwrite (f, _T("blitter_throttle"), _T("%.8f"), p->blitter_speed_throttle);
#ifdef AMIBERRY
cfgfile_write_bool (f, _T("fast_copper"), p->fast_copper);
cfgfile_write_bool(f, _T("multithreaded_drawing"), p->multithreaded_drawing);
#endif
cfgfile_write_bool (f, _T("ntsc"), p->ntscmode);
@ -2735,10 +2734,10 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
cfgfile_dwrite(f, _T("ramsey"), _T("%d"), p->cs_ramseyrev);
cfgfile_dwrite_bool(f, _T("pcmcia"), p->cs_pcmcia);
cfgfile_dwrite_bool(f, _T("resetwarning"), p->cs_resetwarning);
cfgfile_dwrite_bool(f, _T("denise_noehb"), p->cs_denisenoehb);
cfgfile_dwrite_bool(f, _T("agnus_bltbusybug"), p->cs_agnusbltbusybug);
cfgfile_dwrite_bool(f, _T("denise_noehb"), p->cs_denisemodel == DENISEMODEL_VELVET || p->cs_denisemodel == DENISEMODEL_A1000NOEHB);
cfgfile_dwrite_bool(f, _T("agnus_bltbusybug"), p->cs_agnusmodel == AGNUSMODEL_A1000);
cfgfile_dwrite_bool(f, _T("bkpt_halt"), p->cs_bkpthang);
cfgfile_dwrite_bool(f, _T("ics_agnus"), p->cs_dipagnus);
cfgfile_dwrite_bool(f, _T("ics_agnus"), p->cs_agnusmodel == AGNUSMODEL_A1000);
cfgfile_dwrite_bool(f, _T("cia_todbug"), p->cs_ciatodbug);
cfgfile_dwrite_bool(f, _T("z3_autoconfig"), p->cs_z3autoconfig);
cfgfile_dwrite_bool(f, _T("1mchipjumper"), p->cs_1mchipjumper);
@ -2756,6 +2755,9 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
cfgfile_dwrite(f, _T("chipset_hacks"), _T("0x%x"), p->cs_hacks);
cfgfile_dwrite(f, _T("eclockphase"), _T("%d"), p->cs_eclockphase);
cfgfile_dwrite_strarr(f, _T("eclocksync"), eclocksync, p->cs_eclocksync);
cfgfile_dwrite_strarr(f, _T("agnusmodel"), agnusmodel, p->cs_agnusmodel);
cfgfile_dwrite_strarr(f, _T("agnussize"), agnussize, p->cs_agnussize);
cfgfile_dwrite_strarr(f, _T("denisemodel"), denisemodel, p->cs_denisemodel);
if (p->seed) {
cfgfile_write(f, _T("rndseed"), _T("%d"), p->seed);
}
@ -5869,9 +5871,27 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH
if (cfgfile_string(option, value, _T("jit_blacklist"), p->jitblacklist, sizeof p->jitblacklist / sizeof(TCHAR)))
return 1;
if (cfgfile_yesno(option, value, _T("denise_noehb"), &dummybool)) {
if (dummybool) {
p->cs_denisemodel = DENISEMODEL_A1000NOEHB;
}
return 1;
}
if (cfgfile_yesno(option, value, _T("ics_agnus"), &dummybool)) {
if (dummybool) {
p->cs_agnusmodel = AGNUSMODEL_A1000;
}
return 1;
}
if (cfgfile_yesno(option, value, _T("agnus_bltbusybug"), &dummybool)) {
if (dummybool) {
p->cs_agnusmodel = AGNUSMODEL_A1000;
}
return 1;
}
if (cfgfile_yesno(option, value, _T("immediate_blits"), &p->immediate_blits)
#ifdef AMIBERRY
|| cfgfile_yesno(option, value, _T("fast_copper"), &p->fast_copper)
|| cfgfile_yesno(option, value, _T("multithreaded_drawing"), &p->multithreaded_drawing)
#endif
|| cfgfile_yesno(option, value, _T("fpu_no_unimplemented"), &p->fpu_no_unimplemented)
@ -5888,14 +5908,11 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH
|| cfgfile_yesno(option, value, _T("ksmirror_a8"), &p->cs_ksmirror_a8)
|| cfgfile_yesno(option, value, _T("resetwarning"), &p->cs_resetwarning)
|| cfgfile_yesno(option, value, _T("cia_todbug"), &p->cs_ciatodbug)
|| cfgfile_yesno(option, value, _T("denise_noehb"), &p->cs_denisenoehb)
|| cfgfile_yesno(option, value, _T("ics_agnus"), &p->cs_dipagnus)
|| cfgfile_yesno(option, value, _T("z3_autoconfig"), &p->cs_z3autoconfig)
|| cfgfile_yesno(option, value, _T("color_burst"), &p->cs_color_burst)
|| cfgfile_yesno(option, value, _T("toshiba_gary"), &p->cs_toshibagary)
|| cfgfile_yesno(option, value, _T("rom_is_slow"), &p->cs_romisslow)
|| cfgfile_yesno(option, value, _T("1mchipjumper"), &p->cs_1mchipjumper)
|| cfgfile_yesno(option, value, _T("agnus_bltbusybug"), &p->cs_agnusbltbusybug)
|| cfgfile_yesno(option, value, _T("bkpt_halt"), &p->cs_bkpthang)
|| cfgfile_yesno(option, value, _T("gfxcard_hardware_vblank"), &p->rtg_hardwareinterrupt)
|| cfgfile_yesno(option, value, _T("gfxcard_hardware_sprite"), &p->rtg_hardwaresprite)
@ -6034,6 +6051,9 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH
|| cfgfile_strval(option, value, _T("ciaa_type"), &p->cs_ciatype[0], ciatype, 0)
|| cfgfile_strval(option, value, _T("ciab_type"), &p->cs_ciatype[1], ciatype, 0)
|| cfgfile_strboolval(option, value, _T("comp_flushmode"), &p->comp_hardflush, flushmode, 0)
|| cfgfile_strval(option, value, _T("agnusmodel"), &p->cs_agnusmodel, agnusmodel, 0)
|| cfgfile_strval(option, value, _T("agnussize"), &p->cs_agnussize, agnussize, 0)
|| cfgfile_strval(option, value, _T("denisemodel"), &p->cs_denisemodel, denisemodel, 0)
|| cfgfile_strval(option, value, _T("eclocksync"), &p->cs_eclocksync, eclocksync, 0))
return 1;
@ -8904,9 +8924,9 @@ static void set_68020_compa (struct uae_prefs *p, int compa, int cd32)
case 0:
p->m68k_speed = 0;
if ((p->cpu_model == 68020 || p->cpu_model == 68030) && p->cachesize == 0) {
//p->cpu_cycle_exact = 1;
//p->cpu_memory_cycle_exact = 1;
//p->blitter_cycle_exact = 1;
p->cpu_cycle_exact = 1;
p->cpu_memory_cycle_exact = 1;
p->blitter_cycle_exact = 1;
if (p->cpu_model == 68020)
p->cpu_clock_multiplier = 4 << 8;
else
@ -8916,8 +8936,8 @@ static void set_68020_compa (struct uae_prefs *p, int compa, int cd32)
case 1:
p->m68k_speed = 0;
if ((p->cpu_model == 68020 || p->cpu_model == 68030) && p->cachesize == 0) {
//p->blitter_cycle_exact = 1;
//p->cpu_memory_cycle_exact = 1;
p->blitter_cycle_exact = 1;
p->cpu_memory_cycle_exact = 1;
if (p->cpu_model == 68020)
p->cpu_clock_multiplier = 4 << 8;
else
@ -8963,7 +8983,7 @@ static void set_68000_compa (struct uae_prefs *p, int compa)
switch (compa)
{
case 0:
//p->cpu_cycle_exact = p->cpu_memory_cycle_exact = p->blitter_cycle_exact = 1;
p->cpu_cycle_exact = p->cpu_memory_cycle_exact = p->blitter_cycle_exact = 1;
break;
case 1:
break;
@ -9011,11 +9031,7 @@ static int bip_a3000 (struct uae_prefs *p, int config, int compa, int romcheck)
p->floppy_speed = 0;
p->cpu_idle = 150;
p->cs_compatible = CP_A3000;
#ifdef AMIBERRY
p->z3fastmem[0].size = 8 * 1024 * 1024;
#else
p->mbresmem_low.size = 8 * 1024 * 1024;
#endif
built_in_chipset_prefs (p);
p->cs_ciaatod = p->ntscmode ? 2 : 1;
return configure_rom (p, roms, romcheck);
@ -9038,11 +9054,7 @@ static int bip_a4000 (struct uae_prefs *p, int config, int compa, int romcheck)
p->bogomem.size = 0;
p->chipmem.size = 0x200000;
#ifdef AMIBERRY
p->z3fastmem[0].size = 8 * 1024 * 1024;
#else
p->mbresmem_low.size = 8 * 1024 * 1024;
#endif
p->cpu_model = 68030;
p->fpu_model = 68882;
switch (config)
@ -9095,11 +9107,7 @@ static int bip_a4000t (struct uae_prefs *p, int config, int compa, int romcheck)
p->bogomem.size = 0;
p->chipmem.size = 0x200000;
#ifdef AMIBERRY
p->z3fastmem[0].size = 8 * 1024 * 1024;
#else
p->mbresmem_low.size = 8 * 1024 * 1024;
#endif
p->cpu_model = 68030;
p->fpu_model = 68882;
if (config > 0) {
@ -9135,10 +9143,9 @@ static void bip_velvet(struct uae_prefs *p, int config, int compa, int romcheck)
p->cs_compatible = CP_VELVET;
p->bogomem.chipramtiming = false;
p->chipmem.size = 0x40000;
p->cs_dipagnus = 1;
p->cs_agnusbltbusybug = 1;
built_in_chipset_prefs (p);
p->cs_denisenoehb = 1;
p->cs_agnusmodel = AGNUSMODEL_VELVET;
p->cs_denisemodel = DENISEMODEL_VELVET;
p->cs_cia6526 = 1;
}
@ -9155,11 +9162,12 @@ static int bip_a1000 (struct uae_prefs *p, int config, int compa, int romcheck)
p->floppyslots[1].dfxtype = DRV_NONE;
p->cs_compatible = CP_A1000;
p->bogomem.chipramtiming = false;
p->cs_dipagnus = 1;
p->cs_agnusbltbusybug = 1;
p->cs_agnusmodel = AGNUSMODEL_A1000;
p->cs_denisemodel = DENISEMODEL_A1000;
built_in_chipset_prefs (p);
if (config > 0)
p->cs_denisenoehb = 1;
if (config > 0) {
p->cs_denisemodel = DENISEMODEL_A1000NOEHB;
}
if (config > 1)
p->chipmem.size = 0x40000;
if (config > 2) {
@ -9290,7 +9298,6 @@ static int bip_cd32 (struct uae_prefs *p, int config, int compa, int romcheck)
p->cs_rtc = 1;
break;
}
p->m68k_speed = M68K_SPEED_14MHZ_CYCLES;
#endif
return 1;
}
@ -9347,32 +9354,30 @@ static int bip_a1200 (struct uae_prefs *p, int config, int compa, int romcheck)
roms_bliz[0] = 90;
configure_rom(p, roms_bliz, romcheck);
break;
#ifdef WITH_PPC
case 5:
cpuboard_setboard(p, BOARD_BLIZZARD, BOARD_BLIZZARD_SUB_PPC);
p->cpuboardmem1.size = 256 * 1024 * 1024;
p->cpu_model = 68060;
p->fpu_model = 68060;
p->ppc_mode = 1;
p->cs_rtc = 1;
roms[0] = 15;
roms[1] = 11;
roms[2] = -1;
roms_bliz[0] = 100;
configure_rom(p, roms_bliz, romcheck);
break;
#endif
#else
case 2:
p->fastmem[0].size = 0x800000;
p->cs_rtc = 1;
break;
#endif
#ifdef WITH_PPC
case 5:
cpuboard_setboard(p, BOARD_BLIZZARD, BOARD_BLIZZARD_SUB_PPC);
p->cpuboardmem1.size = 256 * 1024 * 1024;
p->cpu_model = 68060;
p->fpu_model = 68060;
p->ppc_mode = 1;
p->cs_rtc = 1;
roms[0] = 15;
roms[1] = 11;
roms[2] = -1;
roms_bliz[0] = 100;
configure_rom(p, roms_bliz, romcheck);
break;
#endif
}
set_68020_compa (p, compa, 0);
#ifdef AMIBERRY
p->m68k_speed = M68K_SPEED_14MHZ_CYCLES;
#endif
return configure_rom (p, roms, romcheck);
}
@ -9786,9 +9791,9 @@ int built_in_chipset_prefs (struct uae_prefs *p)
p->cs_ramseyrev = -1;
p->cs_deniserev = -1;
p->cs_agnusrev = -1;
p->cs_denisenoehb = 0;
p->cs_dipagnus = 0;
p->cs_agnusbltbusybug = 0;
p->cs_agnusmodel = 0;
p->cs_agnussize = 0;
p->cs_denisemodel = 0;
p->cs_bkpthang = 0;
p->cs_mbdmac = 0;
p->cs_pcmcia = 0;
@ -9893,8 +9898,8 @@ int built_in_chipset_prefs (struct uae_prefs *p)
p->cs_a1000ram = 1;
p->cs_ciaatod = p->ntscmode ? 2 : 1;
p->cs_ksmirror_e0 = 0;
p->cs_agnusbltbusybug = 1;
p->cs_dipagnus = 1;
p->cs_agnusmodel = AGNUSMODEL_A1000;
p->cs_denisemodel = DENISEMODEL_A1000;
p->cs_ciatodbug = true;
if (has_expansion_with_rtc(p, 0x80000))
p->cs_rtc = 1;
@ -9902,9 +9907,8 @@ int built_in_chipset_prefs (struct uae_prefs *p)
case CP_VELVET: // A1000 Prototype
p->cs_ciaatod = p->ntscmode ? 2 : 1;
p->cs_ksmirror_e0 = 0;
p->cs_agnusbltbusybug = 1;
p->cs_dipagnus = 1;
p->cs_denisenoehb = 1;
p->cs_agnusmodel = AGNUSMODEL_A1000;
p->cs_denisemodel = DENISEMODEL_A1000NOEHB;
break;
case CP_A1200: // A1200
p->cs_ide = IDE_A600A1200;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

41818
src/cpuemu_20.cpp Normal file

File diff suppressed because it is too large Load Diff

45198
src/cpuemu_21.cpp Normal file

File diff suppressed because it is too large Load Diff

42034
src/cpuemu_22.cpp Normal file

File diff suppressed because it is too large Load Diff

45421
src/cpuemu_23.cpp Normal file

File diff suppressed because it is too large Load Diff

42661
src/cpuemu_24.cpp Normal file

File diff suppressed because it is too large Load Diff

43587
src/cpuemu_31.cpp Normal file

File diff suppressed because it is too large Load Diff

43780
src/cpuemu_32.cpp Normal file

File diff suppressed because it is too large Load Diff

41986
src/cpuemu_33.cpp Normal file

File diff suppressed because it is too large Load Diff

45837
src/cpuemu_34.cpp Normal file

File diff suppressed because it is too large Load Diff

49222
src/cpuemu_35.cpp Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

61784
src/cpuemu_50.cpp Normal file

File diff suppressed because it is too large Load Diff

1788
src/cpummu.cpp Normal file

File diff suppressed because it is too large Load Diff

3564
src/cpummu30.cpp Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

69295
src/cputbl.h Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -3598,7 +3598,7 @@ bool debugmem_get_symbol_value(const TCHAR *name, uae_u32 *valp)
{
for (int i = 0; i < libnamecnt; i++) {
struct libname *libname = &libnames[i];
int lnlen = _tcslen(libname->name);
int lnlen = uaetcslen(libname->name);
// "libname/lvoname"?
if (!_tcsnicmp(name, libname->name, lnlen) && _tcslen(name) > lnlen + 1 && name[lnlen] == '/') {
for (int j = 0; j < libsymbolcnt; j++) {
@ -3682,11 +3682,11 @@ int debugmem_get_symbol(uaecptr addr, TCHAR *out, int maxsize)
}
#endif
if (maxsize > _tcslen(txt)) {
if (maxsize > uaetcslen(txt)) {
if (found)
_tcscat(out, _T("\n"));
_tcscat(out, txt);
maxsize -= _tcslen(txt);
maxsize -= uaetcslen(txt);
}
}
found = i + 1;
@ -3759,9 +3759,9 @@ int debugmem_get_sourceline(uaecptr addr, TCHAR *out, int maxsize)
TCHAR txt[256];
last_codefile = cf;
_stprintf(txt, _T("Source file: %s\n"), cf->name);
if (maxsize > _tcslen(txt)) {
if (maxsize > uaetcslen(txt)) {
_tcscat(out, txt);
maxsize -= _tcslen(txt);
maxsize -= uaetcslen(txt);
}
}
if (lastline - line > 10)
@ -3769,10 +3769,10 @@ int debugmem_get_sourceline(uaecptr addr, TCHAR *out, int maxsize)
for (int j = line; j < lastline; j++) {
TCHAR txt[256];
TCHAR *s = au((uae_char*)cf->lineptr[j]);
if (maxsize > 6 + _tcslen(s) + 2) {
if (maxsize > 6 + uaetcslen(s) + 2) {
_stprintf(txt, _T("%5d %s\n"), j, s);
_tcscat(out, txt);
maxsize -= _tcslen(txt) + 2;
maxsize -= uaetcslen(txt) + 2;
}
xfree(s);
}

View File

@ -237,6 +237,7 @@ void devices_reset(int hardreset)
driveclick_reset();
#endif
ethernet_reset();
reset_traps();
#ifdef FILESYS
filesys_prepare_reset();
filesys_reset();
@ -350,13 +351,14 @@ void virtualdevice_free(void)
execute_device_items(device_leaves_early, device_leave_early_cnt);
reset_traps();
free_traps();
#ifdef FILESYS
filesys_cleanup();
#endif
#ifdef BSDSOCKET
bsdlib_reset();
#endif
free_traps();
sampler_free();
inputdevice_close();
DISK_free();
@ -453,6 +455,7 @@ void devices_restore_start(void)
restore_cia_start();
restore_blkdev_start();
restore_blitter_start();
restore_custom_start();
changed_prefs.bogomem.size = 0;
changed_prefs.chipmem.size = 0;
for (int i = 0; i < MAX_RAM_BOARDS; i++) {

View File

@ -113,18 +113,18 @@ static const TCHAR *disasm_lc_hex2(const TCHAR *s, bool noprefix)
}
const TCHAR *s2 = _tcschr(tmp, '%');
if (s2) {
int len = _tcslen(disasm_hexprefix);
int len = uaetcslen(disasm_hexprefix);
if (s2 > tmp && s2[-1] == '$') {
len--;
s2--;
}
if (len < 0) {
memmove(tmp + (s2 - tmp), tmp + (s2 - tmp) - len, (_tcslen(tmp + (s2 - tmp) - len) + 1) * sizeof(TCHAR));
memmove(tmp + (s2 - tmp), tmp + (s2 - tmp) - len, (uaetcslen(tmp + (s2 - tmp) - len) + 1) * sizeof(TCHAR));
} else {
if (len > 0) {
memmove(tmp + (s2 - tmp) + len, s2, (_tcslen(s2) + 1) * sizeof(TCHAR));
memmove(tmp + (s2 - tmp) + len, s2, (uaetcslen(s2) + 1) * sizeof(TCHAR));
}
memcpy(tmp + (s2 - tmp), disasm_hexprefix, _tcslen(disasm_hexprefix) * sizeof(TCHAR));
memcpy(tmp + (s2 - tmp), disasm_hexprefix, uaetcslen(disasm_hexprefix) * sizeof(TCHAR));
}
}
return tmp;
@ -1393,7 +1393,7 @@ int m68k_asm(TCHAR *sline, uae_u16 *out, uaecptr pc)
int quick = 0;
bool immrelpc = false;
if (_tcslen(sline) > 100)
if (uaetcslen(sline) > 100)
return -1;
srcea[0] = dstea[0] = 0;
@ -1414,7 +1414,7 @@ int m68k_asm(TCHAR *sline, uae_u16 *out, uaecptr pc)
}
*p = 0;
to_upper(line, _tcslen(line));
to_upper(line, uaetcslen(line));
p = line;
while (*p && *p != ' ')
@ -1426,7 +1426,7 @@ int m68k_asm(TCHAR *sline, uae_u16 *out, uaecptr pc)
}
_tcscpy(ins, line);
if (_tcslen(ins) == 0)
if (uaetcslen(ins) == 0)
return 0;
int size = 1;
@ -1508,7 +1508,7 @@ int m68k_asm(TCHAR *sline, uae_u16 *out, uaecptr pc)
}
if (dmode == Areg) {
int l = _tcslen(ins);
int l = uaetcslen(ins);
if (l <= 2)
return -1;
TCHAR last = ins[l- 1];
@ -1535,9 +1535,9 @@ int m68k_asm(TCHAR *sline, uae_u16 *out, uaecptr pc)
bool fp = ins[0] == 'F';
int tsize = size;
if (ins[_tcslen(ins) - 1] == 'Q' && _tcslen(ins) > 3 && !fp) {
if (ins[uaetcslen(ins) - 1] == 'Q' && uaetcslen(ins) > 3 && !fp) {
quick = 1;
ins[_tcslen(ins) - 1] = 0;
ins[uaetcslen(ins) - 1] = 0;
if (inssize < 0)
tsize = 2;
}
@ -2469,12 +2469,12 @@ uae_u32 m68k_disasm_2(TCHAR *buf, int bufsize, uaecptr pc, uae_u16 *bufpc, int b
TCHAR segout[256];
if (debugmem_get_symbol(segpc, segout, sizeof(segout) / sizeof(TCHAR))) {
_tcscat(segout, _T(":\n"));
if (bufsize > _tcslen(segout)) {
memmove(symbolpos + _tcslen(segout), symbolpos, (_tcslen(symbolpos) + 1) * sizeof(TCHAR));
memcpy(symbolpos, segout, _tcslen(segout) * sizeof(TCHAR));
bufsize -= _tcslen(segout);
buf += _tcslen(segout);
symbolpos += _tcslen(segout);
if (bufsize > uaetcslen(segout)) {
memmove(symbolpos + uaetcslen(segout), symbolpos, (uaetcslen(symbolpos) + 1) * sizeof(TCHAR));
memcpy(symbolpos, segout, uaetcslen(segout) * sizeof(TCHAR));
bufsize -= uaetcslen(segout);
buf += uaetcslen(segout);
symbolpos += uaetcslen(segout);
}
}
}

View File

@ -33,8 +33,8 @@ int disk_debug_track = -1;
#include "gui.h"
#include "zfile.h"
#include "newcpu.h"
//#include "osemu.h"
//#include "execlib.h"
#include "osemu.h"
#include "execlib.h"
#include "savestate.h"
#include "cia.h"
#include "debug.h"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,81 @@
/********************************************************/
/* Initialise the DSP emulator */
/* */
/********************************************************/
void DSP_init_emu ();
/********************************************************/
/* Shut down the DSP emulator */
/* */
/********************************************************/
void DSP_shutdown_emu ();
/********************************************************/
/* Reset the DSP */
/* */
/********************************************************/
void DSP_reset();
//note this is triggered via bit 7 of 0xDD0080 going from 1 to 0
/********************************************************/
/* Trigger an interrupt level 0 */
/* */
/********************************************************/
bool DSP_int0();
bool DSP_int0_masked();
//note this is triggered via bit 0 of 0xDD0080 going from 1 to 0
/********************************************************/
/* Trigger an interrupt level 1 */
/* */
/********************************************************/
bool DSP_int1();
bool DSP_int1_masked();
//note this is triggered via bit 1 of 0xDD0080 going from 1 to 0
/********************************************************/
/* DSP has changed M68k interrupt line */
/* */
/********************************************************/
void DSP_external_interrupt(int32_t level, int32_t state);
//state is the state of the associated line, 0 triggers an M68k interrupt
//level=0 corresponds to INT2, level=1 corresponds to INT6
//this routine needs to mask interrupts
/********************************************************/
/* Execute a single DSP instruction, allowing for */
/* instruction and memory latencies */
/********************************************************/
void DSP_execute_insn ();
/********************************************************/
/* Read values from the Amiga's memory space */
/* */
/********************************************************/
uint32_t DSP_get_long_ext(uint32_t addr);
uint16_t DSP_get_short_ext(uint32_t addr);
unsigned char DSP_get_char_ext(uint32_t addr);
/********************************************************/
/* Set values in the Amiga's memory space */
/* */
/********************************************************/
void DSP_set_long_ext(uint32_t addr, uint32_t value);
void DSP_set_short_ext(uint32_t addr, uint16_t value);
void DSP_set_char_ext(uint32_t addr, unsigned char value);
extern char DSP_irsh_flag;
//Notes:
//The DSP write register is byte sized and located at 0xDD0080
//The DSP read register (which should mirror the write register)
//is long word sized and located at 0xDD005C
//
//For more details on the Amiga interface to the DSP3210, see here:
//http://www.devili.iki.fi/mirrors/haynie/research/a3000p/docs/dspprg.pdf

356
src/dsp3210/dsp_glue.cpp Normal file
View File

@ -0,0 +1,356 @@
#include "stdlib.h"
#include "stdint.h"
#include "dsp3210/DSP3210_emulation.h"
#include "sysconfig.h"
#include "sysdeps.h"
#include "options.h"
#include "memory.h"
#include "custom.h"
#include "devices.h"
#include "uae.h"
#include "autoconf.h"
#include "debug.h"
#include "newcpu.h"
#include "threaddep/thread.h"
#include "dsp_glue.h"
#define DSP_INST_COUNT_WAIT 1000
int log_dsp = 0;
static volatile uae_u8 dsp_status;
bool is_dsp_installed;
static volatile int dsp_thread_running;
static uae_sem_t reset_sem, pause_sem;
static volatile uae_atomic dsp_int;
static volatile uae_atomic dsp_int_ext;
static int dsp_int0_delay, dsp_int1_delay;
static volatile bool dsp_running;
static volatile uae_u32 dsp_inst_cnt;
static bool dsp_paused;
static bool dsp_addr_check(uint32_t addr)
{
addrbank *ab = &get_mem_bank(addr);
if ((ab->flags & ABFLAG_THREADSAFE) == 0 && ab != &dummy_bank) {
write_log("DSP accesses non-threadsafe address %08x!\n", addr);
return false;
}
return true;
}
static uint32_t safe_memory_read(uint32_t addr, int size)
{
return 0;
}
static void safe_memory_write(uint32_t addr, uint32_t data, int size)
{
}
uint32_t DSP_get_long_ext(uint32_t addr)
{
int32_t v;
if (dsp_addr_check(addr)) {
v = get_long(addr);
} else {
v = safe_memory_read(addr, 4);
}
v = do_byteswap_32(v);
if (log_dsp) {
write_log("DSP LGET %08x = %08x\n", addr, v);
}
return v;
}
uint16_t DSP_get_short_ext(uint32_t addr)
{
uint16_t v;
if (dsp_addr_check(addr)) {
v = get_word(addr);
} else {
v = safe_memory_read(addr, 2);
}
v = do_byteswap_16(v);
if (log_dsp) {
write_log("DSP WGET %08x = %04x\n", addr, v & 0xffff);
}
return v;
}
unsigned char DSP_get_char_ext(uint32_t addr)
{
unsigned char v;
if (dsp_addr_check(addr)) {
v = get_byte(addr);
} else {
v = safe_memory_read(addr, 1);
}
if (log_dsp) {
write_log("DSP BGET %08x = %02x\n", addr, v & 0xff);
}
return v;
}
void DSP_set_long_ext(uint32_t addr, uint32_t v)
{
v = do_byteswap_32(v);
if (log_dsp) {
write_log("DSP LPUT %08x = %08x\n", addr, v);
}
if (dsp_addr_check(addr)) {
put_long(addr, v);
} else {
safe_memory_write(addr, v, 4);
}
}
void DSP_set_short_ext(uint32_t addr, uint16_t v)
{
v = do_byteswap_16(v);
if (log_dsp) {
write_log("DSP WPUT %08x = %04x\n", addr, v & 0xffff);
}
if (dsp_addr_check(addr)) {
put_word(addr, v);
} else {
safe_memory_write(addr, v, 2);
}
}
void DSP_set_char_ext(uint32_t addr, unsigned char v)
{
if (log_dsp) {
write_log("DSP BPUT %08x = %02x\n", addr, v & 0xff);
}
if (dsp_addr_check(addr)) {
put_byte(addr, v);
} else {
safe_memory_write(addr, v, 1);
}
}
static void dsp_status_intx(void)
{
dsp_status &= ~(1 | 2 | 4 | 8);
dsp_status |= dsp_int;
dsp_status |= dsp_int_ext;
}
static void dsp_rethink(void)
{
dsp_status_intx();
if ((dsp_status & 0x20) && !(dsp_status & 8)) {
if (log_dsp) {
write_log("DSP INTREQ level 6\n");
}
INTREQ_0(0x8000 | 0x2000);
}
if ((dsp_status & 0x10) && !(dsp_status & 4)) {
if (log_dsp) {
write_log("DSP INTREQ level 2\n");
}
INTREQ_0(0x8000 | 0x0008);
}
}
static void dsp_reset(void)
{
dsp_int = 0x01 | 0x02;
dsp_int_ext = 0x04 | 0x08;
}
static void cpu_wait(void)
{
while (dsp_inst_cnt < DSP_INST_COUNT_WAIT && dsp_thread_running > 0) {
x_do_cycles(CYCLE_UNIT * 8);
}
}
// stop CPU for a while if DSP was not waiting for interrupt
static void dsp_do_int(int i)
{
int mask = ~(1 << i);
if (log_dsp) {
write_log("DSP INT%d\n", i);
}
// stop CPU if DSP is not waiting for interrupt
if (DSP_irsh_flag != 4) {
dsp_inst_cnt = 0;
atomic_and(&dsp_int, mask);
cpu_wait();
} else {
atomic_and(&dsp_int, mask);
}
}
void dsp_write(uae_u8 v)
{
dsp_status_intx();
if (log_dsp) {
write_log("DSP write %02x (%02x) PC=%08x\n", v, dsp_status, M68K_GETPC);
}
if (!(dsp_status & 0x80) && (v & 0x80)) {
dsp_status |= 0x80;
write_log("DSP reset released\n");
dsp_inst_cnt = 0;
uae_sem_post(&reset_sem);
cpu_wait();
write_log("DSP reset delay end\n");
} else if ((dsp_status & 0x80) && !(v & 0x80)) {
write_log("DSP reset activated\n");
dsp_status &= ~0x80;
dsp_reset();
}
if ((dsp_status & 1) && !(v & 1)) {
dsp_do_int(0);
} else if (v & 1) {
atomic_or(&dsp_int, 1);
}
if ((dsp_status & 2) && !(v & 2)) {
dsp_do_int(1);
} else if (v & 2) {
atomic_or(&dsp_int, 2);
}
dsp_status = (v & (0x40 | 0x20 | 0x10)) | (dsp_status & 0x80);
dsp_status_intx();
if (log_dsp) {
write_log("-> %02x\n", dsp_status);
}
}
uae_u8 dsp_read(void)
{
dsp_status_intx();
uae_u8 v = dsp_status;
if (log_dsp) {
write_log("DSP read %02x\n", v);
}
return v;
}
void DSP_external_interrupt(int32_t level, int32_t state)
{
int32_t mask = level ? 0x08 : 0x04;
if (state) {
if (log_dsp && !(dsp_status & mask)) {
write_log("DSP interrupt %d = %d\n", level, state);
}
atomic_and(&dsp_int_ext, ~mask);
} else {
if (log_dsp && (dsp_status & mask)) {
write_log("DSP interrupt %d = %d\n", level, state);
}
atomic_or(&dsp_int_ext, mask);
}
atomic_or(&uae_int_requested, 0x010000);
}
static int dsp_thread(void *v)
{
dsp_thread_running = 1;
DSP_init_emu();
dsp_reset();
dsp_int0_delay = 0;
dsp_int1_delay = 0;
while (dsp_thread_running > 0) {
if (!(dsp_status & 0x80)) {
uae_sem_wait(&reset_sem);
dsp_reset();
DSP_reset();
dsp_inst_cnt = 0;
}
if (dsp_paused) {
uae_sem_wait(&pause_sem);
continue;
}
if (dsp_status & 0x80) {
DSP_execute_insn();
dsp_inst_cnt++;
if (!(dsp_int & 1)) {
dsp_int0_delay++;
if (DSP_int0_masked()) {
dsp_int0_delay = 0;
if (log_dsp) {
write_log("DSP interrupt 0 masked\n");
}
}
if (dsp_int0_delay > 2) {
if (DSP_int0()) {
if (log_dsp) {
write_log(_T("DSP interrupt 0 started\n"));
}
}
atomic_or(&dsp_int, 1);
dsp_int0_delay = 0;
}
}
if (!(dsp_int & 2)) {
dsp_int1_delay++;
if (DSP_int1_masked()) {
dsp_int1_delay = 0;
if (log_dsp) {
write_log("DSP interrupt 1 masked\n");
}
}
if (dsp_int1_delay > 2) {
if (DSP_int1()) {
if (log_dsp) {
write_log(_T("DSP interrupt 1 started\n"));
}
}
atomic_or(&dsp_int, 2);
dsp_int1_delay = 0;
}
}
}
}
DSP_shutdown_emu();
dsp_status = 0;
dsp_thread_running = 0;
return 0;
}
static void dsp_free(void)
{
write_log("DSP free\n");
if (dsp_thread_running > 0) {
dsp_status &= ~0x80;
dsp_thread_running = -1;
uae_sem_post(&reset_sem);
uae_sem_post(&pause_sem);
while (dsp_thread_running) {
sleep_millis(2);
}
uae_sem_destroy(&reset_sem);
}
is_dsp_installed = false;
}
bool dsp_init(struct autoconfig_info *aci)
{
aci->start = 0xdd0000;
aci->size = 0x10000;
dsp_status = 0;
dsp_reset();
dsp_status_intx();
if (aci->doinit) {
is_dsp_installed = true;
write_log("DSP init\n");
device_add_rethink(dsp_rethink);
device_add_exit(NULL, dsp_free);
uae_sem_init(&reset_sem, 0, 0);
uae_sem_init(&pause_sem, 0, 0);
uae_start_thread(NULL, dsp_thread, NULL, NULL);
}
return true;
}
void dsp_pause(int pause)
{
if (is_dsp_installed) {
dsp_paused = pause;
uae_sem_post(&pause_sem);
}
}

7
src/dsp3210/dsp_glue.h Normal file
View File

@ -0,0 +1,7 @@
bool dsp_init(struct autoconfig_info *aci);
void dsp_write(uae_u8);
uae_u8 dsp_read(void);
void dsp_pause(int);
extern bool is_dsp_installed;

View File

@ -29,6 +29,7 @@ static const int pissoff_nojit_value = 256 * CYCLE_UNIT;
evt_t event_cycles, nextevent, currcycle;
int is_syncline;
static int syncline_cnt;
frame_time_t is_syncline_end;
int cycles_to_next_event;
int max_cycles_to_next_event;
@ -260,7 +261,7 @@ static bool event_check_vsync(void)
return false;
}
void do_cycles_cpu_fastest(int cycles_to_add)
void do_cycles_slow(int cycles_to_add)
{
#ifdef WITH_X86
#if 0
@ -270,6 +271,19 @@ void do_cycles_cpu_fastest(int cycles_to_add)
#endif
#endif
if (syncline_cnt > 0) {
syncline_cnt--;
return;
}
if (is_syncline) {
// runs CPU emulation with chipset stopped
// when there is free time to do so
if (event_check_vsync()) {
syncline_cnt = 16;
return;
}
}
if (!currprefs.cpu_thread) {
if ((pissoff -= cycles_to_add) >= 0)
return;
@ -300,33 +314,12 @@ void do_cycles_cpu_fastest(int cycles_to_add)
}
}
}
events_schedule ();
}
currcycle += cycles_to_add;
}
void do_cycles_cpu_norm(int cycles_to_add)
{
while ((nextevent - currcycle) <= cycles_to_add)
{
cycles_to_add -= (int)(nextevent - currcycle);
currcycle = nextevent;
for (auto& i : eventtab)
{
if (i.active && i.evtime == currcycle)
{
(*i.handler)();
}
}
events_schedule();
}
currcycle += cycles_to_add;
}
do_cycles_func do_cycles = do_cycles_cpu_norm;
static ev2 *last_event2;
static ev2 dummy_event;

View File

@ -6555,6 +6555,14 @@ static const struct cpuboardsubtype gvpboard_sub[] = {
BOARD_MEMORY_HIGHMEM,
128 * 1024 * 1024,
},
{
_T("T-Rex II"),
_T("trexii"),
ROMTYPE_CB_TREXII, 0, 4,
tekmagic_add_scsi_unit, EXPANSIONTYPE_SCSI,
BOARD_MEMORY_HIGHMEM,
128 * 1024 * 1024
},
#endif
{
NULL

File diff suppressed because it is too large Load Diff

1397
src/fpp_native.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,809 +0,0 @@
/*
* UAE - The Un*x Amiga Emulator
*
* MC68881/68882/68040 FPU emulation
*
* Copyright 1996 Herman ten Brugge
* Modified 2005 Peter Keunecke
* 68040+ exceptions and more by Toni Wilen
*
* This is the version for ARM devices. We have these restrictions:
* - all caclulations are done in double, not in extended format like in MC68881...
* - rounding is only needed by special opcodes (like FSMOVE or FSADD) or if FPCR is set to single
*/
#define __USE_ISOC9X /* We might be able to pick up a NaN */
#define USE_HOST_ROUNDING 1
static uae_u32 dhex_nan[] ={0xffffffff, 0x7fffffff};
static double *fp_nan = (double *)dhex_nan;
static const double twoto32 = 4294967296.0;
#define FPCR_ROUNDING_MODE 0x00000030
#define FPCR_ROUND_NEAR 0x00000000
#define FPCR_ROUND_ZERO 0x00000010
#define FPCR_ROUND_MINF 0x00000020
#define FPCR_ROUND_PINF 0x00000030
#define FPCR_ROUNDING_PRECISION 0x000000c0
#define FPCR_PRECISION_SINGLE 0x00000040
#define FPCR_PRECISION_DOUBLE 0x00000080
#define FPCR_PRECISION_EXTENDED 0x00000000
static uae_u32 fpu_mode_control = 0;
static int fpu_prec;
/* Functions for setting host/library modes and getting status */
static void fpp_set_mode(uae_u32 mode_control)
{
if (mode_control == fpu_mode_control && !currprefs.compfpu)
return;
switch(mode_control & FPCR_ROUNDING_PRECISION) {
case FPCR_PRECISION_EXTENDED: // X
fpu_prec = PREC_EXTENDED;
break;
case FPCR_PRECISION_SINGLE: // S
fpu_prec = PREC_FLOAT;
break;
case FPCR_PRECISION_DOUBLE: // D
default: // undefined
fpu_prec = PREC_DOUBLE;
break;
}
#if USE_HOST_ROUNDING
if ((mode_control & FPCR_ROUNDING_MODE) != (fpu_mode_control & FPCR_ROUNDING_MODE)) {
switch(mode_control & FPCR_ROUNDING_MODE) {
case FPCR_ROUND_NEAR: // to neareset
fesetround(FE_TONEAREST);
break;
case FPCR_ROUND_ZERO: // to zero
fesetround(FE_TOWARDZERO);
break;
case FPCR_ROUND_MINF: // to minus
fesetround(FE_DOWNWARD);
break;
case FPCR_ROUND_PINF: // to plus
fesetround(FE_UPWARD);
break;
}
}
#endif
fpu_mode_control = mode_control;
}
/* Functions for detecting float type */
static bool fpp_is_nan (fpdata *fpd)
{
return isnan(fpd->fp) != 0;
}
static bool fpp_is_infinity (fpdata *fpd)
{
return isinf(fpd->fp) != 0;
}
static bool fpp_is_zero(fpdata *fpd)
{
return fpd->fp == 0.0;
}
static bool fpp_is_neg(fpdata *fpd)
{
return signbit(fpd->fp) != 0;
}
/* Functions for converting between float formats */
/* FIXME: how to preserve/fix denormals and unnormals? */
static void fpp_to_native(fptype *fp, fpdata *fpd)
{
*fp = fpd->fp;
}
static void fpp_from_native(fptype fp, fpdata *fpd)
{
fpd->fp = fp;
}
static void fpp_to_single(fpdata *fpd, uae_u32 wrd1)
{
union {
float f;
uae_u32 u;
} val;
val.u = wrd1;
fpd->fp = (fptype) val.f;
}
static uae_u32 fpp_from_single(fpdata *fpd)
{
union {
float f;
uae_u32 u;
} val;
val.f = (float) fpd->fp;
return val.u;
}
static void fpp_to_double(fpdata *fpd, uae_u32 wrd1, uae_u32 wrd2)
{
((uae_u32*)&(fpd->fp))[1] = wrd1;
((uae_u32*)&(fpd->fp))[0] = wrd2;
}
static void fpp_from_double(fpdata *fpd, uae_u32 *wrd1, uae_u32 *wrd2)
{
*wrd1 = ((uae_u32*)&(fpd->fp))[1];
*wrd2 = ((uae_u32*)&(fpd->fp))[0];
}
void fpp_to_exten(fpdata *fpd, uae_u32 wrd1, uae_u32 wrd2, uae_u32 wrd3)
{
double frac;
if ((wrd1 & 0x7fff0000) == 0 && wrd2 == 0 && wrd3 == 0) {
fpd->fp = (wrd1 & 0x80000000) ? -0.0 : +0.0;
return;
}
frac = ((double)wrd2 + ((double)wrd3 / twoto32)) / 2147483648.0;
if (wrd1 & 0x80000000)
frac = -frac;
fpd->fp = ldexp (frac, ((wrd1 >> 16) & 0x7fff) - 16383);
}
static void fpp_from_exten(fpdata *fpd, uae_u32 *wrd1, uae_u32 *wrd2, uae_u32 *wrd3)
{
int expon;
double frac;
fptype v;
if (fpp_is_zero(fpd)) {
*wrd1 = signbit(fpd->fp) ? 0x80000000 : 0;
*wrd2 = 0;
*wrd3 = 0;
return;
} else if (fpp_is_nan(fpd)) {
*wrd1 = 0x7fff0000;
*wrd2 = 0xffffffff;
*wrd3 = 0xffffffff;
return;
}
v = fpd->fp;
if (v < 0) {
*wrd1 = 0x80000000;
v = -v;
} else {
*wrd1 = 0;
}
frac = frexp (v, &expon);
frac += 0.5 / (twoto32 * twoto32);
if (frac >= 1.0) {
frac /= 2.0;
expon++;
}
*wrd1 |= (((expon + 16383 - 1) & 0x7fff) << 16);
*wrd2 = (uae_u32) (frac * twoto32);
*wrd3 = (uae_u32) ((frac * twoto32 - *wrd2) * twoto32);
}
#if USE_HOST_ROUNDING == 0
#define fpp_round_to_minus_infinity(x) floor(x)
#define fpp_round_to_plus_infinity(x) ceil(x)
#define fpp_round_to_zero(x) ((x) >= 0.0 ? floor(x) : ceil(x))
#define fpp_round_to_nearest(x) round(x)
#endif // USE_HOST_ROUNDING
static uae_s64 fpp_to_int(fpdata *src, int size)
{
static const fptype fxsizes[6] =
{
-128.0, 127.0,
-32768.0, 32767.0,
-2147483648.0, 2147483647.0
};
fptype fp = src->fp;
if (fpp_is_nan(src)) {
uae_u32 w1, w2, w3;
fpp_from_exten(src, &w1, &w2, &w3);
uae_s64 v = 0;
// return mantissa
switch (size)
{
case 0:
v = w2 >> 24;
break;
case 1:
v = w2 >> 16;
break;
case 2:
v = w2 >> 0;
break;
}
return v;
}
if (fp < fxsizes[size * 2 + 0]) {
fp = fxsizes[size * 2 + 0];
}
if (fp > fxsizes[size * 2 + 1]) {
fp = fxsizes[size * 2 + 1];
}
#if USE_HOST_ROUNDING
return lrintl(fp);
#else
uae_s64 result = (int)fp;
switch (regs.fpcr & 0x30)
{
case FPCR_ROUND_ZERO:
result = (int)fpp_round_to_zero (fp);
break;
case FPCR_ROUND_MINF:
result = (int)fpp_round_to_minus_infinity (fp);
break;
case FPCR_ROUND_NEAR:
result = fpp_round_to_nearest (fp);
break;
case FPCR_ROUND_PINF:
result = (int)fpp_round_to_plus_infinity (fp);
break;
}
return result;
#endif
}
static void fpp_from_int(fpdata *fpd, uae_s32 src)
{
fpd->fp = (fptype) src;
}
/* Functions for rounding */
// round to float with extended precision exponent
static void fpp_round32(fpdata *fpd)
{
int expon;
float mant;
mant = (float)(frexpl(fpd->fp, &expon) * 2.0);
fpd->fp = ldexpl((fptype)mant, expon - 1);
}
// round to double with extended precision exponent
static void fpp_round64(fpdata *fpd)
{
#if !defined(CPU_arm)
int expon;
double mant;
mant = (double)(frexpl(fpd->fp, &expon) * 2.0);
fpd->fp = ldexpl((fptype)mant, expon - 1);
#endif
}
// round to float
static void fpp_round_single(fpdata *fpd)
{
fpd->fp = (float) fpd->fp;
}
static void fpp_round_prec(fpdata *fpd, int prec)
{
if (prec == PREC_FLOAT) {
fpp_round_single(fpd);
}
}
static void fp_round(fpdata *fpd)
{
if (!currprefs.fpu_strict)
return;
fpp_round_prec(fpd, fpu_prec);
}
/* Arithmetic functions */
static void fpp_move(fpdata *a, fpdata *b, int prec)
{
a->fp = b->fp;
if (prec == PREC_FLOAT)
fpp_round_single(a);
}
static void fpp_int(fpdata *a, fpdata *b)
{
fptype bb = b->fp;
#if USE_HOST_ROUNDING
a->fp = rintl(bb);
#else
switch (regs.fpcr & FPCR_ROUNDING_MODE)
{
case FPCR_ROUND_NEAR:
a->fp = fpp_round_to_nearest(bb);
break;
case FPCR_ROUND_ZERO:
a->fp = fpp_round_to_zero(bb);
break;
case FPCR_ROUND_MINF:
a->fp = fpp_round_to_minus_infinity(bb);
break;
case FPCR_ROUND_PINF:
a->fp = fpp_round_to_plus_infinity(bb);
break;
default: /* never reached */
break;
}
#endif
}
static void fpp_getexp(fpdata *a, fpdata *b)
{
int expon;
frexpl(b->fp, &expon);
a->fp = (fptype) (expon - 1);
fp_round(a);
}
static void fpp_getman(fpdata *a, fpdata *b)
{
int expon;
a->fp = frexpl(b->fp, &expon) * 2.0;
fp_round(a);
}
static void fpp_div(fpdata *a, fpdata *b, int prec)
{
a->fp = a->fp / b->fp;
if (prec == PREC_FLOAT)
fpp_round_single(a);
}
static void fpp_mod(fpdata *a, fpdata *b, uae_u64 *q, uae_u8 *s)
{
fptype quot;
#if USE_HOST_ROUNDING
quot = truncl(a->fp / b->fp);
#else
quot = fpp_round_to_zero(a->fp / b->fp);
#endif
if (quot < 0.0) {
*s = 1;
quot = -quot;
} else {
*s = 0;
}
*q = (uae_u64)quot;
a->fp = fmodl(a->fp, b->fp);
fp_round(a);
}
static void fpp_rem(fpdata *a, fpdata *b, uae_u64 *q, uae_u8 *s)
{
fptype quot;
#if USE_HOST_ROUNDING
quot = roundl(a->fp / b->fp);
#else
quot = fpp_round_to_nearest(a->fp / b->fp);
#endif
if (quot < 0.0) {
*s = 1;
quot = -quot;
} else {
*s = 0;
}
*q = (uae_u64)quot;
a->fp = remainderl(a->fp, b->fp);
fp_round(a);
}
static void fpp_scale(fpdata *a, fpdata *b)
{
a->fp = ldexpl(a->fp, (int)b->fp);
fp_round(a);
}
static void fpp_sinh(fpdata *a, fpdata *b)
{
a->fp = sinhl(b->fp);
fp_round(a);
}
static void fpp_intrz(fpdata *a, fpdata *b)
{
#if USE_HOST_ROUNDING
a->fp = truncl(b->fp);
#else
a->fp = fpp_round_to_zero (b->fp);
#endif
fp_round(a);
}
static void fpp_sqrt(fpdata *a, fpdata *b, int prec)
{
a->fp = sqrtl(b->fp);
if (prec == PREC_FLOAT)
fpp_round_single(a);
}
static void fpp_lognp1(fpdata *a, fpdata *b)
{
a->fp = log1pl(b->fp);
fp_round(a);
}
static void fpp_etoxm1(fpdata *a, fpdata *b)
{
a->fp = expm1l(b->fp);
fp_round(a);
}
static void fpp_tanh(fpdata *a, fpdata *b)
{
a->fp = tanhl(b->fp);
fp_round(a);
}
static void fpp_atan(fpdata *a, fpdata *b)
{
a->fp = atanl(b->fp);
fp_round(a);
}
static void fpp_atanh(fpdata *a, fpdata *b)
{
a->fp = atanhl(b->fp);
fp_round(a);
}
static void fpp_sin(fpdata *a, fpdata *b)
{
a->fp = sinl(b->fp);
fp_round(a);
}
static void fpp_asin(fpdata *a, fpdata *b)
{
a->fp = asinl(b->fp);
fp_round(a);
}
static void fpp_tan(fpdata *a, fpdata *b)
{
a->fp = tanl(b->fp);
fp_round(a);
}
static void fpp_etox(fpdata *a, fpdata *b)
{
a->fp = expl(b->fp);
fp_round(a);
}
static void fpp_twotox(fpdata *a, fpdata *b)
{
a->fp = powl(2.0, b->fp);
fp_round(a);
}
static void fpp_tentox(fpdata *a, fpdata *b)
{
a->fp = powl(10.0, b->fp);
fp_round(a);
}
static void fpp_logn(fpdata *a, fpdata *b)
{
a->fp = logl(b->fp);
fp_round(a);
}
static void fpp_log10(fpdata *a, fpdata *b)
{
a->fp = log10l(b->fp);
fp_round(a);
}
static void fpp_log2(fpdata *a, fpdata *b)
{
a->fp = log2l(b->fp);
fp_round(a);
}
static void fpp_abs(fpdata *a, fpdata *b, int prec)
{
a->fp = abs(b->fp);
if (prec == PREC_FLOAT)
fpp_round_single(a);
}
static void fpp_cosh(fpdata *a, fpdata *b)
{
a->fp = coshl(b->fp);
fp_round(a);
}
static void fpp_neg(fpdata *a, fpdata *b, int prec)
{
a->fp = -b->fp;
if (prec == PREC_FLOAT)
fpp_round_single(a);
}
static void fpp_acos(fpdata *a, fpdata *b)
{
a->fp = acosl(b->fp);
fp_round(a);
}
static void fpp_cos(fpdata *a, fpdata *b)
{
a->fp = cosl(b->fp);
fp_round(a);
}
static void fpp_sub(fpdata *a, fpdata *b, int prec)
{
a->fp = a->fp - b->fp;
if (prec == PREC_FLOAT)
fpp_round_single(a);
}
static void fpp_add(fpdata *a, fpdata *b, int prec)
{
a->fp = a->fp + b->fp;
if (prec == PREC_FLOAT)
fpp_round_single(a);
}
static void fpp_mul(fpdata *a, fpdata *b, int prec)
{
a->fp = a->fp * b->fp;
if (prec == PREC_FLOAT)
fpp_round_single(a);
}
static void fpp_sglmul(fpdata *a, fpdata *b)
{
fptype z;
float mant;
int expon;
/* FIXME: truncate mantissa of a and b to single precision */
z = a->fp * b->fp;
mant = (float)(frexpl(z, &expon) * 2.0);
a->fp = ldexpl((fptype)mant, expon - 1);
}
static void fpp_sgldiv(fpdata *a, fpdata *b)
{
fptype z;
float mant;
int expon;
z = a->fp / b->fp;
mant = (float)(frexpl(z, &expon) * 2.0);
a->fp = ldexpl((fptype)mant, expon - 1);
}
static void fpp_cmp(fpdata *a, fpdata *b)
{
fptype v = 1.0;
if (currprefs.fpu_strict) {
bool a_neg = fpp_is_neg(a);
bool a_inf = fpp_is_infinity(a);
bool a_zero = fpp_is_zero(a);
bool a_nan = fpp_is_nan(a);
bool b_neg = fpp_is_neg(b);
bool b_inf = fpp_is_infinity(b);
bool b_zero = fpp_is_zero(b);
bool b_nan = fpp_is_nan(b);
if (a_nan || b_nan) {
// FCMP never returns N + NaN
v = *fp_nan;
} else if (a_zero && b_zero) {
if ((a_neg && b_neg) || (a_neg && !b_neg))
v = -0.0;
else
v = 0.0;
} else if (a_zero && b_inf) {
if (!b_neg)
v = -1.0;
else
v = 1.0;
} else if (a_inf && b_zero) {
if (!a_neg)
v = -1.0;
else
v = 1.0;
} else if (a_inf && b_inf) {
if (a_neg == b_neg)
v = 0.0;
if ((a_neg && b_neg) || (a_neg && !b_neg))
v = -v;
} else if (a_inf) {
if (a_neg)
v = -1.0;
} else if (b_inf) {
if (!b_neg)
v = -1.0;
} else {
v = a->fp - b->fp;
}
} else {
v = a->fp - b->fp;
}
a->fp = v;
}
static void fpp_tst(fpdata *a, fpdata *b)
{
a->fp = b->fp;
}
static void fpp_from_pack (fpdata *src, uae_u32 *wrd, int kfactor)
{
int i, j, t;
int exp;
int ndigits;
char *cp, *strp;
char str[100];
fptype fp;
if (fpp_is_nan (src)) {
// copy bit by bit, handle signaling nan
fpp_from_exten(src, &wrd[0], &wrd[1], &wrd[2]);
return;
}
if (fpp_is_infinity (src)) {
// extended exponent and all 0 packed fraction
fpp_from_exten(src, &wrd[0], &wrd[1], &wrd[2]);
wrd[1] = wrd[2] = 0;
return;
}
wrd[0] = wrd[1] = wrd[2] = 0;
fpp_to_native(&fp, src);
sprintf (str, "%#.17e", fp);
// get exponent
cp = str;
while (*cp != 'e') {
if (*cp == 0)
return;
cp++;
}
cp++;
if (*cp == '+')
cp++;
exp = atoi (cp);
// remove trailing zeros
cp = str;
while (*cp != 'e') {
cp++;
}
cp[0] = 0;
cp--;
while (cp > str && *cp == '0') {
*cp = 0;
cp--;
}
cp = str;
// get sign
if (*cp == '-') {
cp++;
wrd[0] = 0x80000000;
} else if (*cp == '+') {
cp++;
}
strp = cp;
if (kfactor <= 0) {
ndigits = abs (exp) + (-kfactor) + 1;
} else {
if (kfactor > 17) {
kfactor = 17;
fpsr_set_exception(FPSR_OPERR);
}
ndigits = kfactor;
}
if (ndigits < 0)
ndigits = 0;
if (ndigits > 16)
ndigits = 16;
// remove decimal point
strp[1] = strp[0];
strp++;
// add trailing zeros
i = strlen (strp);
cp = strp + i;
while (i < ndigits) {
*cp++ = '0';
i++;
}
i = ndigits + 1;
while (i < 17) {
strp[i] = 0;
i++;
}
*cp = 0;
i = ndigits - 1;
// need to round?
if (i >= 0 && strp[i + 1] >= '5') {
while (i >= 0) {
strp[i]++;
if (strp[i] <= '9')
break;
if (i == 0) {
strp[i] = '1';
exp++;
} else {
strp[i] = '0';
}
i--;
}
}
strp[ndigits] = 0;
// store first digit of mantissa
cp = strp;
wrd[0] |= *cp++ - '0';
// store rest of mantissa
for (j = 1; j < 3; j++) {
for (i = 0; i < 8; i++) {
wrd[j] <<= 4;
if (*cp >= '0' && *cp <= '9')
wrd[j] |= *cp++ - '0';
}
}
// exponent
if (exp < 0) {
wrd[0] |= 0x40000000;
exp = -exp;
}
if (exp > 9999) // ??
exp = 9999;
if (exp > 999) {
int d = exp / 1000;
wrd[0] |= d << 12;
exp -= d * 1000;
fpsr_set_exception(FPSR_OPERR);
}
i = 100;
t = 0;
while (i >= 1) {
int d = exp / i;
t <<= 4;
t |= d;
exp -= d * i;
i /= 10;
}
wrd[0] |= t << 16;
}
static void fpp_to_pack (fpdata *fpd, uae_u32 *wrd, int dummy)
{
fptype d;
char *cp;
char str[100];
if (((wrd[0] >> 16) & 0x7fff) == 0x7fff) {
// infinity has extended exponent and all 0 packed fraction
// nans are copies bit by bit
fpp_to_exten(fpd, wrd[0], wrd[1], wrd[2]);
return;
}
if (!(wrd[0] & 0xf) && !wrd[1] && !wrd[2]) {
// exponent is not cared about, if mantissa is zero
wrd[0] &= 0x80000000;
fpp_to_exten(fpd, wrd[0], wrd[1], wrd[2]);
return;
}
cp = str;
if (wrd[0] & 0x80000000)
*cp++ = '-';
*cp++ = (wrd[0] & 0xf) + '0';
*cp++ = '.';
*cp++ = ((wrd[1] >> 28) & 0xf) + '0';
*cp++ = ((wrd[1] >> 24) & 0xf) + '0';
*cp++ = ((wrd[1] >> 20) & 0xf) + '0';
*cp++ = ((wrd[1] >> 16) & 0xf) + '0';
*cp++ = ((wrd[1] >> 12) & 0xf) + '0';
*cp++ = ((wrd[1] >> 8) & 0xf) + '0';
*cp++ = ((wrd[1] >> 4) & 0xf) + '0';
*cp++ = ((wrd[1] >> 0) & 0xf) + '0';
*cp++ = ((wrd[2] >> 28) & 0xf) + '0';
*cp++ = ((wrd[2] >> 24) & 0xf) + '0';
*cp++ = ((wrd[2] >> 20) & 0xf) + '0';
*cp++ = ((wrd[2] >> 16) & 0xf) + '0';
*cp++ = ((wrd[2] >> 12) & 0xf) + '0';
*cp++ = ((wrd[2] >> 8) & 0xf) + '0';
*cp++ = ((wrd[2] >> 4) & 0xf) + '0';
*cp++ = ((wrd[2] >> 0) & 0xf) + '0';
*cp++ = 'E';
if (wrd[0] & 0x40000000)
*cp++ = '-';
*cp++ = ((wrd[0] >> 24) & 0xf) + '0';
*cp++ = ((wrd[0] >> 20) & 0xf) + '0';
*cp++ = ((wrd[0] >> 16) & 0xf) + '0';
*cp = 0;
sscanf (str, "%le", &d);
fpp_from_native(d, fpd);
}
double softfloat_tan(double v)
{
return tanl(v);
}

743
src/framebufferboards.cpp Normal file
View File

@ -0,0 +1,743 @@
/*
* UAE - The Un*x Amiga Emulator
*
* Misc frame buffer boards
*
* - Harlequin
*
*/
#include "sysconfig.h"
#include "sysdeps.h"
#include "options.h"
#include "debug.h"
#include "memory.h"
#include "custom.h"
#include "picasso96.h"
#include "gfxboard.h"
#include "statusline.h"
#include "rommgr.h"
//#include "framebufferboards.h" // file was empty
#include "xwin.h"
typedef uae_u32(REGPARAM3 *fb_get_func)(struct fb_struct *, uaecptr) REGPARAM;
typedef void (REGPARAM3 *fb_put_func)(struct fb_struct *, uaecptr, uae_u32) REGPARAM;
extern addrbank generic_fb_bank;
struct fb_struct
{
int devnum;
int monitor_id;
uae_u32 configured;
uae_u32 io_start, io_end;
uae_u8 data[16];
bool enabled;
bool modechanged;
bool visible;
int width, height;
bool lace;
RGBFTYPE rgbtype;
int fb_offset;
int fb_offset_limit;
int fb_vram_mask;
int fb_vram_size;
bool fb_modified;
uae_u8 *fb;
uae_u8 *surface;
bool isalpha;
bool ntsc;
bool genlock;
int model;
int irq;
fb_get_func lget, wget, bget;
fb_put_func lput, wput, bput;
};
static struct fb_struct *fb_data[MAX_RTG_BOARDS];
static int fb_boards;
static struct fb_struct *fb_last;
static bool fb_get_surface(struct fb_struct *data)
{
struct amigadisplay *ad = &adisplays[data->monitor_id];
if (ad->picasso_on) {
if (data->surface == NULL) {
data->surface = gfx_lock_picasso(data->monitor_id, false);
}
}
return data->surface != NULL;
}
static void fb_free_surface(struct fb_struct *data)
{
if (!data->surface)
return;
gfx_unlock_picasso(data->monitor_id, true);
data->surface = NULL;
}
static void fb_irq(struct fb_struct *data)
{
if (!data->irq)
return;
if (data->irq == 2)
INTREQ_0(0x8000 | 0x0008);
else if (data->irq == 6)
INTREQ_0(0x8000 | 0x2000);
}
static void harlequin_offset(struct fb_struct *data)
{
int offset = data->data[0] & 0x3f;
data->fb_offset = offset * 65536;
}
static void harlequin_setmode(struct fb_struct *data)
{
int mode = data->data[1] & 3;
switch (mode)
{
case 0:
case 3:
data->width = 910;
break;
case 1:
data->width = 832;
break;
case 2:
data->width = 740;
break;
}
data->lace = (data->data[1] & 8) != 0;
data->height = data->ntsc ? 486 : 576;
}
static void REGPARAM2 harlequin_wput(struct fb_struct *data, uaecptr addr, uae_u32 w)
{
addr &= 0x1ffff;
if (addr == 0) {
uae_u8 old0 = data->data[0];
uae_u8 old1 = data->data[1];
data->data[0] = (uae_u8)(w >> 8);
data->data[1] = (uae_u8)(w >> 0);
data->data[0] &= ~0x80;
data->data[0] |= data->genlock ? 0x00 : 0x80;
if ((data->data[0] & 0x40) != (old0 & 0x40))
data->fb_modified = true;
if (data->data[1] != old1)
data->fb_modified = true;
harlequin_offset(data);
harlequin_setmode(data);
} else if (addr >= 0x10000) {
if (data->fb_offset >= data->fb_offset_limit)
return;
addr -= 0x10000;
if (!data->isalpha) {
if ((addr & 3) == 2)
w &= 0xff00;
if ((addr & 3) == 3)
w &= 0x00ff;
}
data->fb[data->fb_offset + addr + 0] = (uae_u8)(w >> 8);
data->fb[data->fb_offset + addr + 1] = (uae_u8)(w >> 0);
data->fb_modified = true;
}
}
static void REGPARAM2 harlequin_bput(struct fb_struct *data, uaecptr addr, uae_u32 b)
{
addr &= 0x1ffff;
if (addr == 2) {
data->data[2] = b;
data->irq = 0;
} else if (addr >= 0x20 && addr < 0x30) {
write_log(_T("RAMDAC WRITE %0x = %02x\n"), addr, (uae_u8)b);
} else if (addr >= 0x10000) {
if (data->fb_offset >= data->fb_offset_limit)
return;
addr -= 0x10000;
if (!data->isalpha && (addr & 3) == 3)
b = 0;
data->fb[data->fb_offset + addr] = (uae_u8)b;
data->fb_modified = true;
}
}
static uae_u32 REGPARAM2 harlequin_wget(struct fb_struct *data, uaecptr addr)
{
uae_u16 v = 0;
addr &= 0x1ffff;
if (addr == 0) {
v = (data->data[0] << 8) | (data->data[1] << 0);
} else if (addr >= 0x10000) {
if (data->fb_offset >= data->fb_offset_limit)
return 0;
addr -= 0x10000;
v = data->fb[data->fb_offset + addr + 0] << 8;
v |= data->fb[data->fb_offset + addr + 1] << 0;
}
return v;
}
static uae_u32 REGPARAM2 harlequin_bget(struct fb_struct *data, uaecptr addr)
{
uae_u8 v = 0;
addr &= 0x1ffff;
if (addr == 0 || addr == 1 || addr == 2) {
v = data->data[addr];
} else if (addr >= 0x20 && addr < 0x30) {
write_log(_T("RAMDAC READ %0x\n"), addr);
} else if (addr >= 0x10000) {
if (data->fb_offset >= data->fb_offset_limit)
return 0;
addr -= 0x10000;
v = data->fb[data->fb_offset + addr];
}
return 0;
}
static bool harlequin_init(struct autoconfig_info *aci)
{
uae_u8 model = 100;
int vram = 0x200000;
bool isac = true;
bool ntsc = false;
aci->label = _T("Harlequin");
struct boardromconfig *brc = get_device_rom(aci->prefs, ROMTYPE_HARLEQUIN, gfxboard_get_devnum(aci->prefs, aci->devnum), NULL);
if (brc) {
model = (brc->roms[0].device_settings & 3) + 100;
ntsc = (model & 1) != 0;
}
aci->autoconfig_bytes[1] = model;
if (!aci->doinit) {
return true;
}
struct fb_struct *data = xcalloc(struct fb_struct, 1);
data->devnum = aci->devnum;
fb_data[data->devnum] = data;
data->bget = harlequin_bget;
data->wget = harlequin_wget;
data->bput = harlequin_bput;
data->wput = harlequin_wput;
if (brc) {
switch((brc->roms[0].device_settings >> 2) & 3)
{
case 0: // 1.5M
vram = 0x200000;
isac = false;
break;
case 1: // 2M
vram = 0x200000;
isac = true;
break;
case 2: // 3M
vram = 0x400000;
isac = false;
break;
case 3: // 4M
vram = 0x400000;
isac = true;
break;
}
data->genlock = ((brc->roms[0].device_settings >> 4) & 1) != 0;
}
data->model = model;
data->ntsc = ntsc;
data->isalpha = isac;
data->fb_vram_size = vram;
data->fb_vram_mask = data->fb_vram_size - 1;
data->fb_offset_limit = vram;
data->fb = xcalloc(uae_u8, data->fb_vram_size);
data->rgbtype = RGBFB_R8G8B8A8;
harlequin_setmode(data);
aci->addrbank = &generic_fb_bank;
aci->userdata = data;
fb_boards++;
return true;
}
static void harlequin_free(void *userdata)
{
struct fb_struct *data = (struct fb_struct*)userdata;
fb_free_surface(data);
xfree(data->fb);
data->fb = NULL;
fb_data[data->devnum] = NULL;
xfree(data);
}
static void harlequin_reset(void *userdata)
{
struct fb_struct *data = (struct fb_struct*)userdata;
fb_boards = 0;
fb_last = NULL;
}
static void harlequin_hsync(void *userdata)
{
struct fb_struct *data = (struct fb_struct*)userdata;
fb_irq(data);
}
static void harlequin_convert(struct fb_struct *data)
{
struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[data->monitor_id];
bool r = (data->data[1] & 0x80) != 0;
bool g = (data->data[1] & 0x40) != 0;
bool b = (data->data[1] & 0x20) != 0;
int buf = (data->data[0] & 0x40) ? 1 : 0;
int offset = 0, laceoffset = 0;
int laceoffsetv = (data->width * data->height / 2) * 4;
if (buf && data->fb_vram_size > 0x200000)
offset += data->fb_vram_size / 2;
int sy = 0;
int w = vidinfo->width < data->width ? vidinfo->width : data->width;
int h = vidinfo->height < data->height ? vidinfo->height : data->height;
for (int y = 0; y < h; y++) {
uae_u8 *s = data->fb + offset + laceoffset + sy * data->width * 4;
if (r && g && b) {
fb_copyrow(data->monitor_id, s, data->surface, 0, 0, data->width, 4, y);
} else {
uae_u8 tmp[1000 * 4];
uae_u8 *d = tmp;
for (int x = 0; x < w * 4; x += 4) {
d[x + 0] = r ? s[x + 0] : 0;
d[x + 1] = g ? s[x + 1] : 0;
d[x + 2] = b ? s[x + 2] : 0;
d[x + 3] = 0;
}
fb_copyrow(data->monitor_id, d, data->surface, 0, 0, data->width, 4, y);
}
if (data->lace) {
laceoffset = laceoffset ? 0 : laceoffsetv;
if (!laceoffset)
sy++;
} else {
sy++;
}
}
}
static bool harlequin_vsync(void *userdata, struct gfxboard_mode *mode)
{
struct fb_struct *data = (struct fb_struct*)userdata;
bool rendered = false;
if (data->model >= 102) {
data->data[2] |= 0x80;
if (data->data[2] & 0x40) {
data->irq = 2;
fb_irq(data);
}
}
if (data->visible) {
mode->width = data->width;
mode->height = data->height;
mode->mode = data->rgbtype;
mode->hlinedbl = 1;
mode->vlinedbl = 1;
if (fb_get_surface(data)) {
if (data->fb_modified || data->modechanged || mode->redraw_required) {
data->fb_modified = false;
data->modechanged = false;
harlequin_convert(data);
}
fb_free_surface(data);
rendered = true;
}
}
return rendered;
}
static bool harlequin_toggle(void *userdata, int mode)
{
struct fb_struct *data = (struct fb_struct*)userdata;
if (!data->configured)
return false;
if (!mode) {
if (!data->enabled)
return false;
data->enabled = false;
data->modechanged = false;
data->visible = false;
return true;
} else {
if (data->enabled)
return false;
data->enabled = true;
data->modechanged = true;
data->visible = true;
return true;
}
return false;
}
static void harlequin_configured(void *userdata, uae_u32 address)
{
struct fb_struct *data = (struct fb_struct*)userdata;
data->configured = address;
data->io_start = address;
data->io_end = data->io_start + 0x20000;
}
static void harlequin_refresh(void *userdata)
{
}
static void rainbow2_setmode(struct fb_struct *data)
{
int mode = data->ntsc;
if (data->data[0] & 4) {
mode = mode ? 0 : 1;
}
switch (mode)
{
case 0:
data->width = 768;
data->height = 576;
break;
case 1:
data->width = 768;
data->height = 476;
break;
}
data->lace = (data->data[0] & 1) != 0;
}
static void REGPARAM2 rainbow2_wput(struct fb_struct *data, uaecptr addr, uae_u32 w)
{
addr &= 0x1fffff;
if (addr < 0x1c0000) {
data->fb[addr + 0] = (uae_u8)(w >> 8);
data->fb[addr + 1] = (uae_u8)(w >> 0);
data->fb_modified = true;
}
}
static void REGPARAM2 rainbow2_bput(struct fb_struct *data, uaecptr addr, uae_u32 b)
{
addr &= 0x1fffff;
if (addr == 0x1ffff8) {
// bit 0: interlace (only makes odd/even fields, does not increase resolution)
// bit 1: display enable
// bit 2: toggle PAL/NTSC (yes, toggle, not set!)
// bit 3: 0=read ROM, 1= read VRAM
data->data[0] = b;
rainbow2_setmode(data);
}
if (addr < 0x18000 && (data->data[0] & 8)) {
data->fb[addr] = (uae_u8)b;
data->fb_modified = true;
}
}
static uae_u32 REGPARAM2 rainbow2_wget(struct fb_struct *data, uaecptr addr)
{
uae_u32 v = 0;
addr &= 0x1fffff;
if (addr < 0x1c0000 && (data->data[0] & 8)) {
v = data->fb[addr + 0] << 8;
v |= data->fb[addr + 1] << 0;
}
return v;
}
static uae_u32 REGPARAM2 rainbow2_bget(struct fb_struct *data, uaecptr addr)
{
uae_u8 v = 0;
addr &= 0x1fffff;
if (addr == 0x1ffff8) {
v = data->data[0];
}
if (addr < 0x1c0000 && (data->data[0] & 8)) {
v = data->fb[addr];
}
return 0;
}
static bool rainbow2_init(struct autoconfig_info *aci)
{
int vram = 0x200000;
bool ntsc = true;
aci->label = _T("Rainbow II");
struct boardromconfig *brc = get_device_rom(aci->prefs, ROMTYPE_RAINBOWII, gfxboard_get_devnum(aci->prefs, aci->devnum), NULL);
if (brc) {
ntsc = (brc->roms[0].device_settings & 1) == 0;
}
if (!aci->doinit) {
return true;
}
struct fb_struct *data = xcalloc(struct fb_struct, 1);
data->devnum = aci->devnum;
fb_data[data->devnum] = data;
data->bget = rainbow2_bget;
data->wget = rainbow2_wget;
data->bput = rainbow2_bput;
data->wput = rainbow2_wput;
data->ntsc = ntsc;
data->fb_vram_size = vram;
data->fb_vram_mask = data->fb_vram_size - 1;
data->fb = xcalloc(uae_u8, data->fb_vram_size);
data->rgbtype = RGBFB_A8R8G8B8;
rainbow2_setmode(data);
aci->addrbank = &generic_fb_bank;
aci->userdata = data;
fb_boards++;
return true;
}
static void rainbow2_free(void *userdata)
{
struct fb_struct *data = (struct fb_struct *)userdata;
fb_free_surface(data);
xfree(data->fb);
data->fb = NULL;
fb_data[data->devnum] = NULL;
xfree(data);
}
static void rainbow2_reset(void *userdata)
{
struct fb_struct *data = (struct fb_struct *)userdata;
fb_boards = 0;
fb_last = NULL;
}
static void rainbow2_hsync(void *userdata)
{
struct fb_struct *data = (struct fb_struct *)userdata;
fb_irq(data);
}
static void rainbow2_convert(struct fb_struct *data)
{
struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[data->monitor_id];
int sy = 0;
int w = vidinfo->width < data->width ? vidinfo->width : data->width;
int h = vidinfo->height < data->height ? vidinfo->height : data->height;
for (int y = 0; y < h; y++) {
uae_u8 *s = data->fb + sy * data->width * 4;
if (!(data->data[0] & 2)) {
uae_u32 tmp[768];
memset(tmp, 0, sizeof(tmp));
fb_copyrow(data->monitor_id, (uae_u8*)tmp, data->surface, 0, 0, data->width, 4, y);
} else {
fb_copyrow(data->monitor_id, s, data->surface, 0, 0, data->width, 4, y);
}
sy++;
}
}
static bool rainbow2_vsync(void *userdata, struct gfxboard_mode *mode)
{
struct fb_struct *data = (struct fb_struct *)userdata;
bool rendered = false;
if (data->visible) {
mode->width = data->width;
mode->height = data->height;
mode->mode = data->rgbtype;
mode->hlinedbl = 1;
mode->vlinedbl = 1;
if (fb_get_surface(data)) {
if (data->fb_modified || data->modechanged || mode->redraw_required) {
data->fb_modified = false;
data->modechanged = false;
rainbow2_convert(data);
}
fb_free_surface(data);
rendered = true;
}
}
return rendered;
}
static bool rainbow2_toggle(void *userdata, int mode)
{
struct fb_struct *data = (struct fb_struct *)userdata;
if (!data->configured)
return false;
if (!mode) {
if (!data->enabled)
return false;
data->enabled = false;
data->modechanged = false;
data->visible = false;
return true;
} else {
if (data->enabled)
return false;
data->enabled = true;
data->modechanged = true;
data->visible = true;
return true;
}
return false;
}
static void rainbow2_configured(void *userdata, uae_u32 address)
{
struct fb_struct *data = (struct fb_struct *)userdata;
data->configured = address;
data->io_start = address;
data->io_end = data->io_start + 0x200000;
}
static void rainbow2_refresh(void *userdata)
{
}
static struct fb_struct *getfbboard(uaecptr addr)
{
if (fb_boards == 1)
return fb_data[0];
if (fb_last && addr >= fb_last->io_start && addr <fb_last->io_end)
return fb_last;
for (int i = 0; i < MAX_RTG_BOARDS; i++) {
struct fb_struct *fb = fb_data[i];
if (!fb)
continue;
if (!fb->configured)
continue;
if (addr >= fb->io_start && addr < fb->io_end) {
fb_last = fb;
return fb;
}
}
return NULL;
}
static void REGPARAM2 fb_lput(uaecptr addr, uae_u32 w)
{
struct fb_struct *data = getfbboard(addr);
if (data) {
data->wput(data, addr + 0, w >> 16);
data->wput(data, addr + 2, w & 65535);
}
}
static void REGPARAM2 fb_wput(uaecptr addr, uae_u32 w)
{
struct fb_struct *data = getfbboard(addr);
if (data) {
data->wput(data, addr, w);
}
}
static void REGPARAM2 fb_bput(uaecptr addr, uae_u32 w)
{
struct fb_struct *data = getfbboard(addr);
if (data) {
data->bput(data, addr, w);
}
}
static uae_u32 REGPARAM2 fb_bget(uaecptr addr)
{
uae_u32 v = 0;
struct fb_struct *data = getfbboard(addr);
if (data) {
v = data->bget(data, addr);
}
return v;
}
static uae_u32 REGPARAM2 fb_wget(uaecptr addr)
{
uae_u32 v = 0;
struct fb_struct *data = getfbboard(addr);
if (data) {
v = data->wget(data, addr);
}
return v;
}
static uae_u32 REGPARAM2 fb_lget(uaecptr addr)
{
uae_u32 v = 0;
struct fb_struct *data = getfbboard(addr);
if (data) {
v = data->wget(data, addr) << 16;
v |= data->wget(data, addr + 2);
}
return v;
}
addrbank generic_fb_bank
{
fb_lget, fb_wget, fb_bget,
fb_lput, fb_wput, fb_bput,
default_xlate, default_check, NULL, NULL, _T("FRAMEBUFFER BOARD"),
fb_lget, fb_wget,
ABFLAG_IO, S_READ, S_WRITE
};
struct gfxboard_func harlequin_func
{
harlequin_init,
harlequin_free,
harlequin_reset,
harlequin_hsync,
harlequin_vsync,
harlequin_refresh,
harlequin_toggle,
harlequin_configured
};
struct gfxboard_func rainbowii_func
{
rainbow2_init,
rainbow2_free,
rainbow2_reset,
rainbow2_hsync,
rainbow2_vsync,
rainbow2_refresh,
rainbow2_toggle,
rainbow2_configured
};

194
src/genblitter.cpp Normal file
View File

@ -0,0 +1,194 @@
/*
* UAE - The Un*x Amiga Emulator
*
* Optimized blitter minterm function generator
*
* Copyright 1995,1996 Bernd Schmidt
* Copyright 1996 Alessandro Bissacco
*/
#include "sysconfig.h"
#include <stdio.h>
#include <stdlib.h>
#include "genblitter.h"
/* Here is the minterm table used in blitter function generation */
static unsigned char blttbl[]= {
0x00, 0x0a, 0x2a, 0x30, 0x3a, 0x3c, 0x4a, 0x6a, 0x8a, 0x8c, 0x9a, 0xa8,
0xaa, 0xb1, 0xca, 0xcc, 0xd8, 0xe2, 0xea, 0xf0, 0xfa, 0xfc
};
static void generate_include(void)
{
int minterm;
printf("STATIC_INLINE uae_u32 blit_func(uae_u32 srca, uae_u32 srcb, uae_u32 srcc, uae_u8 mt)\n{\nswitch(mt){\n");
for (minterm = 0; minterm < 256; minterm++) {
printf("case 0x%x:\n", minterm);
printf("\treturn %s;\n", blitops[minterm].s);
}
printf("}\n");
printf("return 0;\n"); /* No, sir, it doesn't! */
printf("}\n");
}
static void generate_func(void)
{
unsigned int i;
printf("#include \"sysconfig.h\"\n");
printf("#include \"sysdeps.h\"\n");
printf("#include \"options.h\"\n");
printf("#include \"custom.h\"\n");
printf("#include \"memory.h\"\n");
printf("#include \"blitter.h\"\n");
printf("#include \"blitfunc.h\"\n\n");
for (i = 0; i < sizeof(blttbl); i++) {
int active = blitops[blttbl[i]].used;
int a_is_on = active & 1, b_is_on = active & 2, c_is_on = active & 4;
printf("void blitdofast_%x (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b)\n",blttbl[i]);
printf("{\n");
printf("int i,j;\n");
printf("uae_u32 totald = 0;\n");
if (b_is_on) printf("uae_u32 srcb = b->bltbhold;\n");
if (c_is_on) printf("uae_u32 srcc = b->bltcdat;\n");
printf("uae_u16 ashift = bltcon0 >> 12;\n");
printf("uae_u16 bshift = bltcon1 >> 12;\n");
printf("uae_u32 dstd=0;\n");
printf("uaecptr dstp = 0;\n");
printf("for (j = 0; j < b->vblitsize; j++) {\n");
printf("\tfor (i = 0; i < b->hblitsize; i++) {\n");
if (a_is_on) {
printf("\t\tuae_u32 bltadat, srca;\n");
}
if (c_is_on) printf("\t\tif (ptc) { srcc = chipmem_wget_indirect(ptc); ptc += 2; }\n");
if (b_is_on) printf("\t\tif (ptb) {\n\t\t\tuae_u32 bltbdat = b->bltbdat = chipmem_wget_indirect(ptb); ptb += 2;\n");
if (b_is_on) printf("\t\t\tsrcb = (((uae_u32)b->bltbold << 16) | bltbdat) >> bshift;\n");
if (b_is_on) printf("\t\t\tb->bltbold = bltbdat;\n\t\t}\n");
if (a_is_on) printf("\t\tif (pta) { bltadat = b->bltadat = chipmem_wget_indirect(pta); pta += 2; } else { bltadat = b->bltadat; }\n");
if (a_is_on) printf("\t\tbltadat &= blit_masktable[i];\n");
if (a_is_on) printf("\t\tsrca = (((uae_u32)b->bltaold << 16) | bltadat) >> ashift;\n");
if (a_is_on) printf("\t\tb->bltaold = bltadat;\n");
printf("\t\tif (dstp) chipmem_wput_indirect(dstp, dstd);\n");
printf("\t\tdstd = (%s) & 0xFFFF;\n", blitops[blttbl[i]].s);
printf("\t\ttotald |= dstd;\n");
printf("\t\tif (ptd) { dstp = ptd; ptd += 2; }\n");
printf("\t}\n");
if (a_is_on) printf("\tif (pta) pta += b->bltamod;\n");
if (b_is_on) printf("\tif (ptb) ptb += b->bltbmod;\n");
if (c_is_on) printf("\tif (ptc) ptc += b->bltcmod;\n");
printf("\tif (ptd) ptd += b->bltdmod;\n");
printf("}\n");
if (b_is_on) printf("b->bltbhold = srcb;\n");
if (c_is_on) printf("b->bltcdat = srcc;\n");
printf("\t\tif (dstp) chipmem_wput_indirect(dstp, dstd);\n");
printf("if (totald != 0) b->blitzero = 0;\n");
printf("}\n");
printf("void blitdofast_desc_%x (uaecptr pta, uaecptr ptb, uaecptr ptc, uaecptr ptd, struct bltinfo *b)\n",blttbl[i]);
printf("{\n");
printf("uae_u32 totald = 0;\n");
printf("int i,j;\n");
if (b_is_on) printf("uae_u32 srcb = b->bltbhold;\n");
if (c_is_on) printf("uae_u32 srcc = b->bltcdat;\n");
printf("uae_u16 ashift = 16 - (bltcon0 >> 12);\n");
printf("uae_u16 bshift = 16 - (bltcon1 >> 12);\n");
printf("uae_u32 dstd = 0;\n");
printf("uaecptr dstp = 0;\n");
printf("for (j = 0; j < b->vblitsize; j++) {\n");
printf("\tfor (i = 0; i < b->hblitsize; i++) {\n");
if (a_is_on) {
printf("\t\tuae_u32 bltadat, srca;\n");
}
if (c_is_on) printf("\t\tif (ptc) { srcc = chipmem_wget_indirect(ptc); ptc -= 2; }\n");
if (b_is_on) printf("\t\tif (ptb) {\n\t\t\tuae_u32 bltbdat = b->bltbdat = chipmem_wget_indirect(ptb); ptb -= 2;\n");
if (b_is_on) printf("\t\t\tsrcb = ((bltbdat << 16) | b->bltbold) >> bshift;\n");
if (b_is_on) printf("\t\t\tb->bltbold = bltbdat;\n\t\t}\n");
if (a_is_on) printf("\t\tif (pta) { bltadat = b->bltadat = chipmem_wget_indirect(pta); pta -= 2; } else { bltadat = b->bltadat; }\n");
if (a_is_on) printf("\t\tbltadat &= blit_masktable[i];\n");
if (a_is_on) printf("\t\tsrca = (((uae_u32)bltadat << 16) | b->bltaold) >> ashift;\n");
if (a_is_on) printf("\t\tb->bltaold = bltadat;\n");
printf("\t\tif (dstp) chipmem_wput_indirect(dstp, dstd);\n");
printf("\t\tdstd = (%s) & 0xFFFF;\n", blitops[blttbl[i]].s);
printf("\t\ttotald |= dstd;\n");
printf("\t\tif (ptd) { dstp = ptd; ptd -= 2; }\n");
printf("\t}\n");
if (a_is_on) printf("\tif (pta) pta -= b->bltamod;\n");
if (b_is_on) printf("\tif (ptb) ptb -= b->bltbmod;\n");
if (c_is_on) printf("\tif (ptc) ptc -= b->bltcmod;\n");
printf("\tif (ptd) ptd -= b->bltdmod;\n");
printf("}\n");
if (b_is_on) printf("b->bltbhold = srcb;\n");
if (c_is_on) printf("b->bltcdat = srcc;\n");
printf("\t\tif (dstp) chipmem_wput_indirect(dstp, dstd);\n");
printf("if (totald != 0) b->blitzero = 0;\n");
printf("}\n");
}
}
static void generate_table(void)
{
unsigned int index = 0;
unsigned int i;
printf("#include \"sysconfig.h\"\n");
printf("#include \"sysdeps.h\"\n");
printf("#include \"options.h\"\n");
printf("#include \"custom.h\"\n");
printf("#include \"memory.h\"\n");
printf("#include \"blitter.h\"\n");
printf("#include \"blitfunc.h\"\n\n");
printf("blitter_func * const blitfunc_dofast[256] = {\n");
for (i = 0; i < 256; i++) {
if (index < sizeof(blttbl) && i == blttbl[index]) {
printf("blitdofast_%x",i);
index++;
}
else printf("0");
if (i < 255) printf(", ");
if ((i & 7) == 7) printf("\n");
}
printf("};\n\n");
index = 0;
printf("blitter_func * const blitfunc_dofast_desc[256] = {\n");
for (i = 0; i < 256; i++) {
if (index < sizeof(blttbl) && i == blttbl[index]) {
printf("blitdofast_desc_%x",i);
index++;
}
else printf("0");
if (i < 255) printf(", ");
if ((i & 7) == 7) printf("\n");
}
printf("};\n");
}
static void generate_header(void)
{
unsigned int i;
for (i = 0; i < sizeof(blttbl); i++) {
printf("extern blitter_func blitdofast_%x;\n",blttbl[i]);
printf("extern blitter_func blitdofast_desc_%x;\n",blttbl[i]);
}
}
int main(int argc, char **argv)
{
char mode = 'i';
if (argc == 2) mode = *argv[1];
switch (mode) {
case 'i': generate_include();
break;
case 'f': generate_func();
break;
case 't': generate_table();
break;
case 'h': generate_header();
break;
default: abort();
}
return 0;
}

File diff suppressed because it is too large Load Diff

452
src/gengenblitter.cpp Normal file
View File

@ -0,0 +1,452 @@
/*
* UAE - The Un*x Amiga Emulator
*
* Optimized blitter minterm function generator
*
* Copyright 1995,1996 Bernd Schmidt
* Copyright 1996 Alessandro Bissacco
*
* Overkill, n: cf. genblitter
*/
#include "sysconfig.h"
#include "sysdeps.h"
#include "config.h"
#include "options.h"
static void nop(int);
#define xmalloc malloc
#define xfree free
#define xrealloc realloc
typedef struct tree_n {
enum tree_op { op_and, op_or, op_xor, op_not, op_a, op_b, op_c, op_d, op_e, op_f } op;
struct tree_n *left, *right;
} *tree;
static struct tree_n TRA = { op_a, NULL, NULL };
static struct tree_n TRB = { op_b, NULL, NULL };
static struct tree_n TRC = { op_c, NULL, NULL };
static struct tree_n TRD = { op_d, NULL, NULL };
static struct tree_n TRE = { op_e, NULL, NULL };
static struct tree_n TRF = { op_f, NULL, NULL };
static tree tree_a = &TRA;
static tree tree_b = &TRB;
static tree tree_c = &TRC;
static tree tree_d = &TRD;
static tree tree_e = &TRE;
static tree tree_f = &TRF;
typedef struct {
tree *trees;
int space;
int ntrees;
} tree_vec;
STATIC_INLINE int issrc (tree t)
{
return t == tree_a || t == tree_b || t == tree_c || t == tree_d || t == tree_e || t == tree_f;
}
static tree new_op_tree(enum tree_op op, tree l, tree r)
{
tree t;
if (op == op_not && l->op == op_not) {
t = l->left;
xfree(l);
return t;
}
t = (tree)xmalloc(sizeof(struct tree_n));
t->left = l;
t->right = r;
t->op = op;
return t;
}
static int opidx (tree t)
{
switch (t->op) {
case op_a:
return 0;
case op_b:
return 1;
case op_c:
return 2;
case op_d:
return 3;
case op_e:
return 4;
case op_f:
return 5;
default:
return -1;
}
}
static int tree_cst (tree t, unsigned int *src, unsigned int *notsrc)
{
int idx = opidx (t);
if (idx >= 0) {
src[idx] = 1;
return 0;
}
switch (t->op) {
case op_not:
idx = opidx (t->left);
if (idx >= 0) {
notsrc[idx] = 1;
return 3;
}
return 3 + tree_cst (t->left, src, notsrc);
case op_and:
case op_xor:
case op_or:
return 4 + tree_cst (t->left, src, notsrc) + tree_cst (t->right, src, notsrc);
default:
abort ();
}
}
static int tree_cost (tree t)
{
int i, cost;
unsigned int src[6], notsrc[6];
memset (src, 0, sizeof src);
memset (notsrc, 0, sizeof notsrc);
cost = tree_cst (t, src, notsrc);
for (i = 0; i < 6; i++)
if (src[i] && notsrc[i])
cost++;
return cost;
}
static int add_vec(tree_vec *tv, tree t)
{
int i;
#if 0
if (! tree_isnormal(t))
nop(2);
#endif
if (tv->ntrees == tv->space) {
tv->trees = (tree *)xrealloc(tv->trees, sizeof(tree)*(tv->space += 40));
}
tv->trees[tv->ntrees++] = t;
return 1;
}
static void init_vec(tree_vec *tv)
{
tv->ntrees = tv->space = 0;
tv->trees = NULL;
}
static void do_sprint_tree (char *s, tree t)
{
enum tree_op op = t->op;
switch (op) {
case op_a:
strcat (s, "srca");
break;
case op_b:
strcat (s, "srcb");
break;
case op_c:
strcat (s, "srcc");
break;
case op_d:
strcat (s, "srcd");
break;
case op_e:
strcat (s, "srce");
break;
case op_f:
strcat (s, "srcf");
break;
case op_and:
case op_or:
case op_xor:
{
char *c = op == op_and ? " & " : op == op_or ? " | " : " ^ ";
strcat (s, "(");
do_sprint_tree (s, t->left);
strcat (s, c);
while (t->right->op == op) {
t = t->right;
do_sprint_tree (s, t->left);
strcat (s, c);
}
do_sprint_tree(s, t->right);
strcat (s, ")");
}
break;
case op_not:
strcat (s, "~");
do_sprint_tree (s, t->left);
break;
}
}
static tree_vec size_trees[20];
static struct tree_n bad_tree = { op_and, &bad_tree, &bad_tree };
static unsigned int used_mask[256];
static tree best_trees[256];
static unsigned int best_cost[256];
static int n_unknown;
static unsigned long which_fn (tree t)
{
switch (t->op) {
case op_a:
return 0xf0;
case op_b:
return 0xcc;
case op_c:
return 0xaa;
case op_and:
return which_fn (t->left) & which_fn (t->right);
case op_or:
return which_fn (t->left) | which_fn (t->right);
case op_xor:
return which_fn (t->left) ^ which_fn (t->right);
case op_not:
return 0xFF & ~which_fn (t->left);
default:
abort ();
}
}
static unsigned long tree_used_mask (tree t)
{
switch (t->op) {
case op_a:
return 1;
case op_b:
return 2;
case op_c:
return 4;
case op_and:
case op_or:
case op_xor:
return tree_used_mask (t->left) | tree_used_mask (t->right);
case op_not:
return tree_used_mask (t->left);
default:
abort ();
}
}
static void candidate (tree_vec *v, tree t)
{
unsigned long fn = which_fn (t);
unsigned int cost = tree_cost (t);
if (best_trees[fn] == 0)
n_unknown--;
if (cost < best_cost[fn])
best_trees[fn] = t, best_cost[fn] = cost;
add_vec (v, t);
}
static void cand_and_not (tree_vec *v, tree t)
{
candidate (v, t);
t = new_op_tree (op_not, t, 0);
candidate (v, t);
}
static void try_tree (tree_vec *v, tree t)
{
int fnl = which_fn (t->left);
int fnr = which_fn (t->right);
int fn = which_fn (t);
if (fn == fnl
|| fn == fnr
|| fn == 0
|| fn == 0xFF
|| (tree_used_mask (t) & ~used_mask[fn]) != 0
|| best_cost[fn] + 6 < tree_cost (t))
{
xfree (t);
return;
}
cand_and_not (v, t);
}
static void find_best_trees (void)
{
int i, size, do_stop;
for (i = 0; i < 256; i++) {
best_trees[i] = i == 0 || i == 255 ? &bad_tree : 0;
best_cost[i] = 65535;
}
n_unknown = 254;
init_vec (size_trees);
cand_and_not (size_trees, tree_a);
cand_and_not (size_trees, tree_b);
cand_and_not (size_trees, tree_c);
do_stop = 0;
for (size = 2; ! do_stop && size < 20; size++) {
int split, last_split;
tree_vec *sv = size_trees + size - 1;
if (n_unknown == 0)
do_stop = 1;
last_split = (size >> 1) + 1;
for (split = 1; split < last_split; split++) {
int szl = split;
int szr = size - split;
tree_vec *lv = size_trees + szl - 1;
tree_vec *rv = size_trees + szr - 1;
int i;
for (i = 0; i < lv->ntrees; i++) {
tree l = lv->trees[i];
int j;
for (j = szl == szr ? i + 1 : 0; j < rv->ntrees; j++) {
tree r = rv->trees[j];
if (l->op != op_and || r->op != op_and) {
tree tmp = (l->op == op_and
? new_op_tree (op_and, r, l)
: new_op_tree (op_and, l, r));
try_tree (sv, tmp);
}
if (l->op != op_or || r->op != op_or) {
tree tmp = (l->op == op_or
? new_op_tree (op_or, r, l)
: new_op_tree (op_or, l, r));
try_tree (sv, tmp);
}
if (l->op != op_xor || r->op != op_xor) {
tree tmp = (l->op == op_xor
? new_op_tree (op_xor, r, l)
: new_op_tree (op_xor, l, r));
try_tree (sv, tmp);
}
}
}
}
/* An additional pass doesn't seem to create better solutions
* (not that much of a surprise). */
if (n_unknown == 0)
do_stop = 1;
}
}
static int bitset (int mt, int bit)
{
return mt & (1 << bit);
}
static unsigned int generate_expr (int minterm)
{
int bits = 0;
int i;
int expr_dc[8], nexp = 0;
int expr_used[8];
if (minterm == 0 || minterm == 0xFF)
return 0;
for (i = 0; i < 8; i++) {
if (bitset (minterm, i) && !bitset (bits, i)) {
int j;
int dontcare = 0;
int firstand = 1;
int bitbucket[8], bitcount;
bits |= 1<<i;
bitcount = 1; bitbucket[0] = i;
for(j=1; j<8; j *= 2) {
int success = 1;
int k;
for(k=0; k < bitcount; k++) {
if (!bitset (minterm, bitbucket[k] ^ j)) {
success = 0;
}
}
if (success) {
int l;
dontcare |= j;
for(l=bitcount; l < bitcount*2; l++) {
bitbucket[l] = bitbucket[l-bitcount] ^ j;
bits |= 1 << bitbucket[l];
}
bitcount *= 2;
}
}
expr_used[nexp] = 1;
expr_dc[nexp] = dontcare;
nexp++;
}
}
{
unsigned int result = 0;
for (i = 0; i < nexp; i++) {
int j;
for (j = 1; j < 8; j *= 2) {
if (!(expr_dc[i] & j))
result |= (j == 1 ? 4 : j == 2 ? 2 : 1);
}
}
return result;
}
}
static void print_tree(tree t)
{
char buf[300] = "";
do_sprint_tree (buf, t);
printf ("%s", buf);
}
static void generate_optable(void)
{
int minterm;
printf(" /* This file generated automatically - do not edit */\n\n");
printf("#include \"genblitter.h\"\n\n");
printf("struct blitop blitops[256] = {\n");
for (minterm = 0; minterm < 256; minterm++) {
printf(" /* %02x */ { \"", minterm);
if (minterm == 0)
printf ("0");
else if (minterm == 255)
printf ("0xFFFFFFFF");
else
print_tree (best_trees[minterm]);
printf("\", %d }%s\n", used_mask[minterm], minterm == 255 ? "" : ",");
fflush(stdout);
}
printf("};\n");
}
int main (int argc, char **argv)
{
int minterm;
for (minterm = 0; minterm < 256; minterm++)
used_mask[minterm] = generate_expr (minterm);
find_best_trees ();
generate_optable ();
return 0;
}
void nop(int a)
{
}

639
src/genlinetoscr.cpp Normal file
View File

@ -0,0 +1,639 @@
/*
* E-UAE - The portable Amiga Emulator
*
* Generate pixel output code.
*
* (c) 2006 Richard Drummond
*/
#include "sysconfig.h"
#include "sysdeps.h"
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
/* Output for big-endian target if true, little-endian is false. */
int do_bigendian;
typedef int DEPTH_T;
#define DEPTH_8BPP 0
#define DEPTH_16BPP 1
#define DEPTH_32BPP 2
#define DEPTH_MAX DEPTH_32BPP
static const char *get_depth_str (DEPTH_T bpp)
{
if (bpp == DEPTH_8BPP)
return "8";
else if (bpp == DEPTH_16BPP)
return "16";
else
return "32";
}
static const char *get_depth_type_str (DEPTH_T bpp)
{
if (bpp == DEPTH_8BPP)
return "uae_u8";
else if (bpp == DEPTH_16BPP)
return "uae_u16";
else
return "uae_u32";
}
typedef int HMODE_T;
#define HMODE_NORMAL 0
#define HMODE_DOUBLE 1
#define HMODE_DOUBLE2X 2
#define HMODE_HALVE1 3
#define HMODE_HALVE1F 4
#define HMODE_HALVE2 5
#define HMODE_HALVE2F 6
#define HMODE_MAX HMODE_HALVE2F
static const char *get_hmode_str (HMODE_T hmode)
{
if (hmode == HMODE_DOUBLE)
return "_stretch1";
else if (hmode == HMODE_DOUBLE2X)
return "_stretch2";
else if (hmode == HMODE_HALVE1)
return "_shrink1";
else if (hmode == HMODE_HALVE1F)
return "_shrink1f";
else if (hmode == HMODE_HALVE2)
return "_shrink2";
else if (hmode == HMODE_HALVE2F)
return "_shrink2f";
else
return "";
}
typedef enum
{
CMODE_NORMAL,
CMODE_DUALPF,
CMODE_EXTRAHB,
CMODE_EXTRAHB_ECS_KILLEHB,
CMODE_HAM
} CMODE_T;
#define CMODE_MAX CMODE_HAM
static FILE *outfile;
static unsigned int outfile_indent = 0;
static void set_outfile (FILE *f)
{
outfile = f;
}
static int set_indent (int indent)
{
int old_indent = outfile_indent;
outfile_indent = indent;
return old_indent;
}
static void outindent(void)
{
unsigned int i;
for (i = 0; i < outfile_indent; i++)
fputc(' ', outfile);
}
static void outf(const char *s, ...)
{
va_list ap;
va_start(ap, s);
vfprintf(outfile, s, ap);
}
static void outln (const char *s)
{
outindent();
fprintf (outfile, "%s\n", s);
}
static void outlnf (const char *s, ...)
{
va_list ap;
outindent();
va_start (ap, s);
vfprintf (outfile, s, ap);
fputc ('\n', outfile);
}
static void out_linetoscr_decl (DEPTH_T bpp, HMODE_T hmode, int aga, int spr, int genlock)
{
if (spr < 0) {
outlnf("static int NOINLINE linetoscr_%s%s%s%s%s(int spix, int dpix, int dpix_end, int blank)",
get_depth_str(bpp),
get_hmode_str(hmode), aga ? "_aga" : "", "_spronly", genlock ? "_genlock" : "");
} else {
outlnf("static int NOINLINE linetoscr_%s%s%s%s%s(int spix, int dpix, int dpix_end)",
get_depth_str(bpp),
get_hmode_str(hmode), aga ? "_aga" : "", spr > 0 ? "_spr" : "", genlock ? "_genlock" : "");
}
}
static void out_linetoscr_do_srcpix (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_T cmode, int spr)
{
if (spr < 0) {
outln ( " sprpix_val = 0;");
} else {
if (aga && cmode != CMODE_DUALPF) {
if (spr)
outln ( " sprpix_val = pixdata.apixels[spix];");
if (cmode != CMODE_HAM)
outln ( " spix_val = (pixdata.apixels[spix] ^ xor_val) & and_val;");
} else if (cmode != CMODE_HAM) {
outln ( " spix_val = pixdata.apixels[spix];");
if (spr)
outln ( " sprpix_val = spix_val;");
}
}
}
static void out_linetoscr_do_dstpix (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_T cmode, int spr)
{
if (spr < 0)
return;
if (aga && cmode == CMODE_HAM) {
outln ( " spix_val = ham_linebuf[spix];");
outln ( " dpix_val = CONVERT_RGB (spix_val);");
} else if (cmode == CMODE_HAM) {
outln ( " spix_val = ham_linebuf[spix];");
outln ( " dpix_val = p_xcolors[spix_val];");
if (spr)
outln ( " sprpix_val = pixdata.apixels[spix];");
} else if (aga && cmode == CMODE_DUALPF) {
outln ( " {");
outln ( " uae_u8 val = lookup[spix_val];");
outln ( " if (lookup_no[spix_val])");
outln ( " val += dblpfofs[bpldualpf2of];");
outln ( " val ^= xor_val;");
outln ( " dpix_val = p_acolors[val];");
outln ( " }");
} else if (cmode == CMODE_DUALPF) {
outln ( " dpix_val = p_acolors[lookup[spix_val]];");
} else if (aga && cmode == CMODE_EXTRAHB) {
outln ( " if (pixdata.apixels[spix] & 0x20) {");
outln ( " unsigned int c = (colors_for_drawing.color_regs_aga[spix_val & 0x1f] >> 1) & 0x7F7F7F;");
outln ( " dpix_val = CONVERT_RGB (c);");
outln ( " } else");
outln ( " dpix_val = p_acolors[spix_val];");
} else if (cmode == CMODE_EXTRAHB) {
outln(" if (spix_val <= 31)");
outln(" dpix_val = p_acolors[spix_val];");
outln(" else");
outln(" dpix_val = p_xcolors[(colors_for_drawing.color_regs_ecs[spix_val - 32] >> 1) & 0x777];");
} else if (cmode == CMODE_EXTRAHB_ECS_KILLEHB) {
outln(" dpix_val = p_acolors[spix_val & 31];");
} else
outln ( " dpix_val = p_acolors[spix_val];");
}
static void out_linetoscr_do_incspix (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_T cmode, int spr)
{
if (spr < 0) {
outln(" spix++;");
return;
}
if (hmode == HMODE_HALVE1F) {
outln ( " {");
outln ( " uae_u32 tmp_val;");
outln ( " spix++;");
outln ( " tmp_val = dpix_val;");
out_linetoscr_do_srcpix (bpp, hmode, aga, cmode, spr);
out_linetoscr_do_dstpix (bpp, hmode, aga, cmode, spr);
outlnf ( " dpix_val = merge_2pixel%d (dpix_val, tmp_val);", bpp == 0 ? 8 : bpp == 1 ? 16 : 32);
outln ( " spix++;");
outln ( " }");
} else if (hmode == HMODE_HALVE2F) {
outln ( " {");
outln ( " uae_u32 tmp_val, tmp_val2, tmp_val3;");
outln ( " spix++;");
outln ( " tmp_val = dpix_val;");
out_linetoscr_do_srcpix (bpp, hmode, aga, cmode, spr);
out_linetoscr_do_dstpix (bpp, hmode, aga, cmode, spr);
outln ( " spix++;");
outln ( " tmp_val2 = dpix_val;");
out_linetoscr_do_srcpix (bpp, hmode, aga, cmode, spr);
out_linetoscr_do_dstpix (bpp, hmode, aga, cmode, spr);
outln ( " spix++;");
outln ( " tmp_val3 = dpix_val;");
out_linetoscr_do_srcpix (bpp, hmode, aga, cmode, spr);
out_linetoscr_do_dstpix (bpp, hmode, aga, cmode, spr);
outlnf ( " tmp_val = merge_2pixel%d (tmp_val, tmp_val2);", bpp == 0 ? 8 : bpp == 1 ? 16 : 32);
outlnf ( " tmp_val2 = merge_2pixel%d (tmp_val3, dpix_val);", bpp == 0 ? 8 : bpp == 1 ? 16 : 32);
outlnf ( " dpix_val = merge_2pixel%d (tmp_val, tmp_val2);", bpp == 0 ? 8 : bpp == 1 ? 16 : 32);
outln ( " spix++;");
outln ( " }");
} else if (hmode == HMODE_HALVE1) {
outln ( " spix += 2;");
} else if (hmode == HMODE_HALVE2) {
outln ( " spix += 4;");
} else {
outln ( " spix++;");
}
}
static void put_dpixsprgenlock(int offset, int genlock, bool subpixel)
{
if (!genlock)
return;
if (offset && subpixel)
outlnf(" genlock_buf[dpix + %d] = get_genlock_transparency(sprcol);\n", offset);
else if (offset && !subpixel)
outlnf(" genlock_buf[dpix + %d] = genlock_buf[dpix];\n", offset);
else
outlnf(" genlock_buf[dpix] = get_genlock_transparency(sprcol);");
}
static void put_dpixgenlock(int offset, CMODE_T cmode, int aga, int genlock, const char *var2)
{
if (!genlock)
return;
outindent();
if (offset) {
outf(" genlock_buf[dpix + %d] = genlock_buf[dpix];\n", offset);
} else {
outf(" genlock_buf[dpix] = get_genlock_transparency(");
if (cmode == CMODE_EXTRAHB) {
outf("%s", var2 ? var2 : "spix_val & 31");
}
else if (cmode == CMODE_DUALPF) {
outf("%s", var2 ? var2 : "lookup[spix_val]");
}
else if (cmode == CMODE_HAM) {
if (aga) {
outf("%s", var2 ? var2 : "(spix_val >> 2) & 63");
}
else {
outf("%s", var2 ? var2 : "spix_val & 15");
}
}
else {
outf("%s", var2 ? var2 : "spix_val");
}
outf(");\n");
}
}
static void put_dpix (const char *var)
{
outlnf(" buf[dpix++] = %s;", var);
}
static void out_sprite (DEPTH_T bpp, HMODE_T hmode, CMODE_T cmode, int aga, int cnt, int spr, int genlock)
{
if (aga) {
if (cnt == 1) {
outlnf ( " if (spritepixels[dpix].data) {");
outlnf ( " sprcol = render_sprites (dpix + 0, %d, sprpix_val, %d);", cmode == CMODE_DUALPF ? 1 : 0, aga);
outlnf(" if (sprcol) {");
outlnf ( " out_val = p_acolors[sprcol];");
put_dpixsprgenlock(0, genlock, true);
outlnf(" }");
outlnf(" }");
put_dpix("out_val");
} else if (cnt == 2) {
outlnf ( " {");
outlnf ( " uae_u32 out_val1 = out_val;");
outlnf ( " uae_u32 out_val2 = out_val;");
outlnf(" if (spritepixels[dpix + 0].data) {");
outlnf ( " sprcol = render_sprites (dpix + 0, %d, sprpix_val, %d);", cmode == CMODE_DUALPF ? 1 : 0, aga);
outlnf ( " if (sprcol) {");
outlnf ( " out_val1 = p_acolors[sprcol];");
put_dpixsprgenlock(0, genlock, true);
outlnf(" }");
outlnf(" }");
outlnf ( " if (spritepixels[dpix + 1].data) {");
outlnf ( " sprcol = render_sprites (dpix + 1, %d, sprpix_val, %d);", cmode == CMODE_DUALPF ? 1 : 0, aga);
outlnf ( " if (sprcol) {");
outlnf ( " out_val2 = p_acolors[sprcol];");
put_dpixsprgenlock(1, genlock, true);
outlnf(" }");
outlnf(" }");
put_dpix("out_val1");
put_dpix("out_val2");
outlnf ( " }");
} else if (cnt == 4) {
outlnf ( " {");
outlnf ( " uae_u32 out_val1 = out_val;");
outlnf ( " uae_u32 out_val2 = out_val;");
outlnf ( " uae_u32 out_val3 = out_val;");
outlnf ( " uae_u32 out_val4 = out_val;");
outlnf(" if (spritepixels[dpix + 0].data) {");
outlnf ( " sprcol = render_sprites (dpix + 0, %d, sprpix_val, %d);", cmode == CMODE_DUALPF ? 1 : 0, aga);
outlnf ( " if (sprcol) {");
outlnf ( " out_val1 = p_acolors[sprcol];");
put_dpixsprgenlock(0, genlock, true);
outlnf(" }");
outlnf(" }");
outlnf ( " if (spritepixels[dpix + 1].data) {");
outlnf ( " sprcol = render_sprites (dpix + 1, %d, sprpix_val, %d);", cmode == CMODE_DUALPF ? 1 : 0, aga);
outlnf ( " if (sprcol) {");
outlnf ( " out_val2 = p_acolors[sprcol];");
put_dpixsprgenlock(1, genlock, true);
outlnf(" }");
outlnf(" }");
outlnf ( " if (spritepixels[dpix + 2].data) {");
outlnf ( " sprcol = render_sprites (dpix + 2, %d, sprpix_val, %d);", cmode == CMODE_DUALPF ? 1 : 0, aga);
outlnf ( " if (sprcol) {");
outlnf ( " out_val3 = p_acolors[sprcol];");
put_dpixsprgenlock(2, genlock, true);
outlnf(" }");
outlnf(" }");
outlnf ( " if (spritepixels[dpix + 3].data) {");
outlnf ( " sprcol = render_sprites (dpix + 3, %d, sprpix_val, %d);", cmode == CMODE_DUALPF ? 1 : 0, aga);
outlnf ( " if (sprcol) {");
outlnf ( " out_val4 = p_acolors[sprcol];");
put_dpixsprgenlock(3, genlock, true);
outlnf(" }");
outlnf(" }");
put_dpix("out_val1");
put_dpix("out_val2");
put_dpix("out_val3");
put_dpix("out_val4");
outlnf ( " }");
}
} else {
outlnf ( " if (spritepixels[dpix].data) {");
outlnf ( " sprcol = render_sprites (dpix, %d, sprpix_val, %d);", cmode == CMODE_DUALPF ? 1 : 0, aga);
outlnf(" if (sprcol) {");
outlnf ( " uae_u32 spcol = p_acolors[sprcol];");
outlnf ( " out_val = spcol;");
for (int i = 0; i < cnt; i++) {
put_dpixsprgenlock(i, genlock, false);
}
outlnf ( " }");
outlnf ( " }");
for (int i = 0; i < cnt; i++) {
put_dpix("out_val");
}
}
}
static void out_linetoscr_mode (DEPTH_T bpp, HMODE_T hmode, int aga, int spr, CMODE_T cmode, int genlock)
{
int old_indent = set_indent (8);
if (aga && cmode == CMODE_DUALPF) {
outln ( "int *lookup = bpldualpfpri ? dblpf_ind2_aga : dblpf_ind1_aga;");
outln ( "int *lookup_no = bpldualpfpri ? dblpf_2nd2 : dblpf_2nd1;");
} else if (cmode == CMODE_DUALPF)
outln ( "int *lookup = bpldualpfpri ? dblpf_ind2 : dblpf_ind1;");
if (bpp == DEPTH_16BPP && hmode != HMODE_DOUBLE && hmode != HMODE_DOUBLE2X && spr == 0) {
outln ( "int rem;");
outln ( "if (((uintptr_t)&buf[dpix]) & 2) {");
outln ( " uae_u32 spix_val;");
outln ( " uae_u32 dpix_val;");
out_linetoscr_do_srcpix (bpp, hmode, aga, cmode, spr);
out_linetoscr_do_dstpix (bpp, hmode, aga, cmode, spr);
out_linetoscr_do_incspix (bpp, hmode, aga, cmode, spr);
put_dpix("dpix_val");
outln ( "}");
outln ( "if (dpix >= dpix_end)");
outln ( " return spix;");
outln ( "rem = (((uintptr_t)&buf[dpix_end]) & 2);");
outln ( "if (rem)");
outln ( " dpix_end--;");
}
outln ( "while (dpix < dpix_end) {");
if (spr)
outln ( " uae_u32 sprpix_val;");
if (spr >= 0) {
outln ( " uae_u32 spix_val;");
outln ( " uae_u32 dpix_val;");
}
outln ( " uae_u32 out_val;");
outln ( "");
out_linetoscr_do_srcpix (bpp, hmode, aga, cmode, spr);
out_linetoscr_do_dstpix (bpp, hmode, aga, cmode, spr);
out_linetoscr_do_incspix (bpp, hmode, aga, cmode, spr);
if (spr >= 0)
outln ( " out_val = dpix_val;");
else
outln ( " out_val = blank ? 0 : p_acolors[0];");
if (hmode == HMODE_DOUBLE) {
put_dpixgenlock(0, cmode, aga, genlock, NULL);
put_dpixgenlock(1, cmode, aga, genlock, NULL);
} else if (hmode == HMODE_DOUBLE2X) {
put_dpixgenlock(0, cmode, aga, genlock, NULL);
put_dpixgenlock(1, cmode, aga, genlock, NULL);
put_dpixgenlock(2, cmode, aga, genlock, NULL);
put_dpixgenlock(3, cmode, aga, genlock, NULL);
} else {
put_dpixgenlock(0, cmode, aga, genlock, NULL);
}
if (hmode != HMODE_DOUBLE && hmode != HMODE_DOUBLE2X && bpp == DEPTH_16BPP && spr == 0) {
out_linetoscr_do_srcpix (bpp, hmode, aga, cmode, spr);
out_linetoscr_do_dstpix (bpp, hmode, aga, cmode, spr);
out_linetoscr_do_incspix (bpp, hmode, aga, cmode, spr);
if (do_bigendian)
outln ( " out_val = (out_val << 16) | (dpix_val & 0xFFFF);");
else
outln ( " out_val = (out_val & 0xFFFF) | (dpix_val << 16);");
}
if (hmode == HMODE_DOUBLE) {
if (bpp == DEPTH_8BPP) {
outln ( " *((uae_u16 *)&buf[dpix]) = (uae_u16) out_val;");
outln ( " dpix += 2;");
} else if (bpp == DEPTH_16BPP) {
if (spr) {
out_sprite(bpp, hmode, cmode, aga, 2, spr, genlock);
} else {
outln ( " *((uae_u32 *)&buf[dpix]) = out_val;");
outln ( " dpix += 2;");
}
} else {
if (spr) {
out_sprite(bpp, hmode, cmode, aga, 2, spr, genlock);
} else {
put_dpix("out_val");
put_dpix("out_val");
}
}
} else if (hmode == HMODE_DOUBLE2X) {
if (bpp == DEPTH_8BPP) {
outln ( " *((uae_u32 *)&buf[dpix]) = (uae_u32) out_val;");
outln ( " dpix += 4;");
} else if (bpp == DEPTH_16BPP) {
if (spr) {
out_sprite(bpp, hmode, cmode, aga, 4, spr, genlock);
} else {
outln ( " *((uae_u32 *)&buf[dpix]) = out_val;");
outln ( " dpix += 2;");
outln ( " *((uae_u32 *)&buf[dpix]) = out_val;");
outln ( " dpix += 2;");
}
} else {
if (spr) {
out_sprite(bpp, hmode, cmode, aga, 4, spr, genlock);
} else {
put_dpix("out_val");
put_dpix("out_val");
put_dpix("out_val");
put_dpix("out_val");
}
}
} else {
if (bpp == DEPTH_16BPP) {
if (spr) {
out_sprite(bpp, hmode, cmode, aga, 1, spr, genlock);
} else {
outln ( " *((uae_u32 *)&buf[dpix]) = out_val;");
outln ( " dpix += 2;");
}
} else {
if (spr) {
out_sprite(bpp, hmode, cmode, aga, 1, spr, genlock);
} else {
put_dpix("out_val");
}
}
}
outln ( "}");
if (bpp == DEPTH_16BPP && hmode != HMODE_DOUBLE && hmode != HMODE_DOUBLE2X && spr == 0) {
outln ( "if (rem) {");
outln ( " uae_u32 spix_val;");
outln ( " uae_u32 dpix_val;");
out_linetoscr_do_srcpix (bpp, hmode, aga, cmode, spr);
out_linetoscr_do_dstpix (bpp, hmode, aga, cmode, spr);
out_linetoscr_do_incspix (bpp, hmode, aga, cmode, spr);
put_dpix("dpix_val");
outln ( "}");
}
set_indent (old_indent);
return;
}
static void out_linetoscr (DEPTH_T bpp, HMODE_T hmode, int aga, int spr, int genlock)
{
if (aga)
outln ("#ifdef AGA");
out_linetoscr_decl (bpp, hmode, aga, spr, genlock);
outln ( "{");
outlnf ( " %s *buf = (%s *) xlinebuffer;", get_depth_type_str (bpp), get_depth_type_str (bpp));
if (genlock)
outlnf(" uae_u8 *genlock_buf = xlinebuffer_genlock;");
if (spr)
outln ( " uae_u8 sprcol;");
if (aga && spr >= 0) {
outln(" uae_u8 xor_val = bplxor;");
outln(" uae_u8 and_val = bpland;");
}
outln ( "");
if (spr >= 0) {
outln(" switch(bplmode)");
outln(" {");
outln(" case CMODE_NORMAL:");
outln(" {");
out_linetoscr_mode(bpp, hmode, aga, spr, CMODE_NORMAL, genlock);
outln(" }");
outln(" break;");
outln(" case CMODE_HAM:");
outln(" {");
out_linetoscr_mode(bpp, hmode, aga, spr, CMODE_HAM, genlock);
outln(" }");
outln(" break;");
outln(" case CMODE_DUALPF:");
outln(" {");
out_linetoscr_mode(bpp, hmode, aga, spr, CMODE_DUALPF, genlock);
outln(" }");
outln(" break;");
outln(" case CMODE_EXTRAHB:");
outln(" {");
out_linetoscr_mode(bpp, hmode, aga, spr, CMODE_EXTRAHB, genlock);
outln(" }");
outln(" break;");
if (!aga) {
// ECS Denise with KILLEHB set
outln(" case CMODE_EXTRAHB_ECS_KILLEHB:");
outln(" {");
out_linetoscr_mode(bpp, hmode, aga, spr, CMODE_EXTRAHB_ECS_KILLEHB, genlock);
outln(" }");
outln(" break;");
}
} else {
outln ( " if (1) {");
out_linetoscr_mode(bpp, hmode, aga, spr, CMODE_NORMAL, genlock);
}
outln ( " }\n");
outln ( " return spix;");
outln ( "}");
if (aga)
outln ( "#endif");
outln ( "");
}
int main (int argc, char *argv[])
{
DEPTH_T bpp;
int aga, spr;
HMODE_T hmode;
do_bigendian = 0;
for (int i = 1; i < argc; i++) {
if (argv[i][0] != '-')
continue;
if (argv[i][1] == 'b' && argv[i][2] == '\0')
do_bigendian = 1;
}
set_outfile (stdout);
outln ("/*");
outln (" * UAE - The portable Amiga emulator.");
outln (" *");
outln (" * This file was generated by genlinetoscr. Don't edit.");
outln (" */");
outln ("");
for (bpp = DEPTH_16BPP; bpp <= DEPTH_MAX; bpp++) {
for (aga = 0; aga <= 1 ; aga++) {
if (aga && bpp == DEPTH_8BPP)
continue;
for (spr = -1; spr <= 1; spr++) {
if (!aga && spr < 0)
continue;
for (hmode = HMODE_NORMAL; hmode <= HMODE_MAX; hmode++) {
out_linetoscr(bpp, hmode, aga, spr, 0);
if (spr >= 0)
out_linetoscr(bpp, hmode, aga, spr, 1);
}
}
}
}
return 0;
}

File diff suppressed because it is too large Load Diff

1680
src/gfxlib.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,7 @@
#include "custom.h"
#include "rtgmodes.h"
#include "xwin.h"
//#include "gfxfilter.h"
#include "gfxfilter.h"
#include "machdep/maccess.h"
#include <math.h>
@ -144,9 +144,16 @@ static void video_calc_gammatable(int monid)
float bri, con, gam, gams[3];
float max = 255;
bri = ((float)(currprefs.gfx_luminance)) * (128.0f / 1000.0f);
con = ((float)(currprefs.gfx_contrast + 1000)) / 1000.0f;
gam = ((float)(1000 - currprefs.gfx_gamma)) / 1000.0f - 1.0;
if (gfx_hdr) {
bri = 0.0;
con = 1.0;
gam = 0.0;
} else {
bri = ((float)(currprefs.gfx_luminance)) * (128.0f / 1000.0f);
con = ((float)(currprefs.gfx_contrast + 1000)) / 1000.0f;
gam = ((float)(1000 - currprefs.gfx_gamma)) / 1000.0f - 1.0f;
}
gams[0] = gam + ((float)(1000 - currprefs.gfx_gamma_ch[0])) / 1000.0f;
gams[1] = gam + ((float)(1000 - currprefs.gfx_gamma_ch[1])) / 1000.0f;
gams[2] = gam + ((float)(1000 - currprefs.gfx_gamma_ch[2])) / 1000.0f;
@ -167,8 +174,8 @@ static void video_calc_gammatable(int monid)
val = (float)((val * 252.0) / 238.0);
}
if (currprefs.gfx_luminance == 0 && currprefs.gfx_contrast == 0 && currprefs.gfx_gamma == 0 &&
currprefs.gfx_gamma_ch[0] == 0 && currprefs.gfx_gamma_ch[1] == 0 && currprefs.gfx_gamma_ch[2] == 0) {
if (gfx_hdr || (currprefs.gfx_luminance == 0 && currprefs.gfx_contrast == 0 && currprefs.gfx_gamma == 0 &&
currprefs.gfx_gamma_ch[0] == 0 && currprefs.gfx_gamma_ch[1] == 0 && currprefs.gfx_gamma_ch[2] == 0)) {
v = val;
} else {
v = video_gamma(val, gams[j], bri, con);
@ -187,7 +194,9 @@ static void video_calc_gammatable(int monid)
static uae_u32 limit256(int monid, float v)
{
struct amigadisplay *ad = &adisplays[monid];
v = v * (float)(currprefs.gf[ad->picasso_on].gfx_filter_contrast + 1000) / 1000.0f + currprefs.gf[ad->picasso_on].gfx_filter_luminance / 10.0f;
if (!gfx_hdr) {
v = v * (float)(currprefs.gf[ad->gf_index].gfx_filter_contrast + 1000) / 1000.0f + currprefs.gf[ad->gf_index].gfx_filter_luminance / 10.0f;
}
if (v < 0)
v = 0;
if (v > 255)
@ -197,7 +206,9 @@ static uae_u32 limit256(int monid, float v)
static uae_s32 limit256rb(int monid, float v)
{
struct amigadisplay *ad = &adisplays[monid];
v *= (float)(currprefs.gf[ad->picasso_on].gfx_filter_saturation + 1000) / 1000.0f;
if (!gfx_hdr) {
v *= (float)(currprefs.gf[ad->gf_index].gfx_filter_saturation + 1000) / 1000.0f;
}
if (v < -128)
v = -128;
if (v > 127)
@ -320,7 +331,7 @@ void alloc_colors_picasso (int rw, int gw, int bw, int rs, int gs, int bs, int r
int lbmask = (1 << blue_bits) - 1;
for (i = 65535; i >= 0; i--) {
uae_u32 r, g, b, c;
uae_u32 j = byte_swap ? bswap_16(i) : i;
uae_u32 j = byte_swap ? do_byteswap_16(i) : i;
r = (((j >> red_shift) & lrmask) << lrbits) | lowbits (j, red_shift, lrbits);
g = (((j >> green_shift) & lgmask) << lgbits) | lowbits (j, green_shift, lgbits);
b = (((j >> blue_shift) & lbmask) << lbbits) | lowbits (j, blue_shift, lbbits);
@ -341,7 +352,7 @@ void alloc_colors_rgb (int rw, int gw, int bw, int rs, int gs, int bs, int aw, i
for(i = 0; i < 256; i++) {
int j;
if (currprefs.gfx_blackerthanblack) {
if (!gfx_hdr && currprefs.gfx_blackerthanblack) {
j = i * 15 / 16 + 15;
} else {
j = i;
@ -353,13 +364,13 @@ void alloc_colors_rgb (int rw, int gw, int bw, int rs, int gs, int bs, int aw, i
bc[i] = doColor(uae_gamma[j][2], bw, bs) | doAlpha(alpha, aw, as);
if (byte_swap) {
if (bpp <= 16) {
rc[i] = bswap_16(rc[i]);
gc[i] = bswap_16(gc[i]);
bc[i] = bswap_16 (bc[i]);
rc[i] = do_byteswap_16(rc[i]);
gc[i] = do_byteswap_16(gc[i]);
bc[i] = do_byteswap_16 (bc[i]);
} else {
rc[i] = bswap_32(rc[i]);
gc[i] = bswap_32(gc[i]);
bc[i] = bswap_32(bc[i]);
rc[i] = do_byteswap_32(rc[i]);
gc[i] = do_byteswap_32(gc[i]);
bc[i] = do_byteswap_32(bc[i]);
}
}
if (bpp <= 16) {
@ -384,7 +395,7 @@ void alloc_colors64k(int monid, int rw, int gw, int bw, int rs, int gs, int bs,
int g = (((i >> 4) & 0xf) << 4) | ((i >> 4) & 0x0f);
int b = ((i & 0xf) << 4) | (i & 0x0f);
if (currprefs.gfx_blackerthanblack) {
if (!gfx_hdr && currprefs.gfx_blackerthanblack) {
r = (r * (255 - 8) / 255) + 8;
g = (g * (255 - 8) / 255) + 8;
b = (b * (255 - 8) / 255) + 8;
@ -396,9 +407,9 @@ void alloc_colors64k(int monid, int rw, int gw, int bw, int rs, int gs, int bs,
xcolors[i] = doMask(r, rw, rs) | doMask(g, gw, gs) | doMask(b, bw, bs) | doAlpha(alpha, aw, as);
if (byte_swap) {
if (bpp <= 16) {
xcolors[i] = bswap_16(xcolors[i]);
xcolors[i] = do_byteswap_16(xcolors[i]);
} else {
xcolors[i] = bswap_32(xcolors[i]);
xcolors[i] = do_byteswap_32(xcolors[i]);
}
}
if (bpp <= 16) {
@ -407,10 +418,10 @@ void alloc_colors64k(int monid, int rw, int gw, int bw, int rs, int gs, int bs,
xcolors[i] |= xcolors[i] * 0x00010001;
}
}
//fullblack = 0;
//if (gfx_hdr) {
// fullblack = doAlpha(1, aw, as);
//}
fullblack = 0;
if (gfx_hdr) {
fullblack = doAlpha(1, aw, as);
}
#if defined(AGA) || defined(GFXFILTER)
alloc_colors_rgb (rw, gw, bw, rs, gs, bs, aw, as, alpha, byte_swap, xredcolors, xgreencolors, xbluecolors);
@ -459,9 +470,9 @@ void alloc_colors64k(int monid, int rw, int gw, int bw, int rs, int gs, int bs,
xcolors[i] = doMask(r, 5, 11) | doMask(g, 6, 5) | doMask(b, 5, 0);
if (byte_swap) {
if (bpp <= 16)
xcolors[i] = bswap_16(xcolors[i]);
xcolors[i] = do_byteswap_16(xcolors[i]);
else
xcolors[i] = bswap_32(xcolors[i]);
xcolors[i] = do_byteswap_32(xcolors[i]);
}
if (bpp <= 16) {
/* Fill upper 16 bits of each colour value

View File

@ -13,22 +13,22 @@
struct bltinfo {
int blitzero;
int blitashift, blitbshift, blitdownashift, blitdownbshift;
uae_u16 bltadat, bltbdat, bltcdat, bltddat;
uae_u16 bltaold, bltahold, bltbold, bltbhold, bltafwm, bltalwm;
int vblitsize, hblitsize;
int bltamod, bltbmod, bltcmod, bltdmod;
int got_cycle;
int nasty_cnt, wait_nasty;
int blitter_nasty, blit_interrupt;
// blitter is active and D may write to visible bitplane addresses
int blitter_dangerous_bpl;
int blit_main, blit_finald, blit_pending;
int blit_queued;
int finishhpos;
};
extern enum blitter_states {
BLT_done, BLT_init, BLT_read, BLT_work, BLT_write, BLT_next
} bltstate;
extern struct bltinfo blt_info;
extern int blitter_nasty, blit_interrupt, blitter_dangerous_bpl;
extern void check_is_blit_dangerous(uaecptr *bplpt, int planes, int words);
extern uae_u16 bltsize;
@ -36,24 +36,22 @@ extern uae_u16 bltcon0, bltcon1;
extern uae_u32 bltapt, bltbpt, bltcpt, bltdpt;
extern uae_u32 bltptx;
extern int bltptxpos, bltptxc;
extern int blit_singlechannel;
extern void maybe_blit(int, int);
extern void reset_blit(int);
extern int blitnasty(void);
extern int blitnnasty(int);
extern void blitter_handler(uae_u32);
extern void build_blitfilltable(void);
extern void do_blitter(int, int, uaecptr);
extern void decide_blitter(int hpos);
extern int blitter_need(int hpos);
extern void blitter_done_notify(int hpos);
extern bool decide_blitter_maybe_write(int hpos, uaecptr addr, uae_u32 v);
extern void blitter_done_notify(int);
extern void blitter_slowdown(int, int, int, int);
extern int blitter_channel_state(void);
extern void blitter_check_start(void);
extern void blitter_reset(void);
extern void blitter_debugdump(void);
extern void restore_blitter_start(void);
extern void set_blitter_last(int);
typedef void blitter_func(uaecptr, uaecptr, uaecptr, uaecptr, struct bltinfo *);
@ -63,9 +61,4 @@ extern blitter_func *const blitfunc_dofast[256];
extern blitter_func *const blitfunc_dofast_desc[256];
extern uae_u32 blit_masktable[BLITTER_MAX_WORDS];
#define BLIT_MODE_IMMEDIATE -1
#define BLIT_MODE_APPROXIMATE 0
#define BLIT_MODE_COMPATIBLE 1
#define BLIT_MODE_EXACT 2
#endif /* UAE_BLITTER_H */

99
src/include/catweasel.h Normal file
View File

@ -0,0 +1,99 @@
#ifndef UAE_CATWEASEL_H
#define UAE_CATWEASEL_H
#ifdef CATWEASEL
extern struct catweasel_contr cwc;
extern int catweasel_read_keyboard (uae_u8 *keycode);
extern int catweasel_init (void);
extern void catweasel_free (void);
extern int catweasel_detect (void);
extern uae_u32 catweasel_do_bget (uaecptr addr);
extern void catweasel_do_bput (uaecptr addr, uae_u32 b);
extern int catweasel_read_joystick (uae_u8 *dir, uae_u8 *buttons);
extern void catweasel_hsync (void);
extern int catweasel_isjoystick(void);
extern int catweasel_ismouse(void);
extern int catweasel_read_mouse(int port, int *dx, int *dy, int *buttons);
typedef struct catweasel_drive {
struct catweasel_contr *contr; /* The controller this drive belongs to */
int number; /* Drive number: 0 or 1 */
int type; /* 0 = not present, 1 = 3.5" */
int track; /* current r/w head position (0..79) */
int diskindrive; /* 0 = no disk, 1 = disk in drive */
int wprot; /* 0 = not, 1 = write protected */
unsigned char sel;
unsigned char mot;
} catweasel_drive;
typedef struct catweasel_contr {
int type; /* see CATWEASEL_TYPE_* defines below */
int direct_access;
int direct_type;
int iobase; /* 0 = not present (factory default is 0x320) */
void (*msdelay)(int ms); /* microseconds delay routine, provided by host program */
catweasel_drive drives[2]; /* at most two drives on each controller */
int control_register; /* contents of control register */
unsigned char crm_sel0; /* bit masks for the control / status register */
unsigned char crm_sel1;
unsigned char crm_mot0;
unsigned char crm_mot1;
unsigned char crm_dir;
unsigned char crm_step;
unsigned char srm_trk0;
unsigned char srm_dchg;
unsigned char srm_writ;
unsigned char srm_dskready;
int io_sr; /* IO port of control / status register */
int io_mem; /* IO port of memory register */
int sid[2];
int can_sid, can_mouse, can_joy, can_kb;
} catweasel_contr;
#define CATWEASEL_TYPE_NONE -1
#define CATWEASEL_TYPE_MK1 1
#define CATWEASEL_TYPE_MK3 3
#define CATWEASEL_TYPE_MK4 4
/* Initialize a Catweasel controller; c->iobase and c->msdelay must have
been initialized -- msdelay might be used */
void catweasel_init_controller(catweasel_contr *c);
/* Reset the controller */
void catweasel_free_controller(catweasel_contr *c);
/* Set current drive select mask */
void catweasel_select(catweasel_contr *c, int dr0, int dr1);
/* Start/stop the drive's motor */
void catweasel_set_motor(catweasel_drive *d, int on);
/* Move the r/w head */
int catweasel_step(catweasel_drive *d, int dir);
/* Check for a disk change and update d->diskindrive
-- msdelay might be used. Returns 1 == disk has been changed */
int catweasel_disk_changed(catweasel_drive *d);
/* Check if disk in selected drive is write protected. */
int catweasel_write_protected(catweasel_drive *d);
/* Read data -- msdelay will be used */
int catweasel_read(catweasel_drive *d, int side, int clock, int time);
/* Write data -- msdelay will be used. If time == -1, the write will
be started at the index pulse and stopped at the next index pulse,
or earlier if the Catweasel RAM contains a 128 end byte. The
function returns after the write has finished. */
int catweasel_write(catweasel_drive *d, int side, int clock, int time);
int catweasel_fillmfm (catweasel_drive *d, uae_u16 *mfm, int side, int clock, int rawmode);
int catweasel_diskready(catweasel_drive *d);
int catweasel_track0(catweasel_drive *d);
#endif /* CATWEASEL */
#endif /* UAE_CATWEASEL_H */

View File

@ -16,12 +16,13 @@ extern void CIA_vsync_prehandler(void);
extern void CIA_hsync_prehandler(void);
extern void CIA_hsync_posthandler(bool, bool);
extern void CIA_handler(void);
extern void CIAA_tod_inc(int);
extern void CIAA_tod_handler(int);
extern void CIAB_tod_handler(int);
extern void diskindex_handler (void);
extern void cia_parallelack (void);
extern void cia_diskindex (void);
extern void cia_adjust_eclock_phase(int);
extern void cia_set_eclockphase(void);
extern void dumpcia(void);
extern void rethink_cias(void);

View File

@ -377,16 +377,11 @@ STATIC_INLINE void do_cycles_ce000_internal(int clocks)
{
if (currprefs.m68k_speed < 0)
return;
x_do_cycles (clocks * CYCLE_UNIT / 2);
x_do_cycles (clocks * cpucycleunit);
}
STATIC_INLINE void do_cycles_ce000 (int clocks)
{
x_do_cycles (clocks * CYCLE_UNIT / 2);
}
STATIC_INLINE void ipl_fetch (void)
{
regs.ipl = regs.ipl_pin;
x_do_cycles (clocks * cpucycleunit);
}
uae_u32 mem_access_delay_word_read (uaecptr addr);

View File

@ -74,6 +74,7 @@ void cpuboard_gvpmaprom(int);
#define BOARD_GVP_SUB_A1230SI 6
#define BOARD_GVP_SUB_A1230SII 7
#define BOARD_GVP_SUB_QUIKPAK 8
#define BOARD_GVP_SUB_TREXII 9
#define BOARD_KUPKE 6

View File

@ -29,20 +29,998 @@
#include "uae/types.h"
#define MMU_ICACHE 0
#define MMU_IPAGECACHE 1
#define MMU_DPAGECACHE 1
#define CACHE_HIT_COUNT 0
#include "mmu_common.h"
#ifndef FULLMMU
#define FULLMMU
#endif
#define DUNUSED(x)
#define D
static __inline void flush_internals (void) { }
extern int mmu060_state;
extern int mmu040_movem;
extern uaecptr mmu040_movem_ea;
extern uae_u32 mmu040_move16[4];
extern bool mmu_pagesize_8k;
extern int mmu_pageshift, mmu_pageshift1m;
extern uae_u16 mmu_opcode;
extern bool mmu_restart;
extern bool mmu_ttr_enabled, mmu_ttr_enabled_ins, mmu_ttr_enabled_data;
extern bool rmw_cycle;
extern uae_u8 mmu_cache_state;
extern uae_u8 cache_default_ins, cache_default_data;
extern void mmu_dump_tables(void);
#define MMU_TTR_LOGICAL_BASE 0xff000000
#define MMU_TTR_LOGICAL_MASK 0x00ff0000
#define MMU_TTR_BIT_ENABLED (1 << 15)
#define MMU_TTR_BIT_SFIELD_ENABLED (1 << 14)
#define MMU_TTR_BIT_SFIELD_SUPER (1 << 13)
#define MMU_TTR_SFIELD_SHIFT 13
#define MMU_TTR_UX_MASK ((1 << 9) | (1 << 8))
#define MMU_TTR_UX_SHIFT 8
#define MMU_TTR_CACHE_MASK ((1 << 6) | (1 << 5))
#define MMU_TTR_CACHE_SHIFT 5
#define MMU_TTR_CACHE_DISABLE (1 << 6)
#define MMU_TTR_CACHE_MODE (1 << 5)
#define MMU_TTR_BIT_WRITE_PROTECT (1 << 2)
#define MMU_UDT_MASK 3
#define MMU_PDT_MASK 3
#define MMU_DES_WP 4
#define MMU_DES_USED 8
/* page descriptors only */
#define MMU_DES_MODIFIED 16
#define MMU_DES_SUPER (1 << 7)
#define MMU_DES_GLOBAL (1 << 10)
#define MMU_ROOT_PTR_ADDR_MASK 0xfffffe00
#define MMU_PTR_PAGE_ADDR_MASK_8 0xffffff80
#define MMU_PTR_PAGE_ADDR_MASK_4 0xffffff00
#define MMU_PAGE_INDIRECT_MASK 0xfffffffc
#define MMU_PAGE_ADDR_MASK_8 0xffffe000
#define MMU_PAGE_ADDR_MASK_4 0xfffff000
#define MMU_PAGE_UR_MASK_8 ((1 << 12) | (1 << 11))
#define MMU_PAGE_UR_MASK_4 (1 << 11)
#define MMU_PAGE_UR_SHIFT 11
#define MMU_MMUSR_ADDR_MASK 0xfffff000
#define MMU_MMUSR_B (1 << 11)
#define MMU_MMUSR_G (1 << 10)
#define MMU_MMUSR_U1 (1 << 9)
#define MMU_MMUSR_U0 (1 << 8)
#define MMU_MMUSR_Ux (MMU_MMUSR_U1 | MMU_MMUSR_U0)
#define MMU_MMUSR_S (1 << 7)
#define MMU_MMUSR_CM ((1 << 6) | ( 1 << 5))
#define MMU_MMUSR_CM_DISABLE (1 << 6)
#define MMU_MMUSR_CM_MODE (1 << 5)
#define MMU_MMUSR_M (1 << 4)
#define MMU_MMUSR_W (1 << 2)
#define MMU_MMUSR_T (1 << 1)
#define MMU_MMUSR_R (1 << 0)
// 68040 and 68060
#define MMU_TCR_E 0x8000
#define MMU_TCR_P 0x4000
// 68060 only
#define MMU_TCR_NAD 0x2000
#define MMU_TCR_NAI 0x1000
#define MMU_TCR_FOTC 0x0800
#define MMU_TCR_FITC 0x0400
#define MMU_TCR_DCO1 0x0200
#define MMU_TCR_DCO0 0x0100
#define MMU_TCR_DUO1 0x0080
#define MMU_TCR_DUO0 0x0040
#define MMU_TCR_DWO 0x0020
#define MMU_TCR_DCI1 0x0010
#define MMU_TCR_DCI0 0x0008
#define MMU_TCR_DUI1 0x0004
#define MMU_TCR_DUI0 0x0002
#define TTR_I0 4
#define TTR_I1 5
#define TTR_D0 6
#define TTR_D1 7
#define TTR_NO_MATCH 0
#define TTR_NO_WRITE 1
#define TTR_OK_MATCH 2
struct mmu_atc_line {
uaecptr tag; // tag is 16 or 17 bits S+logical
uae_u32 valid;
uae_u32 status;
uaecptr phys; // phys base address
};
/*
* 68040 ATC is a 4 way 16 slot associative address translation cache
* the 68040 has a DATA and an INSTRUCTION ATC.
* an ATC lookup may result in : a hit, a miss and a modified state.
* the 68060 can disable ATC allocation
* we must take care of 8k and 4k page size, index position is relative to page size
*/
#define ATC_WAYS 4
#define ATC_SLOTS 16
#define ATC_TYPE 2
extern uae_u32 mmu_is_super;
extern uae_u32 mmu_tagmask, mmu_pagemask, mmu_pagemaski;
extern struct mmu_atc_line mmu_atc_array[ATC_TYPE][ATC_SLOTS][ATC_WAYS];
extern void mmu_tt_modified(void);
extern int mmu_match_ttr_ins(uaecptr addr, bool super);
extern int mmu_match_ttr(uaecptr addr, bool super, bool data);
extern void mmu_bus_error_ttr_write_fault(uaecptr addr, bool super, bool data, uae_u32 val, int size);
extern int mmu_match_ttr_write(uaecptr addr, bool super, bool data, uae_u32 val, int size);
extern int mmu_match_ttr_maybe_write(uaecptr addr, bool super, bool data, int size, bool write);
extern uaecptr mmu_translate(uaecptr addr, uae_u32 val, bool super, bool data, bool write, int size);
extern void mmu_hardware_bus_error(uaecptr addr, uae_u32 v, bool read, bool ins, int size);
extern bool mmu_is_super_access(bool read);
extern uae_u32 REGPARAM3 mmu060_get_rmw_bitfield (uae_u32 src, uae_u32 bdata[2], uae_s32 offset, int width) REGPARAM;
extern void REGPARAM3 mmu060_put_rmw_bitfield (uae_u32 dst, uae_u32 bdata[2], uae_u32 val, uae_s32 offset, int width) REGPARAM;
extern uae_u16 REGPARAM3 mmu_get_word_unaligned(uaecptr addr, bool data) REGPARAM;
extern uae_u32 REGPARAM3 mmu_get_long_unaligned(uaecptr addr, bool data) REGPARAM;
extern uae_u32 REGPARAM3 mmu_get_ilong_unaligned(uaecptr addr) REGPARAM;
extern void REGPARAM3 mmu_put_word_unaligned(uaecptr addr, uae_u16 val, bool data) REGPARAM;
extern void REGPARAM3 mmu_put_long_unaligned(uaecptr addr, uae_u32 val, bool data) REGPARAM;
extern void mmu_make_transparent_region(uaecptr baseaddr, uae_u32 size, int datamode);
#define FC_DATA (regs.s ? 5 : 1)
#define FC_INST (regs.s ? 6 : 2)
extern void mmu_bus_error(uaecptr addr, uae_u32 val, int fc, bool write, int size, uae_u32 status, bool nonmmu);
extern uae_u32 REGPARAM3 sfc_get_long(uaecptr addr) REGPARAM;
extern uae_u16 REGPARAM3 sfc_get_word(uaecptr addr) REGPARAM;
extern uae_u8 REGPARAM3 sfc_get_byte(uaecptr addr) REGPARAM;
extern void REGPARAM3 dfc_put_long(uaecptr addr, uae_u32 val) REGPARAM;
extern void REGPARAM3 dfc_put_word(uaecptr addr, uae_u16 val) REGPARAM;
extern void REGPARAM3 dfc_put_byte(uaecptr addr, uae_u8 val) REGPARAM;
#define sfc040_get_long sfc_get_long
#define sfc040_get_word sfc_get_word
#define sfc040_get_byte sfc_get_byte
#define dfc040_put_long dfc_put_long
#define dfc040_put_word dfc_put_word
#define dfc040_put_byte dfc_put_byte
#define sfc060_get_long sfc_get_long
#define sfc060_get_word sfc_get_word
#define sfc060_get_byte sfc_get_byte
#define dfc060_put_long dfc_put_long
#define dfc060_put_word dfc_put_word
#define dfc060_put_byte dfc_put_byte
extern void uae_mmu_put_lrmw (uaecptr addr, uae_u32 v, int size, int type);
extern uae_u32 uae_mmu_get_lrmw (uaecptr addr, int size, int type);
extern void REGPARAM3 mmu_flush_atc(uaecptr addr, bool super, bool global) REGPARAM;
extern void REGPARAM3 mmu_flush_atc_all(bool global) REGPARAM;
extern void REGPARAM3 mmu_op_real(uae_u32 opcode, uae_u16 extra) REGPARAM;
extern void REGPARAM3 mmu_reset(void) REGPARAM;
extern void REGPARAM3 mmu_set_funcs(void) REGPARAM;
extern uae_u16 REGPARAM3 mmu_set_tc(uae_u16 tc) REGPARAM;
extern void REGPARAM3 mmu_set_super(bool super) REGPARAM;
extern void REGPARAM3 mmu_flush_cache(void) REGPARAM;
static ALWAYS_INLINE uaecptr mmu_get_real_address(uaecptr addr, struct mmu_atc_line *cl)
{
return cl->phys | (addr & mmu_pagemask);
}
extern void mmu_get_move16(uaecptr addr, uae_u32 *v, bool data, int size);
extern void mmu_put_move16(uaecptr addr, uae_u32 *val, bool data, int size);
#if MMU_IPAGECACHE
extern uae_u32 atc_last_ins_laddr, atc_last_ins_paddr;
extern uae_u8 atc_last_ins_cache;
#endif
#if MMU_DPAGECACHE
#define MMUFASTCACHE_ENTRIES 256
struct mmufastcache
{
uae_u32 log;
uae_u32 phys;
uae_u8 cache_state;
};
extern struct mmufastcache atc_data_cache_read[MMUFASTCACHE_ENTRIES];
extern struct mmufastcache atc_data_cache_write[MMUFASTCACHE_ENTRIES];
#endif
#if CACHE_HIT_COUNT
extern int mmu_ins_hit, mmu_ins_miss;
extern int mmu_data_read_hit, mmu_data_read_miss;
extern int mmu_data_write_hit, mmu_data_write_miss;
#endif
static ALWAYS_INLINE uae_u32 mmu_get_ilong(uaecptr addr, int size)
{
mmu_cache_state = cache_default_ins;
if ((!mmu_ttr_enabled_ins || mmu_match_ttr_ins(addr,regs.s!=0) == TTR_NO_MATCH) && regs.mmu_enabled) {
#if MMU_IPAGECACHE
if (((addr & mmu_pagemaski) | regs.s) == atc_last_ins_laddr) {
#if CACHE_HIT_COUNT
mmu_ins_hit++;
#endif
addr = atc_last_ins_paddr | (addr & mmu_pagemask);
mmu_cache_state = atc_last_ins_cache;
} else {
#if CACHE_HIT_COUNT
mmu_ins_miss++;
#endif
#endif
addr = mmu_translate(addr, 0, regs.s!=0, false, false, size);
#if MMU_IPAGECACHE
}
#endif
}
return x_phys_get_ilong(addr);
}
static ALWAYS_INLINE uae_u16 mmu_get_iword(uaecptr addr, int size)
{
mmu_cache_state = cache_default_ins;
if ((!mmu_ttr_enabled_ins || mmu_match_ttr_ins(addr,regs.s!=0) == TTR_NO_MATCH) && regs.mmu_enabled) {
#if MMU_IPAGECACHE
if (((addr & mmu_pagemaski) | regs.s) == atc_last_ins_laddr) {
#if CACHE_HIT_COUNT
mmu_ins_hit++;
#endif
addr = atc_last_ins_paddr | (addr & mmu_pagemask);
mmu_cache_state = atc_last_ins_cache;
} else {
#if CACHE_HIT_COUNT
mmu_ins_miss++;
#endif
#endif
addr = mmu_translate(addr, 0, regs.s!=0, false, false, size);
#if MMU_IPAGECACHE
}
#endif
}
return x_phys_get_iword(addr);
}
static ALWAYS_INLINE uae_u32 mmu_get_long(uaecptr addr, bool data, int size)
{
mmu_cache_state = cache_default_data;
if ((!mmu_ttr_enabled || mmu_match_ttr(addr,regs.s!=0,data) == TTR_NO_MATCH) && regs.mmu_enabled) {
#if MMU_DPAGECACHE
uae_u32 idx1 = ((addr & mmu_pagemaski) >> mmu_pageshift1m) | regs.s;
uae_u32 idx2 = idx1 & (MMUFASTCACHE_ENTRIES - 1);
if (atc_data_cache_read[idx2].log == idx1) {
addr = atc_data_cache_read[idx2].phys | (addr & mmu_pagemask);
mmu_cache_state = atc_data_cache_read[idx2].cache_state;
#if CACHE_HIT_COUNT
mmu_data_read_hit++;
#endif
} else {
#if CACHE_HIT_COUNT
mmu_data_read_miss++;
#endif
#endif
addr = mmu_translate(addr, 0, regs.s!=0, data, false, size);
#if MMU_DPAGECACHE
}
#endif
}
return x_phys_get_long(addr);
}
static ALWAYS_INLINE uae_u16 mmu_get_word(uaecptr addr, bool data, int size)
{
mmu_cache_state = cache_default_data;
if ((!mmu_ttr_enabled || mmu_match_ttr(addr,regs.s!=0,data) == TTR_NO_MATCH) && regs.mmu_enabled) {
#if MMU_DPAGECACHE
uae_u32 idx1 = ((addr & mmu_pagemaski) >> mmu_pageshift1m) | regs.s;
uae_u32 idx2 = idx1 & (MMUFASTCACHE_ENTRIES - 1);
if (atc_data_cache_read[idx2].log == idx1) {
addr = atc_data_cache_read[idx2].phys | (addr & mmu_pagemask);
mmu_cache_state = atc_data_cache_read[idx2].cache_state;
#if CACHE_HIT_COUNT
mmu_data_read_hit++;
#endif
} else {
#if CACHE_HIT_COUNT
mmu_data_read_miss++;
#endif
#endif
addr = mmu_translate(addr, 0, regs.s!=0, data, false, size);
#if MMU_DPAGECACHE
}
#endif
}
return x_phys_get_word(addr);
}
static ALWAYS_INLINE uae_u8 mmu_get_byte(uaecptr addr, bool data, int size)
{
mmu_cache_state = cache_default_data;
if ((!mmu_ttr_enabled || mmu_match_ttr(addr,regs.s!=0,data) == TTR_NO_MATCH) && regs.mmu_enabled) {
#if MMU_DPAGECACHE
uae_u32 idx1 = ((addr & mmu_pagemaski) >> mmu_pageshift1m) | regs.s;
uae_u32 idx2 = idx1 & (MMUFASTCACHE_ENTRIES - 1);
if (atc_data_cache_read[idx2].log == idx1) {
addr = atc_data_cache_read[idx2].phys | (addr & mmu_pagemask);
mmu_cache_state = atc_data_cache_read[idx2].cache_state;
#if CACHE_HIT_COUNT
mmu_data_read_hit++;
#endif
} else {
#if CACHE_HIT_COUNT
mmu_data_read_miss++;
#endif
#endif
addr = mmu_translate(addr, 0, regs.s!=0, data, false, size);
#if MMU_DPAGECACHE
}
#endif
}
return x_phys_get_byte(addr);
}
static ALWAYS_INLINE void mmu_put_long(uaecptr addr, uae_u32 val, bool data, int size)
{
mmu_cache_state = cache_default_data;
if ((!mmu_ttr_enabled || mmu_match_ttr_write(addr,regs.s!=0,data,val,size) == TTR_NO_MATCH) && regs.mmu_enabled) {
#if MMU_DPAGECACHE
uae_u32 idx1 = ((addr & mmu_pagemaski) >> mmu_pageshift1m) | regs.s;
uae_u32 idx2 = idx1 & (MMUFASTCACHE_ENTRIES - 1);
if (atc_data_cache_write[idx2].log == idx1) {
addr = atc_data_cache_write[idx2].phys | (addr & mmu_pagemask);
mmu_cache_state = atc_data_cache_read[idx2].cache_state;
#if CACHE_HIT_COUNT
mmu_data_write_hit++;
#endif
} else {
#if CACHE_HIT_COUNT
mmu_data_write_miss++;
#endif
#endif
addr = mmu_translate(addr, val, regs.s!=0, data, true, size);
#if MMU_DPAGECACHE
}
#endif
}
x_phys_put_long(addr, val);
}
static ALWAYS_INLINE void mmu_put_word(uaecptr addr, uae_u16 val, bool data, int size)
{
mmu_cache_state = cache_default_data;
if ((!mmu_ttr_enabled || mmu_match_ttr_write(addr,regs.s!=0,data,val,size) == TTR_NO_MATCH) && regs.mmu_enabled) {
#if MMU_DPAGECACHE
uae_u32 idx1 = ((addr & mmu_pagemaski) >> mmu_pageshift1m) | regs.s;
uae_u32 idx2 = idx1 & (MMUFASTCACHE_ENTRIES - 1);
if (atc_data_cache_write[idx2].log == idx1) {
addr = atc_data_cache_write[idx2].phys | (addr & mmu_pagemask);
mmu_cache_state = atc_data_cache_read[idx2].cache_state;
#if CACHE_HIT_COUNT
mmu_data_write_hit++;
#endif
} else {
#if CACHE_HIT_COUNT
mmu_data_write_miss++;
#endif
#endif
addr = mmu_translate(addr, val, regs.s!=0, data, true, size);
#if MMU_DPAGECACHE
}
#endif
}
x_phys_put_word(addr, val);
}
static ALWAYS_INLINE void mmu_put_byte(uaecptr addr, uae_u8 val, bool data, int size)
{
mmu_cache_state = cache_default_data;
if ((!mmu_ttr_enabled || mmu_match_ttr_write(addr,regs.s!=0,data,val,size) == TTR_NO_MATCH) && regs.mmu_enabled) {
#if MMU_DPAGECACHE
uae_u32 idx1 = ((addr & mmu_pagemaski) >> mmu_pageshift1m) | regs.s;
uae_u32 idx2 = idx1 & (MMUFASTCACHE_ENTRIES - 1);
if (atc_data_cache_write[idx2].log == idx1) {
addr = atc_data_cache_write[idx2].phys | (addr & mmu_pagemask);
mmu_cache_state = atc_data_cache_read[idx2].cache_state;
#if CACHE_HIT_COUNT
mmu_data_write_hit++;
#endif
} else {
#if CACHE_HIT_COUNT
mmu_data_write_miss++;
#endif
#endif
addr = mmu_translate(addr, val, regs.s!=0, data, true, size);
#if MMU_DPAGECACHE
}
#endif
}
x_phys_put_byte(addr, val);
}
static ALWAYS_INLINE uae_u32 mmu_get_user_long(uaecptr addr, bool super, bool write, int size, bool ci)
{
mmu_cache_state = cache_default_data;
if ((!mmu_ttr_enabled || mmu_match_ttr_maybe_write(addr,super,true,size,write) == TTR_NO_MATCH) && regs.mmu_enabled) {
#if MMU_DPAGECACHE
uae_u32 idx1 = ((addr & mmu_pagemaski) >> mmu_pageshift1m) | (super ? 1 : 0);
uae_u32 idx2 = idx1 & (MMUFASTCACHE_ENTRIES - 1);
if (atc_data_cache_read[idx2].log == idx1) {
addr = atc_data_cache_read[idx2].phys | (addr & mmu_pagemask);
mmu_cache_state = atc_data_cache_read[idx2].cache_state;
#if CACHE_HIT_COUNT
mmu_data_read_hit++;
#endif
} else {
#if CACHE_HIT_COUNT
mmu_data_read_miss++;
#endif
#endif
addr = mmu_translate(addr, 0, super, true, write, size);
#if MMU_DPAGECACHE
}
#endif
}
if (ci)
mmu_cache_state = CACHE_DISABLE_MMU;
return x_phys_get_long(addr);
}
static ALWAYS_INLINE uae_u16 mmu_get_user_word(uaecptr addr, bool super, bool write, int size, bool ci)
{
mmu_cache_state = cache_default_data;
if ((!mmu_ttr_enabled || mmu_match_ttr_maybe_write(addr,super,true,size,write) == TTR_NO_MATCH) && regs.mmu_enabled) {
#if MMU_DPAGECACHE
uae_u32 idx1 = ((addr & mmu_pagemaski) >> mmu_pageshift1m) | (super ? 1 : 0);
uae_u32 idx2 = idx1 & (MMUFASTCACHE_ENTRIES - 1);
if (atc_data_cache_read[idx2].log == idx1) {
addr = atc_data_cache_read[idx2].phys | (addr & mmu_pagemask);
mmu_cache_state = atc_data_cache_read[idx2].cache_state;
#if CACHE_HIT_COUNT
mmu_data_read_hit++;
#endif
} else {
#if CACHE_HIT_COUNT
mmu_data_read_miss++;
#endif
#endif
addr = mmu_translate(addr, 0, super, true, write, size);
#if MMU_DPAGECACHE
}
#endif
}
if (ci)
mmu_cache_state = CACHE_DISABLE_MMU;
return x_phys_get_word(addr);
}
static ALWAYS_INLINE uae_u8 mmu_get_user_byte(uaecptr addr, bool super, bool write, int size, bool ci)
{
mmu_cache_state = cache_default_data;
if ((!mmu_ttr_enabled || mmu_match_ttr_maybe_write(addr,super,true,size,write) == TTR_NO_MATCH) && regs.mmu_enabled) {
#if MMU_DPAGECACHE
uae_u32 idx1 = ((addr & mmu_pagemaski) >> mmu_pageshift1m) | (super ? 1 : 0);
uae_u32 idx2 = idx1 & (MMUFASTCACHE_ENTRIES - 1);
if (atc_data_cache_read[idx2].log == idx1) {
addr = atc_data_cache_read[idx2].phys | (addr & mmu_pagemask);
mmu_cache_state = atc_data_cache_read[idx2].cache_state;
#if CACHE_HIT_COUNT
mmu_data_read_hit++;
#endif
} else {
#if CACHE_HIT_COUNT
mmu_data_read_miss++;
#endif
#endif
addr = mmu_translate(addr, 0, super, true, write, size);
#if MMU_DPAGECACHE
}
#endif
}
if (ci)
mmu_cache_state = CACHE_DISABLE_MMU;
return x_phys_get_byte(addr);
}
static ALWAYS_INLINE void mmu_put_user_long(uaecptr addr, uae_u32 val, bool super, int size, bool ci)
{
mmu_cache_state = cache_default_data;
if ((!mmu_ttr_enabled || mmu_match_ttr_write(addr,super,true,val,size) == TTR_NO_MATCH) && regs.mmu_enabled) {
#if MMU_DPAGECACHE
uae_u32 idx1 = ((addr & mmu_pagemaski) >> mmu_pageshift1m) | (super ? 1 : 0);
uae_u32 idx2 = idx1 & (MMUFASTCACHE_ENTRIES - 1);
if (atc_data_cache_write[idx2].log == idx1) {
addr = atc_data_cache_write[idx2].phys | (addr & mmu_pagemask);
mmu_cache_state = atc_data_cache_read[idx2].cache_state;
#if CACHE_HIT_COUNT
mmu_data_write_hit++;
#endif
} else {
#if CACHE_HIT_COUNT
mmu_data_write_miss++;
#endif
#endif
addr = mmu_translate(addr, val, super, true, true, size);
#if MMU_DPAGECACHE
}
#endif
}
if (ci)
mmu_cache_state = CACHE_DISABLE_MMU;
x_phys_put_long(addr, val);
}
static ALWAYS_INLINE void mmu_put_user_word(uaecptr addr, uae_u16 val, bool super, int size, bool ci)
{
mmu_cache_state = cache_default_data;
if ((!mmu_ttr_enabled || mmu_match_ttr_write(addr,super,true,val,size) == TTR_NO_MATCH) && regs.mmu_enabled) {
#if MMU_DPAGECACHE
uae_u32 idx1 = ((addr & mmu_pagemaski) >> mmu_pageshift1m) | (super ? 1 : 0);
uae_u32 idx2 = idx1 & (MMUFASTCACHE_ENTRIES - 1);
if (atc_data_cache_write[idx2].log == idx1) {
addr = atc_data_cache_write[idx2].phys | (addr & mmu_pagemask);
mmu_cache_state = atc_data_cache_read[idx2].cache_state;
#if CACHE_HIT_COUNT
mmu_data_write_hit++;
#endif
} else {
#if CACHE_HIT_COUNT
mmu_data_write_miss++;
#endif
#endif
addr = mmu_translate(addr, val, super, true, true, size);
#if MMU_DPAGECACHE
}
#endif
}
if (ci)
mmu_cache_state = CACHE_DISABLE_MMU;
x_phys_put_word(addr, val);
}
static ALWAYS_INLINE void mmu_put_user_byte(uaecptr addr, uae_u8 val, bool super, int size, bool ci)
{
mmu_cache_state = cache_default_data;
if ((!mmu_ttr_enabled || mmu_match_ttr_write(addr,super,true,val,size) == TTR_NO_MATCH) && regs.mmu_enabled) {
#if MMU_DPAGECACHE
uae_u32 idx1 = ((addr & mmu_pagemaski) >> mmu_pageshift1m) | (super ? 1 : 0);
uae_u32 idx2 = idx1 & (MMUFASTCACHE_ENTRIES - 1);
if (atc_data_cache_write[idx2].log == idx1) {
addr = atc_data_cache_write[idx2].phys | (addr & mmu_pagemask);
mmu_cache_state = atc_data_cache_read[idx2].cache_state;
#if CACHE_HIT_COUNT
mmu_data_write_hit++;
#endif
} else {
#if CACHE_HIT_COUNT
mmu_data_write_miss++;
#endif
#endif
addr = mmu_translate(addr, val, super, true, true, size);
#if MMU_DPAGECACHE
}
#endif
}
if (ci)
mmu_cache_state = CACHE_DISABLE_MMU;
x_phys_put_byte(addr, val);
}
static ALWAYS_INLINE void HWput_l(uaecptr addr, uae_u32 l)
{
put_long (addr, l);
}
static ALWAYS_INLINE void HWput_w(uaecptr addr, uae_u32 w)
{
put_word (addr, w);
}
static ALWAYS_INLINE void HWput_b(uaecptr addr, uae_u32 b)
{
put_byte (addr, b);
}
static ALWAYS_INLINE uae_u32 HWget_l(uaecptr addr)
{
return get_long (addr);
}
static ALWAYS_INLINE uae_u32 HWget_w(uaecptr addr)
{
return get_word (addr);
}
static ALWAYS_INLINE uae_u32 HWget_b(uaecptr addr)
{
return get_byte (addr);
}
#if MMU_ICACHE
#define MMU_ICACHE_SZ 4096
struct mmu_icache
{
uae_u16 data;
uae_u32 addr;
};
extern struct mmu_icache mmu_icache_data[MMU_ICACHE_SZ];
static ALWAYS_INLINE uae_u16 uae_mmu040_getc_iword(uaecptr addr)
{
int icidx = (addr & (MMU_ICACHE_SZ - 1)) | regs.s;
if (addr != mmu_icache_data[icidx].addr || !(regs.cacr & 0x8000)) {
mmu_icache_data[icidx].data = mmu_get_iword(addr, sz_word);
mmu_icache_data[icidx].addr = addr;
return mmu_icache_data[icidx].data;
} else {
return mmu_icache_data[icidx].data;
}
}
#endif
static ALWAYS_INLINE uae_u16 uae_mmu040_get_iword(uaecptr addr)
{
#if MMU_ICACHE
return uae_mmu040_getc_iword(addr);
#else
return mmu_get_iword(addr, sz_word);
#endif
}
static ALWAYS_INLINE uae_u32 uae_mmu040_get_ilong(uaecptr addr)
{
#if MMU_ICACHE
uae_u32 result = uae_mmu040_getc_iword(addr);
result <<= 16;
result |= uae_mmu040_getc_iword(addr + 2);
return result;
#else
if (unlikely(is_unaligned_page(addr, 4)))
return mmu_get_ilong_unaligned(addr);
return mmu_get_ilong(addr, sz_long);
#endif
}
static ALWAYS_INLINE uae_u16 uae_mmu040_get_ibyte(uaecptr addr)
{
#if MMU_ICACHE
uae_u16 result = uae_mmu040_getc_iword(addr & ~1);
return (addr & 1) ? result & 0xFF : result >> 8;
#else
return mmu_get_byte(addr, false, sz_byte);
#endif
}
static ALWAYS_INLINE uae_u32 uae_mmu040_get_long(uaecptr addr)
{
if (unlikely(is_unaligned_page(addr, 4)))
return mmu_get_long_unaligned(addr, true);
return mmu_get_long(addr, true, sz_long);
}
static ALWAYS_INLINE uae_u16 uae_mmu040_get_word(uaecptr addr)
{
if (unlikely(is_unaligned_page(addr, 2)))
return mmu_get_word_unaligned(addr, true);
return mmu_get_word(addr, true, sz_word);
}
static ALWAYS_INLINE uae_u8 uae_mmu040_get_byte(uaecptr addr)
{
return mmu_get_byte(addr, true, sz_byte);
}
static ALWAYS_INLINE void uae_mmu040_put_word(uaecptr addr, uae_u16 val)
{
if (unlikely(is_unaligned_page(addr, 2)))
mmu_put_word_unaligned(addr, val, true);
else
mmu_put_word(addr, val, true, sz_word);
}
static ALWAYS_INLINE void uae_mmu040_put_byte(uaecptr addr, uae_u8 val)
{
mmu_put_byte(addr, val, true, sz_byte);
}
static ALWAYS_INLINE void uae_mmu040_put_long(uaecptr addr, uae_u32 val)
{
if (unlikely(is_unaligned_page(addr, 4)))
mmu_put_long_unaligned(addr, val, true);
else
mmu_put_long(addr, val, true, sz_long);
}
static ALWAYS_INLINE uae_u32 uae_mmu060_get_ilong(uaecptr addr)
{
if (unlikely(is_unaligned_page(addr, 4)))
return mmu_get_ilong_unaligned(addr);
return mmu_get_ilong(addr, sz_long);
}
static ALWAYS_INLINE uae_u16 uae_mmu060_get_iword(uaecptr addr)
{
return mmu_get_iword(addr, sz_word);
}
static ALWAYS_INLINE uae_u16 uae_mmu060_get_ibyte(uaecptr addr)
{
return mmu_get_byte(addr, false, sz_byte);
}
static ALWAYS_INLINE uae_u32 uae_mmu060_get_long(uaecptr addr)
{
if (unlikely(is_unaligned_page(addr, 4)))
return mmu_get_long_unaligned(addr, true);
return mmu_get_long(addr, true, sz_long);
}
static ALWAYS_INLINE uae_u16 uae_mmu060_get_word(uaecptr addr)
{
if (unlikely(is_unaligned_page(addr, 2)))
return mmu_get_word_unaligned(addr, true);
return mmu_get_word(addr, true, sz_word);
}
static ALWAYS_INLINE uae_u8 uae_mmu060_get_byte(uaecptr addr)
{
return mmu_get_byte(addr, true, sz_byte);
}
static ALWAYS_INLINE void uae_mmu_get_move16(uaecptr addr, uae_u32 *val)
{
// move16 is always aligned
mmu_get_move16(addr, val, true, 16);
}
static ALWAYS_INLINE void uae_mmu060_put_long(uaecptr addr, uae_u32 val)
{
if (unlikely(is_unaligned_page(addr, 4)))
mmu_put_long_unaligned(addr, val, true);
else
mmu_put_long(addr, val, true, sz_long);
}
static ALWAYS_INLINE void uae_mmu060_put_word(uaecptr addr, uae_u16 val)
{
if (unlikely(is_unaligned_page(addr, 2)))
mmu_put_word_unaligned(addr, val, true);
else
mmu_put_word(addr, val, true, sz_word);
}
static ALWAYS_INLINE void uae_mmu060_put_byte(uaecptr addr, uae_u8 val)
{
mmu_put_byte(addr, val, true, sz_byte);
}
static ALWAYS_INLINE void uae_mmu_put_move16(uaecptr addr, uae_u32 *val)
{
// move16 is always aligned
mmu_put_move16(addr, val, true, 16);
}
// normal 040
STATIC_INLINE void put_byte_mmu040 (uaecptr addr, uae_u32 v)
{
uae_mmu040_put_byte (addr, v);
}
STATIC_INLINE void put_word_mmu040 (uaecptr addr, uae_u32 v)
{
uae_mmu040_put_word (addr, v);
}
STATIC_INLINE void put_long_mmu040 (uaecptr addr, uae_u32 v)
{
uae_mmu040_put_long (addr, v);
}
STATIC_INLINE uae_u32 get_byte_mmu040 (uaecptr addr)
{
return uae_mmu040_get_byte (addr);
}
STATIC_INLINE uae_u32 get_word_mmu040 (uaecptr addr)
{
return uae_mmu040_get_word (addr);
}
STATIC_INLINE uae_u32 get_long_mmu040 (uaecptr addr)
{
return uae_mmu040_get_long (addr);
}
// normal 060
STATIC_INLINE void put_byte_mmu060 (uaecptr addr, uae_u32 v)
{
uae_mmu060_put_byte (addr, v);
}
STATIC_INLINE void put_word_mmu060 (uaecptr addr, uae_u32 v)
{
uae_mmu060_put_word (addr, v);
}
STATIC_INLINE void put_long_mmu060 (uaecptr addr, uae_u32 v)
{
uae_mmu060_put_long (addr, v);
}
STATIC_INLINE uae_u32 get_byte_mmu060 (uaecptr addr)
{
return uae_mmu060_get_byte (addr);
}
STATIC_INLINE uae_u32 get_word_mmu060 (uaecptr addr)
{
return uae_mmu060_get_word (addr);
}
STATIC_INLINE uae_u32 get_long_mmu060 (uaecptr addr)
{
return uae_mmu060_get_long (addr);
}
STATIC_INLINE void get_move16_mmu (uaecptr addr, uae_u32 *v)
{
uae_mmu_get_move16 (addr, v);
}
STATIC_INLINE void put_move16_mmu (uaecptr addr, uae_u32 *v)
{
uae_mmu_put_move16 (addr, v);
}
// locked rmw 060
STATIC_INLINE void put_lrmw_byte_mmu060 (uaecptr addr, uae_u32 v)
{
uae_mmu_put_lrmw (addr, v, sz_byte, 1);
}
STATIC_INLINE void put_lrmw_word_mmu060 (uaecptr addr, uae_u32 v)
{
uae_mmu_put_lrmw (addr, v, sz_word, 1);
}
STATIC_INLINE void put_lrmw_long_mmu060 (uaecptr addr, uae_u32 v)
{
uae_mmu_put_lrmw (addr, v, sz_long, 1);
}
STATIC_INLINE uae_u32 get_lrmw_byte_mmu060 (uaecptr addr)
{
return uae_mmu_get_lrmw (addr, sz_byte, 1);
}
STATIC_INLINE uae_u32 get_lrmw_word_mmu060 (uaecptr addr)
{
return uae_mmu_get_lrmw (addr, sz_word, 1);
}
STATIC_INLINE uae_u32 get_lrmw_long_mmu060 (uaecptr addr)
{
return uae_mmu_get_lrmw (addr, sz_long, 1);
}
// normal rmw 060
STATIC_INLINE void put_rmw_byte_mmu060 (uaecptr addr, uae_u32 v)
{
rmw_cycle = true;
uae_mmu060_put_byte (addr, v);
rmw_cycle = false;
}
STATIC_INLINE void put_rmw_word_mmu060 (uaecptr addr, uae_u32 v)
{
rmw_cycle = true;
uae_mmu060_put_word (addr, v);
rmw_cycle = false;
}
STATIC_INLINE void put_rmw_long_mmu060 (uaecptr addr, uae_u32 v)
{
rmw_cycle = true;
uae_mmu060_put_long (addr, v);
rmw_cycle = false;
}
STATIC_INLINE uae_u32 get_rmw_byte_mmu060 (uaecptr addr)
{
rmw_cycle = true;
uae_u32 v = uae_mmu060_get_byte (addr);
rmw_cycle = false;
return v;
}
STATIC_INLINE uae_u32 get_rmw_word_mmu060 (uaecptr addr)
{
rmw_cycle = true;
uae_u32 v = uae_mmu060_get_word (addr);
rmw_cycle = false;
return v;
}
STATIC_INLINE uae_u32 get_rmw_long_mmu060 (uaecptr addr)
{
rmw_cycle = true;
uae_u32 v = uae_mmu060_get_long (addr);
rmw_cycle = false;
return v;
}
// locked rmw 040
STATIC_INLINE void put_lrmw_byte_mmu040 (uaecptr addr, uae_u32 v)
{
uae_mmu_put_lrmw (addr, v, sz_byte, 0);
}
STATIC_INLINE void put_lrmw_word_mmu040 (uaecptr addr, uae_u32 v)
{
uae_mmu_put_lrmw (addr, v, sz_word, 0);
}
STATIC_INLINE void put_lrmw_long_mmu040 (uaecptr addr, uae_u32 v)
{
uae_mmu_put_lrmw (addr, v, sz_long, 0);
}
STATIC_INLINE uae_u32 get_lrmw_byte_mmu040 (uaecptr addr)
{
return uae_mmu_get_lrmw (addr, sz_byte, 0);
}
STATIC_INLINE uae_u32 get_lrmw_word_mmu040 (uaecptr addr)
{
return uae_mmu_get_lrmw (addr, sz_word, 0);
}
STATIC_INLINE uae_u32 get_lrmw_long_mmu040 (uaecptr addr)
{
return uae_mmu_get_lrmw (addr, sz_long, 0);
}
STATIC_INLINE uae_u32 get_ibyte_mmu040 (int o)
{
uae_u32 pc = m68k_getpci () + o;
return uae_mmu040_get_iword (pc);
}
STATIC_INLINE uae_u32 get_iword_mmu040 (int o)
{
uae_u32 pc = m68k_getpci () + o;
return uae_mmu040_get_iword (pc);
}
STATIC_INLINE uae_u32 get_ilong_mmu040 (int o)
{
uae_u32 pc = m68k_getpci () + o;
return uae_mmu040_get_ilong (pc);
}
STATIC_INLINE uae_u32 next_iword_mmu040 (void)
{
uae_u32 pc = m68k_getpci ();
m68k_incpci (2);
return uae_mmu040_get_iword (pc);
}
STATIC_INLINE uae_u32 next_ilong_mmu040 (void)
{
uae_u32 pc = m68k_getpci ();
m68k_incpci (4);
return uae_mmu040_get_ilong (pc);
}
STATIC_INLINE uae_u32 get_ibyte_mmu060 (int o)
{
uae_u32 pc = m68k_getpci () + o;
return uae_mmu060_get_iword (pc);
}
STATIC_INLINE uae_u32 get_iword_mmu060 (int o)
{
uae_u32 pc = m68k_getpci () + o;
return uae_mmu060_get_iword (pc);
}
STATIC_INLINE uae_u32 get_ilong_mmu060 (int o)
{
uae_u32 pc = m68k_getpci () + o;
return uae_mmu060_get_ilong (pc);
}
STATIC_INLINE uae_u32 next_iword_mmu060 (void)
{
uae_u32 pc = m68k_getpci ();
m68k_incpci (2);
return uae_mmu060_get_iword (pc);
}
STATIC_INLINE uae_u32 next_ilong_mmu060 (void)
{
uae_u32 pc = m68k_getpci ();
m68k_incpci (4);
return uae_mmu060_get_ilong (pc);
}
extern void flush_mmu040 (uaecptr, int);
extern void m68k_do_rts_mmu040 (void);
extern void m68k_do_rte_mmu040 (uaecptr a7);
extern void m68k_do_bsr_mmu040 (uaecptr oldpc, uae_s32 offset);
extern void flush_mmu060 (uaecptr, int);
extern void m68k_do_rts_mmu060 (void);
extern void m68k_do_rte_mmu060 (uaecptr a7);
extern void m68k_do_bsr_mmu060 (uaecptr oldpc, uae_s32 offset);
#endif /* UAE_CPUMMU_H */

View File

@ -1,10 +1,911 @@
#ifndef UAE_CPUMMU030_H
#define UAE_CPUMMU030_H
#define MMU030_DEBUG 0
#include "uae/types.h"
#include "mmu_common.h"
#define MMU_DPAGECACHE030 1
#define MMU_IPAGECACHE030 1
extern uae_u64 srp_030, crp_030;
extern uae_u32 tt0_030, tt1_030, tc_030;
extern uae_u16 mmusr_030;
#define MAX_MMU030_ACCESS 9
extern uae_u32 mm030_stageb_address;
extern int mmu030_idx, mmu030_idx_done;
extern bool mmu030_retry;
extern int mmu030_opcode, mmu030_opcode_stageb;
extern int mmu030_fake_prefetch;
extern uaecptr mmu030_fake_prefetch_addr;
extern uae_u16 mmu030_state[3];
extern uae_u32 mmu030_data_buffer_out;
extern uae_u32 mmu030_disp_store[2];
extern uae_u32 mmu030_fmovem_store[2];
extern uae_u8 mmu030_cache_state, mmu030_cache_state_default;
extern bool ismoves030, islrmw030;
#define MMU030_STATEFLAG1_FMOVEM 0x2000
#define MMU030_STATEFLAG1_MOVEM1 0x4000
#define MMU030_STATEFLAG1_MOVEM2 0x8000
#define MMU030_STATEFLAG1_DISP0 0x0001
#define MMU030_STATEFLAG1_DISP1 0x0002
#define MMU030_STATEFLAG1_LASTWRITE 0x0100
#define MMU030_STATEFLAG1_SUBACCESS0 0x0004
#define MMU030_STATEFLAG1_SUBACCESS1 0x0008
#define MMU030_STATEFLAG1_SUBACCESS2 0x0010
#define MMU030_STATEFLAG1_SUBACCESS3 0x0020
#define MMU030_STATEFLAG1_SUBACCESSX 0x0040
#define MMU030_STATEFLAG1_SUBACCESSL 0x0080
#define MMU030_STATEFLAG1_SUBACCESS_SHIFT 2
struct mmu030_access
{
uae_u32 val;
};
extern struct mmu030_access mmu030_ad[MAX_MMU030_ACCESS + 1];
void mmu030_page_fault(uaecptr addr, bool read, int flags, uae_u32 fc);
int mmu_op30_pmove(uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra);
bool mmu_op30_ptest(uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra);
bool mmu_op30_pflush(uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra);
typedef struct {
uae_u32 addr_base;
uae_u32 addr_mask;
uae_u32 fc_base;
uae_u32 fc_mask;
} TT_info;
bool mmu030_decode_tc(uae_u32 TC, bool);
bool mmu030_decode_rp(uae_u64 RP);
void mmu030_flush_atc_all(void);
void mmu030_reset(int hardreset);
void mmu030_set_funcs(void);
uaecptr mmu030_translate(uaecptr addr, bool super, bool data, bool write);
void mmu030_hardware_bus_error(uaecptr addr, uae_u32 v, bool read, bool ins, int size);
bool mmu030_is_super_access(bool read);
void mmu030_put_long(uaecptr addr, uae_u32 val, uae_u32 fc);
void mmu030_put_word(uaecptr addr, uae_u16 val, uae_u32 fc);
void mmu030_put_byte(uaecptr addr, uae_u8 val, uae_u32 fc);
uae_u32 mmu030_get_long(uaecptr addr, uae_u32 fc);
uae_u16 mmu030_get_word(uaecptr addr, uae_u32 fc);
uae_u8 mmu030_get_byte(uaecptr addr, uae_u32 fc);
uae_u32 mmu030_get_ilong(uaecptr addr, uae_u32 fc);
uae_u16 mmu030_get_iword(uaecptr addr, uae_u32 fc);
uae_u32 uae_mmu030_get_lrmw(uaecptr addr, int size);
void uae_mmu030_put_lrmw(uaecptr addr, uae_u32 val, int size);
void mmu030_put_generic(uaecptr addr, uae_u32 val, uae_u32 fc, int size, int flags);
uae_u32 mmu030_get_generic(uaecptr addr, uae_u32 fc, int size, int flags);
extern uae_u16 REGPARAM3 mmu030_get_word_unaligned(uaecptr addr, uae_u32 fc, int flags) REGPARAM;
extern uae_u32 REGPARAM3 mmu030_get_long_unaligned(uaecptr addr, uae_u32 fc, int flags) REGPARAM;
extern uae_u32 REGPARAM3 mmu030_get_ilong_unaligned(uaecptr addr, uae_u32 fc, int flags) REGPARAM;
extern uae_u16 REGPARAM3 mmu030_get_lrmw_word_unaligned(uaecptr addr, uae_u32 fc, int flags) REGPARAM;
extern uae_u32 REGPARAM3 mmu030_get_lrmw_long_unaligned(uaecptr addr, uae_u32 fc, int flags) REGPARAM;
extern void REGPARAM3 mmu030_put_word_unaligned(uaecptr addr, uae_u16 val, uae_u32 fc, int flags) REGPARAM;
extern void REGPARAM3 mmu030_put_long_unaligned(uaecptr addr, uae_u32 val, uae_u32 fc, int flags) REGPARAM;
static ALWAYS_INLINE uae_u32 uae_mmu030_get_fc_code(void)
{
return (regs.s ? 4 : 0) | 2;
}
static ALWAYS_INLINE uae_u32 uae_mmu030_get_fc_data(void)
{
return (regs.s ? 4 : 0) | 1;
}
static ALWAYS_INLINE uae_u32 uae_mmu030_get_ilong(uaecptr addr)
{
uae_u32 fc = uae_mmu030_get_fc_code();
if (unlikely(is_unaligned_bus(addr, 4)))
return mmu030_get_ilong_unaligned(addr, fc, 0);
return mmu030_get_ilong(addr, fc);
}
static ALWAYS_INLINE uae_u16 uae_mmu030_get_iword(uaecptr addr)
{
uae_u32 fc = uae_mmu030_get_fc_code();
return mmu030_get_iword(addr, fc);
}
static ALWAYS_INLINE uae_u16 uae_mmu030_get_ibyte(uaecptr addr)
{
uae_u32 fc = uae_mmu030_get_fc_code();
return mmu030_get_byte(addr, fc);
}
static ALWAYS_INLINE uae_u32 uae_mmu030_get_long(uaecptr addr)
{
uae_u32 fc = uae_mmu030_get_fc_data();
if (unlikely(is_unaligned_bus(addr, 4)))
return mmu030_get_long_unaligned(addr, fc, 0);
return mmu030_get_long(addr, fc);
}
static ALWAYS_INLINE uae_u32 uae_mmu030_get_word(uaecptr addr)
{
uae_u32 fc = uae_mmu030_get_fc_data();
if (unlikely(is_unaligned_bus(addr, 2)))
return mmu030_get_word_unaligned(addr, fc, 0);
return mmu030_get_word(addr, fc);
}
static ALWAYS_INLINE uae_u32 uae_mmu030_get_byte(uaecptr addr)
{
uae_u32 fc = uae_mmu030_get_fc_data();
return mmu030_get_byte(addr, fc);
}
static ALWAYS_INLINE void uae_mmu030_put_long(uaecptr addr, uae_u32 val)
{
uae_u32 fc = uae_mmu030_get_fc_data();
if (unlikely(is_unaligned_bus(addr, 4)))
mmu030_put_long_unaligned(addr, val, fc, 0);
else
mmu030_put_long(addr, val, fc);
}
static ALWAYS_INLINE void uae_mmu030_put_word(uaecptr addr, uae_u32 val)
{
uae_u32 fc = uae_mmu030_get_fc_data();
if (unlikely(is_unaligned_bus(addr, 2)))
mmu030_put_word_unaligned(addr, val, fc, 0);
else
mmu030_put_word(addr, val, fc);
}
static ALWAYS_INLINE void uae_mmu030_put_byte(uaecptr addr, uae_u32 val)
{
uae_u32 fc = uae_mmu030_get_fc_data();
mmu030_put_byte(addr, val, fc);
}
static ALWAYS_INLINE uae_u32 uae_mmu030_get_ilong_fc(uaecptr addr)
{
if (unlikely(is_unaligned_bus(addr, 4)))
return mmu030_get_ilong_unaligned(addr, regs.fc030, 0);
return mmu030_get_ilong(addr, regs.fc030);
}
static ALWAYS_INLINE uae_u16 uae_mmu030_get_iword_fc(uaecptr addr)
{
return mmu030_get_iword(addr, regs.fc030);
}
static ALWAYS_INLINE uae_u16 uae_mmu030_get_ibyte_fc(uaecptr addr)
{
return mmu030_get_byte(addr, regs.fc030);
}
static ALWAYS_INLINE uae_u32 uae_mmu030_get_long_fc(uaecptr addr)
{
if (unlikely(is_unaligned_bus(addr, 4)))
return mmu030_get_long_unaligned(addr, regs.fc030, 0);
return mmu030_get_long(addr, regs.fc030);
}
static ALWAYS_INLINE uae_u32 uae_mmu030_get_word_fc(uaecptr addr)
{
if (unlikely(is_unaligned_bus(addr, 2)))
return mmu030_get_word_unaligned(addr, regs.fc030, 0);
return mmu030_get_word(addr, regs.fc030);
}
static ALWAYS_INLINE uae_u32 uae_mmu030_get_byte_fc(uaecptr addr)
{
return mmu030_get_byte(addr, regs.fc030);
}
static ALWAYS_INLINE void uae_mmu030_put_long_fc(uaecptr addr, uae_u32 val)
{
if (unlikely(is_unaligned_bus(addr, 4)))
mmu030_put_long_unaligned(addr, val, regs.fc030, 0);
else
mmu030_put_long(addr, val, regs.fc030);
}
static ALWAYS_INLINE void uae_mmu030_put_word_fc(uaecptr addr, uae_u32 val)
{
if (unlikely(is_unaligned_bus(addr, 2)))
mmu030_put_word_unaligned(addr, val, regs.fc030, 0);
else
mmu030_put_word(addr, val, regs.fc030);
}
static ALWAYS_INLINE void uae_mmu030_put_byte_fc(uaecptr addr, uae_u32 val)
{
mmu030_put_byte(addr, val, regs.fc030);
}
uae_u8 uae_mmu030_check_fc(uaecptr addr, bool write, uae_u32 size);
static ALWAYS_INLINE uae_u32 uae_mmu030_get_long_fcx(uaecptr addr, int fc)
{
if (unlikely(is_unaligned_bus(addr, 4)))
return mmu030_get_long_unaligned(addr, fc, 0);
return mmu030_get_long(addr, fc);
}
static ALWAYS_INLINE uae_u32 uae_mmu030_get_word_fcx(uaecptr addr, int fc)
{
if (unlikely(is_unaligned_bus(addr, 2)))
return mmu030_get_word_unaligned(addr, fc, 0);
return mmu030_get_word(addr, fc);
}
static ALWAYS_INLINE uae_u32 uae_mmu030_get_byte_fcx(uaecptr addr, int fc)
{
return mmu030_get_byte(addr, fc);
}
static ALWAYS_INLINE void uae_mmu030_put_long_fcx(uaecptr addr, uae_u32 val, int fc)
{
if (unlikely(is_unaligned_bus(addr, 4)))
mmu030_put_long_unaligned(addr, val, fc, 0);
else
mmu030_put_long(addr, val, fc);
}
static ALWAYS_INLINE void uae_mmu030_put_word_fcx(uaecptr addr, uae_u32 val, int fc)
{
if (unlikely(is_unaligned_bus(addr, 2)))
mmu030_put_word_unaligned(addr, val, fc, 0);
else
mmu030_put_word(addr, val, fc);
}
static ALWAYS_INLINE void uae_mmu030_put_byte_fcx(uaecptr addr, uae_u32 val, int fc)
{
mmu030_put_byte(addr, val, fc);
}
#define ACCESS_CHECK_PUT \
if (mmu030_idx++ < mmu030_idx_done) { \
return; \
} else { \
mmu030_data_buffer_out = v; \
}
#define ACCESS_CHECK_GET \
if (mmu030_idx++ < mmu030_idx_done) { \
v = mmu030_ad[mmu030_idx - 1].val; \
return v; \
}
#define ACCESS_CHECK_GET_PC(pc) \
if (mmu030_idx++ < mmu030_idx_done) { \
v = mmu030_ad[mmu030_idx - 1].val; \
m68k_incpci(pc); \
return v; \
}
#define ACCESS_EXIT_PUT \
mmu030_ad[mmu030_idx_done++].val = mmu030_data_buffer_out;
#define ACCESS_EXIT_GET \
mmu030_ad[mmu030_idx_done++].val = v;
STATIC_INLINE uae_u32 state_store_mmu030(uae_u32 v)
{
if (mmu030_idx++ < mmu030_idx_done) {
v = mmu030_ad[mmu030_idx - 1].val;
} else {
mmu030_ad[mmu030_idx_done++].val = v;
}
return v;
}
// non-cache
static ALWAYS_INLINE uae_u32 sfc030_get_long(uaecptr addr)
{
uae_u32 fc = regs.sfc;
#if MMUDEBUG > 2
write_log(_T("sfc030_get_long: FC = %i\n"),fc);
#endif
if (unlikely(is_unaligned_bus(addr, 4)))
return mmu030_get_long_unaligned(addr, fc, 0);
return mmu030_get_long(addr, fc);
}
static ALWAYS_INLINE uae_u16 sfc030_get_word(uaecptr addr)
{
uae_u32 fc = regs.sfc;
#if MMUDEBUG > 2
write_log(_T("sfc030_get_word: FC = %i\n"),fc);
#endif
if (unlikely(is_unaligned_bus(addr, 2)))
return mmu030_get_word_unaligned(addr, fc, 0);
return mmu030_get_word(addr, fc);
}
static ALWAYS_INLINE uae_u8 sfc030_get_byte(uaecptr addr)
{
uae_u32 fc = regs.sfc;
#if MMUDEBUG > 2
write_log(_T("sfc030_get_byte: FC = %i\n"),fc);
#endif
return mmu030_get_byte(addr, fc);
}
static ALWAYS_INLINE void dfc030_put_long(uaecptr addr, uae_u32 val)
{
uae_u32 fc = regs.dfc;
#if MMUDEBUG > 2
write_log(_T("dfc030_put_long: %08X = %08X FC = %i\n"), addr, val, fc);
#endif
if (unlikely(is_unaligned_bus(addr, 4)))
mmu030_put_long_unaligned(addr, val, fc, 0);
else
mmu030_put_long(addr, val, fc);
}
static ALWAYS_INLINE void dfc030_put_word(uaecptr addr, uae_u16 val)
{
uae_u32 fc = regs.dfc;
#if MMUDEBUG > 2
write_log(_T("dfc030_put_word: %08X = %04X FC = %i\n"), addr, val, fc);
#endif
if (unlikely(is_unaligned_bus(addr, 2)))
mmu030_put_word_unaligned(addr, val, fc, 0);
else
mmu030_put_word(addr, val, fc);
}
static ALWAYS_INLINE void dfc030_put_byte(uaecptr addr, uae_u8 val)
{
uae_u32 fc = regs.dfc;
#if MMUDEBUG > 2
write_log(_T("dfc030_put_byte: %08X = %02X FC = %i\n"), addr, val, fc);
#endif
mmu030_put_byte(addr, val, fc);
}
static ALWAYS_INLINE uae_u32 sfc030_get_long_state(uaecptr addr)
{
uae_u32 v;
ACCESS_CHECK_GET
ismoves030 = true;
v = sfc030_get_long(addr);
ismoves030 = false;
ACCESS_EXIT_GET
return v;
}
static ALWAYS_INLINE uae_u16 sfc030_get_word_state(uaecptr addr)
{
uae_u32 v;
ACCESS_CHECK_GET
ismoves030 = true;
v = sfc030_get_word(addr);
ismoves030 = false;
ACCESS_EXIT_GET
return v;
}
static ALWAYS_INLINE uae_u8 sfc030_get_byte_state(uaecptr addr)
{
uae_u32 v;
ACCESS_CHECK_GET
ismoves030 = true;
v = sfc030_get_byte(addr);
ismoves030 = false;
ACCESS_EXIT_GET
return v;
}
static ALWAYS_INLINE void dfc030_put_long_state(uaecptr addr, uae_u32 v)
{
ACCESS_CHECK_PUT
ismoves030 = true;
dfc030_put_long(addr, v);
ismoves030 = false;
ACCESS_EXIT_PUT
}
static ALWAYS_INLINE void dfc030_put_word_state(uaecptr addr, uae_u32 v)
{
ACCESS_CHECK_PUT
ismoves030 = true;
dfc030_put_word(addr, v);
ismoves030 = false;
ACCESS_EXIT_PUT
}
static ALWAYS_INLINE void dfc030_put_byte_state(uaecptr addr, uae_u32 v)
{
ACCESS_CHECK_PUT
ismoves030 = true;
dfc030_put_byte(addr, v);
ismoves030 = false;
ACCESS_EXIT_PUT
}
uae_u32 REGPARAM3 get_disp_ea_020_mmu030 (uae_u32 base, int idx) REGPARAM;
STATIC_INLINE void put_byte_mmu030_state (uaecptr addr, uae_u32 v)
{
ACCESS_CHECK_PUT
uae_mmu030_put_byte (addr, v);
ACCESS_EXIT_PUT
}
STATIC_INLINE void put_lrmw_byte_mmu030_state (uaecptr addr, uae_u32 v)
{
ACCESS_CHECK_PUT
uae_mmu030_put_lrmw (addr, v, sz_byte);
ACCESS_EXIT_PUT
}
STATIC_INLINE void put_word_mmu030_state (uaecptr addr, uae_u32 v)
{
ACCESS_CHECK_PUT
uae_mmu030_put_word (addr, v);
ACCESS_EXIT_PUT
}
STATIC_INLINE void put_lrmw_word_mmu030_state (uaecptr addr, uae_u32 v)
{
ACCESS_CHECK_PUT
uae_mmu030_put_lrmw (addr, v, sz_word);
ACCESS_EXIT_PUT
}
STATIC_INLINE void put_long_mmu030_state (uaecptr addr, uae_u32 v)
{
ACCESS_CHECK_PUT
uae_mmu030_put_long (addr, v);
ACCESS_EXIT_PUT
}
STATIC_INLINE void put_lrmw_long_mmu030_state (uaecptr addr, uae_u32 v)
{
ACCESS_CHECK_PUT
uae_mmu030_put_lrmw (addr, v, sz_long);
ACCESS_EXIT_PUT
}
STATIC_INLINE uae_u32 get_byte_mmu030_state (uaecptr addr)
{
uae_u32 v;
ACCESS_CHECK_GET
v = uae_mmu030_get_byte (addr);
ACCESS_EXIT_GET
return v;
}
STATIC_INLINE uae_u32 get_lrmw_byte_mmu030_state (uaecptr addr)
{
uae_u32 v;
ACCESS_CHECK_GET
v = uae_mmu030_get_lrmw (addr, sz_byte);
ACCESS_EXIT_GET
return v;
}
STATIC_INLINE uae_u32 get_word_mmu030_state (uaecptr addr)
{
uae_u32 v;
ACCESS_CHECK_GET
v = uae_mmu030_get_word (addr);
ACCESS_EXIT_GET
return v;
}
STATIC_INLINE uae_u32 get_lrmw_word_mmu030_state (uaecptr addr)
{
uae_u32 v;
ACCESS_CHECK_GET
v = uae_mmu030_get_lrmw (addr, sz_word);
ACCESS_EXIT_GET
return v;
}
STATIC_INLINE uae_u32 get_long_mmu030_state (uaecptr addr)
{
uae_u32 v;
ACCESS_CHECK_GET
v = uae_mmu030_get_long (addr);
ACCESS_EXIT_GET
return v;
}
STATIC_INLINE uae_u32 get_lrmw_long_mmu030_state (uaecptr addr)
{
uae_u32 v;
ACCESS_CHECK_GET
v = uae_mmu030_get_lrmw (addr, sz_long);
ACCESS_EXIT_GET
return v;
}
STATIC_INLINE uae_u32 get_ibyte_mmu030_state (int o)
{
uae_u32 v;
uae_u32 addr = m68k_getpci () + o;
ACCESS_CHECK_GET
v = uae_mmu030_get_iword (addr);
ACCESS_EXIT_GET
return v;
}
STATIC_INLINE uae_u32 get_iword_mmu030_state (int o)
{
uae_u32 v;
uae_u32 addr = m68k_getpci () + o;
ACCESS_CHECK_GET
v = uae_mmu030_get_iword (addr);
ACCESS_EXIT_GET
return v;
}
STATIC_INLINE uae_u32 get_ilong_mmu030_state (int o)
{
uae_u32 v;
uae_u32 addr = m68k_getpci () + o;
ACCESS_CHECK_GET
v = uae_mmu030_get_ilong(addr);
ACCESS_EXIT_GET
return v;
}
STATIC_INLINE uae_u32 next_iword_mmu030_state (void)
{
uae_u32 v;
uae_u32 addr = m68k_getpci ();
ACCESS_CHECK_GET_PC(2);
v = uae_mmu030_get_iword (addr);
m68k_incpci (2);
ACCESS_EXIT_GET
return v;
}
STATIC_INLINE uae_u32 next_ilong_mmu030_state (void)
{
uae_u32 v;
uae_u32 addr = m68k_getpci ();
ACCESS_CHECK_GET_PC(4);
v = uae_mmu030_get_ilong(addr);
m68k_incpci (4);
ACCESS_EXIT_GET
return v;
}
STATIC_INLINE uae_u32 get_byte_mmu030 (uaecptr addr)
{
return uae_mmu030_get_byte (addr);
}
STATIC_INLINE uae_u32 get_word_mmu030 (uaecptr addr)
{
return uae_mmu030_get_word (addr);
}
STATIC_INLINE uae_u32 get_long_mmu030 (uaecptr addr)
{
return uae_mmu030_get_long (addr);
}
STATIC_INLINE void put_byte_mmu030 (uaecptr addr, uae_u32 v)
{
uae_mmu030_put_byte (addr, v);
}
STATIC_INLINE void put_word_mmu030 (uaecptr addr, uae_u32 v)
{
uae_mmu030_put_word (addr, v);
}
STATIC_INLINE void put_long_mmu030 (uaecptr addr, uae_u32 v)
{
uae_mmu030_put_long (addr, v);
}
STATIC_INLINE uae_u32 get_ibyte_mmu030 (int o)
{
uae_u32 pc = m68k_getpci () + o;
return uae_mmu030_get_iword (pc);
}
STATIC_INLINE uae_u32 get_iword_mmu030 (int o)
{
uae_u32 pc = m68k_getpci () + o;
return uae_mmu030_get_iword (pc);
}
STATIC_INLINE uae_u32 get_ilong_mmu030 (int o)
{
uae_u32 pc = m68k_getpci () + o;
return uae_mmu030_get_ilong (pc);
}
STATIC_INLINE uae_u32 next_iword_mmu030 (void)
{
uae_u32 v;
uae_u32 pc = m68k_getpci ();
v = uae_mmu030_get_iword (pc);
m68k_incpci (2);
return v;
}
STATIC_INLINE uae_u32 next_ilong_mmu030 (void)
{
uae_u32 v;
uae_u32 pc = m68k_getpci ();
v = uae_mmu030_get_ilong (pc);
m68k_incpci (4);
return v;
}
extern void m68k_do_rts_mmu030 (void);
extern void m68k_do_rte_mmu030 (uaecptr a7);
extern void flush_mmu030 (uaecptr, int);
extern void m68k_do_bsr_mmu030 (uaecptr oldpc, uae_s32 offset);
// more compatible + optional cache
static ALWAYS_INLINE uae_u32 mmu030_get_fc_byte(uaecptr addr, uae_u32 fc)
{
return mmu030_get_byte(addr, fc);
}
static ALWAYS_INLINE uae_u32 mmu030_get_fc_word(uaecptr addr, uae_u32 fc)
{
return mmu030_get_word(addr, fc);
}
static ALWAYS_INLINE uae_u32 mmu030_get_fc_long(uaecptr addr, uae_u32 fc)
{
return mmu030_get_long(addr, fc);
}
static ALWAYS_INLINE void mmu030_put_fc_byte(uaecptr addr, uae_u32 val, uae_u32 fc)
{
mmu030_put_byte(addr, val, fc);
}
static ALWAYS_INLINE void mmu030_put_fc_word(uaecptr addr, uae_u32 val, uae_u32 fc)
{
mmu030_put_word(addr, val, fc);
}
static ALWAYS_INLINE void mmu030_put_fc_long(uaecptr addr, uae_u32 val, uae_u32 fc)
{
mmu030_put_long(addr, val, fc);
}
static ALWAYS_INLINE uae_u32 sfc030c_get_long(uaecptr addr)
{
#if MMUDEBUG > 2
write_log(_T("sfc030_get_long: FC = %i\n"), regs.sfc);
#endif
return read_data_030_fc_lget(addr, regs.sfc);
}
static ALWAYS_INLINE uae_u16 sfc030c_get_word(uaecptr addr)
{
#if MMUDEBUG > 2
write_log(_T("sfc030_get_word: FC = %i\n"), regs.sfc);
#endif
return read_data_030_fc_wget(addr, regs.sfc);
}
static ALWAYS_INLINE uae_u8 sfc030c_get_byte(uaecptr addr)
{
#if MMUDEBUG > 2
write_log(_T("sfc030_get_byte: FC = %i\n"), regs.sfc);
#endif
return read_data_030_fc_bget(addr, regs.sfc);
}
static ALWAYS_INLINE void dfc030c_put_long(uaecptr addr, uae_u32 val)
{
#if MMUDEBUG > 2
write_log(_T("dfc030_put_long: %08X = %08X FC = %i\n"), addr, val, regs.dfc);
#endif
write_data_030_fc_lput(addr, val, regs.dfc);
}
static ALWAYS_INLINE void dfc030c_put_word(uaecptr addr, uae_u16 val)
{
#if MMUDEBUG > 2
write_log(_T("dfc030_put_word: %08X = %04X FC = %i\n"), addr, val, regs.dfc);
#endif
write_data_030_fc_wput(addr, val, regs.dfc);
}
static ALWAYS_INLINE void dfc030c_put_byte(uaecptr addr, uae_u8 val)
{
#if MMUDEBUG > 2
write_log(_T("dfc030_put_byte: %08X = %02X FC = %i\n"), addr, val, regs.dfc);
#endif
write_data_030_fc_bput(addr, val, regs.dfc);
}
static ALWAYS_INLINE uae_u32 sfc030c_get_long_state(uaecptr addr)
{
uae_u32 v;
ACCESS_CHECK_GET
v = sfc030c_get_long(addr);
ACCESS_EXIT_GET
return v;
}
static ALWAYS_INLINE uae_u16 sfc030c_get_word_state(uaecptr addr)
{
uae_u32 v;
ACCESS_CHECK_GET
v = sfc030c_get_word(addr);
ACCESS_EXIT_GET
return v;
}
static ALWAYS_INLINE uae_u8 sfc030c_get_byte_state(uaecptr addr)
{
uae_u32 v;
ACCESS_CHECK_GET
v = sfc030c_get_byte(addr);
ACCESS_EXIT_GET
return v;
}
static ALWAYS_INLINE void dfc030c_put_long_state(uaecptr addr, uae_u32 v)
{
ACCESS_CHECK_PUT
dfc030c_put_long(addr, v);
ACCESS_EXIT_PUT
}
static ALWAYS_INLINE void dfc030c_put_word_state(uaecptr addr, uae_u32 v)
{
ACCESS_CHECK_PUT
dfc030c_put_word(addr, v);
ACCESS_EXIT_PUT
}
static ALWAYS_INLINE void dfc030c_put_byte_state(uaecptr addr, uae_u32 v)
{
ACCESS_CHECK_PUT
dfc030c_put_byte(addr, v);
ACCESS_EXIT_PUT
}
uae_u32 REGPARAM3 get_disp_ea_020_mmu030c (uae_u32 base, int idx) REGPARAM;
STATIC_INLINE void put_byte_mmu030c_state (uaecptr addr, uae_u32 v)
{
ACCESS_CHECK_PUT
write_data_030_bput(addr, v);
ACCESS_EXIT_PUT
}
STATIC_INLINE void put_lrmw_byte_mmu030c_state (uaecptr addr, uae_u32 v)
{
islrmw030 = true;
ACCESS_CHECK_PUT
write_dcache030_lrmw_mmu(addr, v, 0);
ACCESS_EXIT_PUT
islrmw030 = false;
}
STATIC_INLINE void put_word_mmu030c_state (uaecptr addr, uae_u32 v)
{
ACCESS_CHECK_PUT
write_data_030_wput(addr, v);
ACCESS_EXIT_PUT
}
STATIC_INLINE void put_lrmw_word_mmu030c_state (uaecptr addr, uae_u32 v)
{
islrmw030 = true;
ACCESS_CHECK_PUT
write_dcache030_lrmw_mmu(addr, v, 1);
ACCESS_EXIT_PUT
islrmw030 = false;
}
STATIC_INLINE void put_long_mmu030c_state (uaecptr addr, uae_u32 v)
{
ACCESS_CHECK_PUT
write_data_030_lput(addr, v);
ACCESS_EXIT_PUT
}
STATIC_INLINE void put_lrmw_long_mmu030c_state (uaecptr addr, uae_u32 v)
{
islrmw030 = true;
ACCESS_CHECK_PUT
write_dcache030_lrmw_mmu(addr, v, 2);
ACCESS_EXIT_PUT
islrmw030 = false;
}
STATIC_INLINE uae_u32 get_byte_mmu030c_state (uaecptr addr)
{
uae_u32 v;
ACCESS_CHECK_GET
v = read_data_030_bget(addr);
ACCESS_EXIT_GET
return v;
}
STATIC_INLINE uae_u32 get_lrmw_byte_mmu030c_state (uaecptr addr)
{
uae_u32 v;
islrmw030 = true;
ACCESS_CHECK_GET
v = read_dcache030_lrmw_mmu(addr, 0);
ACCESS_EXIT_GET
islrmw030 = false;
return v;
}
STATIC_INLINE uae_u32 get_word_mmu030c_state (uaecptr addr)
{
uae_u32 v;
ACCESS_CHECK_GET
v = read_data_030_wget(addr);
ACCESS_EXIT_GET
return v;
}
STATIC_INLINE uae_u32 get_lrmw_word_mmu030c_state (uaecptr addr)
{
uae_u32 v;
islrmw030 = true;
ACCESS_CHECK_GET
v = read_dcache030_lrmw_mmu(addr, 1);
ACCESS_EXIT_GET
islrmw030 = false;
return v;
}
STATIC_INLINE uae_u32 get_long_mmu030c_state (uaecptr addr)
{
uae_u32 v;
ACCESS_CHECK_GET
v = read_data_030_lget(addr);
ACCESS_EXIT_GET
return v;
}
STATIC_INLINE uae_u32 get_lrmw_long_mmu030c_state (uaecptr addr)
{
uae_u32 v;
islrmw030 = true;
ACCESS_CHECK_GET
v = read_dcache030_lrmw_mmu(addr, 2);
ACCESS_EXIT_GET
islrmw030 = false;
return v;
}
STATIC_INLINE uae_u32 get_ibyte_mmu030c_state (int o)
{
uae_u32 v;
uae_u32 addr = m68k_getpci () + o;
ACCESS_CHECK_GET
v = get_word_icache030(addr);
ACCESS_EXIT_GET
return v;
}
uae_u32 get_word_030_prefetch(int o);
STATIC_INLINE uae_u32 get_iword_mmu030c_state (int o)
{
uae_u32 v;
ACCESS_CHECK_GET;
v = get_word_030_prefetch(o);
ACCESS_EXIT_GET
return v;
}
STATIC_INLINE uae_u32 get_ilong_mmu030c_state (int o)
{
uae_u32 v;
v = get_iword_mmu030c_state(o + 0) << 16;
v |= get_iword_mmu030c_state(o + 2) & 0xffff;
return v;
}
STATIC_INLINE uae_u32 get_iword_mmu030c_opcode_state(int o)
{
return get_iword_mmu030c_state(o);
}
STATIC_INLINE uae_u32 next_iword_mmu030c_state (void)
{
uae_u32 v;
ACCESS_CHECK_GET_PC(2);
v = get_word_030_prefetch(0);
m68k_incpci(2);
ACCESS_EXIT_GET
return v;
}
STATIC_INLINE uae_u32 next_ilong_mmu030c_state (void)
{
uae_u32 v;
v = next_iword_mmu030c_state() << 16;
v |= next_iword_mmu030c_state() & 0xffff;
return v;
}
STATIC_INLINE uae_u32 get_word_mmu030c (uaecptr addr)
{
return read_data_030_wget(addr);
}
STATIC_INLINE uae_u32 get_long_mmu030c (uaecptr addr)
{
return read_data_030_lget(addr);
}
STATIC_INLINE void put_word_mmu030c (uaecptr addr, uae_u32 v)
{
write_data_030_wput(addr, v);
}
STATIC_INLINE void put_long_mmu030c (uaecptr addr, uae_u32 v)
{
write_data_030_lput(addr, v);
}
extern void m68k_do_rts_mmu030c(void);
extern void m68k_do_rte_mmu030c(uaecptr a7);
extern void m68k_do_bsr_mmu030c(uaecptr oldpc, uae_s32 offset);
#endif /* UAE_CPUMMU030_H */

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,24 @@
#include "uae/types.h"
#include "machdep/rpt.h"
extern bool aga_mode;
#define BEAMCON0_HARDDIS 0x4000
#define BEAMCON0_LPENDIS 0x2000
#define BEAMCON0_VARVBEN 0x1000
#define BEAMCON0_LOLDIS 0x0800
#define BEAMCON0_CSCBEN 0x0400
#define BEAMCON0_VARVSYEN 0x0200
#define BEAMCON0_VARHSYEN 0x0100
#define BEAMCON0_VARBEAMEN 0x0080
#define BEAMCON0_DUAL 0x0040
#define BEAMCON0_PAL 0x0020
#define BEAMCON0_VARCSYEN 0x0010
#define BEAMCON0_BLANKEN 0x0008
#define BEAMCON0_CSYTRUE 0x0004
#define BEAMCON0_VSYTRUE 0x0002
#define BEAMCON0_HSYTRUE 0x0001
extern bool aga_mode, ecs_agnus, ecs_denise;
extern bool agnusa1000, denisea1000_noehb, denisea1000;
extern bool direct_rgb;
/* These are the masks that are ORed together in the chipset_mask option.
@ -28,23 +45,25 @@ extern bool direct_rgb;
#define MAXHPOS_ROWS 256
#define MAXVPOS_LINES_ECS 2048
#define MAXVPOS_LINES_OCS 512
#define HPOS_SHIFT 3
uae_u32 get_copper_address (int copno);
#define BLIT_NASTY_CPU_STEAL_CYCLE_COUNT 3
extern int custom_init (void);
extern void custom_prepare (void);
extern void custom_reset (bool hardreset, bool keyboardreset);
extern int intlev (void);
extern void dumpcustom (void);
uae_u32 get_copper_address(int copno);
extern void do_copper (void);
extern int custom_init(void);
extern void custom_prepare(void);
extern void custom_reset(bool hardreset, bool keyboardreset);
extern int intlev(void);
extern void intlev_ack(int);
extern void dumpcustom(void);
extern void notice_new_xcolors (void);
extern void do_copper(void);
extern void notice_new_xcolors(void);
extern void notice_screen_contents_lost(int monid);
extern void init_row_map (void);
extern void init_hz_normal (void);
extern void init_custom (void);
extern void init_row_map(void);
extern void init_hz_normal(void);
extern void init_custom(void);
extern void set_picasso_hack_rate(int hz);
@ -56,33 +75,16 @@ extern uae_u32 hsync_counter, vsync_counter;
extern uae_u16 dmacon;
extern uae_u16 intena, intreq, intreqr;
extern int vpos, lof_store;
extern int vpos, lof_store, lof_display;
extern int scandoubled_line;
extern int n_frames;
STATIC_INLINE int dmaen (unsigned int dmamask)
STATIC_INLINE int dmaen(unsigned int dmamask)
{
return (dmamask & dmacon) && (dmacon & 0x200);
}
#define SPCFLAG_STOP 2
#define SPCFLAG_COPPER 4
#define SPCFLAG_INT 8
#define SPCFLAG_BRK 16
#define SPCFLAG_UAEINT 32
#define SPCFLAG_TRACE 64
#define SPCFLAG_DOTRACE 128
#define SPCFLAG_DOINT 256 /* arg, JIT fails without this.. */
#define SPCFLAG_BLTNASTY 512
#define SPCFLAG_EXEC 1024
#define SPCFLAG_ACTION_REPLAY 2048
#define SPCFLAG_TRAP 4096 /* enforcer-hack */
#define SPCFLAG_MODE_CHANGE 8192
#ifdef JIT
#define SPCFLAG_END_COMPILE 16384
#endif
#define SPCFLAG_CHECK 32768
extern uae_u16 adkcon;
extern unsigned int joy0dir, joy1dir;
@ -102,7 +104,7 @@ extern uae_u16 INTREQR(void);
#define MAXVPOS 312
#else
#define MAXHPOS 256
#define MAXVPOS 592
#define MAXVPOS 800
#endif
/* PAL/NTSC values */
@ -116,23 +118,27 @@ extern uae_u16 INTREQR(void);
#define VBLANK_ENDLINE_PAL 26
#define VBLANK_ENDLINE_NTSC 21
// line when sprite DMA fetches first control words
#define VBLANK_SPRITE_PAL 25
#define VBLANK_SPRITE_NTSC 20
#define VBLANK_STOP_PAL 25
#define VBLANK_STOP_NTSC 20
#define VBLANK_HZ_PAL 50
#define VBLANK_HZ_NTSC 60
#define VSYNC_ENDLINE_PAL 5
#define VSYNC_ENDLINE_NTSC 6
#define EQU_ENDLINE_PAL 8
#define EQU_ENDLINE_NTSC 10
#define EQU_ENDLINE_NTSC 9
extern int maxhpos, maxhpos_short;
extern int maxvpos, maxvpos_nom, maxvpos_display;
extern int hsyncstartpos, hsyncendpos;
extern int minfirstline, vblank_endline, numscrlines;
#define OCS_DENISE_HBLANK_DISABLE_HPOS 0x2e
extern int maxhpos, maxhposm0, maxhpos_short;
extern int maxvpos, maxvpos_nom, maxvpos_display, maxvpos_display_vsync, maxhpos_display;
extern int maxvsize_display;
extern int hsyncstartpos_hw, hsyncendpos_hw;
extern int minfirstline, minfirstline_linear, vblank_endline, numscrlines;
extern float vblank_hz, fake_vblank_hz;
extern float hblank_hz;
extern int vblank_skip, doublescan;
extern bool programmedmode;
extern int programmedmode;
extern int vblank_firstline_hw;
extern int display_reset;
#define DMA_AUD0 0x0001
@ -147,29 +153,29 @@ extern int display_reset;
#define DMA_MASTER 0x0200
#define DMA_BLITPRI 0x0400
#define CYCLE_REFRESH 1
#define CYCLE_STROBE 2
#define CYCLE_MISC 3
#define CYCLE_SPRITE 4
#define CYCLE_COPPER 5
#define CYCLE_BLITTER 6
#define CYCLE_CPU 7
#define CYCLE_CPUNASTY 8
#define CYCLE_COPPER_SPECIAL 0x10
#define CYCLE_BITPLANE 1
#define CYCLE_REFRESH 2
#define CYCLE_STROBE 3
#define CYCLE_MISC 4
#define CYCLE_SPRITE 5
#define CYCLE_COPPER 6
#define CYCLE_BLITTER 7
#define CYCLE_CPU 8
#define CYCLE_MASK 0x0f
extern uae_u32 timeframes;
extern evt_t frametime;
extern uae_u16 htotal, vtotal, beamcon0;
extern uae_u16 htotal, vtotal, beamcon0, new_beamcon0;
extern uae_u16 bemcon0_hsync_mask, bemcon0_vsync_mask;
/* 100 words give you 1600 horizontal pixels. Should be more than enough for
* superhires. Don't forget to update the definition in genp2c.c as well.
* needs to be larger for superhires support */
// 100 words give you 1600 horizontal pixels. Should be more than enough for superhires.
// Extreme overscan superhires needs more.
// must be divisible by 8
#ifdef CUSTOM_SIMPLE
#define MAX_WORDS_PER_LINE 50
#define MAX_WORDS_PER_LINE 56
#else
#define MAX_WORDS_PER_LINE 100
#define MAX_WORDS_PER_LINE 112
#endif
extern uae_u32 hirestab_h[256][2];
@ -201,14 +207,14 @@ extern int xbluecolor_s, xbluecolor_b, xbluecolor_m;
/* get resolution from bplcon0 */
STATIC_INLINE int GET_RES_DENISE(uae_u16 con0)
{
if (!(currprefs.chipset_mask & CSMASK_ECS_DENISE)) {
if (!ecs_denise) {
con0 &= ~0x40; // SUPERHIRES
}
return ((con0) & 0x40) ? RES_SUPERHIRES : ((con0) & 0x8000) ? RES_HIRES : RES_LORES;
}
STATIC_INLINE int GET_RES_AGNUS(uae_u16 con0)
{
if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) {
if (!ecs_agnus) {
con0 &= ~0x40; // SUPERHIRES
}
return ((con0) & 0x40) ? RES_SUPERHIRES : ((con0) & 0x8000) ? RES_HIRES : RES_LORES;
@ -225,7 +231,7 @@ STATIC_INLINE int GET_PLANES(uae_u16 bplcon0)
return (bplcon0 >> 12) & 7; // normal planes bits
}
extern void fpscounter_reset (void);
extern void fpscounter_reset(void);
extern frame_time_t idletime;
extern int lightpen_x[2], lightpen_y[2];
extern int lightpen_cx[2], lightpen_cy[2], lightpen_active, lightpen_enabled, lightpen_enabled2;
@ -234,18 +240,47 @@ struct customhack {
uae_u16 v;
int vpos, hpos;
};
void customhack_put (struct customhack *ch, uae_u16 v, int hpos);
uae_u16 customhack_get (struct customhack *ch, int hpos);
extern void alloc_cycle_ext (int, int);
extern void alloc_cycle_blitter (int hpos, uaecptr *ptr, int);
extern bool ispal (void);
extern bool isvga (void);
extern int current_maxvpos (void);
extern struct chipset_refresh *get_chipset_refresh (struct uae_prefs*);
extern void compute_framesync (void);
extern void alloc_cycle_ext(int, int);
extern bool alloc_cycle_blitter(int hpos, uaecptr *ptr, int, int);
extern uaecptr alloc_cycle_blitter_conflict_or(int, int, bool*);
extern bool ispal(int *lines);
extern bool isvga(void);
extern int current_maxvpos(void);
extern struct chipset_refresh *get_chipset_refresh(struct uae_prefs*);
extern void compute_framesync(void);
extern void getsyncregisters(uae_u16 *phsstrt, uae_u16 *phsstop, uae_u16 *pvsstrt, uae_u16 *pvsstop);
int is_bitplane_dma (int hpos);
bool blitter_cant_access(int hpos);
void custom_cpuchange(void);
bool bitplane_dma_access(int hpos, int offset);
void custom_dumpstate(int);
bool get_ras_cas(uaecptr, int*, int*);
void get_mode_blanking_limits(int *phbstop, int *phbstrt, int *pvbstop, int *pvbstrt);
#define RGA_PIPELINE_ADJUST 4
#define MAX_CHIPSETSLOTS 256
#define MAX_CHIPSETSLOTS_EXTRA 12
extern uae_u8 cycle_line_slot[MAX_CHIPSETSLOTS + RGA_PIPELINE_ADJUST + MAX_CHIPSETSLOTS_EXTRA];
extern uae_u16 cycle_line_pipe[MAX_CHIPSETSLOTS + RGA_PIPELINE_ADJUST + MAX_CHIPSETSLOTS_EXTRA];
extern uae_u16 blitter_pipe[MAX_CHIPSETSLOTS + RGA_PIPELINE_ADJUST + MAX_CHIPSETSLOTS_EXTRA];
#define CYCLE_PIPE_CPUSTEAL 0x8000
#define CYCLE_PIPE_NONE 0x4000
#define CYCLE_PIPE_BLITTER 0x100
#define CYCLE_PIPE_COPPER 0x80
#define CYCLE_PIPE_SPRITE 0x40
#define CYCLE_PIPE_BITPLANE 0x20
#define CYCLE_PIPE_MODULO 0x10
#define RGA_PIPELINE_MASK 255
#define RGA_PIPELINE_OFFSET_BLITTER 1
extern int rga_pipeline_blitter;
STATIC_INLINE int get_rga_pipeline(int hpos, int off)
{
return (hpos + off) % maxhposm0;
}
struct custom_store
{

View File

@ -22,54 +22,79 @@
#define MAX_PLANES 6
#endif
#define AMIGA_WIDTH_MAX (752 / 2)
#define AMIGA_HEIGHT_MAX (576 / 2)
extern int lores_shift, shres_shift, interlace_seen;
extern int visible_left_border, visible_right_border;
extern int detected_screen_resolution;
extern int hsync_end_left_border, denisehtotal;
//#define NEWHSYNC
#define AMIGA_WIDTH_MAX (754 / 2)
#define AMIGA_HEIGHT_MAX_PAL (576 / 2)
#define AMIGA_HEIGHT_MAX_NTSC (486 / 2)
#define AMIGA_HEIGHT_MAX (AMIGA_HEIGHT_MAX_PAL)
// Cycles * 2 from start of scanline to first refresh slot (hsync strobe slot)
#define DDF_OFFSET (2 * 4)
#define RECORDED_REGISTER_CHANGE_OFFSET 0x1000
#ifdef NEWHSYNC
#define DIW_DDF_OFFSET 9
/* this many cycles starting from hpos=0 are visible on right border */
#define HBLANK_OFFSET 13
#define DISPLAY_LEFT_SHIFT 0x40
#else
/* According to the HRM, pixel data spends a couple of cycles somewhere in the chips
before it appears on-screen. (TW: display emulation now does this automatically) */
#define DIW_DDF_OFFSET 1
#define DIW_DDF_OFFSET_SHRES (DIW_DDF_OFFSET << 2)
/* this many cycles starting from hpos=0 are visible on right border */
#define HBLANK_OFFSET 9
/* We ignore that many lores pixels at the start of the display. These are
* invisible anyway due to hardware DDF limits. */
#define DISPLAY_LEFT_SHIFT 0x38
#define DISPLAY_LEFT_SHIFT 0
#define DISPLAY_LEFT_SHIFT_SHRES (DISPLAY_LEFT_SHIFT << 2)
#endif
#define PIXEL_XPOS(HPOS) (((HPOS)*2 - DISPLAY_LEFT_SHIFT + DIW_DDF_OFFSET - 1) << lores_shift)
#define CCK_SHRES_SHIFT 3
#define min_diwlastword (0)
#define max_diwlastword (PIXEL_XPOS(0x1d4 >> 1))
extern int lores_shift, shres_shift, interlace_seen;
extern bool aga_mode, direct_rgb;
extern int visible_left_border, visible_right_border;
extern int detected_screen_resolution;
STATIC_INLINE int shres_coord_hw_to_window_x (int x)
STATIC_INLINE int shres_coord_hw_to_window_x(int x)
{
x -= DISPLAY_LEFT_SHIFT << 2;
x -= DISPLAY_LEFT_SHIFT_SHRES;
x <<= lores_shift;
x >>= 2;
return x;
}
STATIC_INLINE int coord_hw_to_window_x (int x)
STATIC_INLINE int coord_hw_to_window_x_shres(int xx)
{
int x = xx >> (CCK_SHRES_SHIFT - 1);
x -= DISPLAY_LEFT_SHIFT;
if (lores_shift == 1) {
x <<= 1;
x |= (xx >> 1) & 1;
} else if (lores_shift == 2) {
x <<= 2;
x |= xx & 3;
}
return x;
}
STATIC_INLINE int coord_hw_to_window_x_lores(int x)
{
x -= DISPLAY_LEFT_SHIFT;
return x << lores_shift;
}
STATIC_INLINE int coord_window_to_hw_x (int x)
STATIC_INLINE int PIXEL_XPOS(int xx)
{
int x = xx >> (CCK_SHRES_SHIFT - 1);
x -= DISPLAY_LEFT_SHIFT;
x += DIW_DDF_OFFSET;
x -= 1;
if (lores_shift == 1) {
x <<= 1;
x |= (xx >> 1) & 1;
} else if (lores_shift == 2) {
x <<= 2;
x |= xx & 3;
}
return x;
}
#define min_diwlastword (PIXEL_XPOS(hsyncstartpos_start_cycles << CCK_SHRES_SHIFT))
#define max_diwlastword (PIXEL_XPOS(denisehtotal))
STATIC_INLINE int coord_window_to_hw_x(int x)
{
x >>= lores_shift;
return x + DISPLAY_LEFT_SHIFT;
@ -80,12 +105,12 @@ STATIC_INLINE int coord_diw_lores_to_window_x(int x)
return (x - DISPLAY_LEFT_SHIFT + DIW_DDF_OFFSET - 1) << lores_shift;
}
STATIC_INLINE int coord_diw_shres_to_window_x (int x)
STATIC_INLINE int coord_diw_shres_to_window_x(int x)
{
return (x - DISPLAY_LEFT_SHIFT_SHRES + DIW_DDF_OFFSET_SHRES - (1 << 2)) >> shres_shift;
}
STATIC_INLINE int coord_window_to_diw_x (int x)
STATIC_INLINE int coord_window_to_diw_x(int x)
{
x = coord_window_to_hw_x (x);
return x - DIW_DDF_OFFSET;
@ -99,21 +124,33 @@ STATIC_INLINE int coord_window_to_diw_x (int x)
#define CE_BORDERBLANK 0
#define CE_BORDERNTRANS 1
#define CE_BORDERSPRITE 2
#define CE_SHRES_DELAY 4
#define CE_EXTBLANKSET 3
#define CE_SHRES_DELAY_SHIFT 8
STATIC_INLINE bool ce_is_borderblank(uae_u8 data)
STATIC_INLINE bool ce_is_borderblank(uae_u16 data)
{
return (data & (1 << CE_BORDERBLANK)) != 0;
}
STATIC_INLINE bool ce_is_bordersprite(uae_u8 data)
STATIC_INLINE bool ce_is_extblankset(uae_u16 data)
{
return (data & (1 << CE_EXTBLANKSET)) != 0;
}
STATIC_INLINE bool ce_is_bordersprite(uae_u16 data)
{
return (data & (1 << CE_BORDERSPRITE)) != 0;
}
STATIC_INLINE bool ce_is_borderntrans(uae_u8 data)
STATIC_INLINE bool ce_is_borderntrans(uae_u16 data)
{
return (data & (1 << CE_BORDERNTRANS)) != 0;
}
#define VB_VB 0x20 // vblank
#define VB_VS 0x10 // vsync
#define VB_XBORDER 0x08 // forced border color or bblank
#define VB_XBLANK 0x04 // forced bblank
#define VB_PRGVB 0x02 // programmed vblank
#define VB_NOVB 0x01 // normal
struct color_entry {
uae_u16 color_regs_ecs[32];
#ifndef AGA
@ -122,7 +159,7 @@ struct color_entry {
xcolnr acolors[256];
uae_u32 color_regs_aga[256];
#endif
uae_u8 extra;
uae_u16 extra;
};
#ifdef AGA
@ -146,7 +183,7 @@ STATIC_INLINE xcolnr getxcolor(int c)
return CONVERT_RGB(c);
else
#endif
return xcolors[c];
return xcolors[c & 0xfff];
}
/* functions for reading, writing, copying and comparing struct color_entry */
@ -206,8 +243,10 @@ STATIC_INLINE void color_reg_cpy (struct color_entry *dst, struct color_entry *s
#define COLOR_CHANGE_BRDBLANK 0x80000000
#define COLOR_CHANGE_SHRES_DELAY 0x40000000
#define COLOR_CHANGE_HSYNC_HACK 0x20000000
#define COLOR_CHANGE_BLANK 0x20000000
#define COLOR_CHANGE_ACTBORDER (COLOR_CHANGE_BLANK | COLOR_CHANGE_BRDBLANK)
#define COLOR_CHANGE_MASK 0xf0000000
#define COLOR_CHANGE_GENLOCK 0x01000000
struct color_change {
int linepos;
int regno;
@ -218,11 +257,13 @@ struct color_change {
#ifdef UAE_MINI
#define MAX_PIXELS_PER_LINE 880
#else
#define MAX_PIXELS_PER_LINE 1760
#define MAX_PIXELS_PER_LINE 2304
#endif
#define MAXVPOS_WRAPLINES 10
/* No divisors for MAX_PIXELS_PER_LINE; we support AGA and SHRES sprites */
#define MAX_SPR_PIXELS (((MAXVPOS + 1) * 2 + 1) * MAX_PIXELS_PER_LINE)
#define MAX_SPR_PIXELS ((((MAXVPOS + MAXVPOS_WRAPLINES) * 2 + 1) * MAX_PIXELS_PER_LINE) / 4)
struct sprite_entry
{
@ -249,7 +290,7 @@ extern uae_u16 spixels[MAX_SPR_PIXELS * 2];
#endif
/* Way too much... */
#define MAX_REG_CHANGE ((MAXVPOS + 1) * 2 * MAXHPOS)
#define MAX_REG_CHANGE ((MAXVPOS + MAXVPOS_WRAPLINES) * 2 * MAXHPOS / 2)
extern struct color_entry *curr_color_tables, *prev_color_tables;
@ -271,7 +312,7 @@ struct decision {
uae_u16 bplcon3, bplcon4bm, bplcon4sp;
uae_u16 fmode;
#endif
uae_u8 nr_planes;
uae_u8 nr_planes, max_planes;
uae_u8 bplres;
bool ehb_seen;
bool ham_seen;
@ -279,6 +320,7 @@ struct decision {
#ifdef AGA
bool bordersprite_seen;
bool xor_seen;
uae_u8 vb;
#endif
};
@ -290,9 +332,9 @@ struct draw_info {
int nr_color_changes, nr_sprites;
};
extern struct decision line_decisions[2 * (MAXVPOS + 2) + 1];
extern struct decision line_decisions[2 * (MAXVPOS + MAXVPOS_WRAPLINES) + 1];
extern uae_u8 line_data[(MAXVPOS + 2) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2];
extern uae_u8 line_data[(MAXVPOS + MAXVPOS_WRAPLINES) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2];
/* Functions in drawing.c. */
extern int coord_native_to_amiga_y (int);
@ -318,22 +360,23 @@ enum nln_how {
nln_lower_black_always
};
extern void hsync_record_line_state (int lineno, enum nln_how, int changed);
extern void vsync_handle_redraw (int long_field, int lof_changed, uae_u16, uae_u16, bool drawlines);
extern void hsync_record_line_state(int lineno, enum nln_how, int changed);
extern void hsync_record_line_state_last(int lineno, enum nln_how, int changed);
extern void vsync_handle_redraw (int long_field, int lof_changed, uae_u16, uae_u16, bool drawlines, bool initial);
extern bool vsync_handle_check (void);
extern void draw_lines(int end, int section);
extern void init_hardware_for_drawing_frame (void);
extern void reset_drawing (void);
extern void drawing_init (void);
extern bool notice_interlace_seen (bool);
extern void notice_resolution_seen (int, bool);
extern bool notice_interlace_seen(int, bool);
extern void notice_resolution_seen(int, bool);
extern bool frame_drawn (int monid);
extern void redraw_frame(void);
extern void full_redraw_all(void);
extern bool draw_frame (struct vidbuffer*);
extern int get_custom_limits (int *pw, int *ph, int *pdx, int *pdy, int *prealh);
extern void store_custom_limits (int w, int h, int dx, int dy);
extern void set_custom_limits (int w, int h, int dx, int dy);
extern void set_custom_limits (int w, int h, int dx, int dy, bool blank);
extern void check_custom_limits (void);
extern void get_custom_topedge (int *x, int *y, bool max);
extern void get_custom_raw_limits (int *pw, int *ph, int *pdx, int *pdy);
@ -342,6 +385,8 @@ extern void putpixel (uae_u8 *buf, uae_u8 *genlockbuf, int bpp, int x, xcolnr c8
extern void allocvidbuffer(int monid, struct vidbuffer *buf, int width, int height, int depth);
extern void freevidbuffer(int monid, struct vidbuffer *buf);
extern void check_prefs_picasso(void);
extern int get_vertical_visible_height(bool);
extern void get_screen_blanking_limits(int*, int*, int*, int*);
/* Finally, stuff that shouldn't really be shared. */

View File

@ -0,0 +1,86 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef UAE_EPSONPRINTER_H
#define UAE_EPSONPRINTER_H
#define Bit16u uae_u16
#define Bit16s uae_s16
#define Bit8u uae_u8
#define Real64 float
#define Bitu uae_u32
#define Bits uae_s32
#define Bit32u uae_u32
#ifndef WINFONT
#include "ft2build.h"
#include FT_FREETYPE_H
#endif
#if defined (WIN32)
#include <windows.h>
#include <winspool.h>
#endif
#define STYLE_PROP 0x01
#define STYLE_CONDENSED 0x02
#define STYLE_BOLD 0x04
#define STYLE_DOUBLESTRIKE 0x08
#define STYLE_DOUBLEWIDTH 0x10
#define STYLE_ITALICS 0x20
#define STYLE_UNDERLINE 0x40
#define STYLE_SUPERSCRIPT 0x80
#define STYLE_SUBSCRIPT 0x100
#define STYLE_STRIKETHROUGH 0x200
#define STYLE_OVERSCORE 0x400
#define STYLE_DOUBLEWIDTHONELINE 0x800
#define STYLE_DOUBLEHEIGHT 0x1000
#define SCORE_NONE 0x00
#define SCORE_SINGLE 0x01
#define SCORE_DOUBLE 0x02
#define SCORE_SINGLEBROKEN 0x05
#define SCORE_DOUBLEBROKEN 0x06
#define QUALITY_DRAFT 0x01
#define QUALITY_LQ 0x02
#define JUST_LEFT 0
#define JUST_CENTER 1
#define JUST_RIGHT 2
#define JUST_FULL 3
enum Typeface
{
roman = 0,
sansserif,
courier,
prestige,
script,
ocrb,
ocra,
orator,
orators,
scriptc,
romant,
sansserifh,
svbusaba = 30,
svjittra = 31
};
#endif /* UAE_EPSONPRINTER_H */

19
src/include/ersatz.h Normal file
View File

@ -0,0 +1,19 @@
/*
* UAE - The Un*x Amiga Emulator
*
* A "replacement" for a missing Kickstart
*
* (c) 1995 Bernd Schmidt
*/
#ifndef UAE_ERSATZ_H
#define UAE_ERSATZ_H
#include "uae/types.h"
extern void init_ersatz_rom (uae_u8 *data);
extern void ersatz_chipcopy (void);
extern void ersatz_perform (uae_u16);
extern void DISK_ersatz_read (int,int, uaecptr);
#endif /* UAE_ERSATZ_H */

View File

@ -26,7 +26,6 @@ extern frame_time_t vsynctimebase, syncbase;
extern void reset_frame_rate_hack(void);
extern evt_t vsync_cycles;
extern evt_t start_cycles;
extern int event2_count;
extern bool event_wait;
extern void event_init(void);
@ -37,7 +36,6 @@ extern void do_cycles_ce020(int cycles);
extern void events_schedule(void);
extern void do_cycles_slow(int cycles_to_add);
extern void events_reset_syncline(void);
extern void modify_eventcounter(int diff);
extern void clear_events(void);
extern bool is_cycle_ce(uaecptr);
@ -48,10 +46,6 @@ extern evt_t is_syncline_end;
typedef void (*evfunc)(void);
typedef void (*evfunc2)(uae_u32);
typedef void (*do_cycles_func)(int);
extern do_cycles_func do_cycles;
void do_cycles_cpu_fastest(int cycles_to_add);
void do_cycles_cpu_norm(int cycles_to_add);
struct ev
{
bool active;
@ -70,13 +64,13 @@ struct ev2
// hsync handlers must have priority over misc
enum {
ev_copper,
ev_cia, ev_audio, ev_hsync, ev_hsynch, ev_misc,
ev_cia, ev_hsync, ev_hsynch, ev_misc,
ev_audio,
ev_max
};
enum {
ev2_blitter, ev2_disk, ev2_misc,
ev2_blitter, ev2_misc,
ev2_max = 12
};
@ -84,11 +78,11 @@ extern int pissoff_value;
extern int pissoff;
#define countdown pissoff
#define do_cycles do_cycles_slow
extern struct ev eventtab[ev_max];
extern struct ev2 eventtab2[ev2_max];
extern int hpos_offset;
extern int maxhpos;
STATIC_INLINE void cycles_do_special (void)

View File

@ -7,7 +7,6 @@
/* E = MAX & F # 0 -> NotANumber */
/* E = biased by 127 (single) ,1023 (double) ,16383 (extended) */
#pragma once
#define FPSR_BSUN 0x00008000
#define FPSR_SNAN 0x00004000
#define FPSR_OPERR 0x00002000
@ -17,11 +16,155 @@
#define FPSR_INEX2 0x00000200
#define FPSR_INEX1 0x00000100
extern void fp_init_native(void);
#ifdef MSVC_LONG_DOUBLE
extern bool fp_init_native_80(void);
#endif
extern void fp_init_softfloat(int);
extern void fpsr_set_exception(uae_u32 exception);
extern void fpu_modechange(void);
extern void fpu_clearstatus(void);
extern void fpp_set_fpcr(uae_u32 val);
extern void fpp_set_fpsr(uae_u32 val);
extern void fpp_set_fpiar(uae_u32 val);
extern uae_u32 fpp_get_fpsr(void);
extern uae_u32 fpp_get_fpcr(void);
extern uae_u32 fpp_get_fpiar(void);
#if defined(CPU_i386) || defined(CPU_x86_64)
extern void init_fpucw_x87(void);
#ifdef MSVC_LONG_DOUBLE
extern void init_fpucw_x87_80(void);
#endif
#endif
extern void fpu_reset(void);
#define PREC_NORMAL 0
#define PREC_FLOAT 1
#define PREC_DOUBLE 2
#define PREC_EXTENDED 3
#define FPU_FEATURE_EXCEPTIONS 1
#define FPU_FEATURE_DENORMALS 2
typedef void (*FPP_ABQS)(fpdata*, fpdata*, uae_u64*, uae_u8*);
typedef void (*FPP_AB)(fpdata*, fpdata*);
typedef void (*FPP_ABP)(fpdata*, fpdata*, int);
typedef void (*FPP_A)(fpdata*);
typedef void (*FPP_ABC)(fpdata*, fpdata*, fpdata*);
typedef bool (*FPP_IS)(fpdata*);
typedef void (*FPP_SET_MODE)(uae_u32);
typedef void (*FPP_GET_STATUS)(uae_u32*);
typedef void (*FPP_CLEAR_STATUS)(void);
typedef uae_u32 (*FPP_SUPPORT_FLAGS)(void);
typedef void (*FPP_FROM_NATIVE)(fptype, fpdata*);
typedef void (*FPP_TO_NATIVE)(fptype*, fpdata*);
typedef void (*FPP_FROM_INT)(fpdata*,uae_s32);
typedef uae_s64 (*FPP_TO_INT)(fpdata*, int);
typedef void (*FPP_TO_SINGLE)(fpdata*, uae_u32);
typedef uae_u32 (*FPP_FROM_SINGLE)(fpdata*);
typedef void (*FPP_TO_DOUBLE)(fpdata*, uae_u32, uae_u32);
typedef void (*FPP_FROM_DOUBLE)(fpdata*, uae_u32*, uae_u32*);
typedef void (*FPP_TO_EXTEN)(fpdata*, uae_u32, uae_u32, uae_u32);
typedef void (*FPP_FROM_EXTEN)(fpdata*, uae_u32*, uae_u32*, uae_u32*);
typedef void (*FPP_PACK)(fpdata*, uae_u32*, int);
typedef const TCHAR* (*FPP_PRINT)(fpdata*,int);
typedef uae_u32 (*FPP_GET32)(void);
typedef void (*FPP_DENORMALIZE)(fpdata*,int);
extern FPP_PRINT fpp_print;
extern FPP_IS fpp_unset_snan;
extern FPP_IS fpp_is_init;
extern FPP_IS fpp_is_snan;
extern FPP_IS fpp_is_nan;
extern FPP_IS fpp_is_infinity;
extern FPP_IS fpp_is_zero;
extern FPP_IS fpp_is_neg;
extern FPP_IS fpp_is_denormal;
extern FPP_IS fpp_is_unnormal;
extern FPP_A fpp_fix_infinity;
extern FPP_GET_STATUS fpp_get_status;
extern FPP_CLEAR_STATUS fpp_clear_status;
extern FPP_SET_MODE fpp_set_mode;
extern FPP_SUPPORT_FLAGS fpp_get_support_flags;
extern FPP_TO_INT fpp_to_int;
extern FPP_FROM_INT fpp_from_int;
extern FPP_PACK fpp_to_pack;
extern FPP_PACK fpp_from_pack;
extern FPP_TO_SINGLE fpp_to_single;
extern FPP_FROM_SINGLE fpp_from_single;
extern FPP_TO_DOUBLE fpp_to_double;
extern FPP_FROM_DOUBLE fpp_from_double;
extern FPP_TO_EXTEN fpp_to_exten;
extern FPP_FROM_EXTEN fpp_from_exten;
extern FPP_TO_EXTEN fpp_to_exten_fmovem;
extern FPP_FROM_EXTEN fpp_from_exten_fmovem;
extern FPP_A fpp_round_single;
extern FPP_A fpp_round_double;
extern FPP_A fpp_round32;
extern FPP_A fpp_round64;
extern FPP_A fpp_normalize;
extern FPP_DENORMALIZE fpp_denormalize;
extern FPP_A fpp_get_internal_overflow;
extern FPP_A fpp_get_internal_underflow;
extern FPP_A fpp_get_internal_round_all;
extern FPP_A fpp_get_internal_round;
extern FPP_A fpp_get_internal_round_exten;
extern FPP_A fpp_get_internal;
extern FPP_GET32 fpp_get_internal_grs;
extern FPP_AB fpp_int;
extern FPP_AB fpp_sinh;
extern FPP_AB fpp_intrz;
extern FPP_ABP fpp_sqrt;
extern FPP_AB fpp_lognp1;
extern FPP_AB fpp_etoxm1;
extern FPP_AB fpp_tanh;
extern FPP_AB fpp_atan;
extern FPP_AB fpp_atanh;
extern FPP_AB fpp_sin;
extern FPP_AB fpp_asin;
extern FPP_AB fpp_tan;
extern FPP_AB fpp_etox;
extern FPP_AB fpp_twotox;
extern FPP_AB fpp_tentox;
extern FPP_AB fpp_logn;
extern FPP_AB fpp_log10;
extern FPP_AB fpp_log2;
extern FPP_ABP fpp_abs;
extern FPP_AB fpp_cosh;
extern FPP_ABP fpp_neg;
extern FPP_AB fpp_acos;
extern FPP_AB fpp_cos;
extern FPP_ABC fpp_sincos;
extern FPP_AB fpp_getexp;
extern FPP_AB fpp_getman;
extern FPP_ABP fpp_div;
extern FPP_ABQS fpp_mod;
extern FPP_ABP fpp_add;
extern FPP_ABP fpp_mul;
extern FPP_ABQS fpp_rem;
extern FPP_AB fpp_scale;
extern FPP_ABP fpp_sub;
extern FPP_AB fpp_sgldiv;
extern FPP_AB fpp_sglmul;
extern FPP_AB fpp_cmp;
extern FPP_AB fpp_tst;
extern FPP_ABP fpp_move;

94
src/include/gfxfilter.h Normal file
View File

@ -0,0 +1,94 @@
#ifndef UAE_GFXFILTER_H
#define UAE_GFXFILTER_H
#include "uae/types.h"
#ifdef GFXFILTER
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned long u32;
extern void S2X_refresh(int);
extern void S2X_render(int, int, int);
extern bool S2X_init (int, int dw, int dh, int dd);
extern void S2X_reset(int);
extern void S2X_free(int);
extern int S2X_getmult(int);
extern void PAL_init(int monid);
extern void PAL_1x1_32 (uae_u32 *src, int pitchs, uae_u32 *trg, int pitcht, int width, int height);
extern void PAL_1x1_16 (uae_u16 *src, int pitchs, uae_u16 *trg, int pitcht, int width, int height);
#ifndef __cplusplus
typedef int bool;
#endif
extern "C"
{
extern void S2X_configure(int, int rb, int gb, int bb, int rs, int gs, int bs);
extern int Init_2xSaI (int rb, int gb, int bb, int rs, int gs, int bs);
extern void Super2xSaI_16 (const uae_u8 *srcPtr, uae_u32 srcPitch, uae_u8 *dstPtr, uae_u32 dstPitch, int width, int height);
extern void Super2xSaI_32 (const uae_u8 *srcPtr, uae_u32 srcPitch, uae_u8 *dstPtr, uae_u32 dstPitch, int width, int height);
extern void SuperEagle_16 (const uae_u8 *srcPtr, uae_u32 srcPitch, uae_u8 *dstPtr, uae_u32 dstPitch, int width, int height);
extern void SuperEagle_32 (const uae_u8 *srcPtr, uae_u32 srcPitch, uae_u8 *dstPtr, uae_u32 dstPitch, int width, int height);
extern void _2xSaI_16 (const uae_u8 *srcPtr, uae_u32 srcPitch, uae_u8 *dstPtr, uae_u32 dstPitch, int width, int height);
extern void _2xSaI_32 (const uae_u8 *srcPtr, uae_u32 srcPitch, uae_u8 *dstPtr, uae_u32 dstPitch, int width, int height);
extern void AdMame2x (u8 *srcPtr, u32 srcPitch, /* u8 deltaPtr, */
u8 *dstPtr, u32 dstPitch, int width, int height);
extern void AdMame2x32 (u8 *srcPtr, u32 srcPitch, /* u8 deltaPtr, */
u8 *dstPtr, u32 dstPitch, int width, int height);
extern void hq_init (int rb, int gb, int bb, int rs, int gs, int bs);
extern void _cdecl hq2x_16 (unsigned char*, unsigned char*, DWORD, DWORD, DWORD);
extern void _cdecl hq2x_32 (unsigned char*, unsigned char*, DWORD, DWORD, DWORD);
extern void _cdecl hq3x_16 (unsigned char*, unsigned char*, DWORD, DWORD, DWORD);
extern void _cdecl hq3x_32 (unsigned char*, unsigned char*, DWORD, DWORD, DWORD);
extern void _cdecl hq4x_16 (unsigned char*, unsigned char*, DWORD, DWORD, DWORD);
extern void _cdecl hq4x_32 (unsigned char*, unsigned char*, DWORD, DWORD, DWORD);
}
#define UAE_FILTER_NULL 1
#define UAE_FILTER_SCALE2X 2
#define UAE_FILTER_HQ2X 3
#define UAE_FILTER_HQ3X 4
#define UAE_FILTER_HQ4X 5
#define UAE_FILTER_SUPEREAGLE 6
#define UAE_FILTER_SUPER2XSAI 7
#define UAE_FILTER_2XSAI 8
#define UAE_FILTER_PAL 9
#define UAE_FILTER_LAST 9
#define UAE_FILTER_MODE_16 16
#define UAE_FILTER_MODE_16_16 16
#define UAE_FILTER_MODE_16_32 (16 | 8)
#define UAE_FILTER_MODE_32 32
#define UAE_FILTER_MODE_32_32 32
#define UAE_FILTER_MODE_32_16 (32 | 8)
struct uae_filter
{
int type, yuv, intmul;
const TCHAR *name, *cfgname;
int flags;
};
extern struct uae_filter uaefilters[];
void getfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height, int aw, int ah, int scale, int *mode, int temp_width, int temp_height);
void getfilteroffset(int monid, float *dx, float *dy, float *mx, float *my);
uae_u8 *getfilterbuffer(int monid, int *widthp, int *heightp, int *pitch, int *depth);
void freefilterbuffer(int monid, uae_u8*);
uae_u8 *uaegfx_getrtgbuffer(int monid, int *widthp, int *heightp, int *pitch, int *depth, uae_u8 *palette);
void uaegfx_freertgbuffer(int monid, uae_u8 *dst);
extern void getrtgfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int *mode, int dst_width, int dst_height);
extern float filterrectmult(int v1, float v2, int dmode);
#endif /* GFXFILTER */
#endif /* UAE_GFXFILTER_H */

View File

@ -143,7 +143,7 @@ void remove_ide_unit(struct ide_hdf **idetable, int ch);
void alloc_ide_mem (struct ide_hdf **ide, int max, struct ide_thread_state *its);
void ide_reset_device(struct ide_hdf *ide);
//void ata_byteswapidentity(uae_u8 *d);
void ata_byteswapidentity(uae_u8 *d);
void ata_parse_identity(uae_u8 *out, struct uaedev_config_info *uci, bool *lba48, int *max_multiple);
bool ata_get_identity(struct ini_data *ini, uae_u8 *out, bool overwrite);

26
src/include/luascript.h Normal file
View File

@ -0,0 +1,26 @@
/*
* UAE - The Un*x Amiga Emulator
*
* LUA Scripting Layer
*
* Copyright 2013 Frode SOlheim
*/
#ifndef UAE_LUASCRIPT_H
#define UAE_LUASCRIPT_H
#ifdef WITH_LUA
#include <lauxlib.h>
void uae_lua_init(void);
void uae_lua_load(const TCHAR *filename);
void uae_lua_loadall(void);
void uae_lua_free(void);
void uae_lua_init_state(lua_State *L);
void uae_lua_run_handler(const char *name);
void uae_lua_aquire_lock();
void uae_lua_release_lock();
#endif /* WITH_LUA */
#endif /* UAE_LUASCRIPT_H */

114
src/include/mackbd.h Normal file
View File

@ -0,0 +1,114 @@
/*
* UAE - The Un*x Amiga Emulator
*
* Mac keycodes
*
* (c) 1996 Ernesto Corvi
*/
#ifndef UAE_MACKBD_H
#define UAE_MACKBD_H
#define kUpArrowKeyMap 0x7E /* key map offset for up arrow */
#define kDownArrowKeyMap 0x7D /* key map offset for down arrow */
#define kRightArrowKeyMap 0x7C /* key map offset for right arrow */
#define kLeftArrowKeyMap 0x7B /* key map offset for left arrow */
#define kBackSpaceKeyMap 0x33
#define kReturnKeyMap 0x24
#define kEscapeKeyMap 0x35
#define kLBracketKeyMap 0x21
#define kRBracketKeyMap 0x1E
#define kCommaKeyMap 0x2B
#define kSlashKeyMap 0x2C
#define kSemiColonKeyMap 0x29
#define kMinusKeyMap 0x1B
#define kEqualKeyMap 0x18
#define kQuoteKeyMap 0x27
#define k0KeyMap 0x1D
#define k1KeyMap 0x12
#define k2KeyMap 0x13
#define k3KeyMap 0x14
#define k4KeyMap 0x15
#define k5KeyMap 0x17
#define k6KeyMap 0x16
#define k7KeyMap 0x1A
#define k8KeyMap 0x1C
#define k9KeyMap 0x19
#define kAKeyMap 0x00
#define kBKeyMap 0x0B
#define kCKeyMap 0x08
#define kDKeyMap 0x02
#define kEKeyMap 0x0E
#define kFKeyMap 0x03
#define kGKeyMap 0x05
#define kHKeyMap 0x04
#define kIKeyMap 0x22
#define kJKeyMap 0x26
#define kKKeyMap 0x28
#define kLKeyMap 0x25
#define kMKeyMap 0x2E
#define kNKeyMap 0x2D
#define kOKeyMap 0x1F
#define kPKeyMap 0x23
#define kQKeyMap 0x0C
#define kRKeyMap 0x0F
#define kSKeyMap 0x01
#define kTKeyMap 0x11
#define kUKeyMap 0x20
#define kVKeyMap 0x09
#define kWKeyMap 0x0D
#define kXKeyMap 0x07
#define kYKeyMap 0x10
#define kZKeyMap 0x06
#define kPeriodKeyMap 0x2F
#define kCommandKeyMap 0x37
#define kSpaceBarMap 0x31
#define kTabKeyMap 0x30
#define kControlKeyMap 0x3B
#define kOptionKeyMap 0x3A
#define kCapsLockKeyMap 0x39
#define kShiftKeyMap 0x38
#define kPgUpKeyMap 0x74
#define kPgDnKeyMap 0x79
#define kBackSlash 0x2A
#define kF1KeyMap 0x7A
#define kF2KeyMap 0x78
#define kF3KeyMap 0x63
#define kF4KeyMap 0x76
#define kF5KeyMap 0x60
#define kF6KeyMap 0x61
#define kF7KeyMap 0x62
#define kF8KeyMap 0x64
#define kF9KeyMap 0x65
#define kF10KeyMap 0x6D
#define kF11KeyMap 0x67
#define kF12KeyMap 0x6F
#define kShiftRawKey 0x3F
#define kControlRawKey 0x3C
#define kOptionRawKey 0x3D
#define kCapsRawKey 0x3E
#define kCommandRawKey 0x30
#define kUpRawKey 0x79
#define kDownRawKey 0x7A
#define kLeftRawKey 0x7C
#define kRightRawKey 0x7B
#define kSpaceRawKey 0x36
#define kKP0KeyMap 0x52
#define kKP1KeyMap 0x53
#define kKP2KeyMap 0x54
#define kKP3KeyMap 0x55
#define kKP4KeyMap 0x56
#define kKP5KeyMap 0x57
#define kKP6KeyMap 0x58
#define kKP7KeyMap 0x59
#define kKP8KeyMap 0x5B
#define kKP9KeyMap 0x5C
#endif /* UAE_MACKBD_H */

View File

@ -470,8 +470,6 @@ extern uaecptr expamem_z3_pointer_real, expamem_z3_pointer_uae;
extern uae_u32 expamem_z3_highram_real, expamem_z3_highram_uae;
extern uae_u32 expamem_board_size;
extern uae_u32 last_custom_value1;
/* Default memory access functions */
extern void dummy_put (uaecptr addr, int size, uae_u32 val);

View File

@ -2,20 +2,154 @@
#define UAE_MMU_COMMON_H
#include "uae/types.h"
#include "uae/likely.h"
#define MMUDEBUG 0
#define MMUINSDEBUG 0
#define MMUDEBUGMISC 0
#ifdef __cplusplus
struct m68k_exception {
int prb;
m68k_exception (int exc) : prb (exc) {}
operator int() { return prb; }
};
#define SAVE_EXCEPTION
#define RESTORE_EXCEPTION
#define TRY(var) try
#define CATCH(var) catch(m68k_exception var)
#define CATCH(var) catch([[maybe_unused]] m68k_exception &var)
#define THROW(n) throw m68k_exception(n)
#define THROW_AGAIN(var) throw
#define ENDTRY
#define STOPTRY
#else
/* we are in plain C, just use a stack of long jumps */
#include <setjmp.h>
extern jmp_buf __exbuf;
extern int __exvalue;
#define TRY(DUMMY) __exvalue=setjmp(__exbuf); \
if (__exvalue==0) { __pushtry(&__exbuf);
#define CATCH(x) __poptry(); } else {m68k_exception x=__exvalue;
#define ENDTRY __poptry();}
#define STOPTRY __poptry()
#define THROW(x) if (__is_catched()) {longjmp(__exbuf,x);}
#define THROW_AGAIN(var) if (__is_catched()) longjmp(*__poptry(),__exvalue)
#define SAVE_EXCEPTION
#define RESTORE_EXCEPTION
jmp_buf* __poptry(void);
void __pushtry(jmp_buf *j);
int __is_catched(void);
typedef int m68k_exception;
#endif
/* special status word (access error stack frame) */
/* 68060 */
#define MMU_FSLW_MA 0x08000000
#define MMU_FSLW_LK 0x02000000
#define MMU_FSLW_R 0x01000000
#define MMU_FSLW_W 0x00800000
#define MMU_FSLW_SIZE_L 0x00000000 /* Note: wrong in mc68060 manual! */
#define MMU_FSLW_SIZE_B 0x00200000
#define MMU_FSLW_SIZE_W 0x00400000
#define MMU_FSLW_SIZE_D 0x00600000
#define MMU_FSLW_TT 0x00180000
#define MMU_FSLW_TT_N 0x00000000 /* Normal access */
#define MMU_FSLW_TT_16 0x00080000 /* MOVE16 */
#define MMU_FSLW_TM 0x00070000 /* = function code */
#define MMU_FSLW_IO 0x00008000
#define MMU_FSLW_PBE 0x00004000
#define MMU_FSLW_SBE 0x00002000
#define MMU_FSLW_PTA 0x00001000
#define MMU_FSLW_PTB 0x00000800
#define MMU_FSLW_IL 0x00000400
#define MMU_FSLW_PF 0x00000200
#define MMU_FSLW_SP 0x00000100
#define MMU_FSLW_WP 0x00000080
#define MMU_FSLW_TWE 0x00000040
#define MMU_FSLW_RE 0x00000020
#define MMU_FSLW_WE 0x00000010
#define MMU_FSLW_TTR 0x00000008
#define MMU_FSLW_BPE 0x00000004
#define MMU_FSLW_SEE 0x00000001
/* 68040 */
#define MMU_SSW_TM 0x0007
#define MMU_SSW_TT 0x0018
#define MMU_SSW_TT1 0x0010
#define MMU_SSW_TT0 0x0008
#define MMU_SSW_SIZE 0x0060
#define MMU_SSW_SIZE_B 0x0020
#define MMU_SSW_SIZE_W 0x0040
#define MMU_SSW_SIZE_L 0x0000
#define MMU_SSW_SIZE_CL 0x0060
#define MMU_SSW_RW 0x0100
#define MMU_SSW_LK 0x0200
#define MMU_SSW_ATC 0x0400
#define MMU_SSW_MA 0x0800
#define MMU_SSW_CM 0x1000
#define MMU_SSW_CT 0x2000
#define MMU_SSW_CU 0x4000
#define MMU_SSW_CP 0x8000
/* 68030 */
#define MMU030_SSW_FC 0x8000
#define MMU030_SSW_FB 0x4000
#define MMU030_SSW_RC 0x2000
#define MMU030_SSW_RB 0x1000
#define MMU030_SSW_DF 0x0100
#define MMU030_SSW_RM 0x0080
#define MMU030_SSW_RW 0x0040
#define MMU030_SSW_SIZE_MASK 0x0030
#define MMU030_SSW_SIZE_B 0x0010
#define MMU030_SSW_SIZE_W 0x0020
#define MMU030_SSW_SIZE_L 0x0000
#define MMU030_SSW_FC_MASK 0x0007
#define ALWAYS_INLINE __inline
// take care of 2 kinds of alignment, bus size and page
static ALWAYS_INLINE bool is_unaligned_page(uaecptr addr, int size)
{
return unlikely((addr & (size - 1)) && (addr ^ (addr + size - 1)) & regs.mmu_page_size);
}
static ALWAYS_INLINE bool is_unaligned_bus(uaecptr addr, int size)
{
return (addr & (size - 1));
}
static ALWAYS_INLINE void phys_put_long(uaecptr addr, uae_u32 l)
{
put_long(addr, l);
}
static ALWAYS_INLINE void phys_put_word(uaecptr addr, uae_u32 w)
{
put_word(addr, w);
}
static ALWAYS_INLINE void phys_put_byte(uaecptr addr, uae_u32 b)
{
put_byte(addr, b);
}
static ALWAYS_INLINE uae_u32 phys_get_long(uaecptr addr)
{
return get_long(addr);
}
static ALWAYS_INLINE uae_u32 phys_get_word(uaecptr addr)
{
return get_word(addr);
}
static ALWAYS_INLINE uae_u32 phys_get_byte(uaecptr addr)
{
return get_byte(addr);
}
extern uae_u32(*x_phys_get_iword)(uaecptr);
extern uae_u32(*x_phys_get_ilong)(uaecptr);
extern uae_u32(*x_phys_get_byte)(uaecptr);
extern uae_u32(*x_phys_get_word)(uaecptr);
extern uae_u32(*x_phys_get_long)(uaecptr);
extern void(*x_phys_put_byte)(uaecptr, uae_u32);
extern void(*x_phys_put_word)(uaecptr, uae_u32);
extern void(*x_phys_put_long)(uaecptr, uae_u32);
#endif /* UAE_MMU_COMMON_H */

View File

@ -0,0 +1,7 @@
#ifndef UAE_MODULERIPPER_H
#define UAE_MODULERIPPER_H
extern "C" int prowizard_search (unsigned char *in_data, int in_size);
extern void moduleripper (void);
#endif /* UAE_MODULERIPPER_H */

View File

@ -15,6 +15,34 @@
#include "events.h"
#include "thread.h"
#ifdef WITH_SOFTFLOAT
#include <softfloat/softfloat.h>
#endif
#ifndef SET_CFLG
#define SET_CFLG(x) (CFLG() = (x))
#define SET_NFLG(x) (NFLG() = (x))
#define SET_VFLG(x) (VFLG() = (x))
#define SET_ZFLG(x) (ZFLG() = (x))
#define SET_XFLG(x) (XFLG() = (x))
#define GET_CFLG() CFLG()
#define GET_NFLG() NFLG()
#define GET_VFLG() VFLG()
#define GET_ZFLG() ZFLG()
#define GET_XFLG() XFLG()
#define CLEAR_CZNV() do { \
SET_CFLG (0); \
SET_ZFLG (0); \
SET_NFLG (0); \
SET_VFLG (0); \
} while (0)
#define COPY_CARRY() (SET_XFLG (GET_CFLG ()))
#endif
extern const int areg_byteinc[];
extern const int imm8_table[];
@ -22,23 +50,37 @@ extern int movem_index1[256];
extern int movem_index2[256];
extern int movem_next[256];
#ifdef FPUEMU
extern int fpp_movem_index1[256];
extern int fpp_movem_index2[256];
extern int fpp_movem_next[256];
#endif
extern int hardware_bus_error;
typedef uae_u32 REGPARAM3 cpuop_func(uae_u32) REGPARAM;
typedef void REGPARAM3 cpuop_func_ce(uae_u32) REGPARAM;
typedef void REGPARAM3 cpuop_func_noret(uae_u32) REGPARAM;
struct cputbl {
cpuop_func* handler_ff;
cpuop_func *handler_ff;
#ifdef NOFLAGS_SUPPORT_GENCPU
cpuop_func_ret *handler_nf;
#endif
cpuop_func_noret *handler_ff_noret;
#ifdef NOFLAGS_SUPPORT_GENCPU
cpuop_func_ret *handler_nf_noret;
#endif
uae_u16 opcode;
uae_s8 length;
uae_s8 disp020[2];
uae_s8 branch;
uae_u16 specific;
};
#ifdef JIT
#define MIN_JIT_CACHE 128
#define MAX_JIT_CACHE 16384
typedef uae_u32 REGPARAM3 compop_func(uae_u32) REGPARAM;
typedef uae_u32 REGPARAM3 compop_func (uae_u32) REGPARAM;
#define COMP_OPCODE_ISJUMP 0x0001
#define COMP_OPCODE_LONG_OPCODE 0x0002
@ -48,54 +90,123 @@ typedef uae_u32 REGPARAM3 compop_func(uae_u32) REGPARAM;
#define COMP_OPCODE_USES_FPU 0x0020
struct comptbl {
compop_func* handler;
uae_u32 specific;
compop_func *handler;
uae_u32 opcode;
int specific;
};
#endif
extern cpuop_func *loop_mode_table[];
extern uae_u32 REGPARAM3 op_illg(uae_u32) REGPARAM;
extern void REGPARAM3 op_illg_noret(uae_u32) REGPARAM;
extern void REGPARAM3 op_unimpl(uae_u32) REGPARAM;
typedef uae_u8 flagtype;
#ifdef FPUEMU
#ifdef USE_LONG_DOUBLE
typedef long double fptype;
#else
typedef double fptype;
#endif
#endif
#define MAX68020CYCLES 4
#define CPU_PIPELINE_MAX 4
#define CPU000_MEM_CYCLE 4
#define CPU000_CLOCK_MULT 2
#define CPU020_MEM_CYCLE 3
#define CPU020_CLOCK_MULT 4
#define CACHELINES020 64
struct cache020
{
uae_u32 data;
uae_u32 tag;
bool valid;
};
#define CACHELINES030 16
struct cache030
{
uae_u32 data[4];
bool valid[4];
uae_u32 tag;
uae_u8 fc;
};
#define CACHESETS040 64
#define CACHESETS060 128
#define CACHELINES040 4
struct cache040
{
uae_u32 data[CACHELINES040][4];
bool dirty[CACHELINES040][4];
bool gdirty[CACHELINES040];
bool valid[CACHELINES040];
uae_u32 tag[CACHELINES040];
};
struct mmufixup
{
int reg;
uae_u32 value;
};
extern struct mmufixup mmufixup[1];
extern struct mmufixup mmufixup[2];
#ifdef MSVC_LONG_DOUBLE
typedef struct {
uae_u64 m;
uae_u16 e;
uae_u16 dummy;
} fprawtype;
#endif
typedef struct
{
#ifdef WITH_SOFTFLOAT
floatx80 fpx;
#endif
#ifdef MSVC_LONG_DOUBLE
union {
fptype fp;
fprawtype rfp;
};
#else
fptype fp;
#endif
} fpdata;
#ifdef CPU_AARCH64
#ifdef JIT
#include "jit/comptbl.h"
#include "jit/compemu.h"
#endif
#endif
struct regstruct
{
uae_u32 regs[16];
struct flag_struct ccrflags;
uae_u32 pc;
uae_u8* pc_p;
uae_u8* pc_oldp;
uae_u8 *pc_p;
uae_u8 *pc_oldp;
uae_u16 opcode;
uae_u32 instruction_pc;
uae_u32 instruction_pc_user_exception;
uae_u32 trace_pc;
uae_u16 irc, ir;
uae_u16 irc, ir, ird;
volatile uae_atomic spcflags;
uae_u32 last_prefetch;
uae_u32 chipset_latch_rw;
uae_u32 chipset_latch_read;
uae_u32 chipset_latch_write;
uae_u16 db, write_buffer, read_buffer;
int loop_mode;
int instruction_cnt;
uaecptr usp, isp, msp;
@ -104,20 +215,21 @@ struct regstruct
flagtype t0;
flagtype s;
flagtype m;
flagtype x;
flagtype stopped;
int halted;
int exception;
int intmask;
int ipl, ipl_pin;
int ipl[2], ipl_pin, ipl_pin_p;
int lastipl;
evt_t ipl_pin_change_evt, ipl_pin_change_evt_p;
evt_t ipl_evt, ipl_evt_pre;
int ipl_evt_pre_mode;
uae_u32 vbr, sfc, dfc;
#ifdef FPUEMU
fpdata fp[8];
#ifdef JIT
fpdata fp_result;
#endif
uae_u32 fpcr, fpsr, fpiar;
uae_u32 fpu_state;
uae_u32 fpu_exp_state;
@ -130,16 +242,47 @@ struct regstruct
bool fp_exception;
bool fp_branch;
#endif
#ifndef CPUEMU_68000_ONLY
uae_u32 cacr, caar;
uae_u32 itt0, itt1, dtt0, dtt1;
uae_u32 tcr, mmusr, urp, srp;
uae_u32 mmu_fault_addr;
uae_u32 tcr, mmusr, urp, srp, buscr;
uae_u32 mmu_fslw;
uae_u32 mmu_fault_addr, mmu_effective_addr;
uae_u16 mmu_ssw;
uae_u32 wb2_address;
uae_u32 wb3_data;
uae_u8 wb3_status, wb2_status;
int mmu_enabled;
int mmu_page_size;
#endif
uae_u32 pcr;
uae_u32 address_space_mask;
uae_u8* natmem_offset;
uae_u16 prefetch020[CPU_PIPELINE_MAX];
uae_u8 prefetch020_valid[CPU_PIPELINE_MAX];
uae_u32 prefetch020addr;
uae_u32 cacheholdingdata020;
uae_u32 cacheholdingaddr020;
uae_u8 cacheholdingdata_valid;
int pipeline_pos;
int pipeline_r8[2];
int pipeline_stop;
uae_u8 fc030;
uae_u32 prefetch040[CPU_PIPELINE_MAX];
evt_t ce020endcycle;
evt_t ce020startcycle;
evt_t ce020prefetchendcycle;
evt_t ce020extracycles;
bool ce020memcycle_data;
int ce020_tail;
evt_t ce020_tail_cycles;
int memory_waitstate_cycles;
#ifdef CPU_AARCH64 // Used by the AARCH64 JIT implementation
#ifdef JIT
/* store scratch regs also in this struct to avoid load of mem pointer */
uae_u32 scratchregs[VREGS - S1];
@ -151,6 +294,7 @@ struct regstruct
uintptr mem_banks;
uintptr cache_tags;
#endif
#endif
};
extern struct regstruct regs;
@ -161,20 +305,30 @@ struct cputracememory
uae_u32 addr;
uae_u32 data;
int mode;
uae_u32 flags;
};
struct cputracestruct
{
uae_u32 regs[16];
uae_u32 usp, isp, pc;
uae_u16 ir, irc, sr, opcode;
uae_u16 ir, irc, ird, sr, opcode;
int intmask, stopped, state;
uae_u32 msp, vbr;
uae_u32 cacr, caar;
uae_u16 prefetch020[CPU_PIPELINE_MAX];
uae_u8 prefetch020_valid[CPU_PIPELINE_MAX];
uae_u32 prefetch020addr;
uae_u32 cacheholdingdata020;
uae_u32 cacheholdingaddr020;
struct cache020 caches020[CACHELINES020];
int pipeline_pos;
int pipeline_r8[2];
int pipeline_stop;
uae_u16 read_buffer, write_buffer;
uae_u32 startcycles;
evt_t startcycles;
int needendcycles;
int memoryoffset;
int cyclecounter, cyclecounter_pre, cyclecounter_post;
@ -182,21 +336,38 @@ struct cputracestruct
struct cputracememory ctm[MAX_CPUTRACESIZE];
};
#define REGS_DEFINED
#include "machdep/m68k.h"
#include "events.h"
STATIC_INLINE uae_u32 munge24(uae_u32 x)
STATIC_INLINE uae_u32 munge24 (uae_u32 x)
{
return x & regs.address_space_mask;
}
extern int mmu_enabled, mmu_triggered;
extern int cpu_cycles;
extern int cpucycleunit, cpuipldelay2, cpuipldelay4;
extern int m68k_pc_indirect;
extern bool m68k_interrupt_delay;
extern void safe_interrupt_set(int, int, bool);
#define SPCFLAG_CPUINRESET 2
#define SPCFLAG_COPPER 4
#define SPCFLAG_INT 8
#define SPCFLAG_BRK 16
#define SPCFLAG_UAEINT 32
#define SPCFLAG_TRACE 64
#define SPCFLAG_DOTRACE 128
#define SPCFLAG_DOINT 256 /* arg, JIT fails without this.. */
#define SPCFLAG_BLTNASTY 512
#define SPCFLAG_EXEC 1024
#define SPCFLAG_ACTION_REPLAY 2048
#define SPCFLAG_TRAP 4096 /* enforcer-hack */
#define SPCFLAG_MODE_CHANGE 8192
#ifdef JIT
#define SPCFLAG_END_COMPILE 16384
#endif
#define SPCFLAG_CHECK 32768
#define SPCFLAG_MMURESTART 65536
STATIC_INLINE void set_special_exter(uae_u32 x)
{
atomic_or(&regs.spcflags, x);
@ -215,6 +386,14 @@ STATIC_INLINE void unset_special (uae_u32 x)
#define m68k_dreg(r,num) ((r).regs[(num)])
#define m68k_areg(r,num) (((r).regs + 8)[(num)])
// JIT only
#ifdef HAVE_GET_WORD_UNSWAPPED
#define GET_OPCODE (do_get_mem_word_unswapped((uae_u16*)(pc + pc_offset)));
#else
#define GET_OPCODE (do_get_mem_word((uae_u16*)(pc + pc_offset)));
#endif
extern uae_u32(*x_prefetch)(int);
extern uae_u32(*x_get_byte)(uaecptr addr);
extern uae_u32(*x_get_word)(uaecptr addr);
extern uae_u32(*x_get_long)(uaecptr addr);
@ -223,7 +402,9 @@ extern void(*x_put_word)(uaecptr addr, uae_u32 v);
extern void(*x_put_long)(uaecptr addr, uae_u32 v);
extern uae_u32(*x_next_iword)(void);
extern uae_u32(*x_next_ilong)(void);
extern uae_u32(*x_get_ilong)(int);
extern uae_u32(*x_get_iword)(int);
extern uae_u32(*x_get_ibyte)(int);
extern uae_u32(*x_cp_get_byte)(uaecptr addr);
extern uae_u32(*x_cp_get_word)(uaecptr addr);
@ -234,7 +415,29 @@ extern void(*x_cp_put_long)(uaecptr addr, uae_u32 v);
extern uae_u32(*x_cp_next_iword)(void);
extern uae_u32(*x_cp_next_ilong)(void);
#define x_cp_get_disp_ea_020(base) x_get_disp_ea_020(base)
void mem_access_delay_long_write_ce020 (uaecptr addr, uae_u32 v);
void mem_access_delay_word_write_ce020 (uaecptr addr, uae_u32 v);
void mem_access_delay_byte_write_ce020 (uaecptr addr, uae_u32 v);
uae_u32 mem_access_delay_byte_read_ce020 (uaecptr addr);
uae_u32 mem_access_delay_word_read_ce020 (uaecptr addr);
uae_u32 mem_access_delay_long_read_ce020 (uaecptr addr);
uae_u32 mem_access_delay_longi_read_ce020 (uaecptr addr);
uae_u32 mem_access_delay_wordi_read_ce020 (uaecptr addr);
void mem_access_delay_long_write_c040 (uaecptr addr, uae_u32 v);
void mem_access_delay_word_write_c040 (uaecptr addr, uae_u32 v);
void mem_access_delay_byte_write_c040 (uaecptr addr, uae_u32 v);
uae_u32 mem_access_delay_byte_read_c040 (uaecptr addr);
uae_u32 mem_access_delay_word_read_c040 (uaecptr addr);
uae_u32 mem_access_delay_long_read_c040 (uaecptr addr);
uae_u32 mem_access_delay_longi_read_c040 (uaecptr addr);
extern uae_u32(REGPARAM3 *x_cp_get_disp_ea_020)(uae_u32 base, int idx) REGPARAM;
extern bool debugmem_trace;
extern void branch_stack_push(uaecptr, uaecptr);
extern void branch_stack_pop_rte(uaecptr);
extern void branch_stack_pop_rts(uaecptr);
/* direct (regs.pc_p) access */
@ -253,6 +456,10 @@ STATIC_INLINE uaecptr m68k_getpc(void)
return (uaecptr)(regs.pc + ((uae_u8*)regs.pc_p - (uae_u8*)regs.pc_oldp));
}
#define M68K_GETPC m68k_getpc()
STATIC_INLINE uaecptr m68k_getpc_p(uae_u8 *p)
{
return (uaecptr)(regs.pc + ((uae_u8*)p - (uae_u8*)regs.pc_oldp));
}
STATIC_INLINE void m68k_incpc(int o)
{
regs.pc_p += o;
@ -315,27 +522,101 @@ STATIC_INLINE void m68k_incpci(int o)
regs.pc += o;
}
STATIC_INLINE uae_u32 get_iibyte(int o)
{
return get_wordi(m68k_getpci() + (o)) & 0xff;
}
STATIC_INLINE uae_u32 get_iiword(int o)
{
return get_wordi(m68k_getpci() + (o));
}
STATIC_INLINE uae_u32 get_iilong(int o)
{
return get_longi(m68k_getpci() + (o));
return get_longi(m68k_getpci () + (o));
}
STATIC_INLINE uae_u32 next_iiword(void)
STATIC_INLINE uae_u32 next_iibyte (void)
{
uae_u32 r = get_iiword(0);
m68k_incpci(2);
uae_u32 r = get_iibyte (0);
m68k_incpci (2);
return r;
}
STATIC_INLINE uae_u32 next_iilong(void)
STATIC_INLINE uae_u32 next_iiword (void)
{
uae_u32 r = get_iiword (0);
m68k_incpci (2);
return r;
}
STATIC_INLINE uae_u32 next_iiwordi (void)
{
uae_u32 r = get_wordi(m68k_getpci());
m68k_incpci (2);
return r;
}
STATIC_INLINE uae_u32 next_iilong (void)
{
uae_u32 r = get_iilong(0);
m68k_incpci(4);
m68k_incpci (4);
return r;
}
STATIC_INLINE uae_u32 next_iilongi (void)
{
uae_u32 r = get_longi (m68k_getpci ());
m68k_incpci (4);
return r;
}
STATIC_INLINE void m68k_do_bsri(uaecptr oldpc, uae_s32 offset)
{
m68k_areg(regs, 7) -= 4;
x_put_long(m68k_areg(regs, 7), oldpc);
m68k_incpci(offset);
}
STATIC_INLINE void m68k_do_rtsi(void)
{
uae_u32 newpc = x_get_long(m68k_areg(regs, 7));
m68k_setpci(newpc);
m68k_areg(regs, 7) += 4;
}
/* indirect jit friendly versions */
STATIC_INLINE uae_u32 get_iibyte_jit(int o)
{
return get_wordi(m68k_getpc() + (o)) & 0xff;
}
STATIC_INLINE uae_u32 get_iiword_jit(int o)
{
return get_wordi(m68k_getpc() + (o));
}
STATIC_INLINE uae_u32 get_iilong_jit(int o)
{
return get_longi(m68k_getpc() + (o));
}
STATIC_INLINE uae_u32 next_iiword_jit(void)
{
uae_u32 r = get_wordi(m68k_getpc());
m68k_incpc(2);
return r;
}
STATIC_INLINE uae_u32 next_iilong_jit(void)
{
uae_u32 r = get_longi(m68k_getpc());
m68k_incpc(4);
return r;
}
STATIC_INLINE void m68k_do_bsri_jit(uaecptr oldpc, uae_s32 offset)
{
m68k_areg(regs, 7) -= 4;
x_put_long(m68k_areg(regs, 7), oldpc);
m68k_incpc(offset);
}
STATIC_INLINE void m68k_do_rtsi_jit(void)
{
uae_u32 newpc = x_get_long(m68k_areg(regs, 7));
m68k_setpc(newpc);
m68k_areg(regs, 7) += 4;
}
/* common access */
@ -357,57 +638,142 @@ STATIC_INLINE void m68k_setpc_normal(uaecptr pc)
}
}
extern void check_t0_trace(void);
extern void cpu_invalidate_cache(uaecptr, int);
extern bool(*is_super_access)(bool);
extern uae_u32(*read_data_030_bget)(uaecptr);
extern uae_u32(*read_data_030_wget)(uaecptr);
extern uae_u32(*read_data_030_lget)(uaecptr);
extern void(*write_data_030_bput)(uaecptr,uae_u32);
extern void(*write_data_030_wput)(uaecptr,uae_u32);
extern void(*write_data_030_lput)(uaecptr,uae_u32);
extern uae_u32(*read_data_030_fc_bget)(uaecptr, uae_u32);
extern uae_u32(*read_data_030_fc_wget)(uaecptr, uae_u32);
extern uae_u32(*read_data_030_fc_lget)(uaecptr, uae_u32);
extern void(*write_data_030_fc_bput)(uaecptr, uae_u32, uae_u32);
extern void(*write_data_030_fc_wput)(uaecptr, uae_u32, uae_u32);
extern void(*write_data_030_fc_lput)(uaecptr, uae_u32, uae_u32);
extern void write_dcache030_bput(uaecptr, uae_u32, uae_u32);
extern void write_dcache030_wput(uaecptr, uae_u32, uae_u32);
extern void write_dcache030_lput(uaecptr, uae_u32, uae_u32);
extern void write_dcache030_retry(uaecptr addr, uae_u32 v, uae_u32 fc, int size, int flags);
extern uae_u32 read_dcache030_bget(uaecptr, uae_u32);
extern uae_u32 read_dcache030_wget(uaecptr, uae_u32);
extern uae_u32 read_dcache030_lget(uaecptr, uae_u32);
extern uae_u32 read_dcache030_retry(uaecptr addr, uae_u32 fc, int size, int flags);
extern void write_dcache030_mmu_bput(uaecptr, uae_u32);
extern void write_dcache030_mmu_wput(uaecptr, uae_u32);
extern void write_dcache030_mmu_lput(uaecptr, uae_u32);
extern uae_u32 read_dcache030_mmu_bget(uaecptr);
extern uae_u32 read_dcache030_mmu_wget(uaecptr);
extern uae_u32 read_dcache030_mmu_lget(uaecptr);
extern void write_dcache030_lrmw_mmu(uaecptr, uae_u32, uae_u32);
extern void write_dcache030_lrmw_mmu_fcx(uaecptr, uae_u32, uae_u32, int);
extern uae_u32 read_dcache030_lrmw_mmu(uaecptr, uae_u32);
extern uae_u32 read_dcache030_lrmw_mmu_fcx(uaecptr, uae_u32, int);
extern void check_t0_trace(void);
extern uae_u32 get_word_icache030(uaecptr addr);
extern uae_u32 get_long_icache030(uaecptr addr);
uae_u32 fill_icache040(uae_u32 addr);
extern void put_long_cache_040(uaecptr, uae_u32);
extern void put_word_cache_040(uaecptr, uae_u32);
extern void put_byte_cache_040(uaecptr, uae_u32);
extern uae_u32 get_ilong_cache_040(int);
extern uae_u32 get_iword_cache_040(int);
extern uae_u32 get_long_cache_040(uaecptr);
extern uae_u32 get_word_cache_040(uaecptr);
extern uae_u32 get_byte_cache_040(uaecptr);
extern uae_u32 next_iword_cache040(void);
extern uae_u32 next_ilong_cache040(void);
extern uae_u32 get_word_icache040(uaecptr addr);
extern uae_u32 get_long_icache040(uaecptr addr);
extern uae_u32 sfc_nommu_get_byte(uaecptr);
extern uae_u32 sfc_nommu_get_word(uaecptr);
extern uae_u32 sfc_nommu_get_long(uaecptr);
extern void dfc_nommu_put_byte(uaecptr, uae_u32);
extern void dfc_nommu_put_word(uaecptr, uae_u32);
extern void dfc_nommu_put_long(uaecptr, uae_u32);
extern void (*x_do_cycles)(int);
extern void (*x_do_cycles_pre)(int);
extern void (*x_do_cycles_post)(int, uae_u32);
extern uae_u32 REGPARAM3 x_get_disp_ea_020(uae_u32 base) REGPARAM;
extern uae_u32 REGPARAM3 x_get_disp_ea_020 (uae_u32 base, int idx) REGPARAM;
extern uae_u32 REGPARAM3 x_get_disp_ea_ce020 (uae_u32 base, int idx) REGPARAM;
extern uae_u32 REGPARAM3 x_get_disp_ea_ce030 (uae_u32 base, int idx) REGPARAM;
extern uae_u32 REGPARAM3 x_get_disp_ea_040(uae_u32 base, int idx) REGPARAM;
extern uae_u32 REGPARAM3 x_get_bitfield (uae_u32 src, uae_u32 bdata[2], uae_s32 offset, int width) REGPARAM;
extern void REGPARAM3 x_put_bitfield (uae_u32 dst, uae_u32 bdata[2], uae_u32 val, uae_s32 offset, int width) REGPARAM;
extern void m68k_setstopped(void);
extern void m68k_setstopped(int stoptype);
extern void m68k_resumestopped(void);
extern void m68k_cancel_idle(void);
extern void do_cycles_stop(int);
extern uae_u32 REGPARAM3 get_disp_ea_020(uae_u32 base) REGPARAM;
extern uae_u32 REGPARAM3 get_bitfield(uae_u32 src, uae_u32 bdata[2], uae_s32 offset, int width) REGPARAM;
extern void REGPARAM3 put_bitfield(uae_u32 dst, uae_u32 bdata[2], uae_u32 val, uae_s32 offset, int width) REGPARAM;
extern uae_u32 REGPARAM3 get_disp_ea_020 (uae_u32 base, int idx) REGPARAM;
extern uae_u32 REGPARAM3 get_bitfield (uae_u32 src, uae_u32 bdata[2], uae_s32 offset, int width) REGPARAM;
extern void REGPARAM3 put_bitfield (uae_u32 dst, uae_u32 bdata[2], uae_u32 val, uae_s32 offset, int width) REGPARAM;
extern int get_cpu_model(void);
extern void m68k_disasm_ea (uaecptr addr, uaecptr *nextpc, int cnt, uae_u32 *seaddr, uae_u32 *deaddr, uaecptr lastpc);
extern void m68k_disasm (uaecptr addr, uaecptr *nextpc, uaecptr lastpc, int cnt);
extern uae_u32 m68k_disasm_2(TCHAR *buf, int bufsize, uaecptr pc, uae_u16 *bufpc, int bufpccount, uaecptr *nextpc, int cnt, uae_u32 *seaddr, uae_u32 *deaddr, uaecptr lastpc, int safemode);
extern void sm68k_disasm (TCHAR*, TCHAR*, uaecptr addr, uaecptr *nextpc, uaecptr lastpc);
extern int m68k_asm(TCHAR *buf, uae_u16 *out, uaecptr pc);
extern uaecptr ShowEA(void *f, uaecptr pc, uae_u16 opcode, int reg, amodes mode, wordsizes size, TCHAR *buf, uae_u32 *eaddr, int *actualea, int safemode);
extern int get_cpu_model (void);
extern void set_cpu_caches(bool flush);
extern void set_cpu_caches (bool flush);
extern void flush_cpu_caches(bool flush);
extern void flush_cpu_caches_040(uae_u16 opcode);
extern void REGPARAM3 MakeSR(void) REGPARAM;
extern void REGPARAM3 MakeSR (void) REGPARAM;
extern void REGPARAM3 MakeFromSR(void) REGPARAM;
extern void REGPARAM3 MakeFromSR_T0(void) REGPARAM;
extern void REGPARAM3 Exception(int) REGPARAM;
extern void REGPARAM3 MakeFromSR_STOP(void) REGPARAM;
extern void REGPARAM3 Exception (int) REGPARAM;
extern void REGPARAM3 Exception_cpu(int) REGPARAM;
extern void REGPARAM3 Exception_cpu_oldpc(int, uaecptr) REGPARAM;
extern void REGPARAM3 ExceptionL (int, uaecptr) REGPARAM;
extern void NMI (void);
extern void IRQ_forced(int, int);
extern void prepare_interrupt (uae_u32);
extern void doint (void);
extern int m68k_move2c(int, uae_u32*);
extern int m68k_movec2(int, uae_u32*);
extern int m68k_divl(uae_u32, uae_u32, uae_u16, uaecptr);
extern int m68k_mull(uae_u32, uae_u32, uae_u16);
extern void init_m68k(void);
extern void m68k_go(int);
extern void doint(void);
extern void checkint(void);
extern void intlev_load(void);
extern void ipl_fetch_now_pre(void);
extern void ipl_fetch_next_pre(void);
extern void ipl_fetch_now(void);
extern void ipl_fetch_next(void);
extern void dump_counts (void);
extern int m68k_move2c (int, uae_u32 *);
extern int m68k_movec2 (int, uae_u32 *);
extern int m68k_divl (uae_u32, uae_u32, uae_u16, uaecptr);
extern int m68k_mull (uae_u32, uae_u32, uae_u16);
extern void init_m68k (void);
extern void m68k_go (int);
extern void m68k_dumpstate(uaecptr *, uaecptr);
extern void m68k_dumpcache(bool);
extern bool m68k_readcache(uaecptr memaddr, bool dc, uae_u32* valp);
extern int getMulu68kCycles(uae_u16 src);
extern int getMuls68kCycles(uae_u16 src);
extern int getDivu68kCycles(uae_u32 dividend, uae_u16 divisor);
extern int getDivs68kCycles(uae_s32 dividend, uae_s16 divisor);
extern int getDivu68kCycles (uae_u32 dividend, uae_u16 divisor);
extern int getDivs68kCycles (uae_s32 dividend, uae_s16 divisor, int *extra);
extern void divbyzero_special(bool issigned, uae_s32 dst);
extern void setdivuflags(uae_u32 dividend, uae_u16 divisor);
extern void setdivsflags(uae_s32 dividend, uae_s16 divisor);
extern void setchkundefinedflags(uae_s32 src, uae_s32 dst, int size);
extern void setchk2undefinedflags(uae_s32 lower, uae_s32 upper, uae_s32 val, int size);
extern void protect_roms(bool);
extern void unprotect_maprom(void);
extern void protect_roms (bool);
extern void unprotect_maprom (void);
extern bool is_hardreset(void);
extern bool is_keyboardreset(void);
extern void Exception_build_stack_frame_common(uae_u32 oldpc, uae_u32 currpc, int nr);
extern void Exception_build_stack_frame_common(uae_u32 oldpc, uae_u32 currpc, uae_u32 ssw, int nr, int vector_nr);
extern void Exception_build_stack_frame(uae_u32 oldpc, uae_u32 currpc, uae_u32 ssw, int nr, int format);
extern void Exception_build_68000_address_error_stack_frame(uae_u16 mode, uae_u16 opcode, uaecptr fault_addr, uaecptr pc);
extern uae_u32 exception_pc(int nr);
@ -423,8 +789,8 @@ void ccr_68000_word_move_ae_normal(uae_s16 src);
void dreg_68000_long_replace_low(int reg, uae_u16 v);
void areg_68000_long_replace_low(int reg, uae_u16 v);
extern void mmu_op(uae_u32, uae_u32);
extern bool mmu_op30(uaecptr, uae_u32, uae_u16, uaecptr);
extern void mmu_op (uae_u32, uae_u32);
extern bool mmu_op30 (uaecptr, uae_u32, uae_u16, uaecptr);
extern void fpuop_arithmetic(uae_u32, uae_u16);
extern void fpuop_dbcc(uae_u32, uae_u16);
@ -433,7 +799,9 @@ extern void fpuop_trapcc(uae_u32, uaecptr, uae_u16);
extern void fpuop_bcc(uae_u32, uaecptr, uae_u32);
extern void fpuop_save(uae_u32);
extern void fpuop_restore(uae_u32);
extern void fpu_reset(void);
extern uae_u32 fpp_get_fpsr (void);
extern bool fpu_get_constant(fpdata *fp, int cr);
extern int fpp_cond(int condition);
extern void exception3_read(uae_u32 opcode, uaecptr addr, int size, int fc);
extern void exception3_write(uae_u32 opcode, uaecptr addr, int size, uae_u32 val, int fc);
@ -443,6 +811,7 @@ extern void exception3_write_access(uae_u32 opcode, uaecptr addr, int size, uae_
extern void exception3_read_prefetch(uae_u32 opcode, uaecptr addr);
extern void exception3_read_prefetch_68040bug(uae_u32 opcode, uaecptr addr, uae_u16 secondarysr);
extern void exception3_read_prefetch_only(uae_u32 opcode, uaecptr addr);
extern void exception3_notinstruction(uae_u32 opcode, uaecptr addr);
extern void hardware_exception2(uaecptr addr, uae_u32 v, bool read, bool ins, int size);
extern void exception2_setup(uae_u32 opcode, uaecptr addr, bool read, int size, uae_u32 fc);
extern void exception2_read(uae_u32 opcode, uaecptr addr, int size, int fc);
@ -458,44 +827,79 @@ extern void cpu_change(int newmodel);
extern void cpu_fallback(int mode);
extern void fill_prefetch(void);
extern void fill_prefetch_020_ntx(void);
extern void fill_prefetch_030_ntx(void);
extern void fill_prefetch_030_ntx_continue(void);
extern void fill_prefetch_020(void);
extern void fill_prefetch_030(void);
#define CPU_OP_NAME(a) op ## a
/* 68060 */
extern const struct cputbl op_smalltbl_0[];
extern const struct cputbl op_smalltbl_40[];
extern const struct cputbl op_smalltbl_50[];
extern const struct cputbl op_smalltbl_24[]; // CE
extern const struct cputbl op_smalltbl_33[]; // MMU
/* 68040 */
extern const struct cputbl op_smalltbl_1[];
extern const struct cputbl op_smalltbl_41[];
extern const struct cputbl op_smalltbl_51[];
extern const struct cputbl op_smalltbl_25[]; // CE
extern const struct cputbl op_smalltbl_31[]; // MMU
/* 68030 */
extern const struct cputbl op_smalltbl_2[];
extern const struct cputbl op_smalltbl_42[];
extern const struct cputbl op_smalltbl_52[];
extern const struct cputbl op_smalltbl_22[]; // prefetch
extern const struct cputbl op_smalltbl_23[]; // CE
extern const struct cputbl op_smalltbl_32[]; // MMU
extern const struct cputbl op_smalltbl_34[]; // MMU + cache
extern const struct cputbl op_smalltbl_35[]; // MMU + CE + cache
/* 68020 */
extern const struct cputbl op_smalltbl_3[];
extern const struct cputbl op_smalltbl_43[];
extern const struct cputbl op_smalltbl_53[];
extern const struct cputbl op_smalltbl_20[]; // prefetch
extern const struct cputbl op_smalltbl_21[]; // CE
/* 68010 */
extern const struct cputbl op_smalltbl_4[];
extern const struct cputbl op_smalltbl_44[];
extern const struct cputbl op_smalltbl_54[];
extern const struct cputbl op_smalltbl_11[]; // prefetch
extern const struct cputbl op_smalltbl_13[]; // CE
/* 68000 */
extern const struct cputbl op_smalltbl_5[];
extern const struct cputbl op_smalltbl_45[];
extern const struct cputbl op_smalltbl_55[];
extern const struct cputbl op_smalltbl_12[]; // prefetch
extern const struct cputbl op_smalltbl_14[]; // CE
extern cpuop_func* cpufunctbl[65536] ASM_SYM_FOR_FUNC("cpufunctbl");
extern cpuop_func_noret *cpufunctbl_noret[65536] ASM_SYM_FOR_FUNC("cpufunctbl_noret");
extern cpuop_func *cpufunctbl[65536] ASM_SYM_FOR_FUNC("cpufunctbl");
#ifdef JIT
extern void flush_icache(int);
extern void flush_icache_hard(int);
extern void (*flush_icache)(int);
extern void compemu_reset(void);
#else
#define flush_icache(int) do {} while (0)
#define flush_icache_hard(int) do {} while (0)
#endif
bool check_prefs_changed_comp(bool);
bool check_prefs_changed_comp (bool);
extern bool is_cpu_tracer(void);
extern bool set_cpu_tracer(bool force);
extern bool can_cpu_tracer(void);
extern int movec_illg (int regno);
extern uae_u32 val_move2c (int regno);
extern void val_move2c2 (int regno, uae_u32 val);
struct cpum2c {
int regno;
int flags;
const TCHAR *regname;
};
extern struct cpum2c m2cregs[];
extern bool is_cpu_tracer (void);
extern bool set_cpu_tracer (bool force);
extern bool can_cpu_tracer (void);
#define CPU_HALT_PPC_ONLY -1
#define CPU_HALT_BUS_ERROR_DOUBLE_FAULT 1

View File

@ -18,9 +18,9 @@
#include "traps.h"
#include "guisan/color.hpp"
#define UAEMAJOR 5
#define UAEMINOR 7
#define UAESUBREV 4
#define UAEMAJOR 6
#define UAEMINOR 3
#define UAESUBREV 5
#define MAX_AMIGADISPLAYS 1
@ -763,7 +763,6 @@ struct uae_prefs
int collision_level;
int leds_on_screen;
#ifdef AMIBERRY
int fast_copper;
int multithreaded_drawing;
#endif
int leds_on_screen_mask[2];
@ -835,9 +834,6 @@ struct uae_prefs
bool cs_cdtvcr;
bool cs_df0idhw;
bool cs_resetwarning;
bool cs_denisenoehb;
bool cs_dipagnus;
bool cs_agnusbltbusybug;
bool cs_ciatodbug;
bool cs_z3autoconfig;
bool cs_1mchipjumper;
@ -854,6 +850,9 @@ struct uae_prefs
int cs_hvcsync;
int cs_eclockphase;
int cs_eclocksync;
int cs_agnusmodel;
int cs_agnussize;
int cs_denisemodel;
bool cs_memorypatternfill;
bool cs_ipldelay;
bool cs_floppydatapullup;

25
src/include/osemu.h Normal file
View File

@ -0,0 +1,25 @@
/*
* UAE - The Un*x Amiga Emulator
*
* OS emulation prototypes
*
* Copyright 1996 Bernd Schmidt
*/
#ifndef UAE_OSEMU_H
#define UAE_OSEMU_H
#include "uae/types.h"
STATIC_INLINE char *raddr(uaecptr p)
{
return p == 0 ? NULL : (char *)get_real_address (p);
}
extern void gfxlib_install(void);
/* graphics.library */
extern int GFX_WritePixel(uaecptr rp, int x, int y);
#endif /* UAE_OSEMU_H */

Some files were not shown because too many files have changed in this diff Show More