MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\C3\B4\C3\C3\C3F\C3\C3\C3\AB\C3\C3C\C3\DE\C3\C3A\C3\C3\B8\CFC\E5\D5\AF\CD\CBCE\CD\CD itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"B\CD itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"A\E8\CD



MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\CD itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"E

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A\CD\C3\FC\CD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
D\E8\CD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
D

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\CD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
D itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"E

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A\CD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
D itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"E itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"\CD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
D\AF\D1\E1\C3\E5\A7\ED\E1\C9E itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"C\A7\EDC\F9\C3C

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
FD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
FF\C9

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
C

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\E5 itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\E5\EB\D6

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\ED\E3\C1\EB\ED\B0\E1 itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"\B6

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
EEEA\C9\CD\BB

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
C\FE\FE

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
E\CD\BB

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\FA\CD\BB

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
D\FE\FF\F8 itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"F\FD\AF\E5\ED\E1\CA\B2 itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"\EF\FC\AF\E5\ED\E1\DD\C8D\CD\BDE\FE

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\C9\CB\FC

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
AC\E6F\B5\C8\CDF\F3AB\EB

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\CB itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"F itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"\EB\EB\F5\C9E

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
B\DA\DCE itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"\CB

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
E\CB

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\CB\F5\CD\EBE\CB\FE\CB

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
F

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\EEFE

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
CA\FA\E1\F1

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
F\A0

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\F1\B0\FE

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\EEFE\DA\DC\E6 itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"FF\C5\C5\C5\AF\CB\CB\CB\C1\C1\EDB

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
C

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
E\C1EAE\C9\D5\E5\C5\F5AA\FE

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A\F1\FE

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A\FE

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
E

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
EADE\FEAAADA

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
EE

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
EE\FE\E6\F8

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
C itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"\F8

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
F\CDF\FB\FE\FEF itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"B\FE

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
BD\B4\FB\CD\CD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A\F1A\C1\E1\D1\C9\CD\D3\B1\C8 itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"A\CD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
B\F5\FE\FE\C0\CB\B7\DA\E6F itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"\FE\AF\CD\CBE\FB\F9E\CBF\CD\F5\E6F\CD\AF\C3

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
D\CFAB\B2\FA\CD\C5C\B2\F1B

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\D5\EB\EBC\EB\F6\EB\EB\AFC itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"FD itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"FF\B4\EB\AF\CB itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"C\CB itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"DC\FA\FEFC\E3\E3\DD\E1\C1\CB\C2 itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"B\C9C\DC itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"B\EBC\A8\CBC\C2 itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"B\C9\EDB

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
E\FDA\B7

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\ED\EDF\ED itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"\CB\BC\C9\C5\CD\A3E

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\C1\EA\C9

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\E5\E5\CD\FE\E1\D1\F5\E5\CD\F0\FE\E1 itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"F\E5\D1F\CD\D6 itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"CF

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\FE

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A\D3\F1E\E6\CD\C7\F1\CC itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"B\C9\C5\E5

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
AB\F5\E5B\CDF\FEE\CD\E1\CD\B4\F1

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
F\CD\B4

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\E1\F1\E1\C1\AF\C9\C9\C9E

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
F\D7\CD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\CD\CD\F7\CD\E5\CD\E1\CD\CD\CD\CD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
D\CFFE\C9\C3B\EDB itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"C\CD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
BD\CD\D4\E5\CD\FE\F2\CC\CB\FE\F9\CC\FE\FA\CC\C8\FE\DE\EA\FE\E9\CC itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"D\FE\EC\CC

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
B\FE\ED\CC\FE\EB\CC\C7\FE\F3\CC\F4\FE\E4\CC

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\FE\F4\CC\B6\FE\E5\CC\F1\FE\EE\CCD\FE\F6\CCC\FE\FC\CC\FE\F1\CC\FE\FB\CCF\FE\E3\CA\FE\F5\CC\FE\EA\FE\E7\CC\A4\FE\FE\CC

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
D\FE

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
E\CD\FE\E1\CD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
E\C2E\B8\CD\CD\CFB\CDDF\C3\A9\E5E\D5\EB\E5

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A\CD\EC\CD\E1\CD itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"B itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"B\EB\D1\CD\EDBB\CD\E5\EDB\A7\ED\E1\E1\C9\C9E\C9\E5\C1

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"C\CD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
E\EB\A7\ED\D0

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A\ED\D8\EB\EDE\C3\F5\CD\CD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A\CD\EB\CD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
E\EB\F1\C3\ABE\CD\E9\E5\E7\FE\FEE\F5\CD\F1\E1\C9\CD\FE\FE

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
B\FE\C1C\FE\D6\CD\CD\A9FE\CDB

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
AB\E5\CDB itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"\FF\FF

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
AE\F5\CD\F1\FE

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
B\CDB\EF\E1\C5E\CD\ABE itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"\E1\CD\ABB\CD\A9\CD\CD\C1D\CD\AE\F5\CD\A9\CD\FE itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"AC\FE\EC\CD\A9

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
B\AF\C9\CDDED\CDB\CD\A9\D6E\C3\FE\D2\C1\D6\EDB

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
F\C9\CD\CD\F1\FE

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A\CD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
AE\E5\CDB\FF\E5\CD\FE\C2\C1\CDD\CD\D3\E1C\FE\FF

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
C\D1\EB\CD\AE\C3\A9E\C3\AB\AF\F5\CDDE\E5\CDB\CD\FE\FEC\F5\CDD\F1\FE\FE\C1\FE

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\F5\E5\D8\E5D\CD\AE\CDEE\E5\CD\AB\C4\F5\C5 itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"C\FE\FE\C2\C1\CD\C6\CD\A9\AC\CD\C6E\F3E\E1\CDB\F1\FE

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\C8\FE\CD\C6\A7\EB\CD\AE\ED\CD\AE\E7\CD\C6E\CDB\DDE\D1\C3B\FE\D3

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
F\CDDEF\CD\AE

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\C3\AE\FE\D4\CDD\EB\C3\A9 itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"\F1\C5\E5\C9D\C9\FE\C4\C2

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
F\CD\FE\C2\C1C\CD\A9E

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
F\C3\AB\FE\C2 itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"A\C3\A9\FE\D2\CDD\CBC\CD\AEE\C4A\C3\AB\FE\CF\C2\C1\C3D\CDD\CD\F5E\E5\CDB\CDDE\D1\CDB\F1\C9\CD\FE\F5\CC\FE\FE

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
D\FE\D4\DCF\F1\CC\C9\CD\CB\F6\CDD\F1A

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
FC

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
FD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
FF\C9\CD\F1\FE\CAFE

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A\C3\AB\CD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
AE\CD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
D\E1\EDBB\C9

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
E\CD\CDBD\CDBC\C3B\CD\CD\C1\EB\ED\FE itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"A\C2\C1\C9\CD\CD\F1\E5\E5\CD\CDE\CDB\ED\CD\AE\E1\CD\AEE\CD\AB\E1\EDBB\CD\C9\CD\CD\F1\E5\E5E

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A\CD\AB\CD\AE\E1\CD\AEE\ED\CDBEB\CD\ABE\A7\ED\CD\ABE\FA\E1\CD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
E\EB\CD\AB\C9

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
F\CD\FEE itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"A\F5

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\CD\F1\FE\D2\C1\FE itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"C\DA\C1\D6 itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"C

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
F\DF\E5

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
\E1\C9\CD\A9\CD\CD\F1\C3EB\F5\CD\CD\C1B\CD\AEEE\CDB\F1\CDBE\CD\AB\C3\A9E\A0\D8E

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A\CD\ABE\C3\AB\FE\DD\FE itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"F itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"\EB\A7\ED\F8\D0\ED\C0\ED\C8F\C9\CD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
EE\CD\AE\A6\CD\A9

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A\CD\EB\CD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
E\EBE\D2\CD\AB\CD\FE\DE\C2\C1\C9\F7\C3\A9\CD\E7

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
B\CB\B6\C9\C3\A9B\CB\F6\C3

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
EA

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
CD\C0A

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
DC\C9\CD\FEF\C2\C1\CDD\AF\C9\CDD\EDB\CD\AE itemtype='https://schema.org/Blog' itemscope='itemscope' class="wp-singular computer_media-template-default single single-computer_media postid-56696 wp-custom-logo wp-embed-responsive wp-theme-astra wp-child-theme-astra-child ast-desktop ast-separate-container ast-left-sidebar astra-4.12.6 group-blog ast-blog-single-style-1 ast-custom-post-type ast-single-post ast-inherit-site-logo-transparent ast-hfb-header ast-full-width-primary-header ast-box-layout ast-normal-title-enabled astra-addon-4.12.4"C\CD\AE\C3\AE\CD

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
AE\D5\CDB

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
E\CD\A9\EB\D1\C3\AE\C3\C3B\C3E\C3\C3\C3\C3A\C3D\C3\A0\EB\C3\A3\C3\A6\C3\A9\C3\AC\C3\AF\AF 2 REM D\E5EEE\D1\A7\ED\EB

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A\EB

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A\EDB\ED\B0\AF\C9\CD\E7

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
B\CB\B6

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
ED\E5

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
AE\E1\E5\C5\CD\A3

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A\C1\D1\ED\B0\AF\C9D

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

