This is the full code used in Update, which was tested and verified to work on BrandonW's walmart calculator. I don't actually check for write failure, but still. Might want to check that pointer to make sure it's advancing and that you're not trying to write a 1 where a zero is too many times.
Code: WriteFlashByte: ;Write a byte. B=data,DE=adr,A=page.
ex de,hl
ld c,a
in a,(6)
ld (WriteFlashByteRestore+1),a
ld a,c
push af
ld a,2 \ out (6),a
ld a,$AA \ ld ($6AAA),a
ld a,1 \ out (6),a
ld a,$55 \ ld ($5555),a
ld a,2 \ out (6),a
ld a,$A0 \ ld ($6AAA),a
pop af
out (6),a
ld (hl),b
WriteFlashByteLoop:
ld a,(hl)
ld c,a
xor b
and $80
jr z,WriteFlashSuccess
bit 5,c
jr z,WriteFlashByteLoop
ld a,(hl)
xor b
and $80
jr nz,WriteFlashFailure
WriteFlashSuccess:
call WriteFlashByteRestore
xor a
ret
WriteFlashFailure:
call WriteFlashByteRestore
xor a
inc a
ret
WriteFlashByteRestore:
ld a,00
out (6),a
ld (hl),$F0
ex de,hl
inc de
ret
EDIT: The code that runs this routine doesn't check for failure. I just never checked to see what happens if it fails. If I recall correctly, what happens if you try to write a 1 where a zero is causes the code above to become trapped in an endless loop. I don't check for that sort of problem. You might want to. The Flash chip has other ways to check for failure other than the way TI uses.