80-Bus News


Summer 1985, Volume 4, Issue 2

Page 8 of 31

Program listings for chain and overlay functions

oveall: Program 1. A routine to chain another program.

280 bdes feb currec

0005h 005ch fobt20h

equ equ equ

BDOS jump address Default file control block Current record byte in FCB



Start of routine, double colon flags routine ag global to M80 assembler


ld de, feb

ld hl, fobh

ld be, 13


ld de, feb

ld c, 000fh call bdas

inc a

Ip Z, opener xOr a

ld (curreci, 4 ld de, tbdos+1} dec de

ld hl, codend ld be. codend-codbeg lddr

inc de

eX de, hl

dp thl}

load chain file dets into default file control block at Och

epen up the chain file



return on open error (FF hex returned:

0 to current record

Fovlad: :

point DE to top of mem iget from 0006h)

HL point to end of transfer code

BC contains length of transfer code read transfer code into stack area transfer code addr to hl

and execute 1t root:: Following is transfer code codheg 1d sp. hl ld de, 100 rdsec push de ld c, Olah . set dma to current memory addr call bdos ld de, fob la c. 14h call bdas pop de or a iv nz, filred : ld hl, 80h add hl, de 8x de, hl je rdsec

» Sp ne code beginning DE points to start of program area Read a sector in to memory

read next sector

last sector %? -.. Yes so exit loop move memory pointer up 128 bytes

fill: f112: not finished so read another sector

mess: filred:

1d a, 0

ld (80h), a ld de, 80h ld c, lah call bdos

ld hl, SCH ld a, 20H ld bt

Q length command tail

reset DMA to default

: f111 FCB with spaces ovl:

MrT Pah



ld ld call ret

defn defs

defs end


ld ld call ld ld ld ldir call ld ld ld idir call Jp

defb defn

defm end


ld 1d

foveall+l}, hl;


c, 14h de, feb bdos

c, 09 de, bdos

‘Unable to open



de, mess c, 09 0005 de, Sch hl, fill bo, 13

’ovlayit de, Sch hl, fi12 be, 13

ovlaywHt 0

0,’OV1 0, 0V2

‘In root’, 10,13,

c, 09 de, mess


OVL’.0 OVL’ 0

and write it into the call data area

call the overlay. The 0000 address will, have been altered to the overlay base

addr by the previous instruction.


read a sector

file error routine

80 Bus News

overlay file’,10,13, ‘$’

LINK will put the top of program address here

Link looks for this – Reason net known

Program 3. Root module for overlay demo. (ROOT.MAC)

output root ->ssage

load fob with Ist overlay filename

call overlay Insder load fob with ..u overlay filename

call loader again exit to CP/M

overlay filenames

Program 4. 1st overlay for demo program. (OV1.MAC)

; output id message

This is an OCR’d version of the scanned page and likely contains recognition errors.

Page 8 of 31