0 Members and 1 Guest are viewing this topic.
So, that would be like Getcalc(Ans)? The goal is to store a token, either two-byte or one-byte, into ans.
;---------> InsertMem <---------;;B_CALL(_InsertMem) with checks to make sure there is enough RAM and the insertion address is okay;;INPUTS: Arg1: Pointer to start of variable according to GetCalc(); Arg2: Offset in variable to insert RAM; Arg3: Number of bytes to attempt to insert;;OUTPUTS: 0 if not enough RAM or Arg2 is out of range; Nonzero if successfulp_InsertMem:;REGISTERS: hl=Arg3;STACK: | Ret | Arg2 | Arg1 | ... B_CALL(_EnoughMem) ;Check if enough RAM;REGISTERS: de=Arg3;STACK: | Ret | Arg2 | Arg1 | ... pop hl ;Rearrange arguments and stack pop bc ex (sp),hl;REGISTERS: bc=Arg2 de=Arg3 hl=Arg1;STACK: | Ret | ... jr c,__InsertMemFail0Args ;Return failure if not enough RAM dec hl ;Get current variable size ld a,(hl) dec hl push hl ld l,(hl) ld h,a;REGISTERS: bc=Arg2 de=Arg3 hl=current variable size;STACK: | Arg1-2 | Ret | ... sbc hl,bc ;Check if offset is outside of variable jr c,__InsertMemFail1Arg ;Return failure if offset is outside of variable add hl,bc;REGISTERS: bc=Arg2 de=Arg3 hl=current variable size;STACK: | Arg1-2 | Ret | ... add hl,de ;Calculate final variable size ex de,hl ex (sp),hl;REGISTERS: bc=Arg2 de=final variable size hl=Arg1-2;STACK: | Arg3 | Ret | ... ld (hl),e ;Store final variable size inc hl ld (hl),d inc hl;REGISTERS: bc=Arg2 de=final variable size hl=Arg1;STACK: | Arg3 | Ret | ... add hl,bc ;Calculate RAM insertion address ex de,hl ;Prepare arguments for _InsertMem pop hl;REGISTERS: bc=Arg2 de=Arg1+Arg2 (RAM insertion address) hl=Arg3 (bytes to insert);STACK: | Ret | ... B_CALL(_InsertMem) ;Insert memory;REGISTERS: de=RAM insertion address hl=a lot (negative size of a VAT entry?);STACK: | Ret | ... ret ;Result is always nonzero__InsertMemFail1Arg: pop hl__InsertMemFail0Args: ld hl,0 ret__InsertMemEnd:
;---------> DelMem <---------;;B_CALL(_DelMem) with checks to make sure that the deletion address and size are okay;;INPUTS: Arg1: Pointer to start of variable according to GetCalc(); Arg2: Offset in variable to delete RAM; Arg3: Number of bytes to attempt to delete;;OUTPUTS: 0 if Arg2+Arg3 is out of range; Nonzero if successfulp_DelMem:;REGISTERS: hl=Arg3;STACK: | Ret | Arg2 | Arg1 | ... pop af ;Rearrange arguments and stack pop bc pop de push af push hl;REGISTERS: bc=Arg2 de=Arg1 hl=Arg3;STACK: | Arg3 | Ret | ... add hl,bc ;Calculate offset of end of deletion jr c,__DelMemFail ;Return failure if offset+size was so big that it overflowed ex de,hl;REGISTERS: bc=Arg2 de=Arg2+Arg3 hl=Arg1;STACK: | Arg3 | Ret | ... dec hl ;Get current variable size ld a,(hl) dec hl push hl ld l,(hl) ld h,a;REGISTERS: bc=Arg2 de=Arg2+Arg3 hl=current variable size;STACK: | Arg1-2 | Arg3 | Ret | ... sbc hl,de ;Check if end is outside of variable pop de ;Early pop to avoid having fail condition requiring 2 pops;REGISTERS: bc=Arg2 de=Arg1-2 hl=current variable size - (Arg2+Arg3);STACK: | Arg3 | Ret | ... jr c,__DelMemFail ;Return failure if end is outside of variable add hl,bc ;Add back offset to get final variable size;REGISTERS: bc=Arg2 de=Arg1-2 hl=final variable size;STACK: | Arg3 | Ret | ... ex de,hl ;Store final variable size ld (hl),e inc hl ld (hl),d inc hl;REGISTERS: bc=Arg2 de=final variable size hl=Arg1;STACK: | Arg3 | Ret | ... add hl,bc ;Calculate RAM deletion address pop de ;Prepare size argument for _DelMem;REGISTERS: bc=Arg2 de=Arg3 (bytes to delete) hl=Arg1+Arg2 (RAM deletion address);STACK: | Ret | ... B_CALL(_DelMem) ;Delete memory;REGISTERS: de=Arg3 (bytes to delete) hl=a lot (negative size of a VAT entry?);STACK: | Ret | ... ret ;Result is always nonzero__DelMemFail: pop hl ld hl,0 ret__DelMemEnd:
[noobish question]What are tilemaps, and how do I use them?[/noobish question]The ultimate goal is to get a sort of smmothscrolling, specifically for Tio.
The ultimate goal is to get a sort of smmothscrolling
[Pic1r]->Pic000Pt-On(10,10,Pic000)Pt-On(18,10,Pic000+8)
Happy birthday Axe. Not only Axe is 1 years old, it's the project that had the most attention in Omni history with 12000+ posts in its sub-forum. (The second one was Ultima V, I think)