|
With #target TZX you can define custom timings for all pulses (pilot, sync and data bits) used for the standard tape encoding scheme and even own schemes, e.g. to write a ZX81-style data block. For this #target TZX introduces new pseudo opcodes to define the timing and encoding scheme of the current Assembler directives: #code Including C Source Files: #code#code segment. The .tzx- pseudo opcodes to define pulse length and encoding scheme must be placed immediately after the Assembler directives: #code Including C Source Files: #code#code directive.
Defines a sequence of pulses used to construct the pilot tone and the sync pulses. The symbol definition starts with a flag which defines the signal polarity at the start of the symbol and a series of pulse lengths expressed in t-states (3.5MHz). Symbols are indexed in order of appearance.
Uses the above symbols to construct the pilot tone and the sync pulses.
Defines a sequence of pulses used to encode the data of this Assembler directives: #code Including C Source Files: #code#code block. In most encoding schemes one data symbol in the data stream encodes 1 bit of data and you need two different symbols for bit=0 and bit=1, but you can also define an encoding scheme where one data symbol encodes 2 bits, 4 bits or a whole byte. Accordingly there must be either 2, 4, 16 or 256 .tzx-data-sym definitions to encode all possible values. Data symbol definitions use the same syntax as .tzx-pilot-sym.
Pilot and data symbol definitions start with a polarity flag:
0: Toggle polarity (make an edge, most common case) 1: Don't toggle (make no edge, prolong the previous pulse) 2: Force low level 3: Force high level
.tzx-pilot-sym polarity, pulse1, pulse2, ... ; pilot symbol #0
.tzx-pilot-sym polarity, pulse1, pulse2, ... ; pilot symbol #1
...
.tzx-pilot symbol_idx, repetitions, symbol_idx, repetitions, ...
.tzx-data-sym polarity, pulse1, pulse2, ... ; data symbol #0
.tzx-data-sym polarity, pulse1, pulse2, ... ; data symbol #1
...
; assembler source follows
The symbol tables of a Assembler directives: #code Including C Source Files: #code#code block are preset with default values which generate a standard ZX Spectrum (or Jupiter Ace) data block:
Assembler directives: #code Including C Source Files: #code#code name,address,length,flag=0
.tzx-pilot-sym 0,2168 ; symbol for pilot pulses
.tzx-pilot-sym 0,667,735 ; symbol for sync pulses (two pulses)
.tzx-pilot 0,8063, 1,1 ; 8063 pilot pulses (symbol#0), then one sync pulse symbol (symbol#1)
.tzx-data-sym 0,855,855 ; symbol for bit 0
.tzx-data-sym 0,1710,1710 ; symbol for bit 1
Assembler directives: #code Including C Source Files: #code#code name,address,length,flag=255
.tzx-pilot-sym 0,2168 ; symbol for pilot pulses
.tzx-pilot-sym 0,667,735 ; symbol for sync pulses (two pulses)
.tzx-pilot 0,3223, 1,1 ; 3223 pilot pulses (symbol#0), then one sync pulse symbol (symbol#1)
.tzx-data-sym 0,855,855 ; symbol for bit 0
.tzx-data-sym 0,1710,1710 ; symbol for bit 1
Assembler directives: #code Including C Source Files: #code#code name,address,length,flag=0, checksum=ace
.tzx-pilot-sym 0,2011 ; symbol for pilot pulses
.tzx-pilot-sym 0,601,791 ; symbol for sync pulses (two pulses)
.tzx-pilot 0,8192, 1,1 ; 8192 pilot pulses (symbol#0), then one sync pulse symbol (symbol#1)
.tzx-data-sym 0,795,801 ; symbol for bit 0
.tzx-data-sym 0,1585,1591 ; symbol for bit 1
Assembler directives: #code Including C Source Files: #code#code name,address,length,flag=255, checksum=ace
.tzx-pilot-sym 0,2011 ; symbol for pilot pulses
.tzx-pilot-sym 0,601,791 ; symbol for sync pulses (two pulses)
.tzx-pilot 0,1024, 1,1 ; 1024 pilot pulses (symbol#0), then one sync pulse symbol (symbol#1)
.tzx-data-sym 0,795,801 ; symbol for bit 0
.tzx-data-sym 0,1585,1591 ; symbol for bit 1
The TZX file format provides 4 block types to store code. You can either use a #TZX directive to specify the TZX block to use or use Assembler directives: #code Including C Source Files: #code#CODE and leave it to zasm to automatically pick the most suitable block type.
Assembler directives: #code Including C Source Files: #code#CODE name, address, length, flag
Assembler directives: #code Including C Source Files: #code#CODE name, address, length, FLAG=(flag|NONE), [PILOT=(NONE|count)], [CHECKSUM=(NONE|ACE)], [LASTBITS=count], [PAUSE=ms]
#TZX STANDARD, name, address, length, FLAG=(flag|NONE), [CHECKSUM=NONE|ACE], [PAUSE=ms]
#TZX TURBO, name, address, length, FLAG=(flag|NONE), [PILOT=count], [CHECKSUM=(NONE|ACE)], [LASTBITS=count], [PAUSE=ms]
#TZX PURE-DATA, name, address, length, FLAG=(flag|NONE), [PILOT=NONE], [CHECKSUM=(NONE|ACE)], [LASTBITS=count], [PAUSE=ms]
#TZX GENERALIZED, name, address, length, FLAG=(flag|NONE), [PILOT=(NONE|count)], [CHECKSUM=(NONE|ACE)], [LASTBITS=count], [PAUSE=ms]
The restrictions for each tzx block type are as follows:
0x10: Standard data block: • LASTBITS are not supported. • The pulse scheme must not be modified using the .tzx- pseudo opcodes.
0x11: Turbo data block: • The pulse scheme must match the ZX Spectrum encoding but the pulse lengths (pilot, sync, data bits) and number of pilot pulses can be modified.
0x14: Pure data block: • PILOT must be NONE • No pilot must be specified with .tzx-pilot-sym and .tzx-pilot • The pulse scheme for the data bits must match the ZX Spectrum encoding but the pulse lengths can be modified.
0x19: Generalized data block: • No restrictions.
Standard speed data block
Assembler directives: #code Including C Source Files: #code#code name, address, length, flag=255
Turbo speed data block
Assembler directives: #code Including C Source Files: #code#code name, address, length, flag=$ee, pause=150
.tzx-pilot-sym 0, 900 ; symbol#0 for pilot pulses
.tzx-pilot-sym 0, 300,400 ; symbol#1 for sync pulses (two pulses)
.tzx-pilot 0,1520, 1,1 ; 1520 pilot pulses (symbol#0), then one sync pulse symbol (symbol#1)
.tzx-data-sym 0, 290,290 ; symbol#0 for bit 0
.tzx-data-sym 0, 580,580 ; symbol#1 for bit 1
Pure data block
Assembler directives: #code Including C Source Files: #code#code name, address, length, flag=255, pilot=NONE
Generalized data block
; #insert: Examples: #assert: Example: incbin: Examples: #assert: Example:Example with 2-bit symbols. this requires 4 data symbols for the 4 possible values:
Assembler directives: #code Including C Source Files: #code#code name, address, length, flag=255
.tzx-pilot-sym 0, 1500 ; symbol#0 for pilot pulses
.tzx-pilot-sym 0, 500 ; symbol#1 for sync pulses
.tzx-pilot 0,1000, 1,2 ; 1000 pilot pulses (symbol#0), 2 short sync pulses (symbol#1)
.tzx-data-sym 0, 500,350,650,500 ; symbol#0 for 2 bits = 00
.tzx-data-sym 0, 500,450,550,500 ; symbol#1 for 2 bits = 01
.tzx-data-sym 0, 500,550,450,500 ; symbol#2 for 2 bits = 10
.tzx-data-sym 0, 500,650,350,500 ; symbol#3 for 2 bits = 11
; ZX81 program:
Assembler directives: #code Including C Source Files: #code#code name, address, length, flag=NONE, checksum=NONE, pilot=NONE
.tzx-data-sym 3, 530,520,530,520,530,520,530, 4689
.tzx-data-sym 3, 530,520,530,520,530,520,530, 520,530,520,530,520,530,520,530,520,530,4689
| |