![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() The eZ80 is an enhanced version of the Z80... still technically an 8 bit processor, it has a 24 bit address bus and extends the previously 16 bit registers to 24 bit - this allows addressing up to 16mb memory. There is a new 'ADL MEMORY mode' which works in full 24 bit addressing.... 'Z80 Memory Mode' emulates a classic Z80. As the eZ80 is an extension of the Z80, This tutorial assumes you understand the basics of the Z80... if you do not, you need to start here.
ChibiAkumas eZ80 tutorials Z80 Hello World Series
Z80 Platform Specific Lessons
|
Main
Registers:
|
Flags:
SZ-H-PNC
|
Mode | ADL | MADL | MBASE | MMU |
Native Z80 | 0 | 0 | 0 | off |
Virtual Z80 | 0 | 0 | !=0 | off |
Native Z180 | 0 | 0 | 0 | on |
Virtual Z180 | 0 | 0 | !=0 | on |
ADL Mode | 1 | doesn't matter | doesn't matter |
Address |
Purpose |
Details |
$000038 | CBR - Common Bank Register | Used by 80180 compatibility mode (Z180) |
$000039 | BBR - Base Bank Register | Used by 80180 compatibility mode (Z180) |
$00003A | CBAR - Common Bank Area Register | Used by 80180 compatibility mode (Z180) |
CPU Mode |
Parameter Mode |
Command | Result | |
SIS | Short (Z80) |
Short (16 bit) |
LD.SIS HL,$A2A3 LD.SIS (HL),BC LD.SIS (HL),$B2B3 |
HL = $??A2A3 (U=$00 in ADL mode - Unknown
in z80 mode) $89CDEF = $3456 ($89CDEF) = $B2B3 |
SIL | Short (Z80) |
Long (24 bit) |
LD.SIL HL,$A1A2A3 LD.SIL (HL),BC LD.SIL (HL),$B1B2B3 |
HL = $??A2A3 (U=$00 in ADL mode - Unknown
in z80 mode) $89CDEF = $3456 ($89CDEF) = $B2B3 |
LIS | Long (eZ80) |
Short (16 bit) |
LD.LIS HL,$A2A3 LD.LIS (HL),BC LD.LIS (HL),$B2B3 |
HL = $??A2A3 (U=$00 in ADL mode - Unknown
in z80 mode) $ABCDEF = $123456 (S had no effect) ($ABCDEF) = $00B2B3 |
LIL | Long (eZ80) |
Long (24 bit) |
LD.LIL HL,$A1A2A3 LD.LIL (HL),BC LD.LIL (HL),$B1B2B3 |
HL=$A1A2A3 $ABCDEF = $123456 ($ABCDEF) = $B1B2B3 |
The
eZ80 has two modes... Classic Z80 mode where ADL=0... in this mode register pairs like HL are 16 bit. eZ80 mode (ADL Mode) is the new mode where ADL=1.. in this mode register triples like HL are 24 bit. |
![]() |
![]() |
We're going
to use tons of command extensions to switch between Z80 and eZ80
mode on a per command basis! If you need to see more details... you need to read this section here |
There are two stacks on the eZ80... the Z80
'Short stack' SPS and the ADL eZ80 'Long stack' SPL When we switch between modes, these may both be used. |
![]() |
We can use these
commands irrespective of the starting mode... We can use CALL.IL
from either Z80 or eZ80 mode... the only important thing is that
we use RET.L to return. As RET.L uses the 'Extra' mode byte on the stack, we cannot use it with a regular CALL |
![]() |
Cpu |
Cpu |
Suffix |
SPS (16 bit) |
SPL (24 bit) |
New PC |
---|---|---|---|---|---|
S |
S |
none |
PC.L, PC.H |
|
MBASE, Addr.H, Addr.L |
L |
L |
none |
|
PC.L, PC.H, PC.U |
Addr.U, Addr.H, Addr.L |
S |
S |
.IS |
PC.L, PC.H |
02h |
MBASE, Addr.H, Addr.L |
L |
S |
.IS |
PC.L, PC.H |
03h, PC.U |
MBASE, Addr.H, Addr.L |
S |
L |
.IL |
|
02h, PC.L, PC.H |
Addr.U, Addr.H, Addr.L |
L |
L |
.IL |
|
03h, PC.L, PC.H, PC.U |
Addr.U, Addr.H, Addr.L |
![]() |
Rather than
specify the full extension, we can specify half, and the rest
will be 'filled in' based on the current mode. Lets see all the options... |
![]() |
In most cases the suffix
hasn't made a difference between IS and IL suffixes, but it
depends on the MBASE, and the command. To be honest though, it's really best to avoid the issue all together, and avoid using suffixes, and in the rare case you need them specify the full .LIL .SIS etc rather than the partial specification. |
![]() |
DO NOT RUN THESE ON
REAL HARDWARE! - these examples are intended for emulator use
only! OUTing to your hardware could cause problems, hardware damage, and your screen to explode causing shards of glass to poke out your eyes! Don't say I didn't warn you! |
The
TI-84 causes a NMI to ROM functions whenever an OUT occurs -
which rather ruins our plans to play with ports! However, there's a work around, we can switch to 8 bit mode and write our own dummy NMI handler to play with ports... lets have a go! |
![]() |
IN |
Out |
Port |
Src/Dest |
Actions After |
Repeat Until |
IN0 r,# |
OUT0 (#),r |
$00## | r | ||
IND2 |
OUTD2 |
$BBCC | (HL) | DEC HL, DEC C, DEC B | |
IND2R |
OTD2R | $DDEE | (HL) | DEC HL, DEC DE, DEC BC | BC=0 |
INDM |
OTDM |
$00CC | (HL) | DEC HL, DEC C, DEC B | |
INDMR |
OTDMR | $00CC | (HL) | DEC HL, DEC C, DEC B | B=0 |
INDRX |
OTDRX |
$DDEE | (HL) | DEC HL, DEC BC | BC=0 |
INI2 |
OUTI2 | $BBCC | (HL) | INC HL, INC C, DEC B | |
INI2R | OTI2R |
$DDEE | (HL) | INC HL, INC DE, DEC BC | BC=0 |
INIM |
OTIM |
$00CC | (HL) | INC HL, INC C, DEC B | |
INIRX |
OTIRX |
$DDEE | (HL) | INC HL,DEC BC | BC=0 |
We'll only be trying a few port commands in
this episode, The TI-84 doesn't offer many devices we can
access, and some of these commands do strange things (like
reading from port BC, and DECrementing B and C separately) |
![]() |
The TI-84 causes a NMI
interrupt every time we send data to a port, which we can't stop
in eZ80 ADL mode, as we can't change the interrupt handler at
&0066 We can however switch to Short mode, in which all the 64k accessible memory is ram, and write our own dummy interrupt handler (Just a RETI command) Here's a simple test program, which will dim the backlight via port &B024. |
![]() |
Our program has made the screen dim, it then returns to the OS, though the screen stays dim! | ![]() |
OUT0 is a new command, it
uses 16 bit port &00CC - where CC is the C register. This can be used to access the internal IO of the eZ80. Here we use it to read and change the speed of the CPU |
![]() |
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 |
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 |