MCoder

Products: MCoder
Date: 1982
Type: Cassette
Platform(s): TS 1000

This program is a loader for “MCODER,” a ZX81/TS1000 BASIC-to-machine-code compiler. The bulk of the program is stored as raw Z80 machine code embedded in REM statements at lines 0 and 2, with the compiler entry point at address 18821 (USR 18821). Line 10 uses POKE 16389,118 to place a HALT opcode at a system address, a common technique for controlling program flow or patching the system workspace. After invoking the compiler via USR, the loader displays a title screen and instructs the user to delete all lines except 1–4, leaving only the machine code REMs resident in memory. A simple software delay loop using FOR/NEXT replaces a proper PAUSE call, giving a timed display before clearing the screen.


Program Analysis

Program Structure

The program divides into three logical parts: machine code storage in REM statements (lines 0 and 2), a system initialisation and title display section (lines 10–90), and a post-install instruction screen (lines 100–120), supported by a simple delay subroutine at lines 200–230.

LinesRole
0, 2Raw Z80 machine code stored in REM operand bytes
3–6Human-readable metadata REMs (compiler name, copyright)
9SAVE the machine code to tape
10POKE to patch system workspace
20Invoke compiler via USR 18821
25SLOW mode for stable display
30–80Title screen output
90, 110Delay subroutine calls
100Post-install instruction message
120STOP
200–230Delay loop subroutine (FOR/NEXT + CLS)

