home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
ZSYS
/
SIMTEL20
/
SYSLIB
/
SLIB1.LBR
/
SAGO1.Z80
< prev
next >
Wrap
Text File
|
2000-06-30
|
1KB
|
47 lines
;
; SYSLIB Module Name: AGOTO1
; Author: Richard Conn
; SYSLIB Version Number: 3.6
; Module Version Number: 1.1
public agoto1
;
; AGOTO1 is a computed GOTO. When called, register A = index of following
; address to branch to, as indicated:
;
; MVI A,INDEX ; zero-relative
; CALL AGOTO1
; DW ADDR0 ; IF A=0
; DW ADDR1 ; IF A=1
; DW ADDR2 ; IF A=2
; ...
; ADDR0: ; COME HERE IF A=0
; ...
; ADDR1: ; COME HERE IF A=1
; ...
; ADDR2: ; COME HERE IF A=2
; ...
;
; No error or range checking is done
;
agoto1:
ex (sp),hl ; get address of routines, save HL
push de ; save regs
push af
ld d,0
ld e,a ; index in DE
ex de,hl ; index in HL, return address in DE
add hl,hl ; double index to compute offset
add hl,de ; point to jump in HL
ld a,(hl) ; get low
inc hl
ld h,(hl) ; get high
ld l,a ; HL = address to return to
pop af ; get regs
pop de
ex (sp),hl ; restore HL, set address of routine
ret
end