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

getsec:

chain’.

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

filerr:

ld de, feb

ld hl, fobh

ld be, 13

ldir

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

errmes:

tmemry:

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

call

ld ld call ret

defn defs

defs end

280

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

defb defn

defm end

280

ld 1d

foveall+l}, hl;

0000

c, 14h de, feb bdos

c, 09 de, bdos

‘Unable to open

2

2

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

errmes

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.

8

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