Machine Code in REM Statements

Lines 0 and 2 contain dense Z80 binary data encoded as the operand bytes of REM statements. This is the standard technique for embedding machine code in ZX81/TS1000 BASIC: the interpreter skips REM content entirely, but the bytes sit at fixed, calculable addresses in RAM. Line 0 begins at the very start of the BASIC program area, placing the first byte of machine code at a well-known address. The REM at line 2 continues the binary image.

REM line 3 records the compiler name and two key addresses: ZXGT=17389 and PROG=18823, suggesting the compiled machine code image spans from address 17389 onwards, with the BASIC program starting at 18823.

System Initialisation Techniques

Line 10 executes POKE 16389,118. Address 16389 is in the system variables region; decimal 118 is the opcode for Z80 HALT (also the ZX81 NEWLINE/end-of-line token 0x76). This is a known idiom for patching system behaviour or setting a trap, depending on context within the compiler’s own initialisation sequence.

Line 20 calls USR 18821, transferring control to the machine code at that address. The return value is stored in L but is not subsequently used; the call is made purely for its side effects (compiler installation).

Line 25 invokes SLOW mode after the USR call returns, ensuring the subsequent PRINT statements render correctly under the standard one-in-five interrupt display scheme.

Display and Delay Idioms

The title screen uses PRINT AT r,c; with inverse-video character sequences (e.g. %M%C%O%D%E%R) to render highlighted text for the product name “MCODER” and %C %O %M %P %U %T %E %R for “COMPUTER” with spaced inverse letters.

