
;this is the T89C51RD2 bootloader 
;returns bootloader version (IAP call 08) - 24h
;uses the current register set (and does not modify rb0, rb1)
;may disable interrupts for a while (but does not modify them)
;interrupts should be OK, as during programming it disables them
;
;resources usage (stack excl. 2 bytes for the IAP call itself):
;
;IAP call (r1)             stack    registers
;00 (read ID)              0        dptr (contains the accessed XAF address)
;02 (program data byte)    2        r2, acc (returns ALWAYS zero!)
;03 (read device data)     0        (acc - contains the read byte)
;04 (erase SBV+BSB)        2        r4, acc, dptr
;05 (program SSB)          2        r4, acc, dptr
;06 (program SBV+BSB)      2        r4, acc, dptr
;07 (misc read)            0        dptr, (acc)
;08 (bootloader version)   0        (acc)
;09 (program data page)    2        r2, r4, r6, dptr, AUXR1, acc (returns ALWAYS zero!)
;
-----------------------------
;this is the AT89C51ED2 bootloader 
;returns bootloader version (IAP call 0F) - 00h  (and both 0E calls return 00h)
;uses the current register set (and does not modify rb0, rb1)
;contrary to datasheet, most functions (except 09) don't explicitly use DPTR0, but the current DPTR
;contrary to T89... it does NOT disable interrupts...
;
;resources usage (stack excl. 2 bytes for the IAP call itself):
;
;IAP call (r1)             stack    registers
;00 (read ID)              0        dptr (contains the accessed XAF address) (acc)
;01 (erase block)          0        r0, r1, dptr, acc
;02 (program data byte)    0        acc
;03 (read device data)     0        (acc - contains the read byte) *undocumented*
;04 (erase SBV+BSB)        0        acc, dptr *undocumented*
;05 (program SSB)          0        acc, dptr
;06 (program SBV+BSB)      0        acc
;07 (misc read)            0        dptr, (acc) *undocumented - dptr=0003h reads XAF address 06h...*)
;09 (program data page)    0        r0, dptr, AUXR1, acc (returns ALWAYS zero!)
;0A (program X2,BLJB)      2        r0, r1, r2, dptr, (acc)
;0B (read HSB)             0        dptr, (acc)
;0E (read boot ID)         0        (acc)
;0F (read boot version)    0        (acc)
