Learn Multi platform Z80 Assembly Programming... With Vampires!
Platform Specific Lessons
<- Back to the Main Contents & Basic Z80 Assembly Lessons

Platform Specific Series - Lets learn how the hardware of the systems work, so we can get it to do what we want... Covers Amsrad CPC,MSX,ZX Spectrum, TI-83,Enterprise 128/64 and Sam Coupe!
    Lesson P1 - Basic Firmware Text functions

Lesson P2 - More Text Functions, Improvements... and the Sam Coupe!

Lesson P3 - Bitmap graphics on the Amstrad CPC and Enterprise 128

Lesson P4 - Bitmap graphics on the ZX Spectrum and Sam Coupe

Lesson P5 - Bitmap graphics on the TI-83 and MSX

Lesson P6 - Keyreading on the Amstrad CPC, ZX Spectrum and Sam Coupe

Lesson P7 - Keyreading on the MSX, Enterprise and TI-83

Lesson P8 - Tilemap graphics on the Sega Master System & Game Gear

Lesson P9 - Tilemap graphics on the Gameboy and Gameboy Color

Lesson P10 - Tilemap graphics on the MSX1

Lesson P11 - Tilemap graphics on the MSX2

Lesson P12 - Joypad reading on Master System,GameGear, Gameboy and Gameboy Color

Lesson P13 - Palette definitions on the Amstrad CPC and CPC+

Lesson P14 - Palette definitions on the Enterprise and Sam Coupe

Lesson P15 - Palette definitions on the MSX2 and V9990

Lesson P16 - Palette definitions on the Sega Master System and Game Gear

Lesson P17 - Palette definitions on the Gameboy and Gameboy Color

Lesson P18 - Making Sound with the AY-3-8910 on the Amstrad CPC, MSX,ZX Spectrum.... and NeoGeo + Atari ST!!

Lesson P19 - Sound on the Elan Enterprise

Lesson P20 - Sound on the Sam Coupe

Lesson P21 - Sound on the Gameboy and GBC

Lesson P22 - Sound with the SN76489 on the Master System, GameGear, Megadrive (Genesis) and BBC Micro!

Lesson P23 - Sound with the 'Beeper' on the ZX Spectrum and Apple II

Lesson P24 - Bankswitching and hardware detection on the Amstrad CPC

Lesson P25 - Bankswitching and hardware detection on the MSX

Lesson P26 - Bankswitching and hardware detection on the ZX Spectrum

Lesson P27 - Bankswitching and hardware detection on the Enterprise

Lesson P28 - Bankswitching and hardware detection on the Sam Coupe

Lesson P29 - Hardware detection and Bank Switching on the Gameboy/GBC and Sega Mastersystem/GameGear

Lesson P30 - Hardware Sprites on the gameboy

Lesson P31 - Hardware Sprites on the Master System / Game Gear and MSX1!

Lesson P32 - Hardware Sprites on the CPC+

Lesson P33 - Bitmap Graphics on the Camputers Lynx

Lesson P34 - Sound and Keyboard on the Camputers Lynx

Lesson P35 - Playing Digital Sound with WAV on the AY-3-8910!

Lesson P36 - Playing Digital Sound with WAV on the CPC+ via DMA!

Lesson P37 - Playing Digital Sound with WAV on the Sam Coupe, Camputers Lynx and ZX Spectrum

Lesson P38 - Playing Digital Sound with WAV on the Sega MasterSystem/GameGear, Elan Enterprise and GameBoy/GBC

Lesson P39 - Setting the CPC screen with CRTC registers

Lesson P40 - Syncronized mode switches for 320x200 @ 16 color EGX graphics on the Amstrad CPC

Lesson P41 - CRTC Rupture for Interrupt based splitscreen on the CPC

Lesson P42 - Advanced CRTC Rupture

Lesson P43- ULANext on the Spectrum NEXT

Lesson P44- Enhancements to the Classic ULA and Low Res Mode (Radasjimian)

Lesson P45 - 256 color mode on the Elan Enterprise

Lesson P46- Tilemap on the Spectrum NEXT

Lesson P47- Using 16 color Mode 0 to simulate 2x 4 color Layers

Lesson P48 - All MSX2 Bitmap Commands - Part 1/2

Lesson P49 - All MSX2 Bitmap Commands - Part 2/2

Lesson P50 - Alternative Bitmap modes... HighRes, 256 color, YJK (MSX2+) and Interlaced!