The delay subroutine at lines 200–230 uses a FOR F=1 TO 80 : NEXT F loop followed by CLS. This gives a short timed pause before clearing the screen, a practical substitute for PAUSE when precise timing is not critical.

Post-Install Instruction

Line 100 instructs the user to delete all BASIC lines except lines 1–4. This leaves only the two machine code REM lines (0 and 2) and the metadata REMs (3–6) in memory, forming a clean resident compiler image. The loader itself is designed to be discarded after installation.

Notable Z80 Routines (Selected)

Scanning the machine code bytes in line 0 reveals several structured subroutine clusters. Notable patterns include:

  • Repeated CD xx xx (CALL) sequences suggesting a dispatcher or token interpreter loop, consistent with a BASIC compiler’s keyword-handling architecture.
  • ED 52 (SBC HL,DE) used in arithmetic comparisons throughout.
  • ED B0 (LDIR) block copy instructions, used for moving code or data segments during installation.
  • CB-prefixed bit manipulation instructions indicating flag testing and bitfield operations typical of a tokeniser or expression evaluator.
  • Address constants matching system variable locations (e.g. 0C 40 = 16396, 1C 40 = 16412) confirming direct system variable access.

Authorship and Licensing

REM line 4 records COPYRIGHT 1982 PSS, identifying Professional Software Specialists of Coventry, England as the original authors. REM line 80 confirms the product is distributed by Intercomputer Inc under licence from PSS. The compiler is named MCODER (stylised as MCODER in inverse video), a product known to have been commercially released for the ZX81/TS1000 platform.

Anomalies and Observations

  • The return value of USR 18821 is assigned to L at line 20 but never used; this is harmless and may be a remnant of an earlier diagnostic.
  • The delay loop bound of 80 iterations is quite short and gives only a brief display before CLS; the effect depends on SLOW mode being active (confirmed by line 25).
  • Line 9 saves the program to tape as MCODE before the USR call at line 20, meaning a fresh tape copy is made each time the loader runs — useful for distribution but potentially unintentional in normal use.

Content

Appears On

Related Products

BASIC to machine code compiler.

Related Articles

Related Content

Image Gallery

MCoder

