<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.amstrad-cpc.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=HAL+6128</id>
	<title>CPCWiki - THE Amstrad CPC encyclopedia! - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.amstrad-cpc.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=HAL+6128"/>
	<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/wiki/Special:Contributions/HAL_6128"/>
	<updated>2026-09-03T21:03:42Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming:An_example_to_define_a_RSX&amp;diff=35571</id>
		<title>Programming:An example to define a RSX</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming:An_example_to_define_a_RSX&amp;diff=35571"/>
		<updated>2024-04-20T22:29:36Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
;; This program provides the framework for the installation of a Resident System&lt;br /&gt;
;; Extension (an RSX).&lt;br /&gt;
;; &lt;br /&gt;
;; An RSX is a command which is accessed from basic by prexifing the command&lt;br /&gt;
;; with the &#039;|&#039; symbol.&lt;br /&gt;
;;&lt;br /&gt;
;; e.g. An RSX could provide a &amp;quot;MEMEDIT&amp;quot; command, which allows the user&lt;br /&gt;
;; to edit the RAM contents. It would be accessed from BASIC by typing:&lt;br /&gt;
;;&lt;br /&gt;
;; |MEMEDIT&lt;br /&gt;
;;&lt;br /&gt;
;; This program shows how an RSX is set up. You are free to use this &lt;br /&gt;
;; example code to create your own RSX&#039;s.&lt;br /&gt;
;;&lt;br /&gt;
;; Kevin Thacker 1993&lt;br /&gt;
&lt;br /&gt;
.kl_log_ext equ &amp;amp;bcd1&lt;br /&gt;
&lt;br /&gt;
;; this can be any address in the range &amp;amp;0040-&amp;amp;a7ff.&lt;br /&gt;
org &amp;amp;8000&lt;br /&gt;
&lt;br /&gt;
;;-------------------------------------------------------------------------------&lt;br /&gt;
;; install RSX&lt;br /&gt;
&lt;br /&gt;
ld hl,work_space		;;address of a 4 byte workspace useable by Kernel&lt;br /&gt;
ld bc,jump_table		;;address of command name table and routine handlers&lt;br /&gt;
jp kl_log_ext		;;Install RSX&#039;s&lt;br /&gt;
&lt;br /&gt;
.work_space                ;Space for kernel to use&lt;br /&gt;
defs 4&lt;br /&gt;
&lt;br /&gt;
;;-------------------------------------------------------------------------------&lt;br /&gt;
;; RSX definition&lt;br /&gt;
&lt;br /&gt;
.jump_table&lt;br /&gt;
defw name_table            ;address pointing to RSX commands &lt;br /&gt;
&lt;br /&gt;
                           ;list of jump commands associated with each command&lt;br /&gt;
                           &lt;br /&gt;
                           ;The name (in the name_table) and jump instruction&lt;br /&gt;
                           ;(in the jump_table), must be in the same&lt;br /&gt;
                           ;order.&lt;br /&gt;
&lt;br /&gt;
                           ;i.e. the first name in the name_table refers to the&lt;br /&gt;
                           ;first jump in the jump_table, and vice versa.&lt;br /&gt;
&lt;br /&gt;
jp RSX_1_routine           ;routine for COMMAND1 RSX&lt;br /&gt;
jp RSX_2_routine           ;routine for COMMAND2 RSX&lt;br /&gt;
jp RSX_3_routine           ;routine for COMMAND3 RSX&lt;br /&gt;
&lt;br /&gt;
;; the table of RSX function names&lt;br /&gt;
;; the names must be in capitals.&lt;br /&gt;
&lt;br /&gt;
.name_table&lt;br /&gt;
defb &amp;quot;COMMAND&amp;quot;,&amp;quot;1&amp;quot;+&amp;amp;80     ;the last letter of each RSX name must have bit 7 set to 1.&lt;br /&gt;
defb &amp;quot;COMMAND&amp;quot;,&amp;quot;2&amp;quot;+&amp;amp;80     ;This is used by the Kernel to identify the end of the name.&lt;br /&gt;
defb &amp;quot;COMMAND&amp;quot;,&amp;quot;3&amp;quot;+&amp;amp;80     ;commands in ALWAYS in UPPER case, otherwise you&#039;ll get errors&lt;br /&gt;
&lt;br /&gt;
defb 0                     ;end of name table marker&lt;br /&gt;
&lt;br /&gt;
; Code for the example RSXs&lt;br /&gt;
&lt;br /&gt;
.RSX_1_routine&lt;br /&gt;
ret&lt;br /&gt;
&lt;br /&gt;
.RSX_2_routine&lt;br /&gt;
ret&lt;br /&gt;
&lt;br /&gt;
.RSX_3_routine&lt;br /&gt;
ret&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Source_Codes&amp;diff=9182</id>
		<title>Source Codes</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Source_Codes&amp;diff=9182"/>
		<updated>2023-03-30T11:23:23Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Programming]]&lt;br /&gt;
