                The CPCEMU Amstrad CPC Firmware Guide
                === ====== ======= === ======== =====


           Originally by Bob Taylor and Thomas Defoe, 1992.
            This version scanned by David Cantrell, 1994.
             DSK version by Michael Hayes, year unknown.
                 PDF version by John Kavanagh, 2002.


COPYRIGHT
---------

    Bob Taylor and Thomas Defoe retain  all  rights to the contents of
the Firmware  Manual.   PLEASE  don't  redistribute  any  part of this
package without asking them first.

    This guide was  originally  published  by  Bob  Taylor  and Thomas
Defoe, through their 'Printout' magazine.


FILE LIST
---------

You should have the following files ...


FIRMWA11.DSK ... The  DSK  version   of   the   firmware  manual.  The
FIRMWA12.DSK     conversion was performed by Michael Hayes. To use it,
FIRMWA21.DSK     insert FIRMWA11.DSK in  your Amstrad CPC emulator and
FIRMWA22.DSK     type RUN"DISC". To  view  the  instructions on how to
FIRMWA31.DSK     use this version of the  firmware manual, press the I
FIRMWA32.DSK     key and insert FIRMWA41.DSK.
FIRMWA41.DSK
FIRMWA42.DSK


ASMBHELP.BAS ... Locomotive BASIC program, saved  as ASCII text, which
                 gives brief instructions on how to use the 'Printout'
                 inline assembler.

ASMBLOAD.BAS ... Short (one line) Locomotive BASIC program to load the
                 'Printout' inline assembler.

ASMBCODE.BIN ... Machine code loaded by  ASMBLOAD.BAS.  Note that this
                 is the 464  version.   I've  briefly  tested  it on a
                 6128, without any problems, but  have  not given it a
                 thorough test.


ABOUT THE ASSEMBLER
----- --- ---------

    The  'Printout'  Firmware  Guide  had  a  companion  disk/cassette
available for it, which contained  various utility programs, including
a Z80 assembler.  It  is  much  more  convenient  than many commercial
versions, as the assembly language  instructions  can be included in a
BASIC program (like on Acorn  computers).   A  simple program would go
something like this...

10 IF HIMEM>&7FFF THEN MEMORY &7FFF :' Make room for machine code
20 LOAD"asmbcode.bin",&9000         :' Load machine code
30 CALL &9000                       :' Set up RSXs
40 GOSUB 90                         :' assemble "Hello World!" prog
50 CLS
60 CALL &A000                       :' execute machine code prog
70 END
80 '
90 |ASMBL                           :' assemble following code ...
100 'org &a000                      ; Assemble at &A000
110 '.txtout equ &bb5a              ; BB5A is 'TXT OUTPUT' routine
120 'ld hl,text                     ; point to text
130 '.loop
140 'ld a,(hl)                      ; get character
150 'cp &80                         ; compare with &80 (end of string
160 '                               ; marker)
170 'ret z                          ; exit if >=&80
180 'call txtout                    ; print it
190 'inc hl                         ; point to next character
200 'jr loop                        ; round loop again
210 '.text                          ; text starts here
220 'defb "Hello World!",10,13,&80  ; text, finishing with chr$(&80)
230 'end                            ; end of assembly code
240 RETURN                          :' return to main prog

This is a rather long-winded way of writing...

10 PRINT"Hello World!"

    The assembler is not limited to  trivial examples like this - I've
written  several  much  longer  programs  which  assemble  like  this,
including a FAST Mandelbrot plotter and a Disk Editor.