Source Code

   0 REM \BF\BD\AC\B9\76\76\C3\B4\40\C3\23\41\C3\57\41\C3\4F\41\C3\85\41\C3\97\41\C3\AB\41\C3\21\42\C3\9C\42\C3\DE\42\C3\39\43\C3\7A\43\C3\57\43\C3\B8\43\CF\8C\E5\D5\AF\CD\21\42\CB\7C\28\08\3E\16\CD\21\42\CD\1B\41\11\10\27\CD\07\41\30\1A\11\E8\03\CD\07\41\30\15\11\64\00\CD\07\41\30\13\1E\0A\CD\07\41\30\12\C3\FC\40\CD\0D\41\11\E8\03\CD\0D\41\11\64\00\CD\0D\41\1E\0A\CD\0D\41\1E\01\CD\0D\41\AF\D1\E1\C3\21\42\E5\A7\ED\52\E1\C9\3E\1C\A7\ED\52\38\03\3C\18\F9\19\C3\21\42\7C\2F\67\7D\2F\6F\23\C9\2A\0C\40\11\21\00\E5\01\00\00\09\23\E5\19\EB\21\D6\02\ED\42\E3\C1\EB\ED\B0\E1\01\B6\02\09\22\0E\40\3E\21\32\39\40\3E\03\32\3A\40\C9\CD\BB\02\7C\FE\FE\20\0E\CD\BB\02\24\20\FA\CD\BB\02\7D\FE\FF\28\F8\01\7F\FD\AF\E5\ED\42\E1\CA\B2\40\01\EF\FC\AF\E5\ED\42\E1\28\DD\44\24\C8\4D\CD\BD\07\7E\FE\00\C9\CB\FC\22\34\40\2A\34\40\7C\E6\7F\B5\C8\CD\4F\41\28\F3\06\10\4A\7B\EB\21\00\00\CB\39\1F\30\01\19\EB\29\EB\10\F5\C9\3E\2B\90\DA\DC\42\47\3E\01\CB\28\30\02\3E\04\CB\29\30\02\CB\07\F5\CD\EB\41\7E\CB\07\FE\10\30\07\CB\0F\30\02\EE\8F\47\11\9E\0C\3A\30\40\93\FA\E1\41\F1\2F\A0\18\02\F1\B0\FE\08\38\02\EE\8F\18\36\3E\17\90\DA\DC\42\79\E6\1F\4F\C5\C5\C5\AF\CB\10\CB\10\CB\10\68\67\29\29\C1\48\47\09\C1\47\09\ED\4B\0C\40\09\23\22\0E\40\C1\3E\18\90\32\3A\40\3E\21\91\32\39\40\C9\D5\E5\C5\F5\3A\3A\40\FE\02\28\3A\F1\FE\76\28\2A\FE\40\30\72\2A\0E\40\77\23\22\0E\40\3A\39\40\3D\32\39\40\7E\FE\76\20\4A\3A\3A\40\3D\32\3A\40\23\22\0E\40\3E\21\32\39\40\18\38\2A\0E\40\7E\FE\76\28\E6\23\18\F8\2A\0C\40\01\F8\02\09\36\8F\CD\4F\41\28\FB\FE\28\28\15\FE\3F\28\1B\FE\29\20\08\21\10\27\2B\7D\B4\20\FB\CD\23\41\18\03\CD\2A\0A\F1\18\9A\C1\E1\D1\C9\CD\69\08\18\D3\78\B1\C8\1A\CD\21\42\13\0B\18\F5\FE\43\38\09\FE\C0\CB\B7\DA\35\42\E6\3F\21\11\01\47\04\FE\21\30\04\AF\CD\21\42\CB\7E\23\28\FB\10\F9\7E\CB\7F\20\06\CD\21\42\23\18\F5\E6\3F\CD\21\42\AF\C3\2D\42\CF\8A\7B\B2\28\FA\CD\29\43\C5\7C\B2\07\38\F1\4B\42\11\00\00\D5\EB\23\29\EB\29\79\95\78\9C\EB\30\F6\EB\EB\AF\7C\1F\67\7D\1F\6F\B4\28\18\EB\AF\CB\1C\CB\1D\79\95\78\9C\FA\FE\42\79\95\4F\78\9C\47\E3\19\E3\18\DD\E1\C1\CB\78\C2\1B\41\C9\44\7C\17\DC\1B\41\EB\7C\A8\47\CB\7C\C2\1B\41\C9\ED\5B\32\40\63\2E\FD\7A\B7\06\00\ED\52\98\ED\52\98\5F\50\ED\52\30\01\23\22\32\40\CB\BC\C9\03\03\03\C5\03\03\03\03\21\80\49\CD\A3\09\23\3E\76\71\23\36\02\23\C1\71\23\70\23\36\EA\23\77\23\77\23\C9\21\00\00\E5\E5\CD\57\41\FE\16\20\09\E1\D1\F5\E5\CD\21\42\18\F0\FE\76\E1\28\1F\29\E5\29\29\D1\19\4F\CD\21\42\79\D6\1C\38\08\4F\06\00\09\FE\0A\38\D3\F1\3E\E6\CD\21\42\18\C7\F1\CC\1B\41\C9\C5\E5\2A\7B\40\F5\77\E5\23\22\7B\40\CD\4F\41\FE\29\20\12\3E\76\CD\21\42\E1\CD\B4\40\F1\26\00\6F\CD\B4\40\18\02\E1\F1\E1\C1\AF\C9\C9\C9\3E\0F\D7\CD\75\49\18\12\21\00\00\CD\12\44\CD\F7\48\03\CD\78\49\E5\CD\06\49\E1\CD\12\44\CD\59\49\CD\20\44\CD\0D\44\CF\7F\3E\C9\C3\7B\49\22\70\40\ED\5B\1C\40\13\21\72\40\CD\09\45\2A\70\40\36\18\23\36\68\23\22\79\40\11\68\00\19\22\7B\40\21\7D\40\CD\D4\44\23\23\E5\23\22\16\40\CD\44\45\FE\F2\CC\CB\44\FE\F9\CC\96\48\FE\FA\CC\C8\48\FE\DE\28\EA\FE\E9\CC\1D\49\FE\EC\CC\2B\45\FE\ED\CC\40\45\FE\EB\CC\C7\47\FE\F3\CC\F4\47\FE\E4\CC\00\49\FE\F4\CC\B6\47\FE\E5\CC\F1\48\FE\EE\CC\5D\48\FE\F6\CC\6C\48\FE\FC\CC\92\48\FE\F1\CC\03\46\FE\FB\CC\9F\47\FE\E3\CA\96\47\FE\F5\CC\55\45\FE\EA\28\15\FE\E7\CC\A4\47\FE\FE\CC\0D\44\FE\00\20\0E\CD\44\45\FE\76\20\07\E1\CD\0E\49\C2\36\44\3E\B8\CD\68\49\CD\59\49\CF\9B\CD\4D\47\21\5F\49\C3\A9\47\E5\56\23\5E\D5\EB\E5\22\23\40\22\0A\40\CD\EC\45\CD\53\49\E1\CD\13\45\1B\1B\EB\D1\CD\09\45\ED\5B\7B\40\CD\09\45\E5\ED\5B\72\40\A7\ED\52\E1\38\03\22\72\40\E1\C9\73\23\72\23\C9\5E\23\56\23\C9\E5\C1\2A\1C\40\23\CD\0E\45\EB\A7\ED\42\D0\2A\72\40\ED\52\D8\EB\23\18\ED\3E\C3\F5\CD\44\45\CD\2A\48\CD\13\45\EB\CD\0E\45\EB\F1\C3\AB\47\3E\CD\18\E9\E5\E7\FE\76\28\09\FE\7E\28\05\F5\CD\68\49\F1\E1\C9\CD\44\45\FE\76\28\77\FE\0B\28\13\FE\C1\28\4C\FE\D6\28\74\CD\50\47\21\53\49\CD\A9\47\18\4F\3E\18\CD\7B\49\2A\7B\40\E5\CD\7B\49\01\FF\FF\2A\16\40\23\03\7E\F5\CD\68\49\F1\FE\0B\28\05\CD\7B\49\18\EF\22\16\40\E1\C5\71\23\3E\11\CD\AB\47\3E\01\E1\CD\AB\47\21\6B\49\CD\A9\47\18\12\CD\37\47\CD\C1\47\21\43\4D\CD\AE\47\21\F5\08\CD\A9\47\CD\44\45\FE\1A\28\8C\FE\19\28\88\21\EC\45\CD\A9\47\2A\16\40\2B\22\16\40\AF\C9\CD\4D\47\3E\7D\CD\7B\49\21\68\49\CD\A9\47\18\D6\3E\76\C3\68\49\FE\40\D2\C1\44\D6\26\17\17\ED\4B\79\40\26\00\6F\09\C9\CD\44\45\CD\F1\45\FE\64\20\0A\CD\2A\49\3E\E5\CD\7B\49\26\FF\E5\CD\44\45\FE\14\C2\C1\44\CD\3D\46\CD\D3\45\E1\7C\FE\FF\20\0C\21\D1\EB\CD\AE\47\21\09\45\C3\A9\47\3E\22\C3\AB\47\AF\F5\CD\4D\47\3E\E5\CD\7B\49\CD\44\45\FE\11\28\50\FE\76\28\4C\F5\CD\4D\47\F1\FE\15\28\04\FE\16\20\23\C1\67\78\FE\00\20\04\F5\E5\18\D8\E5\21\44\4D\CD\AE\47\CD\7E\46\3E\E5\21\69\60\CD\AB\47\18\C4\F5\C5\18\1C\FE\18\28\10\FE\17\C2\C1\44\CD\C6\46\21\62\49\CD\A9\47\18\AC\CD\C6\46\21\6E\49\18\F3\3E\E1\CD\7B\49\F1\FE\00\C8\FE\15\28\11\CD\C6\46\21\A7\EB\CD\AE\47\21\ED\52\CD\AE\47\18\E7\CD\C6\46\3E\19\CD\7B\49\18\DD\3E\D1\C3\7B\49\FE\D3\20\0F\CD\4D\47\21\7E\6F\CD\AE\47\21\26\00\C3\AE\47\FE\D4\20\12\CD\4D\47\21\EB\46\C3\A9\47\01\F1\46\C5\E5\C9\44\4D\C9\FE\C4\C2\0F\47\CD\44\45\FE\41\C2\C1\44\21\5C\49\CD\A9\47\3E\26\21\00\6F\C3\AB\47\FE\40\C2\1A\47\21\72\49\C3\A9\47\FE\D2\20\11\CD\4D\47\21\CB\7C\CD\AE\47\3E\C4\21\7A\47\C3\AB\47\FE\CF\C2\C1\44\C3\4D\47\CD\4D\47\CD\44\45\F5\3E\E5\CD\7B\49\CD\4D\47\3E\D1\CD\7B\49\F1\C9\CD\44\45\FE\16\F5\CC\44\45\FE\10\28\16\FE\40\30\0D\FE\26\D4\82\47\DC\8F\47\F1\CC\75\47\C9\CD\CB\46\18\F6\CD\3D\46\18\F1\21\7A\47\18\2F\7C\2F\67\7D\2F\6F\23\C9\CD\F1\45\FE\64\CA\3F\49\3E\2A\C3\AB\47\CD\2A\48\3E\21\18\15\CD\0D\44\E1\ED\4B\7B\40\C9\21\2A\0A\18\05\21\56\49\18\00\3E\CD\CD\7B\49\7D\CD\7B\49\7C\C3\7B\49\CD\37\47\CD\C1\47\21\EB\73\18\ED\FE\1A\C2\C1\44\C9\CD\44\45\CD\F1\45\E5\E5\CD\44\45\CD\37\47\3E\23\CD\7B\49\21\ED\53\CD\AE\47\E1\CD\AE\47\3E\22\23\23\CD\AB\47\E1\ED\5B\7B\40\CD\09\45\C9\CD\44\45\CD\F1\45\E5\E5\3E\2A\CD\AB\47\21\23\22\CD\AE\47\E1\CD\AE\47\23\23\3E\ED\CD\7B\49\3E\5B\CD\AB\47\3E\A7\21\ED\52\CD\AB\47\3E\FA\E1\CD\0E\45\EB\CD\AB\47\C9\21\00\00\18\0F\CD\44\45\FE\7E\28\1A\F5\11\0A\00\CD\62\49\F1\FE\26\D2\C1\44\FE\1C\DA\C1\44\D6\1C\06\00\4F\09\18\DF\E5\2A\16\40\11\05\00\19\22\16\40\E1\C9\21\75\49\CD\A9\47\CD\44\45\CD\F1\45\C3\38\46\3E\9B\F5\CD\37\47\CD\C1\47\21\4B\45\CD\AE\47\3E\3E\CD\7B\49\F1\CD\7B\49\3E\32\21\30\40\CD\AB\47\21\65\49\C3\A9\47\3E\A0\18\D8\3E\2A\21\34\40\CD\AB\47\3E\22\21\32\40\C3\AB\47\FE\DD\28\12\FE\14\28\14\1F\30\01\EB\17\A7\ED\52\37\F8\17\D0\18\08\ED\52\37\C0\18\04\ED\52\37\C8\3F\C9\CD\37\47\67\2E\3E\CD\AE\47\21\A6\48\CD\A9\47\2A\0A\40\23\CD\13\45\EB\CD\0E\45\EB\3E\D2\CD\AB\47\CD\44\45\FE\DE\C2\C1\44\C9\21\F7\48\C3\A9\47\CD\E7\02\21\3B\40\CB\B6\C9\21\06\49\C3\A9\47\21\3B\40\CB\F6\C3\07\02\4E\23\46\09\23\3A\0C\40\9D\C0\3A\0D\40\9C\C9\CD\44\45\FE\3F\C2\C1\44\CD\4D\47\AF\C9\CD\4D\47\21\ED\4B\CD\AE\47\21\1C\40\CD\AE\47\21\29\09\C3\AE\47\CD\2A\49\3E\D5\CD\7B\49\21\0E\45\CD\A9\47\21\EB\D1\C3\AE\47\C3\88\40\C3\8B\40\C3\8E\40\C3\91\40\C3\94\40\C3\97\40\C3\9A\40\C3\9D\40\C3\A0\40\EB\C3\A3\40\C3\A6\40\C3\A9\40\C3\AC\40\C3\AF\40\AF\40
   2 REM \21\7D\40\E5\22\79\40\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\23\23\4E\23\46\09\23\D1\A7\ED\52\22\77\40\EB\2A\04\40\73\23\72\23\EB\2A\79\40\ED\4B\77\40\ED\B0\AF\C9\CD\E7\02\21\3B\40\CB\B6\2E\7D\E5\2A\04\40\4E\23\46\E1\E5\C5\CD\A3\09\2A\04\40\23\23\C1\D1\ED\B0\AF\C9\7D\40\00\00\75\00\00\00\00
   3 REM   TAN -ZXGT COMPILER -         ZXGT=17389 PROG=18823
   4 REM        %M%C%O%D%E%R               COPYRIGHT 1982     PSS
   5 REM 
   6 REM 
   9 SAVE "MCODE%R"
  10 POKE 16389,118
  20 LET L=USR 18821
  25 SLOW 
  30 PRINT AT 5,11;"INTER"
  40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R"
  50 PRINT AT 9,10;"PRESENTS"
  60 PRINT AT 11,11;"%M%C%O%D%E%R"
  70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC"
  80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY            ENGLAND"
  90 GOSUB 200
 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES        EXCEPT 1 TO 4 INCLUSIVE"
 110 GOSUB 200
 120 STOP 
 200 FOR F=1 TO 80
 210 NEXT F
 220 CLS 
 230 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
3 REM TAN -ZXGT COMPILER - ZXGT=17389 PROG=18823 4 REM %M%C%O%D%E%R COPYRIGHT 1982 PSS 5 REM 6 REM 9 SAVE "MCODE%R" 10 POKE 16389,118 20 LET L=USR 18821 25 SLOW 30 PRINT AT 5,11;"INTER" 40 PRINT AT 7,6;"%C %O %M %P %U %T %E %R" 50 PRINT AT 9,10;"PRESENTS" 60 PRINT AT 11,11;"%M%C%O%D%E%R" 70 PRINT AT 15,3;"(C)1982 INTERCOMPUTER INC" 80 PRINT AT 16,1;"UNDER LICENCE FROM PSS,COVENTRY ENGLAND" 90 GOSUB 200 100 PRINT AT 5,5;"YOU MAY DELETE ALL LINES EXCEPT 1 TO 4 INCLUSIVE" 110 GOSUB 200 120 STOP 200 FOR F=1 TO 80 210 NEXT F 220 CLS 230 RETURN

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top