&#039;&#039;This article contains source codes and programming examples. You may also have a look at&#039;&#039;&lt;br /&gt;
* [[Programming software]]&lt;br /&gt;
* [[BIOS Functions]]&lt;br /&gt;
* [[Technical documentation]]s&lt;br /&gt;
* [[Locomotive BASIC]]&lt;br /&gt;
* [[Type Ins]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Assembler ==&lt;br /&gt;
*[[Z80_-_undocumented_opcodes|Z80 - undocumented opcodes]]&lt;br /&gt;
*[[Where to learn?]]&lt;br /&gt;
*[[A little optimization for Z80 Assembler]]&lt;br /&gt;
&lt;br /&gt;
== Algorithms ==&lt;br /&gt;
*[[Programming:Bubble sort|Bubble sort]]&lt;br /&gt;
*[[Programming:CPC OS floating point routines|CPC OS floating point routines]]&lt;br /&gt;
*[[Programming:CRC16|CRC16]]&lt;br /&gt;
*[[Programming:CRC32|CRC32]]&lt;br /&gt;
*[[Programming:Integer Division|Integer Division]]&lt;br /&gt;
*[[Programming:Integer Multiplication|Integer Multiplication]]&lt;br /&gt;
*[[Programming:Logarithm|Logarithm]]&lt;br /&gt;
*[[Programming:Ultrafast Multiplication|Ultrafast Multiplication]] by [[Prodatron]]&lt;br /&gt;
*[[Programming:Fast Square Root|Fast Square Root]]&lt;br /&gt;
*[[Programming:Fast 16 bit Square Root|Fast 16 bit Square Root]] by [[User:Executioner|Executioner]]&lt;br /&gt;
*[[Programming:Filling memory with a byte|Filling memory with a byte]]&lt;br /&gt;
*[[Programming:Square Root|Square Root]]&lt;br /&gt;
*[[Programming:Precalculated square|Precalculated square]]&lt;br /&gt;
*[[Programming:Maze generation|Maze generation]]&lt;br /&gt;
*[[Programming:Random Number Generator|Random Number Generator]]&lt;br /&gt;
*[[Programming:Reverse A|Reverse A]]&lt;br /&gt;
*[[Programming:Quicksort|Quicksort]]&lt;br /&gt;
*[[Programming:Sin/Cos calculation|Sin/Cos calculation]]&lt;br /&gt;
&lt;br /&gt;
== CP/M ==&lt;br /&gt;
*[[Programming:A simple &#039;Hello World&#039; program for CP/M using BDOS|A simple &#039;Hello World&#039; program for CP/M using BDOS]]&lt;br /&gt;
*[[Programming:A simple &#039;Hello World&#039; program for CP/M using BIOS|A simple &#039;Hello World&#039; program for CP/M using BIOS]]&lt;br /&gt;
*[[Programming:Executing firmware functions from within CP/M 2.1|Executing firmware functions from within CP/M 2.1]]&lt;br /&gt;
*[[Programming:Executing firmware functions from within CP/M 2.1 or CP/M plus|Executing firmware functions from within CP/M 2.1 or CP/M plus]]&lt;br /&gt;
*[[Programming:Executing firmware functions from within CP/M 2.1|Executing firmware functions from within CP/M 2.1]]&lt;br /&gt;
*[[Programming:Executing firmware functions from within CP/M plus|Executing firmware functions from within CP/M plus]]&lt;br /&gt;
&lt;br /&gt;
== CPC Plus ==&lt;br /&gt;
*[[Amstrad CPC plus sprite format]]&lt;br /&gt;
*[[Programming:Convert CPC sprites to Plus hardware sprites|Convert CPC sprites to Plus hardware sprites]]&lt;br /&gt;
*[[Sprites Multiplexing]]&lt;br /&gt;
*[[Programming:CPC Plus Hardware Sprites|Hardware sprites]]&lt;br /&gt;
*[[Programming:CPC Plus Horizontal scroll|Horizontal scroll]]&lt;br /&gt;
*[[Programming:CPC Plus RLE Hardware Sprites|RLE hardware sprites]]&lt;br /&gt;
*[[Programming:CPC Plus Screen Splitting|Screen splitting]]&lt;br /&gt;
*[[Programming:CPC Plus Vertical scroll|Vertical scroll]]&lt;br /&gt;
*[[Operation of Z80 interrupt mode 0 in the CPC plus design]]&lt;br /&gt;
*[[Programming:Simple Raster Example 2 (uses CPC plus features)|Simple Raster Example 1 (uses CPC plus features)]]&lt;br /&gt;
*[[Programming:Simple Raster Example 3 (uses CPC plus features)|Simple Raster Example 2 (uses CPC plus features)]]&lt;br /&gt;
*[[Programming:Unlocking ASIC|Unlocking ASIC]]&lt;br /&gt;
&lt;br /&gt;
== Devices ==&lt;br /&gt;
*[[Programming:CPC Booster|CPC Booster]]&lt;br /&gt;
*[[Programming:Digiblaster|Digiblaster]]&lt;br /&gt;
*[[Programming:Program to save the ROM of the Multiface 2|Program to save the ROM of the Multiface 2]]&lt;br /&gt;
*[[Programming:SYMBiFACE II|SYMBiFACE II]]&lt;br /&gt;
&lt;br /&gt;
== File access ==&lt;br /&gt;
*[[Programming:An example to read a file byte-by-byte|An example to read a file byte-by-byte]]&lt;br /&gt;
*[[Programming:An example to write a file byte-by-byte|An example to write a file byte-by-byte]]&lt;br /&gt;
*[[Programming:Read/Write a file quickly byte-by-byte|Read or write a file quickly byte-by-byte]]&lt;br /&gt;
*[[Programming:A simple file copier using firmware functions (copies byte-by-byte)|A simple file copier using firmware functions (copies byte-by-byte)]]&lt;br /&gt;
*[[Programming:Loading a file|Loading a file]]&lt;br /&gt;
*[[Programming:Saving a file|Saving a file]]&lt;br /&gt;
*[[Programming:Unlocking a protected basic file|Unlocking a protected basic file]]&lt;br /&gt;
*[[Programming:Undo delete of file|Undo delete of file]]&lt;br /&gt;
&lt;br /&gt;
== Floppy disk ==&lt;br /&gt;
*[[Programming:A simple disc copier using BDOS functions|A simple disc copier using BDOS functions]]&lt;br /&gt;
*[[Programming:A simple disc formatter using BDOS functions|A simple disc formatter using BDOS functions]]&lt;br /&gt;
*[[Programming:An example loader|An example loader]]&lt;br /&gt;
*[[Programming:Catalog a disc and retrieve a directory|Catalog a disc and retrieve a directory]]&lt;br /&gt;
*[[Programming:Detecting an Amstrad or Vortex disc controler|Detecting an Amstrad or Vortex disc controler]]&lt;br /&gt;
*[[Programming:Formatting a track on a disc|Formatting a track on a disc]]&lt;br /&gt;
*[[Programming:Reading a sector from a disc|Reading a sector from a disc]]&lt;br /&gt;
*[[Programming:Reading and writing the boot sector of a SYSTEM/VENDOR disc|Reading and writing the boot sector of a SYSTEM/VENDOR disc]]&lt;br /&gt;
*[[Programming:Writing a sector to disc|Writing a sector to disc]]&lt;br /&gt;
&lt;br /&gt;
== Games ==&lt;br /&gt;
*[[Programming:Coding a simple BASIC game into Assembly]]&lt;br /&gt;
&lt;br /&gt;
== Graphics ==&lt;br /&gt;
&lt;br /&gt;
*[[Programming:Calculating xpos,ypos to screen address in assembly|Calculating xpos,ypos to screen address]]&lt;br /&gt;
*[[Programming:Display a 8-bit number in binary|Display a 8-bit number in binary]]&lt;br /&gt;
*[[Programming:Display a 8-bit number in hex|Display a 8-bit number in hex]]&lt;br /&gt;
*[[Programming:Display a byte as a 3-digit decimal number|Display a byte as a 3-digit decimal number]]&lt;br /&gt;
*[[Programming:Display and update Scores|Display and update Scores]]&lt;br /&gt;
*[[Programming:Distorting the screen using register 2 of the CRTC (Horizontal Sync Position)|Distorting the screen using register 2 of the CRTC (Horizontal Sync Position)]]&lt;br /&gt;
*[[Programming:Fast plot|Fast plot]]&lt;br /&gt;
*[[Programming:Fast Sprites|Fast Sprites]] by [[User:Executioner|Executioner]]&lt;br /&gt;
*[[Programming:Fast Textoutput|Fast Textoutput]] by [[Prodatron]]&lt;br /&gt;
*[[Fastest_Character_Print_in_Mode_2|Fastest Character Print in Mode 2 in all screen positions]] by [[FG Brain]]&lt;br /&gt;
*[[Programming:Hardware scrolling|Hardware Scrolling]] by [[User:Executioner|Executioner]]&lt;br /&gt;
*[[Programming:Hardware scrolling 2|Hardware Scrolling 2]]&lt;br /&gt;
*[[Programming:Hardware scrolling the screen horizontally byte-by-byte using the CRTC|Hardware scrolling the screen horizontally byte-by-byte using the CRTC]]&lt;br /&gt;
*[[Programming:Hardware scrolling the screen using the CRTC|Hardware scrolling the screen using the CRTC]]&lt;br /&gt;
*[[Programming:Next / previous line calculation|Next / previous line calculation]]&lt;br /&gt;
*[[Programming:Overscan|Overscan]]&lt;br /&gt;
*[[Programming:Plotting a sprite using character matrices|Plotting a sprite using character matrices]]&lt;br /&gt;
*[[Mode 4 (two bitplane emulation)| 4th Mode of CPCs: Plotting sprites on 2 bitplanes]]&lt;br /&gt;
*[[Screen refresh rate|Set the screen refresh rate]]&lt;br /&gt;
*[[Programming:Simple Raster Example 1|Simple Raster Example]]&lt;br /&gt;
*[[Programming:Simple Split Raster Example 1|Simple Split Raster Example]]&lt;br /&gt;
*[[Synchronising with the CRTC and display]]&lt;br /&gt;
*[[CRTC change colour (fill) test with precise timing]] by [[User:Matahari|Matahari]]&lt;br /&gt;
*[[256 byte Overscan MEGATEXT Intro - (features 50Hz fullscreen scroll)]] by [[User:Matahari|Matahari]]&lt;br /&gt;
&lt;br /&gt;
== Interrupts ==&lt;br /&gt;
* [[Reliable use of interrupt mode 2 on the CPC]]&lt;br /&gt;
&lt;br /&gt;
== Keyboard ==&lt;br /&gt;
*[[Programming:Keyboard scanning|Keyboard scanning]]&lt;br /&gt;
*[[Programming:Keyboard_redefinition|Keyboard redefinition]]&lt;br /&gt;
&lt;br /&gt;
== Cartridges ==&lt;br /&gt;
*[[Programming:Cartridges|Cartridges]]&lt;br /&gt;
*[[Programming:Crt0Cart|CRT0 for SDCC]] to init a CPR cart&lt;br /&gt;
&lt;br /&gt;
== Other routines ==&lt;br /&gt;
*[[Programming:An example boot sector (executed with rsx command CPM)|An example boot sector (executed with rsx command CPM)]]&lt;br /&gt;
*[[Programming:An example to define a RSX|An example to define a RSX]]&lt;br /&gt;
*[[Programming:Calling a RSX from outside of BASIC|Calling a RSX from outside of BASIC]]&lt;br /&gt;
*[[Programming:Dumping the data of BASIC or AMSDOS or an expansion rom|Dumping the data of BASIC or AMSDOS or an expansion rom]]&lt;br /&gt;
*[[Programming:Dumping the data of the lower rom|Dumping the data of the lower rom]]&lt;br /&gt;
*[[Programming:Storing and Retrieving Screens from the extra 64kb|Storing and Retrieving Screens from the extra 64kb]]&lt;br /&gt;
&lt;br /&gt;
== Sound ==&lt;br /&gt;
*[[How to access the PSG via PPI]]&lt;br /&gt;
*[[Programming:Tutorial - Understanding the fundamentals of BASIC SOUND and the Firmware SOUND QUEUE|Tutorial - Understanding the fundamentals of BASIC SOUND and the Firmware SOUND QUEUE]]&lt;br /&gt;
*[[Programming:Source code to show 0x0ff is always returned when reading PSG port B|Source code to show 0x0ff is always returned when reading PSG port B]]&lt;br /&gt;
*[[Programming:Source code to show it is possible to store data in PSG register 14 and 15 (port A and port B)|Source code to show it is possible to store data in PSG register 14 and 15 (port A and port B)]]&lt;br /&gt;
*[[Programming:Source code to show it is possible to store data in PSG register 14 and 15 even if the port has been set to input|Source code to show it is possible to store data in PSG register 14 and 15 even if the port has been set to input]]&lt;br /&gt;
*[[Programming:Source code to show that some registers always return 0 in some bits|Source code to show that some registers always return 0 in some bits]]&lt;br /&gt;
*[[Programming:Source code to show that when a port is read in output mode; the data read will be ANDed with the inputs to that port|Source code to show that when a port is read in output mode; the data read will be ANDed with the inputs to that port]]&lt;br /&gt;
&lt;br /&gt;
== Cross Development ==&lt;br /&gt;
*[[Programming:Cross Development|Cross Development]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Source code]]&lt;br /&gt;
&lt;br /&gt;
== General Notes ==&lt;br /&gt;
&lt;br /&gt;
* Memory range for programs is &amp;amp;0040-&amp;amp;a700. This avoids firmware and memory allocated by AMSDOS disc ROM.&lt;br /&gt;
This is safe for the purpose of loading and being compatible with the firmware.&lt;br /&gt;
After loading, if you disable the firmware, you can re-use the firmware areas as you want, but you need to do everything yourself (scanning keyboard, drawing, sound etc).If you need to use these areas, a common thing to do is to load most into the safe area, some into the screen, and relocate it after loading.&lt;br /&gt;
* Programs on cassette and disc have a header that define the load address, length and execution address.&lt;br /&gt;
&lt;br /&gt;
In Pasmo assembler use the &amp;quot;end&amp;quot; mnemonic to define the label which is the execution address and use &amp;quot;--amsdos&amp;quot; to put an AMSDOS header on it.&lt;br /&gt;
&lt;br /&gt;
* Basic programs start at &amp;amp;170.&lt;br /&gt;
* Firmware uses interrupt mode 1 of the Z80 (interrupts jump to &amp;amp;0038)&lt;br /&gt;
* Lowest place you can LOAD a binary file to with BASIC is &amp;amp;389 e.g.:&lt;br /&gt;
&lt;br /&gt;
 openout&amp;quot;d&amp;quot;&lt;br /&gt;
 memory &amp;lt;address&amp;gt;-1&lt;br /&gt;
 closeout&lt;br /&gt;
 load &amp;quot;code&amp;quot;,&amp;lt;address&amp;gt;&lt;br /&gt;
 call &amp;lt;exec&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Screen is normally at &amp;amp;c000-&amp;amp;ffff. (It can be changed using firmware, or using CRTC R12/R13)&lt;br /&gt;
*Stack is normally at &amp;amp;c000 and goes down.&lt;br /&gt;
*Extra registers (BC&#039;, AF&#039;, HL&#039;, DE&#039; are reserved by the firmware). Avoid if you are using firmware functions.&lt;br /&gt;
*Lower rom (containing OS) can be paged into memory between &amp;amp;0000-&amp;amp;3fff.&lt;br /&gt;
*Upper rom is selectable, examples are BASIC and AMSDOS. They can be paged into memory between &amp;amp;c000-&amp;amp;ffff.&lt;br /&gt;
*From basic, a game is run with:&lt;br /&gt;
&lt;br /&gt;
 RUN&amp;quot;&amp;lt;filename&amp;gt;&lt;br /&gt;
&lt;br /&gt;
keep it in the safe memory ranges and it&#039;ll run from cassette and disc.&lt;br /&gt;
*Screen is normally 40 crtc chars wide (CRTC R1=40), 25 crtc chars tall (CRTC R6=25). 8 scan lines per char (R9=7). Firmware functions assume this.&lt;br /&gt;
*Screen is bitmapped. You must draw/erase your own sprites and text.&lt;br /&gt;
*Firmware refreshes the palette every 50th of a second, so you need to turn off the firmware and use the hardware directly, or set the colours using firmware.&lt;br /&gt;
*Firmware can be &amp;quot;turned off&amp;quot;, by disabling lower ROM, redirecting interrupts and not calling firmware functions.&lt;br /&gt;
*Screen can be resized the same as the Spectrum. Provided you do not use hardware scrolling, this gives you extra space although because of the layout of the screen, it&#039;s not continuous, it&#039;s in 8 seperate blocks, but it&#039;s enough to store data and code.&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120915</id>
		<title>Programming the V9990: Learning by disassembling the &quot;Robot&quot; demo</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120915"/>
		<updated>2023-03-30T11:23:03Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;&amp;lt;big&amp;gt;V9990 Robot-Demo&amp;lt;/big&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Demo File:&lt;br /&gt;
For executing extract files on a CPC floppy or upload it on the M4 board and change directory into the DSK container (|CD,&amp;quot;ROBOT.DSK&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Run file &amp;quot;ROBOT.BIN&amp;quot; and wait some time. At least a running robot through a forest will be shown.&lt;br /&gt;
&lt;br /&gt;
You should be able to move (left, right, jump up) the robot via cursor keys and fire a bullet with space.&lt;br /&gt;
&lt;br /&gt;
https://www.cpcwiki.eu/index.php/File:Robot.dsk&lt;br /&gt;
&lt;br /&gt;
(there might be some DSK files around where you can&#039;t find the &amp;quot;ROBOT.BIN&amp;quot; file. The DSK container attached is a version made by @Geco.&lt;br /&gt;
&lt;br /&gt;
In the case you don&#039;t have it you nevertheless can run the demo by executing the files in following 10 order:&lt;br /&gt;
# run&amp;quot;clear &amp;gt;&lt;br /&gt;
# run&amp;quot;a1 &amp;gt; &lt;br /&gt;
# run&amp;quot;a2 &amp;gt; &lt;br /&gt;
# run&amp;quot;a3 &amp;gt; &lt;br /&gt;
# run&amp;quot;b1 &amp;gt; &lt;br /&gt;
# run&amp;quot;b2 &amp;gt; &lt;br /&gt;
# run&amp;quot;b3 &amp;gt; &lt;br /&gt;
# run&amp;quot;c1 &amp;gt; &lt;br /&gt;
# run&amp;quot;c2 &amp;gt; &lt;br /&gt;
# run&amp;quot;c3 &amp;gt;&lt;br /&gt;
# run&amp;quot;robo)&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120914</id>
		<title>Programming the V9990: Learning by disassembling the &quot;Robot&quot; demo</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120914"/>
		<updated>2023-03-30T11:22:11Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;&amp;lt;big&amp;gt;Learning to program the V9990 VDP&amp;lt;/big&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Having a V9990 VDP attached on my CPC and always eager to learn about and program it.&lt;br /&gt;
First steps are reproducing the &amp;quot;Robot&amp;quot; demo which were spread around the net to show little of the capabilities of the VDP V9990 from Yamaha.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Demo File:&lt;br /&gt;
For executing extract files on a CPC floppy or upload it on the M4 board and change directory into the DSK container (|CD,&amp;quot;ROBOT.DSK&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Run file &amp;quot;ROBOT.BIN&amp;quot; and wait some time. At least a running robot through a forest will be shown.&lt;br /&gt;
&lt;br /&gt;
You should be able to move (left, right, jump up) the robot via cursor keys and fire a bullet with space.&lt;br /&gt;
&lt;br /&gt;
https://www.cpcwiki.eu/index.php/File:Robot.dsk&lt;br /&gt;
&lt;br /&gt;
(there might be some DSK files around where you can&#039;t find the &amp;quot;ROBOT.BIN&amp;quot; file. The DSK container attached is a version made by @Geco.&lt;br /&gt;
&lt;br /&gt;
In the case you don&#039;t have it you nevertheless can run the demo by executing the files in following 10 order:&lt;br /&gt;
# run&amp;quot;clear &amp;gt;&lt;br /&gt;
# run&amp;quot;a1 &amp;gt; &lt;br /&gt;
# run&amp;quot;a2 &amp;gt; &lt;br /&gt;
# run&amp;quot;a3 &amp;gt; &lt;br /&gt;
# run&amp;quot;b1 &amp;gt; &lt;br /&gt;
# run&amp;quot;b2 &amp;gt; &lt;br /&gt;
# run&amp;quot;b3 &amp;gt; &lt;br /&gt;
# run&amp;quot;c1 &amp;gt; &lt;br /&gt;
# run&amp;quot;c2 &amp;gt; &lt;br /&gt;
# run&amp;quot;c3 &amp;gt;&lt;br /&gt;
# run&amp;quot;robo)&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120912</id>
		<title>Programming the V9990: Learning by disassembling the &quot;Robot&quot; demo</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120912"/>
		<updated>2023-03-24T18:48:37Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;&amp;lt;big&amp;gt;Learning to program the V9990 VDP&amp;lt;/big&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Having a V9990 VDP attached on my CPC and always eager to learn about and program it.&lt;br /&gt;
First steps are reproducing the &amp;quot;Robot&amp;quot; demo which were spread around the net to show little of the capabilities of the VDP V9990 from Yamaha.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;But how does it works?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
.... (tbd)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Demo File:&lt;br /&gt;
For executing extract files on a CPC floppy or upload it on the M4 board and change directory into the DSK container (|CD,&amp;quot;ROBOT.DSK&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Run file &amp;quot;ROBOT.BIN&amp;quot; and wait some time. At least a running robot through a forest will be shown.&lt;br /&gt;
&lt;br /&gt;
You should be able to move (left, right, jump up) the robot via cursor keys and fire a bullet with space.&lt;br /&gt;
&lt;br /&gt;
https://www.cpcwiki.eu/index.php/File:Robot.dsk&lt;br /&gt;
&lt;br /&gt;
(there might be some DSK files around where you can&#039;t find the &amp;quot;ROBOT.BIN&amp;quot; file. The DSK container attached is a version made by @Geco.&lt;br /&gt;
&lt;br /&gt;
In the case you don&#039;t have it you nevertheless can run the demo by executing the files in following 10 order:&lt;br /&gt;
1. run&amp;quot;clear &amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. run&amp;quot;a1 &amp;gt; &lt;br /&gt;
&lt;br /&gt;
3. run&amp;quot;a2 &amp;gt; &lt;br /&gt;
&lt;br /&gt;
4. run&amp;quot;a3 &amp;gt; &lt;br /&gt;
&lt;br /&gt;
5. run&amp;quot;b1 &amp;gt; &lt;br /&gt;
&lt;br /&gt;
6. run&amp;quot;b2 &amp;gt; &lt;br /&gt;
&lt;br /&gt;
7. run&amp;quot;b3 &amp;gt; &lt;br /&gt;
&lt;br /&gt;
8. run&amp;quot;c1 &amp;gt; &lt;br /&gt;
&lt;br /&gt;
9. run&amp;quot;c2 &amp;gt; &lt;br /&gt;
&lt;br /&gt;
10. run&amp;quot;c3 &amp;gt;11. run&amp;quot;robo)&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120911</id>
		<title>Programming the V9990: Learning by disassembling the &quot;Robot&quot; demo</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120911"/>
		<updated>2023-03-24T18:48:18Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;&amp;lt;big&amp;gt;Learning to program the V9990 VDP&amp;lt;/big&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Having a V9990 VDP attached on my CPC and always eager to learn about and program it.&lt;br /&gt;
First steps are reproducing the &amp;quot;Robot&amp;quot; demo which were spread around the net to show little of the capabilities of the VDP V9990 from Yamaha.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;But how does it works?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
.... (tbd)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Demo File:&lt;br /&gt;
For executing extract files on a CPC floppy or upload it on the M4 board and change directory into the DSK container (|CD,&amp;quot;ROBOT.DSK&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Run file &amp;quot;ROBOT.BIN&amp;quot; and wait some time. At least a running robot through a forest will be shown.&lt;br /&gt;
&lt;br /&gt;
You should be able to move (left, right, jump up) the robot via cursor keys and fire a bullet with space.&lt;br /&gt;
&lt;br /&gt;
https://www.cpcwiki.eu/index.php/File:Robot.dsk&lt;br /&gt;
&lt;br /&gt;
(there might be some DSK files around where you can&#039;t find the &amp;quot;ROBOT.BIN&amp;quot; file. The DSK container attached is a version made by @Geco.&lt;br /&gt;
&lt;br /&gt;
In the case you don&#039;t have it you nevertheless can run the demo by executing the files in following 10 order:&lt;br /&gt;
1. run&amp;quot;clear &amp;gt;&lt;br /&gt;
2. run&amp;quot;a1 &amp;gt; &lt;br /&gt;
3. run&amp;quot;a2 &amp;gt; &lt;br /&gt;
4. run&amp;quot;a3 &amp;gt; &lt;br /&gt;
5. run&amp;quot;b1 &amp;gt; &lt;br /&gt;
6. run&amp;quot;b2 &amp;gt; &lt;br /&gt;
7. run&amp;quot;b3 &amp;gt; &lt;br /&gt;
8. run&amp;quot;c1 &amp;gt; &lt;br /&gt;
9. run&amp;quot;c2 &amp;gt; &lt;br /&gt;
10. run&amp;quot;c3 &amp;gt;11. run&amp;quot;robo)&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120910</id>
		<title>Programming the V9990: Learning by disassembling the &quot;Robot&quot; demo</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120910"/>
		<updated>2023-03-24T14:38:39Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;&amp;lt;big&amp;gt;Learning to program the V9990 VDP&amp;lt;/big&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Having a V9990 VDP attached on my CPC and always eager to learn about and program it.&lt;br /&gt;
First steps are reproducing the &amp;quot;Robot&amp;quot; demo which were spread around the net to show little of the capabilities of the VDP V9990 from Yamaha.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;But how does it works?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
.... (tbd)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Demo File:&lt;br /&gt;
For executing extract files on a CPC floppy or upload it on the M4 board and change directory into the DSK container (|CD,&amp;quot;ROBOT.DSK&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Run file &amp;quot;ROBOT.BIN&amp;quot; and wait some time. At least a running robot through a forest will be shown.&lt;br /&gt;
&lt;br /&gt;
You should be able to move (left, right, jump up) the robot via cursor keys and fire a bullet with space.&lt;br /&gt;
&lt;br /&gt;
https://www.cpcwiki.eu/index.php/File:Robot.dsk&lt;br /&gt;
&lt;br /&gt;
(there might be some DSK files around where you can&#039;t find the &amp;quot;ROBOT.BIN&amp;quot; file. The DSK container attached is a version made by @Geco.&lt;br /&gt;
In the case you don&#039;t have you can run the demo by executing it by loading / running the files in following 10 steps:&lt;br /&gt;
1. run&amp;quot;clear &amp;gt; 2. run&amp;quot;a1 &amp;gt; 3. run&amp;quot;a2 &amp;gt; 4. run&amp;quot;a3 &amp;gt; 5. run&amp;quot;b1 &amp;gt; 6. run&amp;quot;b2 &amp;gt; 7. run&amp;quot;b3 &amp;gt; 8. run&amp;quot;c1 &amp;gt; 9. run&amp;quot;c2 &amp;gt; 10. run&amp;quot;c3 &amp;gt;11. run&amp;quot;robo)&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120909</id>
		<title>Programming the V9990: Learning by disassembling the &quot;Robot&quot; demo</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120909"/>
		<updated>2023-03-24T14:37:57Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;&amp;lt;big&amp;gt;Learning to program the V9990 VDP&amp;lt;/big&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Having a V9990 VDP attached on my CPC and always eager to learn about and program it.&lt;br /&gt;
First steps are reproducing the &amp;quot;Robot&amp;quot; demo which were spread around the net to show little of the capabilities of the VDP V9990 from Yamaha.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;But how does it works?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
.... (tbd)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Demo File:&lt;br /&gt;
For executing extract files on a CPC floppy or upload it on the M4 board and change directory into the DSK container (|CD,&amp;quot;ROBOT.DSK&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Run file &amp;quot;ROBOT.BIN&amp;quot; and wait some time. At least a running robot through a forest will be shown.&lt;br /&gt;
&lt;br /&gt;
You should be able to move (left, right, jump up) the robot via cursor keys and fire a bullet with space.&lt;br /&gt;
&lt;br /&gt;
https://www.cpcwiki.eu/index.php/File:Robot.dsk&lt;br /&gt;
&lt;br /&gt;
(there might be some DSK files around where you can&#039;t find the &amp;quot;ROBOT.BIN&amp;quot; file. The DSK container attached is a version made by @Geco.&lt;br /&gt;
In the case you don&#039;t have you can run the demo by executing it by loading / running the files in following order:&lt;br /&gt;
1. run&amp;quot;clear&lt;br /&gt;
2. run&amp;quot;a1&lt;br /&gt;
3. run&amp;quot;a2&lt;br /&gt;
4. run&amp;quot;a3&lt;br /&gt;
5. run&amp;quot;b1&lt;br /&gt;
6. run&amp;quot;b2&lt;br /&gt;
7. run&amp;quot;b3&lt;br /&gt;
8. run&amp;quot;c1&lt;br /&gt;
9. run&amp;quot;c2&lt;br /&gt;
10. run&amp;quot;c3&lt;br /&gt;
11. run&amp;quot;robo)&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Source_Codes&amp;diff=9181</id>
		<title>Source Codes</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Source_Codes&amp;diff=9181"/>
		<updated>2023-03-24T14:32:54Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Programming]]&lt;br /&gt;
&#039;&#039;This article contains source codes and programming examples. You may also have a look at&#039;&#039;&lt;br /&gt;
* [[Programming software]]&lt;br /&gt;
* [[BIOS Functions]]&lt;br /&gt;
* [[Technical documentation]]s&lt;br /&gt;
* [[Locomotive BASIC]]&lt;br /&gt;
* [[Type Ins]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Assembler ==&lt;br /&gt;
*[[Z80_-_undocumented_opcodes|Z80 - undocumented opcodes]]&lt;br /&gt;
*[[Where to learn?]]&lt;br /&gt;
*[[A little optimization for Z80 Assembler]]&lt;br /&gt;
&lt;br /&gt;
== Algorithms ==&lt;br /&gt;
*[[Programming:Bubble sort|Bubble sort]]&lt;br /&gt;
*[[Programming:CPC OS floating point routines|CPC OS floating point routines]]&lt;br /&gt;
*[[Programming:CRC16|CRC16]]&lt;br /&gt;
*[[Programming:CRC32|CRC32]]&lt;br /&gt;
*[[Programming:Integer Division|Integer Division]]&lt;br /&gt;
*[[Programming:Integer Multiplication|Integer Multiplication]]&lt;br /&gt;
*[[Programming:Logarithm|Logarithm]]&lt;br /&gt;
*[[Programming:Ultrafast Multiplication|Ultrafast Multiplication]] by [[Prodatron]]&lt;br /&gt;
*[[Programming:Fast Square Root|Fast Square Root]]&lt;br /&gt;
*[[Programming:Fast 16 bit Square Root|Fast 16 bit Square Root]] by [[User:Executioner|Executioner]]&lt;br /&gt;
*[[Programming:Filling memory with a byte|Filling memory with a byte]]&lt;br /&gt;
*[[Programming:Square Root|Square Root]]&lt;br /&gt;
*[[Programming:Precalculated square|Precalculated square]]&lt;br /&gt;
*[[Programming:Maze generation|Maze generation]]&lt;br /&gt;
*[[Programming:Random Number Generator|Random Number Generator]]&lt;br /&gt;
*[[Programming:Reverse A|Reverse A]]&lt;br /&gt;
*[[Programming:Quicksort|Quicksort]]&lt;br /&gt;
*[[Programming:Sin/Cos calculation|Sin/Cos calculation]]&lt;br /&gt;
&lt;br /&gt;
== CP/M ==&lt;br /&gt;
*[[Programming:A simple &#039;Hello World&#039; program for CP/M using BDOS|A simple &#039;Hello World&#039; program for CP/M using BDOS]]&lt;br /&gt;
*[[Programming:A simple &#039;Hello World&#039; program for CP/M using BIOS|A simple &#039;Hello World&#039; program for CP/M using BIOS]]&lt;br /&gt;
*[[Programming:Executing firmware functions from within CP/M 2.1|Executing firmware functions from within CP/M 2.1]]&lt;br /&gt;
*[[Programming:Executing firmware functions from within CP/M 2.1 or CP/M plus|Executing firmware functions from within CP/M 2.1 or CP/M plus]]&lt;br /&gt;
*[[Programming:Executing firmware functions from within CP/M 2.1|Executing firmware functions from within CP/M 2.1]]&lt;br /&gt;
*[[Programming:Executing firmware functions from within CP/M plus|Executing firmware functions from within CP/M plus]]&lt;br /&gt;
&lt;br /&gt;
== CPC Plus ==&lt;br /&gt;
*[[Amstrad CPC plus sprite format]]&lt;br /&gt;
*[[Programming:Convert CPC sprites to Plus hardware sprites|Convert CPC sprites to Plus hardware sprites]]&lt;br /&gt;
*[[Sprites Multiplexing]]&lt;br /&gt;
*[[Programming:CPC Plus Hardware Sprites|Hardware sprites]]&lt;br /&gt;
*[[Programming:CPC Plus Horizontal scroll|Horizontal scroll]]&lt;br /&gt;
*[[Programming:CPC Plus RLE Hardware Sprites|RLE hardware sprites]]&lt;br /&gt;
*[[Programming:CPC Plus Screen Splitting|Screen splitting]]&lt;br /&gt;
*[[Programming:CPC Plus Vertical scroll|Vertical scroll]]&lt;br /&gt;
*[[Operation of Z80 interrupt mode 0 in the CPC plus design]]&lt;br /&gt;
*[[Programming:Simple Raster Example 2 (uses CPC plus features)|Simple Raster Example 1 (uses CPC plus features)]]&lt;br /&gt;
*[[Programming:Simple Raster Example 3 (uses CPC plus features)|Simple Raster Example 2 (uses CPC plus features)]]&lt;br /&gt;
*[[Programming:Unlocking ASIC|Unlocking ASIC]]&lt;br /&gt;
&lt;br /&gt;
== Devices ==&lt;br /&gt;
*[[Programming:CPC Booster|CPC Booster]]&lt;br /&gt;
*[[Programming:Digiblaster|Digiblaster]]&lt;br /&gt;
*[[Programming:Program to save the ROM of the Multiface 2|Program to save the ROM of the Multiface 2]]&lt;br /&gt;
*[[Programming:SYMBiFACE II|SYMBiFACE II]]&lt;br /&gt;
&lt;br /&gt;
== File access ==&lt;br /&gt;
*[[Programming:An example to read a file byte-by-byte|An example to read a file byte-by-byte]]&lt;br /&gt;
*[[Programming:An example to write a file byte-by-byte|An example to write a file byte-by-byte]]&lt;br /&gt;
*[[Programming:Read/Write a file quickly byte-by-byte|Read or write a file quickly byte-by-byte]]&lt;br /&gt;
*[[Programming:A simple file copier using firmware functions (copies byte-by-byte)|A simple file copier using firmware functions (copies byte-by-byte)]]&lt;br /&gt;
*[[Programming:Loading a file|Loading a file]]&lt;br /&gt;
*[[Programming:Saving a file|Saving a file]]&lt;br /&gt;
*[[Programming:Unlocking a protected basic file|Unlocking a protected basic file]]&lt;br /&gt;
*[[Programming:Undo delete of file|Undo delete of file]]&lt;br /&gt;
&lt;br /&gt;
== Floppy disk ==&lt;br /&gt;
*[[Programming:A simple disc copier using BDOS functions|A simple disc copier using BDOS functions]]&lt;br /&gt;
*[[Programming:A simple disc formatter using BDOS functions|A simple disc formatter using BDOS functions]]&lt;br /&gt;
*[[Programming:An example loader|An example loader]]&lt;br /&gt;
*[[Programming:Catalog a disc and retrieve a directory|Catalog a disc and retrieve a directory]]&lt;br /&gt;
*[[Programming:Detecting an Amstrad or Vortex disc controler|Detecting an Amstrad or Vortex disc controler]]&lt;br /&gt;
*[[Programming:Formatting a track on a disc|Formatting a track on a disc]]&lt;br /&gt;
*[[Programming:Reading a sector from a disc|Reading a sector from a disc]]&lt;br /&gt;
*[[Programming:Reading and writing the boot sector of a SYSTEM/VENDOR disc|Reading and writing the boot sector of a SYSTEM/VENDOR disc]]&lt;br /&gt;
*[[Programming:Writing a sector to disc|Writing a sector to disc]]&lt;br /&gt;
&lt;br /&gt;
== Games ==&lt;br /&gt;
*[[Programming:Coding a simple BASIC game into Assembly]]&lt;br /&gt;
&lt;br /&gt;
== Graphics ==&lt;br /&gt;
&lt;br /&gt;
*[[Programming:Calculating xpos,ypos to screen address in assembly|Calculating xpos,ypos to screen address]]&lt;br /&gt;
*[[Programming:Display a 8-bit number in binary|Display a 8-bit number in binary]]&lt;br /&gt;
*[[Programming:Display a 8-bit number in hex|Display a 8-bit number in hex]]&lt;br /&gt;
*[[Programming:Display a byte as a 3-digit decimal number|Display a byte as a 3-digit decimal number]]&lt;br /&gt;
*[[Programming:Display and update Scores|Display and update Scores]]&lt;br /&gt;
*[[Programming:Distorting the screen using register 2 of the CRTC (Horizontal Sync Position)|Distorting the screen using register 2 of the CRTC (Horizontal Sync Position)]]&lt;br /&gt;
*[[Programming:Fast plot|Fast plot]]&lt;br /&gt;
*[[Programming:Fast Sprites|Fast Sprites]] by [[User:Executioner|Executioner]]&lt;br /&gt;
*[[Programming:Fast Textoutput|Fast Textoutput]] by [[Prodatron]]&lt;br /&gt;
*[[Fastest_Character_Print_in_Mode_2|Fastest Character Print in Mode 2 in all screen positions]] by [[FG Brain]]&lt;br /&gt;
*[[Programming:Hardware scrolling|Hardware Scrolling]] by [[User:Executioner|Executioner]]&lt;br /&gt;
*[[Programming:Hardware scrolling 2|Hardware Scrolling 2]]&lt;br /&gt;
*[[Programming:Hardware scrolling the screen horizontally byte-by-byte using the CRTC|Hardware scrolling the screen horizontally byte-by-byte using the CRTC]]&lt;br /&gt;
*[[Programming:Hardware scrolling the screen using the CRTC|Hardware scrolling the screen using the CRTC]]&lt;br /&gt;
*[[Programming:Next / previous line calculation|Next / previous line calculation]]&lt;br /&gt;
*[[Programming:Overscan|Overscan]]&lt;br /&gt;
*[[Programming:Plotting a sprite using character matrices|Plotting a sprite using character matrices]]&lt;br /&gt;
*[[Mode 4 (two bitplane emulation)| 4th Mode of CPCs: Plotting sprites on 2 bitplanes]]&lt;br /&gt;
*[[Screen refresh rate|Set the screen refresh rate]]&lt;br /&gt;
*[[Programming:Simple Raster Example 1|Simple Raster Example]]&lt;br /&gt;
*[[Programming:Simple Split Raster Example 1|Simple Split Raster Example]]&lt;br /&gt;
*[[Synchronising with the CRTC and display]]&lt;br /&gt;
*[[CRTC change colour (fill) test with precise timing]] by [[User:Matahari|Matahari]]&lt;br /&gt;
*[[256 byte Overscan MEGATEXT Intro - (features 50Hz fullscreen scroll)]] by [[User:Matahari|Matahari]]&lt;br /&gt;
*[[Programming the V9990: Learning by disassembling the &amp;quot;Robot&amp;quot; demo]]&lt;br /&gt;
&lt;br /&gt;
== Interrupts ==&lt;br /&gt;
* [[Reliable use of interrupt mode 2 on the CPC]]&lt;br /&gt;
&lt;br /&gt;
== Keyboard ==&lt;br /&gt;
*[[Programming:Keyboard scanning|Keyboard scanning]]&lt;br /&gt;
*[[Programming:Keyboard_redefinition|Keyboard redefinition]]&lt;br /&gt;
&lt;br /&gt;
== Cartridges ==&lt;br /&gt;
*[[Programming:Cartridges|Cartridges]]&lt;br /&gt;
*[[Programming:Crt0Cart|CRT0 for SDCC]] to init a CPR cart&lt;br /&gt;
&lt;br /&gt;
== Other routines ==&lt;br /&gt;
*[[Programming:An example boot sector (executed with rsx command CPM)|An example boot sector (executed with rsx command CPM)]]&lt;br /&gt;
*[[Programming:An example to define a RSX|An example to define a RSX]]&lt;br /&gt;
*[[Programming:Calling a RSX from outside of BASIC|Calling a RSX from outside of BASIC]]&lt;br /&gt;
*[[Programming:Dumping the data of BASIC or AMSDOS or an expansion rom|Dumping the data of BASIC or AMSDOS or an expansion rom]]&lt;br /&gt;
*[[Programming:Dumping the data of the lower rom|Dumping the data of the lower rom]]&lt;br /&gt;
*[[Programming:Storing and Retrieving Screens from the extra 64kb|Storing and Retrieving Screens from the extra 64kb]]&lt;br /&gt;
&lt;br /&gt;
== Sound ==&lt;br /&gt;
*[[How to access the PSG via PPI]]&lt;br /&gt;
*[[Programming:Tutorial - Understanding the fundamentals of BASIC SOUND and the Firmware SOUND QUEUE|Tutorial - Understanding the fundamentals of BASIC SOUND and the Firmware SOUND QUEUE]]&lt;br /&gt;
*[[Programming:Source code to show 0x0ff is always returned when reading PSG port B|Source code to show 0x0ff is always returned when reading PSG port B]]&lt;br /&gt;
*[[Programming:Source code to show it is possible to store data in PSG register 14 and 15 (port A and port B)|Source code to show it is possible to store data in PSG register 14 and 15 (port A and port B)]]&lt;br /&gt;
*[[Programming:Source code to show it is possible to store data in PSG register 14 and 15 even if the port has been set to input|Source code to show it is possible to store data in PSG register 14 and 15 even if the port has been set to input]]&lt;br /&gt;
*[[Programming:Source code to show that some registers always return 0 in some bits|Source code to show that some registers always return 0 in some bits]]&lt;br /&gt;
*[[Programming:Source code to show that when a port is read in output mode; the data read will be ANDed with the inputs to that port|Source code to show that when a port is read in output mode; the data read will be ANDed with the inputs to that port]]&lt;br /&gt;
&lt;br /&gt;
== Cross Development ==&lt;br /&gt;
*[[Programming:Cross Development|Cross Development]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Source code]]&lt;br /&gt;
&lt;br /&gt;
== General Notes ==&lt;br /&gt;
&lt;br /&gt;
* Memory range for programs is &amp;amp;0040-&amp;amp;a700. This avoids firmware and memory allocated by AMSDOS disc ROM.&lt;br /&gt;
This is safe for the purpose of loading and being compatible with the firmware.&lt;br /&gt;
After loading, if you disable the firmware, you can re-use the firmware areas as you want, but you need to do everything yourself (scanning keyboard, drawing, sound etc).If you need to use these areas, a common thing to do is to load most into the safe area, some into the screen, and relocate it after loading.&lt;br /&gt;
* Programs on cassette and disc have a header that define the load address, length and execution address.&lt;br /&gt;
&lt;br /&gt;
In Pasmo assembler use the &amp;quot;end&amp;quot; mnemonic to define the label which is the execution address and use &amp;quot;--amsdos&amp;quot; to put an AMSDOS header on it.&lt;br /&gt;
&lt;br /&gt;
* Basic programs start at &amp;amp;170.&lt;br /&gt;
* Firmware uses interrupt mode 1 of the Z80 (interrupts jump to &amp;amp;0038)&lt;br /&gt;
* Lowest place you can LOAD a binary file to with BASIC is &amp;amp;389 e.g.:&lt;br /&gt;
&lt;br /&gt;
 openout&amp;quot;d&amp;quot;&lt;br /&gt;
 memory &amp;lt;address&amp;gt;-1&lt;br /&gt;
 closeout&lt;br /&gt;
 load &amp;quot;code&amp;quot;,&amp;lt;address&amp;gt;&lt;br /&gt;
 call &amp;lt;exec&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Screen is normally at &amp;amp;c000-&amp;amp;ffff. (It can be changed using firmware, or using CRTC R12/R13)&lt;br /&gt;
*Stack is normally at &amp;amp;c000 and goes down.&lt;br /&gt;
*Extra registers (BC&#039;, AF&#039;, HL&#039;, DE&#039; are reserved by the firmware). Avoid if you are using firmware functions.&lt;br /&gt;
*Lower rom (containing OS) can be paged into memory between &amp;amp;0000-&amp;amp;3fff.&lt;br /&gt;
*Upper rom is selectable, examples are BASIC and AMSDOS. They can be paged into memory between &amp;amp;c000-&amp;amp;ffff.&lt;br /&gt;
*From basic, a game is run with:&lt;br /&gt;
&lt;br /&gt;
 RUN&amp;quot;&amp;lt;filename&amp;gt;&lt;br /&gt;
&lt;br /&gt;
keep it in the safe memory ranges and it&#039;ll run from cassette and disc.&lt;br /&gt;
*Screen is normally 40 crtc chars wide (CRTC R1=40), 25 crtc chars tall (CRTC R6=25). 8 scan lines per char (R9=7). Firmware functions assume this.&lt;br /&gt;
*Screen is bitmapped. You must draw/erase your own sprites and text.&lt;br /&gt;
*Firmware refreshes the palette every 50th of a second, so you need to turn off the firmware and use the hardware directly, or set the colours using firmware.&lt;br /&gt;
*Firmware can be &amp;quot;turned off&amp;quot;, by disabling lower ROM, redirecting interrupts and not calling firmware functions.&lt;br /&gt;
*Screen can be resized the same as the Spectrum. Provided you do not use hardware scrolling, this gives you extra space although because of the layout of the screen, it&#039;s not continuous, it&#039;s in 8 seperate blocks, but it&#039;s enough to store data and code.&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Source_Codes&amp;diff=9180</id>
		<title>Source Codes</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Source_Codes&amp;diff=9180"/>
		<updated>2023-03-24T14:32:00Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Programming]]&lt;br /&gt;
&#039;&#039;This article contains source codes and programming examples. You may also have a look at&#039;&#039;&lt;br /&gt;
* [[Programming software]]&lt;br /&gt;
* [[BIOS Functions]]&lt;br /&gt;
* [[Technical documentation]]s&lt;br /&gt;
* [[Locomotive BASIC]]&lt;br /&gt;
* [[Type Ins]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Assembler ==&lt;br /&gt;
*[[Z80_-_undocumented_opcodes|Z80 - undocumented opcodes]]&lt;br /&gt;
*[[Where to learn?]]&lt;br /&gt;
*[[A little optimization for Z80 Assembler]]&lt;br /&gt;
&lt;br /&gt;
== Algorithms ==&lt;br /&gt;
*[[Programming:Bubble sort|Bubble sort]]&lt;br /&gt;
*[[Programming:CPC OS floating point routines|CPC OS floating point routines]]&lt;br /&gt;
*[[Programming:CRC16|CRC16]]&lt;br /&gt;
*[[Programming:CRC32|CRC32]]&lt;br /&gt;
*[[Programming:Integer Division|Integer Division]]&lt;br /&gt;
*[[Programming:Integer Multiplication|Integer Multiplication]]&lt;br /&gt;
*[[Programming:Logarithm|Logarithm]]&lt;br /&gt;
*[[Programming:Ultrafast Multiplication|Ultrafast Multiplication]] by [[Prodatron]]&lt;br /&gt;
*[[Programming:Fast Square Root|Fast Square Root]]&lt;br /&gt;
*[[Programming:Fast 16 bit Square Root|Fast 16 bit Square Root]] by [[User:Executioner|Executioner]]&lt;br /&gt;
*[[Programming:Filling memory with a byte|Filling memory with a byte]]&lt;br /&gt;
*[[Programming:Square Root|Square Root]]&lt;br /&gt;
*[[Programming:Precalculated square|Precalculated square]]&lt;br /&gt;
*[[Programming:Maze generation|Maze generation]]&lt;br /&gt;
*[[Programming:Random Number Generator|Random Number Generator]]&lt;br /&gt;
*[[Programming:Reverse A|Reverse A]]&lt;br /&gt;
*[[Programming:Quicksort|Quicksort]]&lt;br /&gt;
*[[Programming:Sin/Cos calculation|Sin/Cos calculation]]&lt;br /&gt;
&lt;br /&gt;
== CP/M ==&lt;br /&gt;
*[[Programming:A simple &#039;Hello World&#039; program for CP/M using BDOS|A simple &#039;Hello World&#039; program for CP/M using BDOS]]&lt;br /&gt;
*[[Programming:A simple &#039;Hello World&#039; program for CP/M using BIOS|A simple &#039;Hello World&#039; program for CP/M using BIOS]]&lt;br /&gt;
*[[Programming:Executing firmware functions from within CP/M 2.1|Executing firmware functions from within CP/M 2.1]]&lt;br /&gt;
*[[Programming:Executing firmware functions from within CP/M 2.1 or CP/M plus|Executing firmware functions from within CP/M 2.1 or CP/M plus]]&lt;br /&gt;
*[[Programming:Executing firmware functions from within CP/M 2.1|Executing firmware functions from within CP/M 2.1]]&lt;br /&gt;
*[[Programming:Executing firmware functions from within CP/M plus|Executing firmware functions from within CP/M plus]]&lt;br /&gt;
&lt;br /&gt;
== CPC Plus ==&lt;br /&gt;
*[[Amstrad CPC plus sprite format]]&lt;br /&gt;
*[[Programming:Convert CPC sprites to Plus hardware sprites|Convert CPC sprites to Plus hardware sprites]]&lt;br /&gt;
*[[Sprites Multiplexing]]&lt;br /&gt;
*[[Programming:CPC Plus Hardware Sprites|Hardware sprites]]&lt;br /&gt;
*[[Programming:CPC Plus Horizontal scroll|Horizontal scroll]]&lt;br /&gt;
*[[Programming:CPC Plus RLE Hardware Sprites|RLE hardware sprites]]&lt;br /&gt;
*[[Programming:CPC Plus Screen Splitting|Screen splitting]]&lt;br /&gt;
*[[Programming:CPC Plus Vertical scroll|Vertical scroll]]&lt;br /&gt;
*[[Operation of Z80 interrupt mode 0 in the CPC plus design]]&lt;br /&gt;
*[[Programming:Simple Raster Example 2 (uses CPC plus features)|Simple Raster Example 1 (uses CPC plus features)]]&lt;br /&gt;
*[[Programming:Simple Raster Example 3 (uses CPC plus features)|Simple Raster Example 2 (uses CPC plus features)]]&lt;br /&gt;
*[[Programming:Unlocking ASIC|Unlocking ASIC]]&lt;br /&gt;
&lt;br /&gt;
== Devices ==&lt;br /&gt;
*[[Programming:CPC Booster|CPC Booster]]&lt;br /&gt;
*[[Programming:Digiblaster|Digiblaster]]&lt;br /&gt;
*[[Programming:Program to save the ROM of the Multiface 2|Program to save the ROM of the Multiface 2]]&lt;br /&gt;
*[[Programming:SYMBiFACE II|SYMBiFACE II]]&lt;br /&gt;
&lt;br /&gt;
== File access ==&lt;br /&gt;
*[[Programming:An example to read a file byte-by-byte|An example to read a file byte-by-byte]]&lt;br /&gt;
*[[Programming:An example to write a file byte-by-byte|An example to write a file byte-by-byte]]&lt;br /&gt;
*[[Programming:Read/Write a file quickly byte-by-byte|Read or write a file quickly byte-by-byte]]&lt;br /&gt;
*[[Programming:A simple file copier using firmware functions (copies byte-by-byte)|A simple file copier using firmware functions (copies byte-by-byte)]]&lt;br /&gt;
*[[Programming:Loading a file|Loading a file]]&lt;br /&gt;
*[[Programming:Saving a file|Saving a file]]&lt;br /&gt;
*[[Programming:Unlocking a protected basic file|Unlocking a protected basic file]]&lt;br /&gt;
*[[Programming:Undo delete of file|Undo delete of file]]&lt;br /&gt;
&lt;br /&gt;
== Floppy disk ==&lt;br /&gt;
*[[Programming:A simple disc copier using BDOS functions|A simple disc copier using BDOS functions]]&lt;br /&gt;
*[[Programming:A simple disc formatter using BDOS functions|A simple disc formatter using BDOS functions]]&lt;br /&gt;
*[[Programming:An example loader|An example loader]]&lt;br /&gt;
*[[Programming:Catalog a disc and retrieve a directory|Catalog a disc and retrieve a directory]]&lt;br /&gt;
*[[Programming:Detecting an Amstrad or Vortex disc controler|Detecting an Amstrad or Vortex disc controler]]&lt;br /&gt;
*[[Programming:Formatting a track on a disc|Formatting a track on a disc]]&lt;br /&gt;
*[[Programming:Reading a sector from a disc|Reading a sector from a disc]]&lt;br /&gt;
*[[Programming:Reading and writing the boot sector of a SYSTEM/VENDOR disc|Reading and writing the boot sector of a SYSTEM/VENDOR disc]]&lt;br /&gt;
*[[Programming:Writing a sector to disc|Writing a sector to disc]]&lt;br /&gt;
&lt;br /&gt;
== Games ==&lt;br /&gt;
*[[Programming:Coding a simple BASIC game into Assembly]]&lt;br /&gt;
&lt;br /&gt;
== Graphics ==&lt;br /&gt;
&lt;br /&gt;
*[[Programming:Calculating xpos,ypos to screen address in assembly|Calculating xpos,ypos to screen address]]&lt;br /&gt;
*[[Programming:Display a 8-bit number in binary|Display a 8-bit number in binary]]&lt;br /&gt;
*[[Programming:Display a 8-bit number in hex|Display a 8-bit number in hex]]&lt;br /&gt;
*[[Programming:Display a byte as a 3-digit decimal number|Display a byte as a 3-digit decimal number]]&lt;br /&gt;
*[[Programming:Display and update Scores|Display and update Scores]]&lt;br /&gt;
*[[Programming:Distorting the screen using register 2 of the CRTC (Horizontal Sync Position)|Distorting the screen using register 2 of the CRTC (Horizontal Sync Position)]]&lt;br /&gt;
*[[Programming:Fast plot|Fast plot]]&lt;br /&gt;
*[[Programming:Fast Sprites|Fast Sprites]] by [[User:Executioner|Executioner]]&lt;br /&gt;
*[[Programming:Fast Textoutput|Fast Textoutput]] by [[Prodatron]]&lt;br /&gt;
*[[Fastest_Character_Print_in_Mode_2|Fastest Character Print in Mode 2 in all screen positions]] by [[FG Brain]]&lt;br /&gt;
*[[Programming:Hardware scrolling|Hardware Scrolling]] by [[User:Executioner|Executioner]]&lt;br /&gt;
*[[Programming:Hardware scrolling 2|Hardware Scrolling 2]]&lt;br /&gt;
*[[Programming:Hardware scrolling the screen horizontally byte-by-byte using the CRTC|Hardware scrolling the screen horizontally byte-by-byte using the CRTC]]&lt;br /&gt;
*[[Programming:Hardware scrolling the screen using the CRTC|Hardware scrolling the screen using the CRTC]]&lt;br /&gt;
*[[Programming:Next / previous line calculation|Next / previous line calculation]]&lt;br /&gt;
*[[Programming:Overscan|Overscan]]&lt;br /&gt;
*[[Programming:Plotting a sprite using character matrices|Plotting a sprite using character matrices]]&lt;br /&gt;
*[[Mode 4 (two bitplane emulation)| 4th Mode of CPCs: Plotting sprites on 2 bitplanes]]&lt;br /&gt;
*[[Screen refresh rate|Set the screen refresh rate]]&lt;br /&gt;
*[[Programming:Simple Raster Example 1|Simple Raster Example]]&lt;br /&gt;
*[[Programming:Simple Split Raster Example 1|Simple Split Raster Example]]&lt;br /&gt;
*[[Synchronising with the CRTC and display]]&lt;br /&gt;
*[[CRTC change colour (fill) test with precise timing]] by [[User:Matahari|Matahari]]&lt;br /&gt;
*[[256 byte Overscan MEGATEXT Intro - (features 50Hz fullscreen scroll)]] by [[User:Matahari|Matahari]]&lt;br /&gt;
*[[Programming the V9990: 1. Learning by disassembling the &amp;quot;Robot&amp;quot; demo]]&lt;br /&gt;
&lt;br /&gt;
== Interrupts ==&lt;br /&gt;
* [[Reliable use of interrupt mode 2 on the CPC]]&lt;br /&gt;
&lt;br /&gt;
== Keyboard ==&lt;br /&gt;
*[[Programming:Keyboard scanning|Keyboard scanning]]&lt;br /&gt;
*[[Programming:Keyboard_redefinition|Keyboard redefinition]]&lt;br /&gt;
&lt;br /&gt;
== Cartridges ==&lt;br /&gt;
*[[Programming:Cartridges|Cartridges]]&lt;br /&gt;
*[[Programming:Crt0Cart|CRT0 for SDCC]] to init a CPR cart&lt;br /&gt;
&lt;br /&gt;
== Other routines ==&lt;br /&gt;
*[[Programming:An example boot sector (executed with rsx command CPM)|An example boot sector (executed with rsx command CPM)]]&lt;br /&gt;
*[[Programming:An example to define a RSX|An example to define a RSX]]&lt;br /&gt;
*[[Programming:Calling a RSX from outside of BASIC|Calling a RSX from outside of BASIC]]&lt;br /&gt;
*[[Programming:Dumping the data of BASIC or AMSDOS or an expansion rom|Dumping the data of BASIC or AMSDOS or an expansion rom]]&lt;br /&gt;
*[[Programming:Dumping the data of the lower rom|Dumping the data of the lower rom]]&lt;br /&gt;
*[[Programming:Storing and Retrieving Screens from the extra 64kb|Storing and Retrieving Screens from the extra 64kb]]&lt;br /&gt;
&lt;br /&gt;
== Sound ==&lt;br /&gt;
*[[How to access the PSG via PPI]]&lt;br /&gt;
*[[Programming:Tutorial - Understanding the fundamentals of BASIC SOUND and the Firmware SOUND QUEUE|Tutorial - Understanding the fundamentals of BASIC SOUND and the Firmware SOUND QUEUE]]&lt;br /&gt;
*[[Programming:Source code to show 0x0ff is always returned when reading PSG port B|Source code to show 0x0ff is always returned when reading PSG port B]]&lt;br /&gt;
*[[Programming:Source code to show it is possible to store data in PSG register 14 and 15 (port A and port B)|Source code to show it is possible to store data in PSG register 14 and 15 (port A and port B)]]&lt;br /&gt;
*[[Programming:Source code to show it is possible to store data in PSG register 14 and 15 even if the port has been set to input|Source code to show it is possible to store data in PSG register 14 and 15 even if the port has been set to input]]&lt;br /&gt;
*[[Programming:Source code to show that some registers always return 0 in some bits|Source code to show that some registers always return 0 in some bits]]&lt;br /&gt;
*[[Programming:Source code to show that when a port is read in output mode; the data read will be ANDed with the inputs to that port|Source code to show that when a port is read in output mode; the data read will be ANDed with the inputs to that port]]&lt;br /&gt;
&lt;br /&gt;
== Cross Development ==&lt;br /&gt;
*[[Programming:Cross Development|Cross Development]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Source code]]&lt;br /&gt;
&lt;br /&gt;
== General Notes ==&lt;br /&gt;
&lt;br /&gt;
* Memory range for programs is &amp;amp;0040-&amp;amp;a700. This avoids firmware and memory allocated by AMSDOS disc ROM.&lt;br /&gt;
This is safe for the purpose of loading and being compatible with the firmware.&lt;br /&gt;
After loading, if you disable the firmware, you can re-use the firmware areas as you want, but you need to do everything yourself (scanning keyboard, drawing, sound etc).If you need to use these areas, a common thing to do is to load most into the safe area, some into the screen, and relocate it after loading.&lt;br /&gt;
* Programs on cassette and disc have a header that define the load address, length and execution address.&lt;br /&gt;
&lt;br /&gt;
In Pasmo assembler use the &amp;quot;end&amp;quot; mnemonic to define the label which is the execution address and use &amp;quot;--amsdos&amp;quot; to put an AMSDOS header on it.&lt;br /&gt;
&lt;br /&gt;
* Basic programs start at &amp;amp;170.&lt;br /&gt;
* Firmware uses interrupt mode 1 of the Z80 (interrupts jump to &amp;amp;0038)&lt;br /&gt;
* Lowest place you can LOAD a binary file to with BASIC is &amp;amp;389 e.g.:&lt;br /&gt;
&lt;br /&gt;
 openout&amp;quot;d&amp;quot;&lt;br /&gt;
 memory &amp;lt;address&amp;gt;-1&lt;br /&gt;
 closeout&lt;br /&gt;
 load &amp;quot;code&amp;quot;,&amp;lt;address&amp;gt;&lt;br /&gt;
 call &amp;lt;exec&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Screen is normally at &amp;amp;c000-&amp;amp;ffff. (It can be changed using firmware, or using CRTC R12/R13)&lt;br /&gt;
*Stack is normally at &amp;amp;c000 and goes down.&lt;br /&gt;
*Extra registers (BC&#039;, AF&#039;, HL&#039;, DE&#039; are reserved by the firmware). Avoid if you are using firmware functions.&lt;br /&gt;
*Lower rom (containing OS) can be paged into memory between &amp;amp;0000-&amp;amp;3fff.&lt;br /&gt;
*Upper rom is selectable, examples are BASIC and AMSDOS. They can be paged into memory between &amp;amp;c000-&amp;amp;ffff.&lt;br /&gt;
*From basic, a game is run with:&lt;br /&gt;
&lt;br /&gt;
 RUN&amp;quot;&amp;lt;filename&amp;gt;&lt;br /&gt;
&lt;br /&gt;
keep it in the safe memory ranges and it&#039;ll run from cassette and disc.&lt;br /&gt;
*Screen is normally 40 crtc chars wide (CRTC R1=40), 25 crtc chars tall (CRTC R6=25). 8 scan lines per char (R9=7). Firmware functions assume this.&lt;br /&gt;
*Screen is bitmapped. You must draw/erase your own sprites and text.&lt;br /&gt;
*Firmware refreshes the palette every 50th of a second, so you need to turn off the firmware and use the hardware directly, or set the colours using firmware.&lt;br /&gt;
*Firmware can be &amp;quot;turned off&amp;quot;, by disabling lower ROM, redirecting interrupts and not calling firmware functions.&lt;br /&gt;
*Screen can be resized the same as the Spectrum. Provided you do not use hardware scrolling, this gives you extra space although because of the layout of the screen, it&#039;s not continuous, it&#039;s in 8 seperate blocks, but it&#039;s enough to store data and code.&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120908</id>
		<title>Programming the V9990: Learning by disassembling the &quot;Robot&quot; demo</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120908"/>
		<updated>2023-03-24T14:31:08Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;&amp;lt;big&amp;gt;Learning to program the V9990 VDP&amp;lt;/big&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Having a V9990 VDP attached on my CPC and always eager to learn about and program it.&lt;br /&gt;
First steps are reproducing the &amp;quot;Robot&amp;quot; demo which were spread around the net to show little of the capabilities of the VDP V9990 from Yamaha.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;But how does it works?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
.... (tbd)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Demo File:&lt;br /&gt;
For executing extract files on a CPC floppy or upload it on the M4 board and change directory into the DSK container (|CD,&amp;quot;ROBOT.DSK&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Run file &amp;quot;ROBOT.BIN&amp;quot; and wait some time. At least a running robot through a forest will be shown.&lt;br /&gt;
&lt;br /&gt;
You should be able to move (left, right, jump up) the robot via cursor keys and fire a bullet with space.&lt;br /&gt;
&lt;br /&gt;
https://www.cpcwiki.eu/index.php/File:Robot.dsk&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120907</id>
		<title>Programming the V9990: Learning by disassembling the &quot;Robot&quot; demo</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120907"/>
		<updated>2023-03-24T14:31:00Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;&amp;lt;big&amp;gt;Learning to program the V9990 VDP&amp;lt;/big&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Having a V9990 VDP attached on my CPC and always eager to learn about and program it.&lt;br /&gt;
First steps are reproducing the &amp;quot;Robot&amp;quot; demo which were spread around the net to show little of the capabilities of the VDP V9990 from Yamaha.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;But how does it works?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Demo File:&lt;br /&gt;
For executing extract files on a CPC floppy or upload it on the M4 board and change directory into the DSK container (|CD,&amp;quot;ROBOT.DSK&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Run file &amp;quot;ROBOT.BIN&amp;quot; and wait some time. At least a running robot through a forest will be shown.&lt;br /&gt;
&lt;br /&gt;
You should be able to move (left, right, jump up) the robot via cursor keys and fire a bullet with space.&lt;br /&gt;
&lt;br /&gt;
https://www.cpcwiki.eu/index.php/File:Robot.dsk&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120906</id>
		<title>Programming the V9990: Learning by disassembling the &quot;Robot&quot; demo</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120906"/>
		<updated>2023-03-24T14:30:49Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;&amp;lt;big&amp;gt;Learning to program the V9990 VDP&amp;lt;/big&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Having a V9990 VDP attached on my CPC and always eager to learn about and program it.&lt;br /&gt;
First steps are reproducing the &amp;quot;Robot&amp;quot; demo which were spread around the net to show little of the capabilities of the VDP V9990 from Yamaha.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;But how does it works?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Demo File:&lt;br /&gt;
For executing extract files on a CPC floppy or upload it on the M4 board and change directory into the DSK container (|CD,&amp;quot;ROBOT.DSK&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Run file &amp;quot;ROBOT.BIN&amp;quot; and wait some time. At least a running robot through a forest will be shown.&lt;br /&gt;
&lt;br /&gt;
You should be able to move (left, right, jump up) the robot via cursor keys and fire a bullet with space.&lt;br /&gt;
&lt;br /&gt;
https://www.cpcwiki.eu/index.php/File:Robot.dsk&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120905</id>
		<title>Programming the V9990: Learning by disassembling the &quot;Robot&quot; demo</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120905"/>
		<updated>2023-03-24T14:30:08Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;&amp;lt;big&amp;gt;Learning to program the V9990 VDP&amp;lt;/big&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Having a V9990 VDP attached on my CPC and always eager to learn about and program it.&lt;br /&gt;
First steps are reproducing the &amp;quot;Robot&amp;quot; demo which were spread around the net to show little of the capabilities of the VDP V9990 from Yamaha.&lt;br /&gt;
&lt;br /&gt;
Demo File:&lt;br /&gt;
For executing extract files on a CPC floppy or upload it on the M4 board and change directory into the DSK container (|CD,&amp;quot;ROBOT.DSK&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Run file &amp;quot;ROBOT.BIN&amp;quot; and wait some time. At least a running robot through a forest will be shown.&lt;br /&gt;
&lt;br /&gt;
You should be able to move (left, right, jump up) the robot via cursor keys and fire a bullet with space.&lt;br /&gt;
&lt;br /&gt;
https://www.cpcwiki.eu/index.php/File:Robot.dsk&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120904</id>
		<title>Programming the V9990: Learning by disassembling the &quot;Robot&quot; demo</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120904"/>
		<updated>2023-03-24T14:30:00Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;&amp;lt;big&amp;gt;Learning to program the V9990 VDP&amp;lt;/big&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Having a V9990 VDP attached on my CPC and always eager to learn about and program it.&lt;br /&gt;
First steps are reproducing the &amp;quot;Robot&amp;quot; demo which were spread around the net to show little of the capabilities of the VDP V9990 from Yamaha.&lt;br /&gt;
&lt;br /&gt;
Demo File:&lt;br /&gt;
For executing extract files on a CPC floppy or upload it on the M4 board and change directory into the DSK container (|CD,&amp;quot;ROBOT.DSK&amp;quot;).&lt;br /&gt;
Run file &amp;quot;ROBOT.BIN&amp;quot; and wait some time. At least a running robot through a forest will be shown.&lt;br /&gt;
&lt;br /&gt;
You should be able to move (left, right, jump up) the robot via cursor keys and fire a bullet with space.&lt;br /&gt;
&lt;br /&gt;
https://www.cpcwiki.eu/index.php/File:Robot.dsk&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120903</id>
		<title>Programming the V9990: Learning by disassembling the &quot;Robot&quot; demo</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120903"/>
		<updated>2023-03-24T14:29:51Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;&amp;lt;big&amp;gt;Learning to program the V9990 VDP&amp;lt;/big&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Having a V9990 VDP attached on my CPC and always eager to learn about and program it.&lt;br /&gt;
First steps are reproducing the &amp;quot;Robot&amp;quot; demo which were spread around the net to show little of the capabilities of the VDP V9990 from Yamaha.&lt;br /&gt;
&lt;br /&gt;
Demo File:&lt;br /&gt;
For executing extract files on a CPC floppy or upload it on the M4 board and change directory into the DSK container (|CD,&amp;quot;ROBOT.DSK&amp;quot;).&lt;br /&gt;
Run file &amp;quot;ROBOT.BIN&amp;quot; and wait some time. At least a running robot through a forest will be shown.&lt;br /&gt;
&lt;br /&gt;
You should be able to move (left, right, jump up) the robot via cursor keys and fire a bullet with space.&lt;br /&gt;
https://www.cpcwiki.eu/index.php/File:Robot.dsk&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120902</id>
		<title>Programming the V9990: Learning by disassembling the &quot;Robot&quot; demo</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120902"/>
		<updated>2023-03-24T14:29:34Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;&amp;lt;big&amp;gt;Learning to program the V9990 VDP&amp;lt;/big&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Having a V9990 VDP attached on my CPC and always eager to learn about and program it.&lt;br /&gt;
First steps are reproducing the &amp;quot;Robot&amp;quot; demo which were spread around the net to show little of the capabilities of the VDP V9990 from Yamaha.&lt;br /&gt;
&lt;br /&gt;
Demo File:&lt;br /&gt;
For executing extract files on a CPC floppy or upload it on the M4 board and change directory into the DSK container (|CD,&amp;quot;ROBOT.DSK&amp;quot;).&lt;br /&gt;
Run file &amp;quot;ROBOT.BIN&amp;quot; and wait some time.&lt;br /&gt;
At least a running robot through a forest will be shown. &lt;br /&gt;
You should be able to move (left, right, jump up) the robot via cursor keys and fire a bullet with space.&lt;br /&gt;
https://www.cpcwiki.eu/index.php/File:Robot.dsk&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120901</id>
		<title>Programming the V9990: Learning by disassembling the &quot;Robot&quot; demo</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120901"/>
		<updated>2023-03-24T14:29:16Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;&amp;lt;big&amp;gt;Learning to program the V9990 VDP&amp;lt;/big&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Having a V9990 VDP attached on my CPC and always eager to learn about and program it.&lt;br /&gt;
First steps are reproducing the &amp;quot;Robot&amp;quot; demo which were spread around the net to show little of the capabilities of the VDP V9990 from Yamaha.&lt;br /&gt;
&lt;br /&gt;
Demo File:&lt;br /&gt;
For executing extract files on a CPC floppy or upload it on the M4 board and change directory into the DSK container (|CD,&amp;quot;ROBOT.DSK&amp;quot;).&lt;br /&gt;
Run file &amp;quot;ROBOT.BIN&amp;quot; and wait some time. At least a running robot through a forest will be shown. You should be able to move (left, right, jump up) the robot via cursor keys and fire a bullet with space.&lt;br /&gt;
https://www.cpcwiki.eu/index.php/File:Robot.dsk&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120900</id>
		<title>Programming the V9990: Learning by disassembling the &quot;Robot&quot; demo</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120900"/>
		<updated>2023-03-24T14:25:24Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;&amp;lt;big&amp;gt;Learning to program the V9990 VDP&amp;lt;/big&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Having a V9990 VDP attached on my CPC and always eager to learn about and program it.&lt;br /&gt;
First steps are reproducing the &amp;quot;Robot&amp;quot; demo which were spread around the net to show little of the capabilities of the VDP V9990 from Yamaha.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
https://www.cpcwiki.eu/index.php/File:Robot.dsk&lt;br /&gt;
[[File:ROBOT.dsk|thumbnail|Robot Demo Disk]]&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120899</id>
		<title>Programming the V9990: Learning by disassembling the &quot;Robot&quot; demo</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120899"/>
		<updated>2023-03-24T14:24:05Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;&amp;lt;big&amp;gt;Learning to program the V9990 VDP&amp;lt;/big&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Having a V9990 VDP attached on my CPC and always eager to learn about and program it.&lt;br /&gt;
First steps are reproducing the &amp;quot;Robot&amp;quot; demo which were spread around the net to show little of the capabilities of the VDP V9990 from Yamaha.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:ROBOT.dsk|thumbnail|Robot Demo Disk]]&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=File:Robot.dsk&amp;diff=120916</id>
		<title>File:Robot.dsk</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=File:Robot.dsk&amp;diff=120916"/>
		<updated>2023-03-24T14:21:16Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: The Robot Demo Disk for the Amstrad CPC with a V9990 attached.
It&amp;#039;s the advanced version. Just start &amp;quot;robot.bin&amp;quot; file.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Robot Demo Disk for the Amstrad CPC with a V9990 attached.&lt;br /&gt;
It&#039;s the advanced version. Just start &amp;quot;robot.bin&amp;quot; file.&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120898</id>
		<title>Programming the V9990: Learning by disassembling the &quot;Robot&quot; demo</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120898"/>
		<updated>2023-03-24T14:19:59Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Robot.dsk|thumbnail|Robot Demo Disk]]&lt;br /&gt;
Having a V9990 VDP attached on my CPC and always eager to learn about and program it. First steps are reproducing the &amp;quot;Robot&amp;quot; demo which were spread around the net to show little of the capabilities of the VDP V9990 from Yamaha.&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120897</id>
		<title>Programming the V9990: Learning by disassembling the &quot;Robot&quot; demo</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming_the_V9990:_Learning_by_disassembling_the_%22Robot%22_demo&amp;diff=120897"/>
		<updated>2023-03-24T14:18:56Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: Created page with &amp;quot;Having a V9990 VDP attached on my CPC and always eager to learn about and program it. First steps are reproducing the &amp;quot;Robot&amp;quot; demo which were spread around the net to show lit...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Having a V9990 VDP attached on my CPC and always eager to learn about and program it. First steps are reproducing the &amp;quot;Robot&amp;quot; demo which were spread around the net to show little of the capabilities of the VDP V9990 from Yamaha.&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Source_Codes&amp;diff=9179</id>
		<title>Source Codes</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Source_Codes&amp;diff=9179"/>
		<updated>2023-03-24T14:15:01Z</updated>

		<summary type="html">&lt;p&gt;HAL 6128: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Programming]]&lt;br /&gt;
&#039;&#039;This article contains source codes and programming examples. You may also have a look at&#039;&#039;&lt;br /&gt;
* [[Programming software]]&lt;br /&gt;
* [[BIOS Functions]]&lt;br /&gt;
* [[Technical documentation]]s&lt;br /&gt;
* [[Locomotive BASIC]]&lt;br /&gt;
* [[Type Ins]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Assembler ==&lt;br /&gt;
*[[Z80_-_undocumented_opcodes|Z80 - undocumented opcodes]]&lt;br /&gt;
*[[Where to learn?]]&lt;br /&gt;
*[[A little optimization for Z80 Assembler]]&lt;br /&gt;
&lt;br /&gt;
== Algorithms ==&lt;br /&gt;
*[[Programming:Bubble sort|Bubble sort]]&lt;br /&gt;
*[[Programming:CPC OS floating point routines|CPC OS floating point routines]]&lt;br /&gt;
*[[Programming:CRC16|CRC16]]&lt;br /&gt;
*[[Programming:CRC32|CRC32]]&lt;br /&gt;
*[[Programming:Integer Division|Integer Division]]&lt;br /&gt;
*[[Programming:Integer Multiplication|Integer Multiplication]]&lt;br /&gt;
*[[Programming:Logarithm|Logarithm]]&lt;br /&gt;
*[[Programming:Ultrafast Multiplication|Ultrafast Multiplication]] by [[Prodatron]]&lt;br /&gt;
*[[Programming:Fast Square Root|Fast Square Root]]&lt;br /&gt;
*[[Programming:Fast 16 bit Square Root|Fast 16 bit Square Root]] by [[User:Executioner|Executioner]]&lt;br /&gt;
*[[Programming:Filling memory with a byte|Filling memory with a byte]]&lt;br /&gt;
*[[Programming:Square Root|Square Root]]&lt;br /&gt;
*[[Programming:Precalculated square|Precalculated square]]&lt;br /&gt;
*[[Programming:Maze generation|Maze generation]]&lt;br /&gt;
*[[Programming:Random Number Generator|Random Number Generator]]&lt;br /&gt;
*[[Programming:Reverse A|Reverse A]]&lt;br /&gt;
*[[Programming:Quicksort|Quicksort]]&lt;br /&gt;
*[[Programming:Sin/Cos calculation|Sin/Cos calculation]]&lt;br /&gt;
&lt;br /&gt;
== CP/M ==&lt;br /&gt;
*[[Programming:A simple &#039;Hello World&#039; program for CP/M using BDOS|A simple &#039;Hello World&#039; program for CP/M using BDOS]]&lt;br /&gt;
*[[Programming:A simple &#039;Hello World&#039; program for CP/M using BIOS|A simple &#039;Hello World&#039; program for CP/M using BIOS]]&lt;br /&gt;
*[[Programming:Executing firmware functions from within CP/M 2.1|Executing firmware functions from within CP/M 2.1]]&lt;br /&gt;
*[[Programming:Executing firmware functions from within CP/M 2.1 or CP/M plus|Executing firmware functions from within CP/M 2.1 or CP/M plus]]&lt;br /&gt;
*[[Programming:Executing firmware functions from within CP/M 2.1|Executing firmware functions from within CP/M 2.1]]&lt;br /&gt;
*[[Programming:Executing firmware functions from within CP/M plus|Executing firmware functions from within CP/M plus]]&lt;br /&gt;
&lt;br /&gt;
== CPC Plus ==&lt;br /&gt;
*[[Amstrad CPC plus sprite format]]&lt;br /&gt;
*[[Programming:Convert CPC sprites to Plus hardware sprites|Convert CPC sprites to Plus hardware sprites]]&lt;br /&gt;
*[[Sprites Multiplexing]]&lt;br /&gt;
*[[Programming:CPC Plus Hardware Sprites|Hardware sprites]]&lt;br /&gt;
*[[Programming:CPC Plus Horizontal scroll|Horizontal scroll]]&lt;br /&gt;
*[[Programming:CPC Plus RLE Hardware Sprites|RLE hardware sprites]]&lt;br /&gt;
*[[Programming:CPC Plus Screen Splitting|Screen splitting]]&lt;br /&gt;
*[[Programming:CPC Plus Vertical scroll|Vertical scroll]]&lt;br /&gt;
*[[Operation of Z80 interrupt mode 0 in the CPC plus design]]&lt;br /&gt;
*[[Programming:Simple Raster Example 2 (uses CPC plus features)|Simple Raster Example 1 (uses CPC plus features)]]&lt;br /&gt;
*[[Programming:Simple Raster Example 3 (uses CPC plus features)|Simple Raster Example 2 (uses CPC plus features)]]&lt;br /&gt;
*[[Programming:Unlocking ASIC|Unlocking ASIC]]&lt;br /&gt;
&lt;br /&gt;
== Devices ==&lt;br /&gt;
*[[Programming:CPC Booster|CPC Booster]]&lt;br /&gt;
*[[Programming:Digiblaster|Digiblaster]]&lt;br /&gt;
*[[Programming:Program to save the ROM of the Multiface 2|Program to save the ROM of the Multiface 2]]&lt;br /&gt;
*[[Programming:SYMBiFACE II|SYMBiFACE II]]&lt;br /&gt;
&lt;br /&gt;
== File access ==&lt;br /&gt;
*[[Programming:An example to read a file byte-by-byte|An example to read a file byte-by-byte]]&lt;br /&gt;
*[[Programming:An example to write a file byte-by-byte|An example to write a file byte-by-byte]]&lt;br /&gt;
*[[Programming:Read/Write a file quickly byte-by-byte|Read or write a file quickly byte-by-byte]]&lt;br /&gt;
*[[Programming:A simple file copier using firmware functions (copies byte-by-byte)|A simple file copier using firmware functions (copies byte-by-byte)]]&lt;br /&gt;
*[[Programming:Loading a file|Loading a file]]&lt;br /&gt;
*[[Programming:Saving a file|Saving a file]]&lt;br /&gt;
*[[Programming:Unlocking a protected basic file|Unlocking a protected basic file]]&lt;br /&gt;
*[[Programming:Undo delete of file|Undo delete of file]]&lt;br /&gt;
&lt;br /&gt;
== Floppy disk ==&lt;br /&gt;
*[[Programming:A simple disc copier using BDOS functions|A simple disc copier using BDOS functions]]&lt;br /&gt;
*[[Programming:A simple disc formatter using BDOS functions|A simple disc formatter using BDOS functions]]&lt;br /&gt;
*[[Programming:An example loader|An example loader]]&lt;br /&gt;
*[[Programming:Catalog a disc and retrieve a directory|Catalog a disc and retrieve a directory]]&lt;br /&gt;
*[[Programming:Detecting an Amstrad or Vortex disc controler|Detecting an Amstrad or Vortex disc controler]]&lt;br /&gt;
*[[Programming:Formatting a track on a disc|Formatting a track on a disc]]&lt;br /&gt;
*[[Programming:Reading a sector from a disc|Reading a sector from a disc]]&lt;br /&gt;
*[[Programming:Reading and writing the boot sector of a SYSTEM/VENDOR disc|Reading and writing the boot sector of a SYSTEM/VENDOR disc]]&lt;br /&gt;
*[[Programming:Writing a sector to disc|Writing a sector to disc]]&lt;br /&gt;
&lt;br /&gt;
== Games ==&lt;br /&gt;
*[[Programming:Coding a simple BASIC game into Assembly]]&lt;br /&gt;
&lt;br /&gt;
== Graphics ==&lt;br /&gt;
&lt;br /&gt;
*[[Programming:Calculating xpos,ypos to screen address in assembly|Calculating xpos,ypos to screen address]]&lt;br /&gt;
*[[Programming:Display a 8-bit number in binary|Display a 8-bit number in binary]]&lt;br /&gt;
*[[Programming:Display a 8-bit number in hex|Display a 8-bit number in hex]]&lt;br /&gt;
*[[Programming:Display a byte as a 3-digit decimal number|Display a byte as a 3-digit decimal number]]&lt;br /&gt;
*[[Programming:Display and update Scores|Display and update Scores]]&lt;br /&gt;
*[[Programming:Distorting the screen using register 2 of the CRTC (Horizontal Sync Position)|Distorting the screen using register 2 of the CRTC (Horizontal Sync Position)]]&lt;br /&gt;
*[[Programming:Fast plot|Fast plot]]&lt;br /&gt;
*[[Programming:Fast Sprites|Fast Sprites]] by [[User:Executioner|Executioner]]&lt;br /&gt;
*[[Programming:Fast Textoutput|Fast Textoutput]] by [[Prodatron]]&lt;br /&gt;
*[[Fastest_Character_Print_in_Mode_2|Fastest Character Print in Mode 2 in all screen positions]] by [[FG Brain]]&lt;br /&gt;
*[[Programming:Hardware scrolling|Hardware Scrolling]] by [[User:Executioner|Executioner]]&lt;br /&gt;
*[[Programming:Hardware scrolling 2|Hardware Scrolling 2]]&lt;br /&gt;
*[[Programming:Hardware scrolling the screen horizontally byte-by-byte using the CRTC|Hardware scrolling the screen horizontally byte-by-byte using the CRTC]]&lt;br /&gt;
*[[Programming:Hardware scrolling the screen using the CRTC|Hardware scrolling the screen using the CRTC]]&lt;br /&gt;
*[[Programming:Next / previous line calculation|Next / previous line calculation]]&lt;br /&gt;
*[[Programming:Overscan|Overscan]]&lt;br /&gt;
*[[Programming:Plotting a sprite using character matrices|Plotting a sprite using character matrices]]&lt;br /&gt;
*[[Mode 4 (two bitplane emulation)| 4th Mode of CPCs: Plotting sprites on 2 bitplanes]]&lt;br /&gt;
*[[Screen refresh rate|Set the screen refresh rate]]&lt;br /&gt;
*[[Programming:Simple Raster Example 1|Simple Raster Example]]&lt;br /&gt;
*[[Programming:Simple Split Raster Example 1|Simple Split Raster Example]]&lt;br /&gt;
*[[Synchronising with the CRTC and display]]&lt;br /&gt;
*[[CRTC change colour (fill) test with precise timing]] by [[User:Matahari|Matahari]]&lt;br /&gt;
*[[256 byte Overscan MEGATEXT Intro - (features 50Hz fullscreen scroll)]] by [[User:Matahari|Matahari]]&lt;br /&gt;
*[[Programming the V9990: Learning by disassembling the &amp;quot;Robot&amp;quot; demo]]&lt;br /&gt;
&lt;br /&gt;
== Interrupts ==&lt;br /&gt;
* [[Reliable use of interrupt mode 2 on the CPC]]&lt;br /&gt;
&lt;br /&gt;
== Keyboard ==&lt;br /&gt;
*[[Programming:Keyboard scanning|Keyboard scanning]]&lt;br /&gt;
*[[Programming:Keyboard_redefinition|Keyboard redefinition]]&lt;br /&gt;
&lt;br /&gt;
== Cartridges ==&lt;br /&gt;
*[[Programming:Cartridges|Cartridges]]&lt;br /&gt;
*[[Programming:Crt0Cart|CRT0 for SDCC]] to init a CPR cart&lt;br /&gt;
&lt;br /&gt;
== Other routines ==&lt;br /&gt;
*[[Programming:An example boot sector (executed with rsx command CPM)|An example boot sector (executed with rsx command CPM)]]&lt;br /&gt;
*[[Programming:An example to define a RSX|An example to define a RSX]]&lt;br /&gt;
*[[Programming:Calling a RSX from outside of BASIC|Calling a RSX from outside of BASIC]]&lt;br /&gt;
*[[Programming:Dumping the data of BASIC or AMSDOS or an expansion rom|Dumping the data of BASIC or AMSDOS or an expansion rom]]&lt;br /&gt;
*[[Programming:Dumping the data of the lower rom|Dumping the data of the lower rom]]&lt;br /&gt;
*[[Programming:Storing and Retrieving Screens from the extra 64kb|Storing and Retrieving Screens from the extra 64kb]]&lt;br /&gt;
&lt;br /&gt;
== Sound ==&lt;br /&gt;
*[[How to access the PSG via PPI]]&lt;br /&gt;
*[[Programming:Tutorial - Understanding the fundamentals of BASIC SOUND and the Firmware SOUND QUEUE|Tutorial - Understanding the fundamentals of BASIC SOUND and the Firmware SOUND QUEUE]]&lt;br /&gt;
*[[Programming:Source code to show 0x0ff is always returned when reading PSG port B|Source code to show 0x0ff is always returned when reading PSG port B]]&lt;br /&gt;
*[[Programming:Source code to show it is possible to store data in PSG register 14 and 15 (port A and port B)|Source code to show it is possible to store data in PSG register 14 and 15 (port A and port B)]]&lt;br /&gt;
*[[Programming:Source code to show it is possible to store data in PSG register 14 and 15 even if the port has been set to input|Source code to show it is possible to store data in PSG register 14 and 15 even if the port has been set to input]]&lt;br /&gt;
*[[Programming:Source code to show that some registers always return 0 in some bits|Source code to show that some registers always return 0 in some bits]]&lt;br /&gt;
*[[Programming:Source code to show that when a port is read in output mode; the data read will be ANDed with the inputs to that port|Source code to show that when a port is read in output mode; the data read will be ANDed with the inputs to that port]]&lt;br /&gt;
&lt;br /&gt;
== Cross Development ==&lt;br /&gt;
*[[Programming:Cross Development|Cross Development]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Source code]]&lt;br /&gt;
&lt;br /&gt;
== General Notes ==&lt;br /&gt;
&lt;br /&gt;
* Memory range for programs is &amp;amp;0040-&amp;amp;a700. This avoids firmware and memory allocated by AMSDOS disc ROM.&lt;br /&gt;
This is safe for the purpose of loading and being compatible with the firmware.&lt;br /&gt;
After loading, if you disable the firmware, you can re-use the firmware areas as you want, but you need to do everything yourself (scanning keyboard, drawing, sound etc).If you need to use these areas, a common thing to do is to load most into the safe area, some into the screen, and relocate it after loading.&lt;br /&gt;
* Programs on cassette and disc have a header that define the load address, length and execution address.&lt;br /&gt;
&lt;br /&gt;
In Pasmo assembler use the &amp;quot;end&amp;quot; mnemonic to define the label which is the execution address and use &amp;quot;--amsdos&amp;quot; to put an AMSDOS header on it.&lt;br /&gt;
&lt;br /&gt;
* Basic programs start at &amp;amp;170.&lt;br /&gt;
* Firmware uses interrupt mode 1 of the Z80 (interrupts jump to &amp;amp;0038)&lt;br /&gt;
* Lowest place you can LOAD a binary file to with BASIC is &amp;amp;389 e.g.:&lt;br /&gt;
&lt;br /&gt;
 openout&amp;quot;d&amp;quot;&lt;br /&gt;
 memory &amp;lt;address&amp;gt;-1&lt;br /&gt;
 closeout&lt;br /&gt;
 load &amp;quot;code&amp;quot;,&amp;lt;address&amp;gt;&lt;br /&gt;
 call &amp;lt;exec&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Screen is normally at &amp;amp;c000-&amp;amp;ffff. (It can be changed using firmware, or using CRTC R12/R13)&lt;br /&gt;
*Stack is normally at &amp;amp;c000 and goes down.&lt;br /&gt;
*Extra registers (BC&#039;, AF&#039;, HL&#039;, DE&#039; are reserved by the firmware). Avoid if you are using firmware functions.&lt;br /&gt;
*Lower rom (containing OS) can be paged into memory between &amp;amp;0000-&amp;amp;3fff.&lt;br /&gt;
*Upper rom is selectable, examples are BASIC and AMSDOS. They can be paged into memory between &amp;amp;c000-&amp;amp;ffff.&lt;br /&gt;
*From basic, a game is run with:&lt;br /&gt;
&lt;br /&gt;
 RUN&amp;quot;&amp;lt;filename&amp;gt;&lt;br /&gt;
&lt;br /&gt;
keep it in the safe memory ranges and it&#039;ll run from cassette and disc.&lt;br /&gt;
*Screen is normally 40 crtc chars wide (CRTC R1=40), 25 crtc chars tall (CRTC R6=25). 8 scan lines per char (R9=7). Firmware functions assume this.&lt;br /&gt;
*Screen is bitmapped. You must draw/erase your own sprites and text.&lt;br /&gt;
*Firmware refreshes the palette every 50th of a second, so you need to turn off the firmware and use the hardware directly, or set the colours using firmware.&lt;br /&gt;
*Firmware can be &amp;quot;turned off&amp;quot;, by disabling lower ROM, redirecting interrupts and not calling firmware functions.&lt;br /&gt;
*Screen can be resized the same as the Spectrum. Provided you do not use hardware scrolling, this gives you extra space although because of the layout of the screen, it&#039;s not continuous, it&#039;s in 8 seperate blocks, but it&#039;s enough to store data and code.&lt;/div&gt;</summary>
		<author><name>HAL 6128</name></author>
	</entry>
</feed>