Thought for the day...

cmartinez

Joined Jan 17, 2007
8,768
Or sometimes your own!
Lol ... that happens to me more frequently than not ... That's why I'm in the habit of heavily commenting my code as if it were a story being told, step by step. I practically never make a flow chart. But I've just finished a project that I think I'll be making one for. A simple one that covers the logic flow so that things are easier to understand when one needs to revisit the nuances of the code later on.

Here's a sample:

Code:
;*****************************************************************************************
;
;                          Is FSR0 greater than or equal to FSR1?
;
;    Both FSRs point to the LSB of an array with NUMBER bytes each. Works with both Hex 
;   and BCD registers as long as they're both the same type. Will preserve the original
;   values of both FSRs
;
;                               if FSR0  = FSR1  then Z = 1
;                               if FSR0 <= FSR1  then C = 1
;                               if FSR0  > FSR1  then C = 0
;
;                               Destroyed registers: PUSH01
;                         The original FSRs values are preserved
;
;                            No memory bank change takes place
;*****************************************************************************************
GTE2_FSR0_FSR1:
       MovF2F NUMBER, PUSH01
      
       ;make both FSRs registers point to their respective arrays' MSB
      decfsz PUSH01, f
       goto Point_To_HB
      goto Skip_Point_To_HB       ;skip if there's only one byte in the arrays

Point_To_HB:                      ;point to the high byte in both arrays
      bsf AUX_FLAGS, FSR_SELECT_FLAG ;work with FSR1
      movf PUSH01, w
      call Add_W_To_FSRX
      bcf AUX_FLAGS, FSR_SELECT_FLAG ;work with FSR0
      movf PUSH01, w
      call Add_W_To_FSRX

Skip_Point_To_HB:
      MovF2F NUMBER, PUSH01

GTE2_Comp_Loop:
        moviw 0[FSR0]             ;loading w this way allows reading from a dt table
        subwf INDF1, w            ;compare current bytes
        btfss STATUS, Z           ;are they equal?
         goto Restore_FSRs_Loop   ;exit if they're not

        addfsr FSR0, -1d          ;point to the next byte down
        addfsr FSR1, -1d          ;this does not affect the STATUS register
        
       decfsz PUSH01, f
      goto GTE2_Comp_Loop
                                
      addfsr FSR0, d'1'           ;if we reached this point, both values are equal
      addfsr FSR1, d'1'           ;set both FSR to their respective initial condition
      goto Exit_GTE2_FSR0_FSR1    ;exit this function immediately

Restore_FSRs_Loop:                ;restore the original values of both FSR's if
        addfsr FSR0, -1d          ;the previous loop exited early
        addfsr FSR1, -1d          ;restoration is done this way as not to affect
       decfsz PUSH01, f           ;the values of Z and C
      goto Restore_FSRs_Loop      
      
      addfsr FSR0, d'1'           ;sets both FSR to their respective initial condition
      addfsr FSR1, d'1'        

Exit_GTE2_FSR0_FSR1:

    return
 

WBahn

Joined Mar 31, 2012
32,876
Iran is a total mess.
It's something that we've seen in that country many times. While sooner or later the end will be different, I'm not seeing any reason for thinking/hoping that this is the one. The regime will crack down brutally on the protestors, lots of people will disappear, and everyone else will duck their heads and go back to simmer for another year or two at which point something else will cause the next round. For better or worse, this is just how their system releases steam.
 

cmartinez

Joined Jan 17, 2007
8,768
everyone else will duck their heads and go back to simmer for another year or two
Nothing can simmer indefinitely. It eventually reaches a boiling point, or catches fire. Iran will have its day sooner than later, I predict. Kudos to the brave few who have the courage to defy the suffocating regime currently ruling their country. I just hope that whatever comes next, it results in a measurable improvement.
 

WBahn

Joined Mar 31, 2012
32,876
Nothing can simmer indefinitely. It eventually reaches a boiling point, or catches fire. Iran will have its day sooner than later, I predict. Kudos to the brave few who have the courage to defy the suffocating regime currently ruling their country. I just hope that whatever comes next, it results in a measurable improvement.
As I said, sooner or later it will end differently. But the fact remains that this is a recurring theme that, thus far, has always ended the same way. And every time there has been no shortage of people insisting that this time is different or not even recognizing that it has happened before, let alone happened repeatedly.
 

nsaspook

Joined Aug 27, 2009
16,330
It's something that we've seen in that country many times. While sooner or later the end will be different, I'm not seeing any reason for thinking/hoping that this is the one. The regime will crack down brutally on the protestors, lots of people will disappear, and everyone else will duck their heads and go back to simmer for another year or two at which point something else will cause the next round. For better or worse, this is just how their system releases steam.
The lack of food and water for the masses is an added accelerant this time but you're right. I've watched them protest and get beaten (I trained with their forces in the States when Carter was in office) down and be brutally murdered before and after the 1979 revolution. The entire population today there have little left to lose so I do think it's at the breaking point soon for some sort of change but not for the better unless the mass population is willing to burn it down for a reset to the next stage as the old guys die out but the old crew is still running the show.

https://caspianpost.com/iran/iran-designates-royal-canadian-navy-a-terrorist-organization
 

nsaspook

Joined Aug 27, 2009
16,330
Again, and again and ...

1767370642136.jpeg
https://www.bbc.com/news/live/c8xdxvj2qjdt
Swiss bar fire that killed 40 likely started by sparklers on champagne bottles, officials say

If you're at a indoor party with sparklers, leave asap. If a fire starts, the smoke will knock you down in seconds. You likely won't have the chance to run.
 
Last edited:

cmartinez

Joined Jan 17, 2007
8,768
Pyrotechnics started the ignition. But Bertus is right, that's sound reducing foam material of the same type used in recording studios. It's probably there to improve the room's acoustics.

What draws my attention is how quickly it caught fire. That thing had zero flame retardant in it if I'm not mistaken. And also, it is reported that a series of explosions (or fireballs ... the investigation is ongoing) quickly followed afterwards. I wonder what the cause was.
 

nsaspook

Joined Aug 27, 2009
16,330
Pyrotechnics started the ignition. But Bertus is right, that's sound reducing foam material of the same type used in recording studios. It's probably there to improve the room's acoustics.

What draws my attention is how quickly it caught fire. That thing had zero flame retardant in it if I'm not mistaken. And also, it is reported that a series of explosions (or fireballs ... the investigation is ongoing) quickly followed afterwards. I wonder what the cause was.
Sure, it's always something that burns but it's the smoke that mass kills usually. Backdraft when the doors opened created pressure flame wave front as the fresh oxygen mixes with smoke. It's something we trained for in Navy firefighter school. Stay low and kiss the deck.
 

WBahn

Joined Mar 31, 2012
32,876
And, as usual, there's no shortage of idiots who aren't going to help fight the fire, who aren't going to evacuate a burning building, and who aren't going to get the hell out of the way of the people that are going to fight the fire or are trying to get the hell out of building. But, they can be counted on to pull out there phones and video it in search of that all important viral video they all so desperately want.

In a just world, the only people that died would have been those morons -- and it would have been little more than evolution in action. Unfortunately, there very likely were people that perished or received critical injuries that could have been avoided had the morons just been a bit less moronic.
 

cmartinez

Joined Jan 17, 2007
8,768
From what I heard, most of them were kids ... their lack of experience and situational awareness were a big factor in the outcome, IMHO
 
Top