gnupic: Bug in sumlation of BSF instruction in GPSIM?


Previous by date: 17 Sep 2000 10:28:35 -0000 GPASM - problem with building of COD file for many source files, Wojtek Zabolotny
Next by date: 17 Sep 2000 10:28:35 -0000 Re: Bug in sumlation of BSF instruction in GPSIM?, Scott Dattalo
Previous in thread:
Next in thread: 17 Sep 2000 10:28:35 -0000 Re: Bug in sumlation of BSF instruction in GPSIM?, Scott Dattalo

Subject: Bug in sumlation of BSF instruction in GPSIM?
From: Wojtek Zabolotny ####@####.####
Date: 17 Sep 2000 10:28:35 -0000
Message-Id: <20000917122002.A601@wzab.nasz.dom>

Hi All,

I've just stated that GPSIM has problems with simulation of BSF instruction
on ports which are partially configured as inputs, and partially as outputs.
I've attached the simplest source which demonstrates the problem.
Port C bits [0..5] are outputs, [6,7] are inputs.
The BSF PORT C,5 instruction reads 0x1f (correctly) and writes back 0x20
(incorrectly). MPLAB simulates this example correctly.

Below is the output of GPSIM session:

gpsim - the GNUPIC simulator
version: 0.20.2


type help for help
gpsim> 
gpsim> Loading /home/wzab/photohd/asm/demo1.cod
processing cod file /home/wzab/photohd/asm/demo1.cod
directory is "/home/wzab/photohd/asm"
filename is "demo1.cod"
 f877 create 
 f874 create 
 setting cfg_word and cfg_modes ffff  1
 setting cfg_word and cfg_modes 3f3a  0
 --- Reset
16F877  0x0000  0x2840  goto	0x0040
  cycle: 0x01
  cycle: 0x02
16F877  0x0040  0x30FF  movlw	0xff
  wrote: 0xff to W
  cycle: 0x03
16F877  0x0041  0x0087  movwf	portc
   read: 0xff from W
  wrote: 0x00 to portc
  cycle: 0x04
16F877  0x0042  0x1683  bsf	status,5
   read: 0x18 from status
  wrote: 0x38 to status
  cycle: 0x05
16F877  0x0043  0x30C0  movlw	0xc0
  wrote: 0xc0 to W
  cycle: 0x06
16F877  0x0044  0x0087  movwf	trisc
   read: 0xc0 from W
  wrote: 0x3f to portc
  wrote: 0xc0 to trisc
  cycle: 0x07
16F877  0x0045  0x1283  bcf	status,5
   read: 0x38 from status
  wrote: 0x18 to status
  cycle: 0x08
16F877  0x0046  0x1687  bsf	portc,5
   read: 0x3f from portc
  wrote: 0x20 to portc
  cycle: 0x09
16F877  0x0047  0x2847  goto	0x0047
  cycle: 0x0a
  cycle: 0x0b

-- 
			Greetings
			Wojciech Zabolotny
			http://www.ise.pw.edu.pl/~wzab

When buying hardware, ask the dealer if it is Open Source friendly!!!
http://www.openhardware.org

	list      p=16f877            ; list directive to define processor

	include "p16f877.inc"

 __CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_OFF & _HS_OSC & _WRT_ENABLE_ON & _LVP_OFF & _DEBUG_OFF & _CPD_OFF 

		ORG     0x000             ; processor reset vector
		goto main
		
		org 0x40
main		movlw	0xff
		movwf	PORTC
		bsf	STATUS,RP0
		movlw	b'11000000'
		movwf   TRISC
		bcf	STATUS,RP0
		bsf	PORTC,5
loop		goto 	loop
		end

Previous by date: 17 Sep 2000 10:28:35 -0000 GPASM - problem with building of COD file for many source files, Wojtek Zabolotny
Next by date: 17 Sep 2000 10:28:35 -0000 Re: Bug in sumlation of BSF instruction in GPSIM?, Scott Dattalo
Previous in thread:
Next in thread: 17 Sep 2000 10:28:35 -0000 Re: Bug in sumlation of BSF instruction in GPSIM?, Scott Dattalo


Powered by ezmlm-browse 0.20.