0 Members and 4 Guests are viewing this topic.
ld a,b xor (hl) bit 7,a jr z,programdone bit 5,(hl) !!! jr z,programwaitloop
;b = byte;de = address ld hl,$0AAA ld (hl),l ld hl,$0555 ld (hl),l ld a,$A0 ld ($0AAA),a ld a,b ld (de),aread ld a,(de) cp b ; yep, cp the fastest option for fast & successful writings (using xor directly would add 4 cycles for the backup) ret z ld c,a ; backup, to be sure to read bit 5 of the same byte later xor b ret p bit 5,c jp z,read ld a,$F0 ld ($0000),a scf ret;cf = 0 (success) | 1 (failure)
The thing is, that if the chip happens to switch from "status" to "data" mode right before the second reading, bit 5 of actual data will be tested, potentially leading to an unwanted abort instruction.Am i right about that potential breach ?
That can happen, and in fact probably happens a lot, but it's not a problem unless your routine also returns an error status. Issuing the reset command in read mode does nothing, so there's no reason to go out of your way to prevent that.
Yes, my code will specify if an error occured.Thx for your time, again =]
In that case, have the error handler check the data to see if it's actually different, which will be slightly faster.
Is the error handler system-dependant ?
Yo Streety =]Something between an OS and a shell...
No, I mean, in your flash write routine, when you see an error, double check if the data is in fact different than what was intended to be written, and only report an error if it's different. This will save you from the logic of retaining the status read value in a register.
;c = byte;de = address ld hl,$0AAA ld (hl),l ld hl,$0555 ld (hl),l ld a,$A0 ld ($0AAA),a ex de,hl ld (hl),ccheck ld a,c xor (hl) ret p bit 5,(hl) jp z,check ld a,c xor (hl) ret p ld a,$F0 ld ($0000),a scf ret;cf = 0 (success) | 1 (failure)
That sounds interesting. You have my attention.
Quote from: the_mad_joob on July 02, 2014, 12:06:11 pmYo Streety =]Something between an OS and a shell...That sounds interesting. You have my attention.