Lesson P51 - Window - Tilemap Scrolling - Alt Tile Pattern addresses and Interrupts

Lesson P52 - MSX1 mode G2 for 768 onscreen tiles

Lesson P53 - Realtime Sprite Flipping on the Amstrad CPC

Lesson P54 - Transparency on Amstrad CPC software sprites

Lesson P55 - LightGun Reading on the Sega Master System

Lesson P56 - Pixel Plotting on the Amstrad CPC

Lesson P57 - Stereoscopic 3D on the SegaMasterSystem with the Segascope 3D Glasses

Lesson P58 - Modes 4, 3, 2 and 1 on the Sam coupe

Lesson P59 - Hardware scrolling on the MSX 1/2/2+

Lesson P60 - Tape loading on the Amstrad CPC (5K subs special)

Lesson P61 - 2x and 4x sprite scaling with Lookup Tables on the Amstrad CPC

Lesson P62 - AMX Mouse reading on the Amstrad CPC

Lesson P63 - Kempson Mouse reading on the ZX Spectrum + SpecNEXT






Lesson P60 - Tape loading on the Amstrad CPC (5K subs special)
The 5000 sub special demo used a cassette file, and streamed data in a couple of formats to the screen.

Lets take a look at the loading methods used.

CPC_TapeRLE.asm
5K_Demo.cdt


Making a tape with 2CDT
We're using 2CDT to build a tape file... Our test program has two types:
2 files are saved normally with blocks (The RLE compressed Cinema)
1 file is saved headerless (The final thanks message)

2CDT takes a variety of switches we'll need:

;-n   = start New tape
;-s 1 = Speed 2000 Baud (fast)
;-m 0 = Add Block data (use with &BC77)
;-t 1 = Turbo Loading blocks (default)

;-m 1 = Add Headerless (use with &BCA1)

Tape loading... Getting Started
Our demo is started with CALL &4000 ...

We're running on an AMSTRAD 6128 - this system starts with reading from disk - we need to use the basic command "|TAPE"
There's no defined firmware command to do this, but we can do a 'FAR CALL' (Call to ROM) with RST3

This command takes a pointer to 3 bytes... the first two are a destination address (&CCFD for |TAPE) and the third is a ROM NUMBER (7 for the DISK ROM which contains the command)



By default the CPC will show tape messages - we'll want to turn this off.
We do this with &BC6B (CAS NOISY)... passing this a 0 in A will enable messages (Default)... we want to turn them off so we set A=1

Tape loading... Reading Bytes (With Blocks)

We're going to open a file on the tape... it's RLE data, and we'll process it a byte at a time.

We need to specify a memory address of a 2k buffer - we do this with DE

If we want to specify the filename to load, we specify a pointer to the name in HL - and the filename length in B... alternatively we can specify B=0 to just load the next file on the tape.

We then use function &BC77 (CAS IN OPEN) to open the cassette file
we use &BC80 (CAS IN CHAR) to read in a single byte from the file...

We're using the RLE decoder we looked at previously to show the cinema graphic

Each section has a 'header byte'
If the whole byte is zero - then we're reached the end of the compressed sequence
If the top bit is 1, the next sequence is RLE compressed... the remaining bits are a bytecount (1-127)
If the top bit is 0, the next sequence is LINEAR uncompressed data... the remaining bits are a bytecount (1-127)

The RLE decompressor has been modified to skip zero bytes, allowing multiple layers to be overlaid to build up an image.

Layer 1
Layer 2
Combined Result
Once we've loaded in the file we use &BC7A (CAS IN CLOSE) to close the file.
If you don't want to do anything clever with the file byte by byte, and want to read in blocks, use &BC83 - CAS IN DIRECT

Specify a destination address with HL,and the file will be loaded into ram.

Tape loading... Reading to ram (Headerless)

If we want to quickly load a large block of data, Headerless data is fastest... we load headerless data with &BCA1 (CAS READ)

As there's no header, we don't specify a filename... there's no blocks, so the data is quicker.

We need to specify a destination in HL, a size in DE... and a Header sync byte in A (this needs to match the one used to build the file - 2CDT and the amstrad BIOS default to &16 for data) 
This can be used for reading in a loading screen in one go.




Lesson P61 - 2x and 4x sprite scaling with Lookup Tables on the Amstrad CPC

