0 Members and 4 Guests are viewing this topic.
Are you using the parser hook? (I forget)
Does HL point to the numerical data itself or the token data?
;this first section is only if you are going to run it as a program. It stores the hook in;AppBackUpScreen and sets it up as well. ld de,9972h ;117299 this is a appbackupscreen+256 ld a,(de) ;1A This will store the byte into a cp 83h ;FE83 if a=83h, the hook might be active, so disable it... jr nz,3 ;2003 ...and quit xor a ;AF this sets a to 0 ld (de),a ;12 this disables the hook by overwriting the 83 ret ;C9 ld hl,9DB0h ;21B09D This is the location of the hook data ld bc,512 ;010002 number of bytes left in appbackupscreen push DE ;D5 ldir ;EDB0 this copies the hook data to 9972 pop HL ;E1 this points to the start of the hook in appbackupscreen in a,(6) ;DB06 this checks the current page.. B_Call(5026h) ;EF2650 sets up the hook using HL=pointer to hook and a=page in memory ret ;C9HOOK: add a,e ;83 necessary to start a hook or a ;B7 like cp 0. if A=0, z flag is set ret z ;C8 push hl ;E5 will need this later, but also need hl ld hl,B1B1h ;21B1B1 B1 is the int( token sbc hl,bc ;ED42 BC= the token, so if it is int(, HL-BC=0 and sets the Z flag pop hl ;E1 jr z,2 ;2802 so if it is the right token, skip 2 bytes xor a ;AF this is to set the z flag I think ret ; C9;And this is where the code gets creative. HL is the number of arguments passed and OP1 has the last argument. the arguments are stored reverse in the FPS, so it can be confusing. To pass a value, just store it to OP1 and do FE01C9... So here goes... ld a,(843Fh) ;3A3F84 this is the key press... it is used in my quickkeys program B_Call(478Ch) ;EF8C47 this is SetXXOP1 cp 1 ;FE01 does something flag-wise to let it exit the hook with modified Ans ret ;C9
Sorry, it might take a while for me to get alll the info. I had a folder named Parser Notes, but it didn't have my actual notes in it. Right now I am figuring everything out all over again... And I have to convert all the hex *groan* Here is the start of the hook I have. All it does is change int( into a getKey-ish thing:Code: [Select];this first section is only if you are going to run it as a program. It stores the hook in;AppBackUpScreen and sets it up as well. ld de,9972h ;117299 this is a appbackupscreen+256 ld a,(de) ;1A This will store the byte into a cp 83h ;FE83 if a=83h, the hook might be active, so disable it... jr nz,3 ;2003 ...and quit xor a ;AF this sets a to 0 ld (de),a ;12 this disables the hook by overwriting the 83 ret ;C9 ld hl,9DB0h ;21B09D This is the location of the hook data ld bc,512 ;010002 number of bytes left in appbackupscreen push DE ;D5 ldir ;EDB0 this copies the hook data to 9972 pop HL ;E1 this points to the start of the hook in appbackupscreen in a,(6) ;DB06 this checks the current page.. B_Call(5026h) ;EF2650 sets up the hook using HL=pointer to hook and a=page in memory ret ;C9HOOK: add a,e ;83 necessary to start a hook or a ;B7 like cp 0. if A=0, z flag is set ret z ;C8 push hl ;E5 will need this later, but also need hl ld hl,B1B1h ;21B1B1 B1 is the int( token sbc hl,bc ;ED42 BC= the token, so if it is int(, HL-BC=0 and sets the Z flag pop hl ;E1 jr z,2 ;2802 so if it is the right token, skip 2 bytes xor a ;AF this is to set the z flag I think ret ; C9;And this is where the code gets creative. HL is the number of arguments passed and OP1 has the last argument. the arguments are stored reverse in the FPS, so it can be confusing. To pass a value, just store it to OP1 and do FE01C9... So here goes... ld a,(843Fh) ;3A3F84 this is the key press... it is used in my quickkeys program B_Call(478Ch) ;EF8C47 this is SetXXOP1 cp 1 ;FE01 does something flag-wise to let it exit the hook with modified Ans ret ;C9
ParserHook:relocate(appbackupscreen) .db 83h ; Required for all hooks;Check to see if the command is one of the following:;Output to display the normal 6x8 routine. This is;for compatability in case a user wants to update;his program to do a different font; or a ;Which condition? ;If an instruction is being ;read, we don't ;waste time seeing what ;instruction it is ret z;For Text(), Output(), the value of register A will;be equal to 2. We can then check the value of the;token being used. cp 1 jr z, _ cp 2 jr nz, Not_2_ ld hl, ($965D) ;HL now points ;to the instruction ;being read.;Decrease hl to check for two byte token. HL;usually points to the second byte of a two byte token,;if it is a two byte one dec hl ld a, (hl) inc hl cp $BB jr z, Check_Instruction_Two_Byte_Token;Is this the Output() statement? cp $E0 jr z, CorrelationOutput
Okay, from there you will want to check the floating point stack, but I am not sure exactly where that is (there are a few bytes in RAM that point to various points). If you used Output(Y,X,<<String>> it will put a pointer to the temporary string in OP1, X at the top of the FPS, and then Y. I am not sure if PopReal or PopRealO1 might be useful B_Calls for you??? I am not sure if they work in hooks, though.
What do you mean by class 2? Sorry, I have only ever used the int( command in my parser hooks.