RE: A85: Re: Tyrant ports
[Prev][Next][Index][Thread]
RE: A85: Re: Tyrant ports
Here you go:
reStart:
ld hl, jumpTab
ld bc, (PROGRAM_ADDR)
add hl, bc
ld de, TEXT_MEM2 ; TEXT_MEM2 can hold 168/3 rellocated addresses
ld a, 2 ; number of addresses to rellocate (in this case 2)
reloc_loop:
push hl
push af
CALL LD_HL_MHL
pop af
add hl, bc ; calculate the real address
ex de, hl
ld (hl), 0xC3 ; opcode for JP
inc hl
ld (hl), e
inc hl
ld (hl), d ; these go in backwards coz the Z80 is little endian
inc hl
ex de, hl
pop hl
inc hl
inc hl
dec a
jr nz, reloc_loop
; put your program here
ROUTINE1:
; stuff
ret
ROUTINE2:
; stuff
ret
jumpTab:
.dw routine1
.dw routine2
routine1 EQU TEXT_MEM2
routine2 EQU TEXT_MEM2 + 3
; ... etc for each of your routines
; now, if you want to call (or jump to ) ROUTINE1, just do this:
call routine1 ; make sure you're using the EQU from TEXT_MEM2
; what this does is calls what's at TEXT_MEM2 which is this:
; jp ROUTINE1
; except that ROUTINE1 has (PROGRAM_ADDR) added to is already
On Fri, 13 Nov 1998, Richard Owen Lewis wrote:
>
>
> I'm interested. Can I see the code? I could incorporate it in to Summit, and release it sooner. =)
>
> ----------
> From: Last Man Standing[SMTP:ehuizing@ucalgary.ca]
> Sent: Friday, November 13, 1998 2:42 AM
> To: assembly-85@lists.ticalc.org
> Subject: Re: A85: Re: Tyrant ports
>
>
>
> I'll have to disagree there. There's still quite a few people I know who
> still use / write for ZShell (me for one).
>
> If anyone's interested, I've developed a way to rellocate ZShell programs.
> Its not as simple as Usgard, but still gets the job done.
>
References: