Skip to content

Commit

Permalink
Merge pull request #2 from diegoparrilla/hardware-scroll
Browse files Browse the repository at this point in the history
Hardware scroll version
  • Loading branch information
diegoparrilla authored Mar 24, 2023
2 parents e7bac9c + 219d698 commit 239f19a
Show file tree
Hide file tree
Showing 103 changed files with 8,712 additions and 4,624 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
run: sed -i 's/-it//' /usr/local/bin/stcmd

- name: Run - Build executable and not publish
run: ST_WORKING_FOLDER=${GITHUB_WORKSPACE} make all
run: ST_WORKING_FOLDER=${GITHUB_WORKSPACE} stcmd make all DEBUG_MODE=0
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: sed -i 's/-it//' /usr/local/bin/stcmd

- name: Run build and publish
run: ST_WORKING_FOLDER=${GITHUB_WORKSPACE} make release DEBUG_MODE=0
run: ST_WORKING_FOLDER=${GITHUB_WORKSPACE} stcmd make release DEBUG_MODE=0

- name: Upload shell scripts to release with version
uses: svenstaro/upload-release-action@v2
Expand Down
28 changes: 19 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ EXE = SILYDEMO.TOS
# To disable debug, make target DEBUG_MODE=0
DEBUG_MODE = 1
VASMFLAGS=-Faout -quiet -x -m68000 -spaces -showopt -devpac -D_DEBUG=$(DEBUG_MODE)
VASM = stcmd vasm
VLINK = stcmd vlink
VASM = vasm
VLINK = vlink

# LIBCMINI PARAMETERS
# IMPORTANT! There is functional verson of the LIBCMINI library in the docker image
Expand All @@ -24,7 +24,7 @@ VLINK = stcmd vlink
LIBCMINI = /freemint/libcmini

# GCC PARAMETERS
CC = stcmd gcc
CC = m68k-atari-mint-gcc
CFLAGS=-c -std=gnu99 -I$(LIBCMINI)/include -g -D_DEBUG=$(DEBUG_MODE)

# LINKER PARAMETERS
Expand All @@ -50,8 +50,13 @@ sinwaves:
python src/scroller.py
python src/small_sprites.py
python src/sprite_large.py
python src/sprite_large_boing.py
python src/textroll.py

clean-compile : clean init.o loader.o loop.o print.o print_s.o rasters.o scroller.o sprite_s.o sprite_l.o tiles.o ym6.o main.o
clean-compile : clean emunat.o init.o loader.o loop.o print.o print_s.o rasters.o scroller.o sndh.o sprite_s.o sprite_l.o textroll.o tiles.o main.o

emunat.o: prepare
$(VASM) $(VASMFLAGS) $(SOURCES_DIR)/emunat.s -o $(BUILD_DIR)/emunat.o

init.o: prepare
$(VASM) $(VASMFLAGS) $(SOURCES_DIR)/init.s -o $(BUILD_DIR)/init.o
Expand All @@ -74,35 +79,40 @@ rasters.o: prepare
scroller.o: prepare
$(VASM) $(VASMFLAGS) $(SOURCES_DIR)/scroller.s -o $(BUILD_DIR)/scroller.o

sndh.o: prepare
$(VASM) $(VASMFLAGS) $(SOURCES_DIR)/sndh.s -o $(BUILD_DIR)/sndh.o

sprite_s.o: prepare
$(VASM) $(VASMFLAGS) $(SOURCES_DIR)/sprite_s.s -o $(BUILD_DIR)/sprite_s.o

sprite_l.o: prepare
$(VASM) $(VASMFLAGS) $(SOURCES_DIR)/sprite_l.s -o $(BUILD_DIR)/sprite_l.o

textroll.o: prepare
$(VASM) $(VASMFLAGS) $(SOURCES_DIR)/textroll.s -o $(BUILD_DIR)/textroll.o

tiles.o: prepare
$(VASM) $(VASMFLAGS) $(SOURCES_DIR)/tiles.s -o $(BUILD_DIR)/tiles.o

ym6.o: prepare
$(VASM) $(VASMFLAGS) $(SOURCES_DIR)/ym6.s -o $(BUILD_DIR)/ym6.o

# All C files
main.o: prepare
$(CC) $(CFLAGS) $(SOURCES_DIR)/main.c -o $(BUILD_DIR)/main.o