Lets take a look at sprite scaling! in this example we'll use lookup tables to effect Double and Quad size sprites on the Amstrad CPC.

We'll use a lookup table, so the scaled sprite will be about as fast as a regular one.

CPC_Scale2x4x_Sprite.asm

This example scales images on the CPC... but the principal will work on any system which uses a bitmap screen (Like the SAM or Speccy)

Scaling sprites can be used for a neat effect - it could also be used to save memory if you want huge graphics - of course a sprite scaled 2x in both directions uses 1/4 of the size of an unscaled sprite.

Sprite scaling and the Lookup tables

We're going to scale our Chibiko sprite - here it's shown at 1x , 2x and 4x size.

The sprite file is the same as the one used in the simple series. and the code used to display the 1x version is almost the same (It uses different registers for convenience to match the 2x and 4x versions)
We need some lookup tables to convert the bytes to 2x and 4x... these contain the new scaled 'screen bytes'
There are 256 possible screen bytes at 1x
2x needs a 512 byte Lookup Table
4x needs a 1024 byte Lookup Table

As MODE 0 only has 2 pixels per byte, we don't actually need the 4x lookup table in Mode 0

Building the Lookup Tables

Before we use the draw routines, we need to fill the LUT's...

The lookup tables are byte aligned

If the 2x LUT is at &16xx...
&16xx will be the First byte of the conversion for screen byte xx
&17xx will be the Second byte of the conversion for screen byte xx

The same is true for the 4x LUT... but it will use addresses &18xx &19xx &20xx and &21xx for the 4 output bytes

We need to mask each pixel of the source byte, and fill the destination byte with OR commands

We need to understand how the screen pixels work to do this... here we're building the 2x scale for Mode 1
It's pretty much the same for the MODE 1 4x scale routine.
The MODE 0 2x scaling routine is almost the same, just the mask and shifts are different.

There is no 4x LUT for Mode 0 - because there are only two pixels per byte, we can use the 2x LUT for the 4x version (we just use each entry twice)

Drawing the sprites!

We're going to draw our sprite!...

We have 3 different routines for each of the scales.

We use 'GetScreenPos' to calculate the screen ram location... this is the same as in the Simple Series.
Here's the 1x routine, we read each pixel from the source bitmap in HL... and transfer them to the screen at DE
When we want to scale the source sprite 2x we use the lookup table.

We read a byte as before from HL... but this time we load the lookup table into BC.

We swap C for the byte from HL - BC now points to the first conversion for that byte

We transfer the first byte from BC to the screen (This is the first of the 2x scaled equivalents of the byte from HL)

We increment B - BC now points to the second conversion for that byte

We transfer the first byte from BC to the screen (This is the first of the 2x scaled equivalents of the byte from HL)

We repeat the procedure for the next source byte.

The 4x procedure is the same... of course we use the 4x scaling LUT form Mode 1this time.

This time We transfer 4 bytes from the LUT to the screen

We INC B four times in MODE 2 for the 4 destination byte.

In Mode 0 we use the 2x LUT - and we write each byte from the LUT twice... INCing B twice - this is because there's only 2 pixels per byte, so there's no need for another LUT

We can also use the 4x LUT for 8X if we want super blocky sprites for some reason!


Lesson P62 - AMX Mouse reading on the Amstrad CPC

The AMX mouse is an 8 bit mouse supporting both the Amstrad CPC and the ZX Spectrum - it's a little unusual, rather than connecting via a dedicated mouse port, it in fact 'emulates' a joystick!...
When the mouse is moved up, the 'UP' button is pressed... the same for Down, Left and Right. and 'Fire' buttons
We could just play our regular game with the mouse, but really we need to read it during an interrupt handler for smooth movement... lets learn how!

CPC_Mouse.asm

Our Test program.

We're going to create a test program.

It will read the mouse via the joystick port and move a cursor around the screen.

When you click the left mouse button, it will draw a 'Chibiko' (our vampire mascot)

When you drag the left mouse button it will draw a blob trail.

For speed and simplicity, All sprites will be drawn with 'XOR'  meaning a sprite will be removed if it's drawn in the same position twice.

Reading the Mouse (Joystick)

We read the joystick in the same way as the keyboard - we need to select the row of the keyboard we want to read, and read that line in via the AY

We read in line &49 - the line for Joystick 1 - this contains all the joystick buttons the mouse use.

Keyboard Matrix

