0 Members and 3 Guests are viewing this topic.
BIT 7, H JR Z, MemInsert ;p_IntNeg xor a sub l ld l, a sbc a, a sub h ld h,a MemDelete: POP DE ;Offset to remove EX (SP), HL ;Variable name (SP = size) PUSH DE RST rMov9ToOP1 BCALL(_ChkFindSym) ;Look in the VAT, DE set to pointer to size bytes of variable) JR C, Error_Pop2 ;ERR: NOT FOUND XOR A OR B JR NZ, Error_Pop2 ;ERR: ARCHIVED POP HL ;Offset to remove memory POP BC ;Memory needed PUSH HL ;Offset to remove memory PUSH BC ;Memory needed PUSH DE ;Pointer to size bytes INC DE ;Skip size bytes INC DE EX DE, HL ;HL = pointer, DE = bytes ADD HL, DE LD D, B \ LD E, C ;Memory needed BCALL(_DelMem) ;Delete the memory POP HL ;Pointer to size bytes PUSH HL ;Pointer to size bytes BCALL(_LdHLInd) ;HL = size of variable POP DE ;Pointer to size bytes POP BC ;Memory needed XOR A SBC HL, BC ;Decrease size bytes EX DE, HL LD (HL), E INC HL LD (HL), D INC HL POP BC ;Offset to remove memory ADD HL, BC RETMemInsert: BCALL(_EnoughMem) ;Check if enough memory (stores value in DE) JR C, Error_Pop2 ;ERR: MEMORY LD B, D \ LD C, E ;Memory needed POP DE ;Offset to insert memory POP HL ;Variable's name PUSH DE ;Offset to insert memory PUSH BC ;Memory needed RST rMov9ToOP1 BCALL(_ChkFindSym) ;Look in the VAT, DE set to pointer to size bytes of variable) JR C, Error_Pop2 ;ERR: NOT FOUND XOR A OR B JR NZ, Error_Pop2 ;ERR: ARCHIVED POP HL ;Memory needed EX DE, HL POP BC ;Offset to insert memory PUSH BC PUSH DE ;Memory needed PUSH HL ;Pointer to size bytes INC HL ;Skip size bytes INC HL ADD HL, BC EX DE, HL BCALL(_InsertMem) ;Insert the memory POP HL ;Pointer to size bytes PUSH HL ;Pointer to size bytes BCALL(_LdHLInd) ;HL = size of variable POP DE ;Pointer to size bytes POP BC ;Memory needed ADD HL,BC ;Increase size bytes EX DE, HL LD (HL), E ;Write new size INC HL LD (HL), D INC HL ;Pointer to data POP BC ;Offset to insert memory ADD HL, BC PUSH HL ;Pointer to data BytesInit: LD (HL), $41 ;Write 'A' INC HL DEC BC LD A, B OR C JR NZ, BytesInit POP HL ;Pointer to data RETError_Pop2: POP HL POP HLError: LD HL, 0 RET
What do you mean by "variable" ? Because Memkit, an Axiom that is included in Axe's zip, can already add or remove bytes in an appvar for example.
I don't know if it works with everything but I am sure it works with appvars (I used that in AudaciTI), I am pretty sure it works with programs (given the difference between appvars and programs -.-) but I don't know for other variables.
For now, we can do this[]→°CST°CST1-°CST2→°CST3But we can't do this:[]-°CST1→°CST2Could this possibility be added ? Basically, I have this fileSpoiler For Spoiler: *See Hayleia's original message*And I need to retract a constant to every "[]→", so I don't feel like doing things like[]→°TEMP°TEMP-°CST1→°CST2for each of them edit Alternatively, is there a way to "compile with .org 0" ?
Well yeah, I could theoretically rewrite that in assembly and use spasm... but given the size of the file already, you understand why I ask if there's an "easy" solution Actually, I could maybe add the "-°CST1" in my code since it is always the same constant for everyone. It would just waste an addition.And thanks
It doesn't waste anything if I add an constant to another constant, but it does waste if I add a constant to a calculation that doesn't end with a constant addition.
Quote from: Hayleia on August 27, 2014, 06:20:36 amIt doesn't waste anything if I add an constant to another constant, but it does waste if I add a constant to a calculation that doesn't end with a constant addition.Yes, indeed. But in your case (°CST1-°CST2→°CST3), it only wastes some bytes in the source program.
Actually, I see a lot of potential for that .org command That would help me with my data, and this would also allow people to write ramcodes very easily, even ones using absolute jumps.edit the token used could be the same as #Realloc but with a r.