main: main.o init.o loader.o loop.o print.o print_s.o rasters.o scroller.o sprite_s.o sprite_l.o tiles.o ym6.o
main: main.o emunat.o init.o loader.o loop.o print.o print_s.o rasters.o scroller.o sndh.o sprite_s.o sprite_l.o textroll.o tiles.o
$(CC) $(LIBCMINI)/lib/crt0.o \
$(BUILD_DIR)/emunat.o \
$(BUILD_DIR)/init.o \
$(BUILD_DIR)/loader.o \
$(BUILD_DIR)/loop.o \
$(BUILD_DIR)/print.o \
$(BUILD_DIR)/print_s.o \
$(BUILD_DIR)/rasters.o \
$(BUILD_DIR)/scroller.o \
$(BUILD_DIR)/sndh.o \
$(BUILD_DIR)/sprite_s.o \
$(BUILD_DIR)/sprite_l.o \
$(BUILD_DIR)/textroll.o \
$(BUILD_DIR)/tiles.o \
$(BUILD_DIR)/ym6.o \
$(BUILD_DIR)/main.o \
-o $(BUILD_DIR)/$(EXE) $(LINKFLAGS);

Expand Down
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,33 @@ make

5. Run the demo!

## How to configure Hatari and FFMPEG to record the demo