The Keyboard matrix uses 7 bits of line &49 for the Joystick - 4 directions and up to 3 firebuttons.

Fire 3 is undocumented, but is supported on the classic CPC as middle mouse - however it is NOT supported on the CPC+


      0            1            2            3            4            5            6            7     
&40 C-U C-R C-D F9 F6 F3 F-ENT F.
&41 C-L CPY F7 F8 F5 F1 F2 F0
&42 c [ RET ] 4 SHIFT \ c
&43 ^ - @ P ; : / .
&44 0 9 O I L K M ,
&45 8 7 U Y H J N
&46  6 J2-U   5 J2-D   R J2-L   T J2-R   G J2-F1   F J2-F2   B J2-F3  V
&47 4 3 E W S D C X
&48 1 2 ESC Q TAB A CAPS Z
&49 J1-U J1-D J1-L J1-R J1-F1 J1-F2 J1-F3 DEL

Our Mouse Routine

We're going to use a custom interrupt handler, this ensures mouse movements wont be missed if our program gets slow.
We're going to need some variables

We'll store the mouse position - we keep the last position so we know where the mouse was last time we drew it (so we can remove the old sprite)

We use 16 bit X,Y co-ordinates so we can have 'half movements' - we use the top byte of the X,Y pos for drawing...

Our drawing routine works in screen bytes - so the Mode 1 screen is 80x200 - meaning we need to move 1 unit in the X axis for every 4 or so in the Y axis.
We need to process each of the 4 directions... Up, Down, Left and Right

We check for each direction, and if it's pressed - we check the current location

If we're already at the edge of the screen, we don't want to move again, but if our current position is OK, we add or subtract the move as required and update the cursor position.
We also test the fire button, and if it's down we set our fire markers...

if it's released we clear the held marker. (The fire down marker should be cleared by the routine that uses the mouse)

This example just processes the left mouse button - we could mimic this for the right and even center buttons.

Just remember - Fire 3 (Center) will not work on the CPC+!

Using the Mouse Routine
We're going to use our mouse... First we test if fire was just pressed... if it was we'll show 'TestSprite2' (Chibiko) at our current location

We need to clear the Fire down event to mark it processed
We're going to update the cursor - first we check if the old position and new position are the same - if so we have nothing to do.

If the cursor has moved, first we redraw the cursor in the old position - as we're using XOR sprites this removes the old cursor,

Next we draw the cursor in the new position

Finally we copy the new cursor position into the old cursor position - for the next run of the main loop
Finally we'll process Fire held... this routine only runs if the cursor has moved.

If fire is held, we show a blob at the current position
We do NOT clear the fire held flag - it's cleared by the interrupt handler.


Lesson P63 - Kempson Mouse reading on the ZX Spectrum + SpecNEXT

The Spectrum can also use a mouse... the Kempson mouse - this is supported by the classic spectrum and spectrum next... lets put it to good use!

ZXS_KempsonMouse.asm
ZXN_KempsonMouse.asm



Mouse Routine
Reading the Kempson mouse is super easy!
Ww just read 3 ports

Reading &FBDF We can get an 'X position'
Reading &FFDF We can get an 'Y position'

Reading &FADF gets the Left and right mouse buttons in the format %000000LR
Here is some sample code to read the XY pos of the mouse in HL - and the Buttons in A


Note X and Y position read from &FBDF and &FFDF do not give positions on the screen - they are relative movements positions.

X=0 does not mean far left, nor does 255 mean far right... all we know is if the X pos goes down the mouse moved left... and if the Y pos goes down the mouse moved down.

Our Mouse Routine

We're going to need some variables

We'll store the mouse position - we keep the last position so we know where the mouse was last time we drew it (so we can remove the old sprite)
We use 16 bit X,Y co-ordinates so we can have 'half movements' - we use the top byte of the X,Y pos for drawing...

We also need two bytes to compare the last XY position to the current one (Xmove and Ymove)
First we test the fire button with port &FADF, and if it's down we set our fire markers...

if it's released we clear the held marker. (The fire down marker should be cleared by the routine that uses the mouse)
We read in the current X and Y position from &FBDF and &FFDF

We subtract these from the last read in value to get a movement distance - we flip the Y axis to match our screen co-ordinates.
We use these Xmove and Ymove values (now in Reg D and E) to alter the mouse position.

When we add or subtract the movement from each axis, we need to check if this causes an overflow,

