org 0 ; This code must be position-independent BOFA: equ 65052 offset: equ 0xeeee ; Length of the BASIC prefix LOAD: equ 0xdddd ; Load address ENTRY: equ 0xbbbb ld hl,(BOFA) ld bc,offset ; offset <= 255 add hl,bc ld de,LOAD ; Get data block length loop: ld a,-8 add (hl) jp nc,ENTRY ; END is a shorter line than any data line ; Skip length byte + line number (2 bytes) + string opcode (3 bytes) ld c,6 add hl,bc ; Copy remaining data ld c,a ldir ; Skip return + CR inc hl inc hl jr loop