Learn Multi platform PDP11 Assembly Programming... With Octal!

SuckShoot Series

In this series we'll learn a simple game called 'Suck Shoot'... Well learn how to compile it, and run on an emulator.


Lesson SuckShoot1 - Sprites on the UKNC
Lets take a look at the sprite routines of SuckShoot on the UKNC!
In this lesson, we'll take a look at the sprite drawing routines, which handle the drawing of the sprites, and scaling of the bat graphics

SuckSh.mac


Our Sprites

Our game uses a total of 7 sprites.

Sprite 0 is the crosshair for the player
Sprite 1/2 are the largest bat sprites (2 frames)
Sprite 3/4 are the mid sized bat
Sprite 5/6 are the small bat

These were all exported with Akusprite Editor.
Our sprite data is in two parts.

The first is the raw bitmap data.

The second is a lookup table, each sprite has 4 byte entries.
The first pair of bytes (0+1) is the address of the bitmap data.
The third (2) is the Width in pixels.
The fourth (3) is the Height in pixels.

Sprite drawing

When we want to draw a sprite, we first need to load the sprite number into R0.

The player crosshair is sprite 0!
The enemy sprite is a bit more tricky!

We need to select a sprite number based on the size of the sprite (EnSca - Enemy Scale)
First we load in the width and height of the sprite, and use these to 'center' the sprite.

We then calculate the Vram Destination
Once we've calculated the VRAM destination, we transfer our sprite to the screen.

The Title screen!

We draw 3 things on our title screen.

1. The 'Suck Shoot' title.

2. The current highscore (in binary coded decimal)

3. the animated bat at it's largest size.
We then loop, redrawing the sprite, toggling the two frames of animation.

We do so until the player presses fire, at which point the game starts!
This game uses ChibiSound and the Screen and keyboard routines covered in the Platform specific series.

If you want to know about them, see the platform specific series... or dont! it's no skin of my nose, do what you want!

Lesson SuckShoot2 - SuckShoot Code #2 on UKNC
Lets take a look at the rest of the suckshoot code.

SuckSh.mac

The Main Loop

When a new game starts we need to reset all the game parameters for the new round.
At the start of the loop we check the sound timeout, if it's reached zero we silence ChibiSound
We show the sprites to the screen, pause a moment and then remove them.

We will then calculate any changes to the sprites.
We next check the keypresses and update the players position as required.
We next check the fire key.

If the player has pressed fire we make a fire sound and then do a 'range test' on the player/enemy position.

If the player hit the enemy, we need to give the enemy a new position, and give the player some score!
We now handle the enemy bat... we dont' make it larger every frame, so we update EnSpB to keep track of the times we want to increase the bat size.

When the bat gets larger we check if it's reached the maximum size (64) - if it has the player has been bitten!

We make the bite sound, reduce the player lives and continue

Game Over

The gameover screen Silences the sound, clears the screen and shows the game over message.

Next we check if the score is higher than the highscore.

if it is we update the highscore and show a different message.

We wait for fire before returning to the title screen.
We need to define the text strings for the gameover routine.

Other bits!

UpdateScore redraws the text score and lives at the top of the screen.
RndEne re-randomizes the enemy position, and resets the scale of the enemy bat.



 

View Options
Default Dark
Simple (Hide this menu)
Print Mode (white background)

Top Menu
***Main Menu***
Youtube channel
Patreon
Introduction to Assembly (Basics for absolute beginners)
Amazon Affiliate Link
AkuSprite Editor
ChibiTracker
Dec/Bin/Hex/Oct/Ascii Table

Alt Tech
Archive.org
Bitchute
Odysee
Rumble
DailyMotion
Please note: I wlll upload more content to these alt platforms based on the views they bring in

Z80 Content
***Z80 Tutorial List***
Learn Z80 Assembly (2021)
Learn Z80 Assembly (old)
Hello World
Simple Samples
Advanced Series
Multiplatform Series
Platform Specific Series
ChibiAkumas Series
Grime Z80
Z80 Downloads
Z80 Cheatsheet
Sources.7z
DevTools kit
Z80 Platforms
Amstrad CPC
Elan Enterprise
Gameboy & Gameboy Color
Master System & GameGear
MSX & MSX2
Sam Coupe
TI-83
ZX Spectrum
Spectrum NEXT
Camputers Lynx

6502 Content
***6502 Tutorial List***
Learn 6502 Assembly
Advanced Series
Platform Specific Series
Hello World Series
Simple Samples
Grime 6502
6502 Downloads
6502 Cheatsheet
Sources.7z
DevTools kit
6502 Platforms
Apple IIe
Atari 800 and 5200
Atari Lynx
BBC Micro
Commodore 64
Commodore PET
Commander x16
Super Nintendo (SNES)
Nintendo NES / Famicom
PC Engine (Turbografx-16)
Vic 20