If we go below zero, then we've gone over the top or left edge of the screen...
If we go over X>256-7 or Y>192-7 then we've hit the right or bottom of the screen.

We've now converted the movement to a valid onscreen mouse position

Using the Mouse Routine
We're going to use our mouse... First we test if fire was just pressed... if it was we'll show 'TestSprite2' (Chibiko) at our current location

We need to clear the Fire down event to mark it processed.
We're going to update the cursor - first we check if the old position and new position are the same - if so we have nothing to do.

If the cursor has moved, first we redraw the cursor in the old position - as we're using XOR sprites this removes the old cursor,

Next we draw the cursor in the new position

Finally we copy the new cursor position into the old cursor position - for the next run of the main loop
Finally we'll process Fire held... this routine only runs if the cursor has moved.

If fire is held, we show a blob at the current position
We do NOT clear the fire held flag - it's cleared by the mouse reading routine.



Lesson P64 - Mouse reading on the MSX
The MSX aslo has a mouse - it connects to the Joystick port, but is not read in the same way as a normal joystick.

We have to set some bits of the port, and we get a pair of nibbles for each X and Y axis - these are an 'offset' which we can use to build a 'position'... lets learn how.

MSX_MouseText.asm
MSX_Mouse.asm



Mouse Routine
Like the Joystick The mouse is read through AY ports A and B...

Unlike the Joystick, we need to send data on pin 8 to select the High/Low nibble of the axis.... our first read will get the X axis offset, the second will get the Y axis.

The bits of the ports are shown below

Port A (&A2 - AY Reg 14)
Bit Direction Details Joy Function Mouse Function
0 IN J1-Pin 1 / J2-Pin 1 Up Low/High Bit 0
1 IN J1-Pin 2 / J2-Pin 2 Down Low/High Bit 1
2 IN J1-Pin 3 / J2-Pin 3 Left Low/High Bit 2
3 IN J1-Pin 4 / J2-Pin 4 Right Low/High Bit 3
4 IN J1-Pin 6 / J2-Pin 6 Fire 1 Right Button
5 IN J1-Pin 7 / J2-Pin 7 Fire 2 Left Button
6 IN Key Layout Select (JP version only)

7 IN Cassette Read


Port B (&A1 - AY Reg 15)
Bit Direction Details Joy Function Mouse Function
0 OUT J1-Pin 6 Set to 1 Set to 1
1 OUT J1-Pin 7 Set to 1 Set to 1
2 OUT J2-Pin 6 Set to 1 Set to 1
3 OUT J2-Pin 7 Set to 1 Set to 1
4 OUT J1-Pin 8
Get Low/High Nibble
5 OUT J2-Pin 8
Get Low/High Nibble
6 OUT Port A Input Select Joy 1/2 Mouse 1/2
7 OUT Kana Lamp On/Off


Reading from the mouse

When we want to read a nibble from an axis, we need to send the configuration to port B to set up the mouse,

We then read from port A to get the data from the mouse
We need to send the correct data to port B - the bits we need to set are different depending if our mouse is in joystick port 1 or 2
The settings here are reading a mouse in joystick port 2 - use the REMmed out versions for joystick port 1

Here we're reading and combining the high and low nibbles - this gets one axis.
We run the GetMouseAxis command twice - this reads both the X and Y axis...

A will also contain the Left/Right mouse buttons in bits 4,5 - we set all the other bits to 1
Here's a simple routine to read in the mouse data, and convert it to an XY position in BC... A contains the LR Mouse buttons.

Note X and Y position read from here do not give positions on the screen - they are relative movements positions compared to the last read - even when we add them to previous reads, they are still only a 'relative movement - we need to covert this to a screen co-ordinate.

Our Mouse Drawing Routine

We're going to write a little mouse drawing routine,

It will show a cursor that's limited to the screen area, we'll be able to click to draw a 'Chibiko', and click and drag to draw blobs.

This is written on the MSX2
We're going to need some variables

We'll store the mouse position - we keep the last position so we know where the mouse was last time we drew it (so we can remove the old sprite)
We use 16 bit X,Y co-ordinates so we can have 'half movements' - we use the top byte of the X,Y pos for drawing...
First we test the fire button - it's still in the Accumulator, and if it's down we set our fire markers...

if it's released we clear the held marker. (The fire down marker should be cleared by the routine that uses the mouse)
We transfer the read in XY pos into DE
NOTE: The mouse reading routine has been flipped... a NEG command has been added to GetMouseNibble


