Loading ...
Sorry, an error occurred while loading the content.

FW: minor JAL simulator bug?

Expand Messages
  • Wouter van Ooijen
    Reported by Erwin de Winter. ... From: Wouter van Ooijen [mailto:wouter@voti.nl] Sent: Wednesday, February 04, 2004 1:34 PM To: Erwin Winter Subject: RE:
    Message 1 of 2 , Feb 4 5:19 AM
    • 0 Attachment
      Reported by Erwin de Winter.

      -----Original Message-----
      From: Wouter van Ooijen [mailto:wouter@...]
      Sent: Wednesday, February 04, 2004 1:34 PM
      To: 'Erwin Winter'
      Subject: RE: minor JAL simulator bug?


      I think you are right. Are you in contact with the sourceforge group?

      Wouter van Ooijen

      -- -------------------------------------------
      Van Ooijen Technische Informatica: www.voti.nl
      consultancy, development, PICmicro products


      > -----Original Message-----
      > From: Erwin Winter [mailto:Erwin.Winter@...]
      > Sent: Wednesday, February 04, 2004 3:11 PM
      > To: wouter@...
      > Subject: minor JAL simulator bug?
      >
      >
      > Hi Wouter,
      >
      > I just reviewed the simulator-code and I stepped over
      > the following strange location:
      >
      > file: jal-0.4.59\jal\simulator.c
      >
      > 107: void instruction_cycle(int n)
      > 108: {
      > 109: while (n > 0) {
      > 110: n--;
      > 111: simulated_instructions++;
      > 112: sim_tmr0_prescaler--;
      > 113: if (sim_tmr0_prescaler == 0) {
      > 114: sim_tmr0_prescaler = sim_tmr0_prescaler_start;
      > 115: sim_tmr0++;
      > 116: if (sim_tmr0 == 0xFF) {
      > 117: sim_tmr0 = 0x00;
      > 118: sim_intcon |= intcon_t0if;
      > 119: sim_check_int = true;
      > 120: }
      > 121: }
      > 122: }
      > 123:}
      >
      > shouldn't line 116 be coded: if (sim_tmr0 > 0xFF) {
      > or if you wan't to keep == : if (sim_tmr0 == 256) {
      >
      > In the above code sim_tmr0 never gets the legal value 0xFF or 255.
      >
      > In my opinion sim_tmr0 must get the 256 different values:
      > 0,1,2...254,255
      > Now when 255 is incremented it must become 0 again
      > AND then the tmr0-overflow bit must be set (which is already correct!)
      >
      > Sincerely yours
      > Erwin Winter
      >
      > PS. My style to code the lines would be:
      >
      > 115: sim_tmr0++;
      > 116: sim_tmr0 %= 256; /* 0,1,..,255,0 */
      > 117: if (sim_tmr0 == 0) { /* now 0, was 255 =>
      > overflow */
      > 118: sim_intcon |= intcon_t0if;
      > 119: sim_check_int = true;
      > 120: }
      >
      >
    • Javier Martínez
      Hi Wouter, OK, I ll add it with Vasile s bug. -- Regards, Javi. www.japus.org El Miércoles, 4 de Febrero de 2004 14:19, Wouter van Ooijen
      Message 2 of 2 , Feb 4 9:03 AM
      • 0 Attachment
        Hi Wouter,

        OK, I'll add it with Vasile's bug.



        --
        Regards,
        Javi.
        www.japus.org



        El Miércoles, 4 de Febrero de 2004 14:19, Wouter van Ooijen
        escribió:
        > Reported by Erwin de Winter.
        >
        > -----Original Message-----
        > From: Wouter van Ooijen [mailto:wouter@...]
        > Sent: Wednesday, February 04, 2004 1:34 PM
        > To: 'Erwin Winter'
        > Subject: RE: minor JAL simulator bug?
        >
        >
        > I think you are right. Are you in contact with the sourceforge
        > group?
        >
        > Wouter van Ooijen
        >
        > -- -------------------------------------------
        > Van Ooijen Technische Informatica: www.voti.nl
        > consultancy, development, PICmicro products
        >
        > > -----Original Message-----
        > > From: Erwin Winter [mailto:Erwin.Winter@...]
        > > Sent: Wednesday, February 04, 2004 3:11 PM
        > > To: wouter@...
        > > Subject: minor JAL simulator bug?
        > >
        > >
        > > Hi Wouter,
        > >
        > > I just reviewed the simulator-code and I stepped over
        > > the following strange location:
        > >
        > > file: jal-0.4.59\jal\simulator.c
        > >
        > > 107: void instruction_cycle(int n)
        > > 108: {
        > > 109: while (n > 0) {
        > > 110: n--;
        > > 111: simulated_instructions++;
        > > 112: sim_tmr0_prescaler--;
        > > 113: if (sim_tmr0_prescaler == 0) {
        > > 114: sim_tmr0_prescaler = sim_tmr0_prescaler_start;
        > > 115: sim_tmr0++;
        > > 116: if (sim_tmr0 == 0xFF) {
        > > 117: sim_tmr0 = 0x00;
        > > 118: sim_intcon |= intcon_t0if;
        > > 119: sim_check_int = true;
        > > 120: }
        > > 121: }
        > > 122: }
        > > 123:}
        > >
        > > shouldn't line 116 be coded: if (sim_tmr0 > 0xFF) {
        > > or if you wan't to keep == : if (sim_tmr0 == 256) {
        > >
        > > In the above code sim_tmr0 never gets the legal value 0xFF or
        > > 255.
        > >
        > > In my opinion sim_tmr0 must get the 256 different values:
        > > 0,1,2...254,255
        > > Now when 255 is incremented it must become 0 again
        > > AND then the tmr0-overflow bit must be set (which is already
        > > correct!)
        > >
        > > Sincerely yours
        > > Erwin Winter
        > >
        > > PS. My style to code the lines would be:
        > >
        > > 115: sim_tmr0++;
        > > 116: sim_tmr0 %= 256; /* 0,1,..,255,0 */
        > > 117: if (sim_tmr0 == 0) { /* now 0, was 255 =>
        > > overflow */
        > > 118: sim_intcon |= intcon_t0if;
        > > 119: sim_check_int = true;
        > > 120: }
        >
        > Yahoo! Groups Links
        >
        > To visit your group on the web, go to:
        > http://groups.yahoo.com/group/Jal_developers/
        >
        > To unsubscribe from this group, send an email to:
        > Jal_developers-unsubscribe@yahoogroups.com
        >
        > Your use of Yahoo! Groups is subject to:
        > http://docs.yahoo.com/info/terms/
      Your message has been successfully submitted and would be delivered to recipients shortly.