68000 Content
***68000 Tutorial List***
Learn 68000 Assembly
Hello World Series
Platform Specific Series
Simple Samples
Grime 68000
68000 Downloads
68000 Cheatsheet
Sources.7z
DevTools kit
68000 Platforms
Amiga 500
Atari ST
Neo Geo
Sega Genesis / Mega Drive
Sinclair QL
X68000 (Sharp x68k)

8086 Content
Learn 8086 Assembly
Platform Specific Series
Hello World Series
Simple Samples
8086 Downloads
8086 Cheatsheet
Sources.7z
DevTools kit
8086 Platforms
Wonderswan
MsDos

ARM Content
Learn ARM Assembly
Learn ARM Thumb Assembly
Platform Specific Series
Hello World
Simple Samples
ARM Downloads
ARM Cheatsheet
Sources.7z
DevTools kit
ARM Platforms
Gameboy Advance
Nintendo DS
Risc Os

Risc-V Content
Learn Risc-V Assembly
Risc-V Downloads
Risc-V Cheatsheet
Sources.7z
DevTools kit

MIPS Content
Learn Risc-V Assembly
Platform Specific Series
Hello World
Simple Samples
MIPS Downloads
MIPS Cheatsheet
Sources.7z
DevTools kit
MIPS Platforms
Playstation
N64

PDP-11 Content
Learn PDP-11 Assembly
Platform Specific Series
Simple Samples
PDP-11 Downloads
PDP-11 Cheatsheet
Sources.7z
DevTools kit
PDP-11 Platforms
PDP-11
UKNC

TMS9900 Content
Learn TMS9900 Assembly
Platform Specific Series
Hello World
TMS9900 Downloads
TMS9900 Cheatsheet
Sources.7z
DevTools kit
TMS9900 Platforms
Ti 99

6809 Content
Learn 6809 Assembly
Learn 6309 Assembly
Platform Specific Series
Hello World Series
Simple Samples
6809 Downloads
6809/6309 Cheatsheet
Sources.7z
DevTools kit
6809 Platforms
Dragon 32/Tandy Coco
Fujitsu FM7
TRS-80 Coco 3
Vectrex

65816 Content
Learn 65816 Assembly
Hello World
Simple Samples
65816 Downloads
65816 Cheatsheet
Sources.7z
DevTools kit
65816 Platforms
SNES

eZ80 Content
Learn eZ80 Assembly
Platform Specific Series
eZ80 Downloads
eZ80 Cheatsheet
Sources.7z
DevTools kit
eZ80 Platforms
Ti84 PCE

IBM370 Content
Learn IBM370 Assembly
Simple Samples
IBM370 Downloads
IBM370 Cheatsheet
Sources.7z
DevTools kit

Super-H Content
Learn SH2 Assembly
Hello World Series
Simple Samples
SH2 Downloads
SH2 Cheatsheet
Sources.7z
DevTools kit
SH2 Platforms
32x
Saturn

PowerPC Content
Learn PowerPC Assembly
Hello World Series
Simple Samples
PowerPC Downloads
PowerPC Cheatsheet
Sources.7z
DevTools kit
PowerPC Platforms
Gamecube

Work in Progress
ChibiAndroids

Misc bits
Ruby programming









Buy my Assembly programming book
on Amazon in Print or Kindle!


Buy my Assembly programming book





Available worldwide!
Search 'ChibiAkumas' on
your local Amazon website!
Click here for more info!


























































































Buy my Assembly programming book
on Amazon in Print or Kindle!


Buy my Assembly programming book





Available worldwide!
Search 'ChibiAkumas' on
your local Amazon website!
Click here for more info!


























































































Buy my Assembly programming book
on Amazon in Print or Kindle!


Buy my Assembly programming book





Available worldwide!
Search 'ChibiAkumas' on
your local Amazon website!
Click here for more info!

























































































































































Buy my Assembly programming book
on Amazon in Print or Kindle!


Buy my Assembly programming book





Available worldwide!
Search 'ChibiAkumas' on
your local Amazon website!
Click here for more info!


























































































Buy my Assembly programming book
on Amazon in Print or Kindle!


Buy my Assembly programming book





Available worldwide!
Search 'ChibiAkumas' on
your local Amazon website!
Click here for more info!



































































































Buy my Assembly programming book
on Amazon in Print or Kindle!


Buy my Assembly programming book





Available worldwide!
Search 'ChibiAkumas' on
your local Amazon website!
Click here for more info!


























































































Buy my Assembly programming book
on Amazon in Print or Kindle!


Buy my Assembly programming book





Available worldwide!
Search 'ChibiAkumas' on
your local Amazon website!
Click here for more info!

























































































































































Buy my Assembly programming book
on Amazon in Print or Kindle!


Buy my Assembly programming book





Available worldwide!
Search 'ChibiAkumas' on
your local Amazon website!
Click here for more info!



































































































Buy my Assembly programming book
on Amazon in Print or Kindle!


Buy my Assembly programming book





Available worldwide!
Search 'ChibiAkumas' on
your local Amazon website!
Click here for more info!