When we add or subtract the movement from each axis, we need to check if this causes an overflow,

If we go below zero, then we've gone over the top or left edge of the screen...
If we go over X>256-7 or Y>192-7 then we've hit the right or bottom of the screen.

We've now converted the movement to a valid onscreen mouse position

This code uses MSX2 VDP commands to do the graphics work... if you don't know about them, you can learn more Here


Using the Mouse Routine
We're going to use our mouse... First we test if fire was just pressed... if it was we'll show 'TestSprite2' (Chibiko) at our current location

We need to clear the Fire down event to mark it processed.
We're going to update the cursor - first we check if the old position and new position are the same - if so we have nothing to do.

If the cursor has moved, first we redraw the cursor in the old position - as we're using XOR sprites this removes the old cursor,

Next we draw the cursor in the new position

Finally we copy the new cursor position into the old cursor position - for the next run of the main loop
Finally we'll process Fire held... this routine only runs if the cursor has moved.

If fire is held, we show a blob at the current position
We do NOT clear the fire held flag - it's cleared by the mouse reading routine.


Lesson P65 - Mouse reading on the Sam Coupe
Lets take a look at the Sam Coupe mouse.

It can be read from the keyboard matrix, but returns 12 bit values, lets learn how it works!

SAM_MouseCursor.asm
SAM_Mouse.asm


Generally, the tech manual"sam-coupe_tech-man_v3-0.pdf" is pretty awesome, but the documentation on the mouse is a massive pile of suck!... Either that or the author of these tutorials is too stupid to understand them (Either is possible!)

As the documentation was lacking, today's example was written by trial and error, it seems to work fine, but no promises can be made!

Mouse Port on the SAM
The SAM Coupe mouse is read from port &FFFE,

We need to do sequential reads from that port, and look at the bottom 4 bits.

We need to combine combine 3 nibbles to build the 12 bit X and Y movement.
Successive reads from &FFFE will return the following data:
Port &FFFE Bit
Read Number  7 
 6 
 5 
 4 
3 2 1 0
1 X X X X - - - -
2 X X X X - - - -
3 X X X X - R C L
4 X X X X Y-High Nibble
5 X X X X Y-Mid Nibble
6 X X X X Y-Low Nibble
7 X X X X X-High Nibble
8 X X X X X-Mid Nibble
9 X X X X X-Low Nibble
We need to read in 3 times from &FFFE to start, the last gets us the mouse buttons,

Now we do 3 reads, these will be the Y axis

Then we do 3 more reads, these will be the X axis

Our Mouse Routine

We're going to write a mouse reader which will draw a cursor onscreen.

Clicking the left button will draw a 'Chibiko' mascot, dragging will draw a trail of blobs,
The sprites are XOR, so drawing twice will remove a sprite.
We're going to need some variables

We'll store the mouse position - we keep the last position so we know where the mouse was last time we drew it (so we can remove the old sprite)
We use 16 bit X,Y co-ordinates so we can have 'half movements' - we use the top byte of the X,Y pos for drawing...
First read in 3 times and test the fire button with port &FFFE, and if it's down we set our fire markers...

if it's released we clear the held marker. (The fire down marker should be cleared by the routine that uses the mouse)

We use the DoAxis function to read in the Y and X move
We use these Xmove and Ymove values (now in Reg D and E) to alter the mouse position.

When we add or subtract the movement from each axis, we need to check if this causes an overflow,

If we go below zero, then we've gone over the top or left edge of the screen...
If we go over X>128-7 or Y>192-7 then we've hit the right or bottom of the screen.

We've now converted the movement to a valid onscreen mouse position

Using the Mouse Routine
We're going to use our mouse... First we test if fire was just pressed... if it was we'll show 'TestSprite2' (Chibiko) at our current location

We need to clear the Fire down event to mark it processed.
We're going to update the cursor - first we check if the old position and new position are the same - if so we have nothing to do.

If the cursor has moved, first we redraw the cursor in the old position - as we're using XOR sprites this removes the old cursor,

Next we draw the cursor in the new position

Finally we copy the new cursor position into the old cursor position - for the next run of the main loop
Finally we'll process Fire held... this routine only runs if the cursor has moved.

If fire is held, we show a blob at the current position
We do NOT clear the fire held flag - it's cleared by the mouse reading routine.



 

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

