diff options
author | H. Peter Anvin <hpa@zytor.com> | 2016-10-07 01:35:40 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2016-10-07 01:35:40 -0700 |
commit | c07de56eb72f7bfe313d3dddd1ccfce87a0de209 (patch) | |
tree | 52542ddb9a5ed9a5674cf789be92a2b698e70d9c /data/bacldr2.asm | |
parent | 2b65a31fbf1658d2bc831aa83542c3f861b9b0bc (diff) | |
download | abc80-c07de56eb72f7bfe313d3dddd1ccfce87a0de209.tar.gz abc80-c07de56eb72f7bfe313d3dddd1ccfce87a0de209.tar.xz abc80-c07de56eb72f7bfe313d3dddd1ccfce87a0de209.zip |
bin2bac: update to handle relocations from z88dk-z80asm
Change the bin2bac code to process a relocation file generated by
z80asm from z88dk version 1.99 or later. At the same time, simplify
the loader code substantially by removing the recursive dependency
between header length and loader length - it doesn't actually buy
us anything, because it is just as easy to fetch the line length
from the byte at BOFA (true as long as the BASIC prefix is only one
line, but it can be more than one statement if necessary.)
Diffstat (limited to 'data/bacldr2.asm')
-rw-r--r-- | data/bacldr2.asm | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/data/bacldr2.asm b/data/bacldr2.asm deleted file mode 100644 index ae9c381..0000000 --- a/data/bacldr2.asm +++ /dev/null @@ -1,65 +0,0 @@ - ;; Load an assembly program at BOFA and handle relocations - ;; Relocations are a list of 16-bit addresses at the end of - ;; the image, processed in reverse order, terminated with - ;; an FFFFh sentinel. - - org 0 ; This code must be position-independent - -BOFA: equ 65052 -offset: equ 0xeeee ; Length of the BASIC prefix -ENTRY: equ 0xbbbb - - ld hl,(BOFA) - push hl - ld e,l - ld d,h - ld bc,offset ; Offset < 256 so B = 0 - add hl,bc - - ; Get data block length -loop: - ld a,-8 - add (hl) - jr nc,reloc ; 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 - - ;; Process relocations. At this point DE points beyond - ;; the end of the contiguous image. -reloc: - pop bc ; BC <- BOFA -reloc_loop: - ex de,hl - dec hl - ld d,(hl) - dec hl - ld e,(hl) - ld a,e - and d - inc a ; A = FFh only if BC = FFFFh - jr z,reloc_done - ex de,hl - add hl,bc - ld a,(hl) - add c - ld (hl),a - inc hl - ld a,(hl) - adc a,b - ld (hl),a - jr reloc_loop -reloc_done: - ld hl,ENTRY - add hl,bc - jp (hl) |