<!-- PDF page 310 -->

Composite vs Unified sprites ....................... 136\
Batching ............................................ 137\
Automatic sprite movement ........................... 137\
Sprite functions .................................... 139\
Scrolling ........................................... 140\
The Copper .......................................... 140

**Chapter 18 – Sound and Music ....................... 144**\
Basic sounds with the BEEP command .................. 144\
Enhanced Sound and Music with PLAY .................. 147\
Using the PLAY command .............................. 147\
Constructing strings ................................ 148\
PLAY command summary ................................ 148\
Setting the pitch ................................... 148\
Note duration ....................................... 149\
The N Command ....................................... 151\
Note volume ......................................... 151\
Volume effects ....................................... 151\
Tempo ............................................... 152\
Repeated phrases ..................................... 152\
The H command ....................................... 153\
Comments ............................................ 153\
Channel selection ................................... 153\
Stereo control ....................................... 153\
Digital Audio ....................................... 153\
WAV ................................................. 154\
MOD ................................................. 154\
PT3 ................................................. 154\
Using the Pi accelerator for audio ................... 154\
External Audio Output ................................ 155

**Chapter 19 – NextZXOS and alternatives ............. 157**\
Guide to NextZXOS ................................... 157\
NextZXOS main features .............................. 157\
Files, Drives, Partitions and Disks .................. 158\
Working with files .................................. 158\
Filenames ........................................... 159\
LOAD ................................................ 160\
SAVE ................................................ 164\
VERIFY .............................................. 168\
MERGE ............................................... 169\
Using NextZXOS ...................................... 170\
Wildcards ........................................... 170\
Filesystems ......................................... 171\
Partitions .......................................... 171\
Storage devices and disks ............................ 171\
Mounting ............................................ 172\
Drive cataloguing ................................... 173\
Drive, Folder and User Area navigation and management 177\
MKDIR ............................................... 178\
RMDIR ............................................... 178\
CD .................................................. 179\
PWD ................................................. 180\
Managing files and their attributes .................. 181\
COPY ................................................ 181\
ERASE ............................................... 182\
MOVE ................................................ 183\
File attributes ...................................... 184\
The RAMdisk ......................................... 186\
Drive and Partition Management ...................... 186\
CAT TAB and CAT ASN .................................. 186\
MOVE ... IN, MOVE ... OUT and REMOUNT ............... 187\
Virtual filesystem management – .mkdata and .mkswap .. 188\
Printing ............................................ 189\
The SPECTRUM command ................................ 189\
Speed Control ....................................... 191\
NextBASIC Editor and Program support commands ....... 192\
The Browser ......................................... 193\
The Browser Window .................................. 193\
Using the Browser ................................... 194\
Configuring the Browser .............................. 196\
The Command Line ..................................... 196\
ROM Cartridge Loaders ................................ 197\
48K BASIC ........................................... 197\
128K BASIC .......................................... 197\
ZX80 and ZX81 BASIC .................................. 197\
NMI Menu ............................................ 197\
The NextZXOS folder structure ........................ 199\
NextZXOS dot commands ................................ 199\
Modifying the startup – Autoexec.bas ................. 200\
CP/M ................................................ 201\
Preparing your ZX Spectrum Next for esxDOS ........... 204

**Chapter 20 – Channels, Streams,**\
Drivers and Windows ................................. 206\
Channels ............................................ 206\
Streams ............................................. 208\
Using Streams ....................................... 208\
Stream control commands .............................. 208\
The Variable and Memory Channels ..................... 211\
Installable device drivers and Driver Channels ....... 213\
Driver Channel support ............................... 213\
Windows ............................................. 214\
System Windows vs User Windows ....................... 214\
User character sets .................................. 216\
Window input ......................................... 217\
Window definitions ................................... 217

**Chapter 21 – Optional Features ...................... 220**\
Overview ............................................ 220\
Installation (for Issue 2 mainboards) ................ 220\
Raspberry Pi Zero installation on the Issue 4 mainboard 222\
Testing the add-ons' installation .................... 222\
A. Testing the memory ................................ 223\
Using the Real Time Clock hardware ................... 227\
Using the RTC together with the WiFi module .......... 228\
Using the rest of the add-ons ........................ 228

**Chapter 22 – IN, OUT and the**\
Next Registers ...................................... 229\
IN and OUT .......................................... 229\
Hardware address decoding ............................ 229\
Accessing the ZX Spectrum Next features with NextREG . 232\
The Next Registers .................................. 234\
The Expansion Bus ................................... 246

**Chapter 23 – The Memory ............................ 247**\
Overview ............................................ 247\
ROM and RAM ......................................... 247\
The Memory Map ...................................... 247\
Memory Management ................................... 248\
Reading and Writing to Memory ........................ 249\
NextZXOS and NextBASIC memory allocation ............. 251\
Memory Areas and their use ........................... 252\
NextBASIC Data Structures ............................ 253\
PEEK, POKE and their variants ........................ 256\
CLEAR ............................................... 259\
Memory Bank management with BANK .................... 259\
Using BANK with graphics ............................. 262\
Using BANK with files ................................ 264\
Extending NextBASIC Programs with BANK ............... 265\
NextZXOS Paging Mechanism Overview ................... 265\
MMU-Based Memory Management .......................... 269\
Layer 2 Bank Switching ............................... 269\
Paging method interactions ........................... 269\
Paging out the ROM ................................... 269

**Chapter 24 – The System Variables ................... 271**\
Overview ............................................ 271\
System Variables ..................................... 271

**Chapter 25 – Using Machine Code ..................... 275**\
Using Machine Code ................................... 275\
Using CLEAR to Make Space ............................ 275\
Using USR to run machine code ........................ 276\
Calling NextZXOS from NextBASIC ...................... 278\
Opcodes Prefixes ..................................... 281

**Appendix A – Character Set, Z80N**\
Mnemonics and Control Codes ......................... 282

**Appendix B – Reference .............................. 288**\
Reports and Error Codes .............................. 288\
General Errors ....................................... 288\
Storage Device Related Errors ........................ 290\
NextBASIC Keywords and Functions ..................... 291\
The Decimal System ................................... 295\
The Binary System .................................... 295\
The Hexadecimal System ............................... 295\
Bits, Bytes and Words ................................ 296\
Using Binary and Hex in NextBASIC .................... 296

**Appendix C – Machine Personalities .................. 297**\
Overview ............................................ 297\
The Cores and their update procedures ................ 297\
Regular Core update .................................. 298\
AB Core update ....................................... 298\
Multicore (Extra Cores) update ........................ 299