Top Menu
***Main Menu***
Youtube channel
Forum
AkuSprite Editor
Dec/Bin/Hex/Oct/Ascii Table

Z80 Content
***Z80 Tutorial List***
Learn Z80 Assembly
Hello World
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
Grime 6502
6502 Downloads
6502 Cheatsheet
Sources.7z
DevTools kit
6502 Platforms
Apple IIe
Atari 800 and 5200
Atari Lynx
BBC Micro
Commodore 64
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
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
8086 Downloads
8086 Cheatsheet
Sources.7z
DevTools kit
8086 Platforms
Wonderswan
MsDos

ARM Content
Learn ARM Assembly
Platform Specific Series
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

PDP-11 Content
Learn PDP-11 Assembly
PDP-11 Downloads
PDP-11 Cheatsheet
Sources.7z
DevTools kit

TMS9900 Content
Learn TMS9900 Assembly
TMS9900 Downloads
TMS9900 Cheatsheet
Sources.7z
DevTools kit
TMS9900 Platforms
Ti 99

6809 Content
Learn 6809 Assembly
6809 Downloads
6809/6309 Cheatsheet
Sources.7z
DevTools kit
6809 Platforms
Dragon 32/Tandy Coco
Fujitsu FM7
TRS-80 Coco 3
Vectrex

My Game projects
Chibi Aliens
Chibi Akumas

Work in Progress
Learn 65816 Assembly
Learn eZ80 Assembly

Misc bits
Ruby programming































































Recent New Content
6809 Lesson 5 - More Maths - Logical Ops, Bit shifts and more

x68000 Hardware Sprites

Joypad & Pen on the GBA / NDS ... Key reading on Risc OS

C64 Hardware Sprites - 6502 ASM Lesson YQuest14

SNES Hardware sprites - 6502 ASM YQuest13

Vector drawing on the Vectrex

Graphics on the Fujitsu FM7

CPC ASM: Tape loading on the Amstrad CPC (5K subs special)

68000 YQuest7 - Atari ST Specific code

Hardware Sprites on the NES - Lesson YQuest12

Hardware Sprites on the PC Engine / Turbografix

Joystick reading on the Vectrex - 6809 ASM


Gaming + more:

Emily The Strange (DS) - Live full playthrough

$150 calculator: Unboxing the Ti-84 Plus CE (eZ80 cpu)










Buy Chibi Akuma(s) from PolyPlay
Buy ChibiAkuma(s) games now!














































































































Recent New Content
6809 Lesson 5 - More Maths - Logical Ops, Bit shifts and more

x68000 Hardware Sprites

Joypad & Pen on the GBA / NDS ... Key reading on Risc OS

C64 Hardware Sprites - 6502 ASM Lesson YQuest14

SNES Hardware sprites - 6502 ASM YQuest13

Vector drawing on the Vectrex

Graphics on the Fujitsu FM7

CPC ASM: Tape loading on the Amstrad CPC (5K subs special)

68000 YQuest7 - Atari ST Specific code

Hardware Sprites on the NES - Lesson YQuest12

Hardware Sprites on the PC Engine / Turbografix

Joystick reading on the Vectrex - 6809 ASM


Gaming + more:

Emily The Strange (DS) - Live full playthrough

$150 calculator: Unboxing the Ti-84 Plus CE (eZ80 cpu)










Buy Chibi Akuma(s) from PolyPlay
Buy ChibiAkuma(s) games now!














































































































Recent New Content
6809 Lesson 5 - More Maths - Logical Ops, Bit shifts and more

x68000 Hardware Sprites

Joypad & Pen on the GBA / NDS ... Key reading on Risc OS

C64 Hardware Sprites - 6502 ASM Lesson YQuest14

SNES Hardware sprites - 6502 ASM YQuest13

Vector drawing on the Vectrex

Graphics on the Fujitsu FM7

CPC ASM: Tape loading on the Amstrad CPC (5K subs special)

68000 YQuest7 - Atari ST Specific code

Hardware Sprites on the NES - Lesson YQuest12

Hardware Sprites on the PC Engine / Turbografix

Joystick reading on the Vectrex - 6809 ASM


Gaming + more:

Emily The Strange (DS) - Live full playthrough

$150 calculator: Unboxing the Ti-84 Plus CE (eZ80 cpu)










Buy Chibi Akuma(s) from PolyPlay
Buy ChibiAkuma(s) games now!