A83: ram calls


[Prev][Next][Index][Thread]

A83: ram calls





I tested my last theory, and it works.  I included two sample programs, 
ZRAMCALL.Z80, and ZCALLOFF.Z80.  You run ZRAMCALL to set up the calls, 
then you run ZCALLOFF to run it.  Unfortunatly you can't do call _off 
inside of the same program that sets it up.  I don't know why, but you 
just can't.  Also 1340bytes of routines can be stored there.

-Phelan 'Amen' Wolf

  MIND YOU:  DO NOT RUN ZCALLOFF WITHOUT RUNNING ZRAMCALL FIRST.  IT 
WILL CRASH YOUR CALC, I FOUND OUT THE HARD WAY. (i lost a basic program 
for chemistry, it was about 12K big, it took me forever to make.  as you 
might deduce i am incredibly angry.)

;PROGRAM:ZRAMCALL.Z80
;sets up ram call '_off'
.nolist
RAM_CALL = 8265h
_off     = RAM_CALL

.list
.org 9327h
 ld hl,off         ;load the off routine
 ld de,RAM_CALL    ;where to put it
 ld bc,6           ;it is 6 bytes long
 ldir              ;copy the data
 ld hl,RAM_CALL+7  ;load where to place some zeros
 xor a             ;clear a
 ld (hl),a         ;load the 00 at 8265h+06h
 ld hl,off2        ;load the second part
 ld de,RAM_CALL+8  ;where to put it
 ld bc,6           ;it is 6 bytes long
 ldir              ;copy the data
 ret

off:
 .db $f3,$3e,$01,$d3,$03,$3e,0
off2:
 .db $d3,$04,$08,$d9,$fb,$c9,0
 
end
.end

;PROGRAM:ZCALLOFF
;calls the ram call '_off'
.nolist
RAM_CALL = 8265h
_off     = RAM_CALL

.list
.org 9327h
 call _off

end
.end


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com