1. To configure the Hatari emulator, I followed the instructions in the [Dead Hackers Society site](https://www.dhs.nu/videorecording.php).

2. Install FFMPEG. In my case, I installed it with Brew:

```
brew install chromaprint amiaopensource/amiaos/decklinksdk
brew tap homebrew-ffmpeg/ffmpeg
brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-chromaprint
```

3. I started Hatari adding the following command line parameters:

```
--avi-file ./sillydemo.avi --avi-vcodec png --png-level 1
```

The `--png-level 1` guarantees that the PNG files are not very compressed, which is important to avoid issues in the video in slow computers.

4. After recording the demo, I used the following command to convert the PNG files to a video that can be processed with Quicktime before uploading to YouTube or Twitter:

```
ffmpeg -i sillydemo.avi -vf "scale=1600:1000, pad=1920:1080:160:40:black, format=yuv420p" -sws_flags neighbor -vcodec libx264 -acodec copy sillydemo.mov
```


## Resources

This "Resources" section contains a list of helpful materials for learning how to build a demo for the Atari ST. This section include tutorials, documentation, and sample code that can assist in the development of a demo for the Atari STe. These materials are intended for developers with varying levels of experience, mostly experienced programmers.
Expand Down Expand Up @@ -82,6 +109,7 @@ Please feel free to contribute to this list by submitting pull requests with add

* [Reservoir Gods library](https://github.com/ReservoirGods/GODLIB) - A library for the Atari ST. The library includes a lot of useful routines for demo creation. The library is written in C, but it also includes a lot of 68K assembler routines. The library is available on GitHub.

* [ASM Samples from NoExtra-Team](https://github.com/NoExtra-Team/Samples) - A collection of sources for demo creation from the NoExtra-Team. Sources are available in 68K assembler, C and also GFA Basic.
### Tools

* [Motorola 68000 Assembly Extension](https://marketplace.visualstudio.com/items?itemName=clcxce.motorola-68k-assembly) - A Visual Studio Code extension for Motorola 68000 Assembly Language. The extension includes syntax highlighting, snippets, and a debugger.
Expand All @@ -90,6 +118,11 @@ Please feel free to contribute to this list by submitting pull requests with add

* [VS Code - C/C++](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools)- The official Visual Studio Code extension for C/C++ development by Microsoft. The extension includes syntax highlighting, snippets, and a debugger.

### Chiptunes

* [Nguillaumin YM Jukebox](https://github.com/nguillaumin/ym-jukebox/tree/master): This repo contains a collection of YM music files. The YM files are available in the `data` folder. The silly demo needs to decompress the ym files with the lha tool. Example: `lha -x chiptune.ym`. The decompresses file should be renamed to `music.ym` and places in the `resources` folder before compiling. You can install `lha` with `brew` in macOS. Use your favourite installation tool to install on Linux.

* [ST sound basics](https://nguillaumin.github.io/perihelion-m68k-tutorials/_of_hearing_that_which_is_spoken.html): A tutorial about how to play YM music files on the Atari ST. The tutorial is written by Nicolas Guillaumin.

## License
This project is licenses under the GNU General Public License v3.0. See the [LICENSE](LICENSE) file for details.
Binary file added resources/C23CUT.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/C23LG_P0.BIN
Binary file not shown.
Binary file added resources/C23LG_P1.BIN
Binary file not shown.
2,143 changes: 2,143 additions & 0 deletions resources/DF.YM

Large diffs are not rendered by default.

Binary file added resources/DULCEDO.SND
Binary file not shown.
Binary file added resources/F3225_P0.BIN
Binary file not shown.
Binary file added resources/F3225_P1.BIN
Binary file not shown.
Binary file added resources/FONT.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/FONT1616.BIN
Binary file not shown.
Binary file added resources/FONTC23.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/FONTC23_OLD.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/HER1.SND
Binary file not shown.
Binary file added resources/HYBRIS.SND
Binary file not shown.
Binary file added resources/Heavy Metal.ym
Binary file not shown.
Binary file added resources/Image Hammer Font by Sodan.pi1
Binary file not shown.
Binary file added resources/MYM_REPL.BIN
Binary file not shown.
Binary file added resources/OKS.SND
Binary file not shown.
Binary file added resources/PWMWVJAM.SND
Binary file not shown.
Binary file added resources/Scaven1.ym
Binary file not shown.
Binary file added resources/Scaven2.ym
Binary file not shown.
Binary file added resources/Scaven3.ym
Binary file not shown.
Binary file added resources/Scaven4.ym
Binary file not shown.
Binary file added resources/Scaven5.ym
Binary file not shown.
Binary file added resources/Scaven6.ym
Binary file not shown.
Binary file added resources/Speedball1.ym
Binary file not shown.
Binary file added resources/Speedball2.ym
Binary file not shown.
Binary file added resources/Speedball3.ym
Binary file not shown.
Binary file added resources/Speedball4.ym
Binary file not shown.
Binary file added resources/TELEPHON.SND
Binary file not shown.
Binary file added resources/TEST_STE.SND
Binary file not shown.
Binary file added resources/Xenon Title.ym
Binary file not shown.
Binary file added resources/Xenon.ym6
Binary file not shown.
Binary file added resources/Xenon2.ym
Binary file not shown.
Binary file added resources/Z1616.PI1
Binary file not shown.
Binary file added resources/Z3232.PI1
Binary file not shown.
Binary file added resources/atariucr.sng
Binary file not shown.
Binary file added resources/c23.ccp
Binary file not shown.
Binary file added resources/c23_f0.rbp
Binary file not shown.
Binary file added resources/c23_f1.rbp
Binary file not shown.
Binary file added resources/colmap.ccp
Binary file not shown.
Binary file added resources/colmap.ccr
Binary file not shown.
Binary file added resources/colmap.ccs
Binary file not shown.
Binary file added resources/font.ccp
Binary file not shown.
Binary file added resources/font_f0.rbp
Binary file not shown.
Binary file added resources/font_f1.rbp
Binary file not shown.
Binary file added resources/fontc23_f0_p1.rbp
Binary file not shown.
Binary file added resources/fontc23_f0_p2.rbp
Binary file not shown.
Binary file added resources/fontc23_f1_p1.rbp
Binary file not shown.
Binary file added resources/fontc23_f1_p2.rbp
Binary file not shown.
Binary file added resources/fontc23_p1.ccp
Binary file not shown.
Binary file added resources/fontc23_p2.ccp
Binary file not shown.
27 changes: 27 additions & 0 deletions resources/palette.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#==============================================================================
# Build colourmaps
#==============================================================================

AGTBIN=/Users/diego/mister_wkspc/agtools/bin/Darwin/x86_64

# final colourmaps are precious - generate rarely, keep under source control
OUT=./resources
IN=./resources
# working directory
GENTEMP=./build
mkdir -p ${GENTEMP}

PCS="${AGTBIN}/pcs -dg -cd ste -pc 4 -ccmode 5 -ccincap 65535 -ccfields 1 -ccrounds 32 -ccthreads 4"

#==============================================================================

# create a superpalette from all art assets (only needs done once, or after significant art changes)
# WARNING: this is a compute-intensive step. it takes time. best disabled once the palette is produced.

#TUNING="-ccpopctrl 0.5 -ccdodge 1110 -ccl 0=0:0:0 -ccl 1=b:7:b -ccl 2=9:5:9 -ccl 3=a:0:a -ccl 4=0:1:F -ccl 5=3:0:3 -ccl 6=F:a:c -ccl 7=6:3:6"
#TUNING="-ccpopctrl 0.5 -ccdodge 1110 -ccl 0=0:0:0 -ccl 7=F:F:F"
#TUNING="-ccpopctrl 0.5 -ccdodge 0111 -ccl 0=0:0:0 -ccl 1=6:3:6 -ccl 2=7:5:a -ccl 3=a:5:8 -ccl 4=c:7:b -ccl 5=3:0:3 -ccl 6=d:9:b -ccl 7=f:9:c -ccl 8=8:8:8 -ccl 15=F:F:F"
TUNING="-ccpopctrl 0.8 -ccdodge 0111 -ccl 0=0:0:0 -ccl 7=F:F:F -ccl 8=8:8:8 -ccl 9=8:8:8 -ccl 10=8:8:8 -ccl 11=8:8:8 -ccl 12=8:8:8 -ccl 13=8:8:8 -ccl 14=8:8:8 -ccl 15=F:F:F"

#${PCS} -ccout ${OUT}/colmap ${TUNING} ${IN}/uridium-zinc-c64.png
${PCS} -ccout ${OUT}/colmap ${TUNING} ${IN}/FONTC23.PNG
Binary file added resources/song_000.ym
Binary file not shown.
Binary file added resources/song_361.ym
Binary file not shown.
Binary file added resources/speedball4.ym6
Binary file not shown.
Binary file added resources/speedb~2.ym
Binary file not shown.
Binary file added resources/speedb~3.ym
Binary file not shown.
Binary file added resources/swatch_pairs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/swatch_real.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/syner1
Binary file not shown.
Binary file added resources/syner2
Binary file not shown.
Binary file added resources/syner3
Binary file not shown.
Binary file added resources/syner4
Binary file not shown.
Binary file added resources/syner5
Binary file not shown.
Binary file added resources/syner6
Binary file not shown.
Binary file added resources/uridium-zinc-c64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/uridium-zinc-c64.xcf
Binary file not shown.
Binary file added resources/uridium-zinc.raw
Binary file not shown.
Binary file added resources/uridium-zinc.raw.pal
Binary file not shown.
Binary file added resources/uridium.bmp
Binary file not shown.
Binary file added resources/uridium.ico
Binary file not shown.
Binary file added resources/uridium.pbm
Binary file not shown.
Binary file added resources/uridium_f0_p1.rbp
Binary file not shown.
Binary file added resources/uridium_f0_p2.rbp
Binary file not shown.
Binary file added resources/uridium_f1_p1.rbp
Binary file not shown.
Binary file added resources/uridium_f1_p2.rbp
Binary file not shown.
Binary file added resources/uridiummap-c64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/uridiummap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 21 additions & 8 deletions src/constants.s
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,33 @@
; all the global constants are defined here
; They must start with an underscore and a letter

_BUFFER_NUMBERS equ 32 ; number of buffers to use. Only power of 2 allowed (2, 4, 8, 16...)
_SCREEN_SIZE equ 32000 ; size of the screen in bytes
_SCREEN_WIDTH_BYTES equ 160 ; width of a screen line in bytes
_SCREEN_HEIGHT_LINES equ 192 ; height of the visible screen in lines
_SCREEN_BITPLANES equ 4 ; number of bitplanes
_BUFFER_NUMBERS equ 2 ; number of buffers to use. Only power of 2 allowed (2, 4, 8, 16...)
_SCROLL_BACKGROUND_SPEED equ 1 ; 1 = 1 pixel per frame, 2 = 2 pixels per frame, etc. Use 2^n values
_SCROLL_BACKGROUND_START equ 0 ; Start at odd address to avoid the 'jump' when the pixel offset is 0
_SCREEN_SIZE equ _SCREEN_WIDTH_BYTES * _SCREEN_PHYSICAL_HEIGHT_LINES ; size of the screen in bytes
_SCREEN_L_OFFSET_BYTES equ 24 ; value how many BYTES the Shifter is supposed to skip after each Rasterline
_SCREEN_L_OFFSET_WORDS equ _SCREEN_L_OFFSET_BYTES / 2 ; Same value in WORDS, needed by the register
_SCREEN_WIDTH_NO_L_OFFSET_BYTES equ 160 ; width of a screen line in bytes
_SCREEN_WIDTH_BYTES equ _SCREEN_WIDTH_NO_L_OFFSET_BYTES + _SCREEN_L_OFFSET_BYTES ; width of a screen line in bytes
_SCREEN_HEIGHT_LINES equ 192 ; height of the visible screen in lines
_SCREEN_PHYSICAL_HEIGHT_LINES equ 200 ; height of the physical screen in lines
_SCREEN_BITPLANES equ 4 ; number of bitplanes

; Font large
FONT_LARGE_SIZE_WORDS equ 600 / 2 ; 25 lines x 6 bytes x 3 planes
FONT_LARGE_SIZE_WORDS equ 600 / 2 ; 25 lines x 6 bytes x 4 planes (last empty)

; C23 logo
C23LOGO_WIDTH_BYTES equ (40 - ((1 + 1) * 2)) * C23LOGO_PLANES
C23LOGO_HEIGHT_LINES equ 59 ; 59 lines height
C23LOGO_WIDTH_BYTES equ (40 - ((1) * 2)) * C23LOGO_PLANES
C23LOGO_HEIGHT_LINES equ 57 ; 59 lines height
C23LOGO_PLANES equ 3 ; 3 planes

; Video hardware section
VIDEO_BASE_ADDR_LOW equ $ffff820d
VIDEO_BASE_ADDR_MID equ $ffff8203
VIDEO_BASE_ADDR_HIGH equ $ffff8201
VIDEO_BASE_PIXEL_OFFSET equ $ffff8265
VIDEO_BASE_LINE_OFFSET equ $ffff820f

; Blitter section
HALFTONE_RAM equ $00
SRC_ADDR equ $24
Expand Down
Loading

0 comments on commit 239f19a

Please sign in to comment.