0 Members and 2 Guests are viewing this topic.
;=========================================================; Mnemonic Hex Explanation;========================================================= bcall(_RclAns) ;EFD74A DE points to size bytes cp 4 ;FE04 To make sure Ans is a string ret nz ;C0 Quits if a is not equal to 4 ex de,hl ;EB Swaps hl and de. Now hl points to the size bytes of Ans ld c,(hl) ;4E loads the LSB (Least Significant Byte) of the size into c inc hl ;23 hl points to the next size byte;;As a note, these next two lines can be replaced with ;ld b,0 in this case (because the name shouldn't be >8 bytes);but this is the general way to get the size of a variable.; ld b,(hl) ;46 now the MSB of the size is stored to b. BC is now equal to the size of the string in Ans inc hl ;23 hl now points to the actual data;;At this point, HL points to the string in Ans;and BC is the size of the string. This will be;useful when we copy to OP1 :); inc a ;3C Since a is 4, this makes a=5 (the type for a program) ld de,OP1 ;117884 DE points to OP1 ld (de),a ;12 Stores a (which is 5) to the byte at OP1+0 inc de ;13 DE now points to the next byte (OP1+1) ldir ;EDBO Copies BC number of bytes from HL to DE. In other words, it copies the string in Ans to OP1 xor a ;AF This makes A=0. It is an optimisation trick :) ld (de),a ;12 This copies a (0) to (de) which is at the end of the string in OP1 bcall(_ChkFindSym) ;EFF142 This searches for a var named in OP1 ret nc ;D0 This stops if the var already exists ld hl,256 ;210001 This is the size you want the program to be bcall(_CreateProg) ;EF3943 This creates the program ret ;C9
oh thanks! hah and yeah i did read Hot_Dog's z80 ASM for the Absolute Beginner, but stop at chapter 13 because it got kinda complicated. When i first read it was easy, but then it got little confusing and hard to understand later