Hello,
If my understanding of your problem is correct, you wish to write two bytes of data to flash, as part of the normal operation of your JK3 code. Assuming this needs to be done only infrequently, so as not to exceed the endurance limit for the flash, it is really only necessary to erase one page of flash (64 bytes), and re-program the first two bytes. There are no special measures required to directly read the data from flash. The first flash block would normally be chosen so that the remainder of the code can be write protected.
The code shown in AN2504 does far more than you require to do, and with more overheads, to cater for the more general case. However, the various other sources of documentation on the use of the ROM based routines are generally described in assembly code, rather than C. You did not say exactly what your problem is.
To use the ROM routines, the primary requirement is the use of specific locations in RAM, which would normally require six bytes for writing two data bytes only. However, I would suggest you look at AN1831, where a problem with the page erase routine, applicable to the JK3 and other devices, is discussed. This will involve a "page erase work-around", which requires use of a greater amount of RAM. I am not sure whether AN2504 actually takes this issue into account.
The use of the ROM routines is also discussed in AN2874, but not the page erase problem.
I have previously used a very simple assembly sub-routine to do the same task that you seem to require, but for the QY device that does not have the page erase issue. Let me know if you are interested in the code, and I will post it.
Regards,
Mac