Environment on entry to Z80 code on BBC Z80 platforms ===================================================== When code is entered in the Z80 environment after an OSCLI (*command) or RESET, HL holds the entry address, and the A register and flags hold certain values. If code has a ROM header ------------------------ NZ = Z80 CoPro v1.20 Z = Z80 CoPro v2.00, Serial Z80 Tube, Z80Tube Emulator, BBC BASIC NC = All cases A=%x1xx1xxx RESET on Z80 CoPro v1.20 A=%01001000 RESET on Z80Tube emulator A=%00001000 RESET on Z80 CoPro v2.00 A=%00000001 OSCLI in all cases except old Z80Tube A=%00000000 OSCLI on Z80Tube Emulator old version If code does not have a ROM header ---------------------------------- NZ = Z80 CoPro, Serial Z80Tube Z = Z80Tube Emulator, BBC BASIC NC = All cases A=%???????? Z80 CoPro, BBC BASIC A=%00000001 Serial Z80 Tube, Z80Tube Emulator A=%00000000 Z80Tube old version When raw code is entered on the v1.20 Z80 CoPro there is an extra word on the stack that needs to be POPed before a RETurn can be made. Unfortunately, it is not easy to determine this case programatically. Sample code ----------- \ Just test if v1.20 CoPro or not \ ------------------------------- .entry JR start:NOP:DEFM "(C)" :\ Simple ROM header DEFB &48:DEFB &02 .start JR NZ,ver120:JR Z,not120 \ Test if entered on RESET or via OSCLI \ ------------------------------------- .entry JR start:NOP:DEFM "(C)" :\ Simple ROM header DEFB &48:DEFB &02 .start BIT 3,A:JR Z,notReset BIT 6,A:JR Z,not120:JR NZ,ver120