6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 11:23 am

All times are UTC




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Visual 6502 Bug
PostPosted: Sat Jul 27, 2013 10:26 pm 
Offline

Joined: Tue Dec 25, 2007 4:57 am
Posts: 109
Sometimes, I clock several transistors and wrong data is shown on the screen. For example, I click t1606. The t1606 displays, “transistor: t1606 on node: 693 A+B0”. Move your mouse pointer toward to the edge of node 1348, t1606, and node #aluresult0 (957) and the location displays, “1381 op-T3-jmp”. I did notice some transistors when I was working to group some of them.

Take care,
Bryan Parkoff


Top
 Profile  
Reply with quote  
 Post subject: Re: Visual 6502 Bug
PostPosted: Sun Jul 28, 2013 5:02 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
I can't reproduce this. A screenshot showing the exact cursor location might help. I'm using Chrome: knowing your browser, and the magnification/zoom factor you have set for the page might help.
Cheers
Ed


Top
 Profile  
Reply with quote  
 Post subject: Re: Visual 6502 Bug
PostPosted: Sun Jul 28, 2013 9:25 pm 
Offline

Joined: Tue Dec 25, 2007 4:57 am
Posts: 109
BigEd wrote:
I can't reproduce this. A screenshot showing the exact cursor location might help. I'm using Chrome: knowing your browser, and the magnification/zoom factor you have set for the page might help.


Hi, Ed

I use Internet Explorer 10. Visual 6502 works fine on version 10 of Internet Explorer, but it will not work on earlier version. The Java script is included in this version 10. I have been using Internet Explorer without any problems for many months. Move your mouse pointer on the yellow node. If yellow node becomes white. Move your mouse pointer to another node and click it before move it back to the previous node. Try to make sure the current node should not become white while it remains yellow. Move it around between yellow node, red transistor, and white bus (alu result0). You will see the incorrect message.

Look at my screen shot. I am unable to capture my mouse pointer when I press print screen key. It will disappear. I redrew it back on the screenshot. Move your mouse pointer up about 5 pixels and right about 3 pixels. Another incorrect message is, "node: 950 op-T+-cpx/cpy-abs". Move your mouse pointer below the white bus (alu result0) on the same yellow node.

Take care,
Bryan Parkoff


Attachments:
Visual 6502 Bug.png
Visual 6502 Bug.png [ 893.79 KiB | Viewed 780 times ]
Top
 Profile  
Reply with quote  
 Post subject: Re: Visual 6502 Bug
PostPosted: Mon Jul 29, 2013 4:31 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
It's pretty likely that this bug is specific to IE10 - which I don't have, so I can't investigate. Visual6502 uses an unusual technique to determine which node you clicked on - see the function setupHitBuffer - it stores the nodeid in the colour of shapes in a hidden layer. Any antialiasing (or scaling) performed on that hidden layer will cause a problem.

If you have trouble, I recommend using Chrome, which is available for all platforms and which we will aim to keep working.

Sorry
Ed


Top
 Profile  
Reply with quote  
 Post subject: Re: Visual 6502 Bug
PostPosted: Mon Jul 29, 2013 5:20 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8509
Location: Midwestern USA
Bryan Parkoff wrote:
I use Internet Explorer 10.

That explains a lot. Wise owls don't use Internet Exploder. It's a lame browser that lacks W3C compliance and is a gateway for all sorts of computer diseases.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: Visual 6502 Bug
PostPosted: Tue Jul 30, 2013 4:41 am 
Offline

Joined: Tue Dec 25, 2007 4:57 am
Posts: 109
BigDumbDinosaur wrote:
Bryan Parkoff wrote:
I use Internet Explorer 10.

That explains a lot. Wise owls don't use Internet Exploder. It's a lame browser that lacks W3C compliance and is a gateway for all sorts of computer diseases.


Well, I choose to use Internet Explorer 10 because I use high contrast. Of course, Chrome has high contrast feature. Unfortunately, not all high contrast will work on some websites when some images such as buttons and links do not show up. Internet Explorer 10 has same problem with high contrast. It is what I need to work Visual 6502 on Internet Explorer 10 due to limited option.

I am able to reproduce decimal mode bug in Visual 6502. I am not talking about invalid N flag, V flag, and Z flag. Let me demonstrate how I can do that.

SED
SEC
LDA #25
SBC #07

You will get the value: 1E instead of 18.

SED
SEC
LDA #25
SBC #05

You will get correct value: 20.

I wonder why anyone claim that real 6502 chip never reproduce decimal mode bug, but Visual 6502 did show it.

I finish analyzing ALU's binary mode. I begin to study decimal mode before I will be able to explain why decimal mode has bug. I already wrote my C++ source code several years ago when I was able to reproduce bugs in both decimal mode and invalid flags.

Take care,
Bryan Parkoff


Top
 Profile  
Reply with quote  
 Post subject: Re: Visual 6502 Bug
PostPosted: Tue Jul 30, 2013 6:31 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Hi Bryan
for the decimal subtraction, I wonder if you arranged for the literal values to be hex? To subtract decimal 7 from decimal 25, you need encode them in BCD, which means they are hex $07 and $25 - and the result should be, and is, $18 hex. That's decimal 18, encoded in BCD.

Here's the check I did:
http://visual6502.org/JSSim/expert.html ... 7&steps=20
and here's the program:
Code:
$0600    f8        SED
$0601    38        SEC
$0602    a9 25     LDA #$25
$0604    e9 07     SBC #$07


Cheers
Ed


Top
 Profile  
Reply with quote  
 Post subject: Re: Visual 6502 Bug
PostPosted: Tue Jul 30, 2013 10:27 pm 
Offline

Joined: Sun Nov 08, 2009 1:56 am
Posts: 411
Location: Minnesota
Code:
SED
SEC
LDA #25
SBC #07

You will get the value: 1E instead of 18.


I haven't tried it myself, but that seems odd. In decimal mode the result should be BCD, and 'E' is not a valid BCD character.

Anyway, if the arguments are in decimal, in hexadecimal they would be

Code:
SED
SEC
LDA #$19
SBC #$07


which is valid BCD. You should get $12 as a result.


Top
 Profile  
Reply with quote  
 Post subject: Re: Visual 6502 Bug
PostPosted: Tue Jul 30, 2013 11:31 pm 
Offline

Joined: Tue Dec 25, 2007 4:57 am
Posts: 109
teamtempest wrote:
Code:
SED
SEC
LDA #25
SBC #07

You will get the value: 1E instead of 18.


I haven't tried it myself, but that seems odd. In decimal mode the result should be BCD, and 'E' is not a valid BCD character.

Anyway, if the arguments are in decimal, in hexadecimal they would be

Code:
SED
SEC
LDA #$19
SBC #$07


which is valid BCD. You should get $12 as a result.


Well, Ed is correct. "decimal mode" and "decimal value" are different meaning. I must think about "hexadecimal value". If decimal mode is turned off, you will get hexadecimal value and you can convert from hexadecimal value into decimal value. If decimal mode is turned on, you still use hexadecimal value as long as hexadecimal value is treated as decimal value and you don't need to convert from hexadecimal value into decimal value because both hexadecimal value and decimal value are identical.

When I test Visual 6502, I thought hexadecimal value is supposed to be adjusted in the ALU register by adding or subtracting 6 on depend if you select ADC or SBC instruction. I made mistake. I did not realize that ALU register is always in binary mode. The hexadecimal value needs to be transferred from ALU register into special bus before decimal mode can adjust hexadecimal value and store it into accumulator register.

Ed agrees what I have said.

Take care,
Bryan Parkoff


Top
 Profile  
Reply with quote  
 Post subject: Re: Visual 6502 Bug
PostPosted: Wed Jul 31, 2013 12:45 am 
Offline
User avatar

Joined: Mon Apr 23, 2012 12:28 am
Posts: 760
Location: Huntsville, AL
Brian:

The contents of the registers are always treated by the 6502 as binary numbers.

In decimal mode, the sum or difference is adjusted when appropriate comparisons are made in each nibble of the magnitudes and carrys/borrows of the partial binary result. In other words, the Decimal mode interjects an independent adjustment to each nibble based on whether the operation is adc/sbc, there is a carry out of the nibble, and the value of the nibble is greater than 9. Also keep in mind that decimal mode only applies to ADC/SBC. The increment and decrement instructions are always binary mode operations regardless of the value of the Decimal mode flag.

I have implemented the BCD mode in my M65C02 core, and I use several small ROMs to perform the adjustments. For ADC, I adjust the partial sum (binary sum) by 0x00, 0x06, 0x60, or 0x66 depending of the digit values and the nibble carrys. Similarly, for SBC, I adjust the partial difference (binary difference) by 0x00, 0xFA, 0xA0, or 0x9A depending of the digit values and the nibble borrows. Notice that my adjustment factors for SBC are not exactly the 1's Complement of the adjustment factors for ADC.

In either case, the first result must be considered as binary, and it's only after the second addition using the first result and the previously given adjustment factors that the final result is available with BCD encoding restored to each of the nibbles. An interesting issue occurs if a decimal mode ADC/SBC on the accumulator is followed by an INC/DEC instruction. The BCD normalization of the accumulator is potentially destroyed by binary mode increment/decrement instruction.

I would be curious to see a description (or schematic) of this process as it implemented in the 6502.

_________________
Michael A.


Top
 Profile  
Reply with quote  
 Post subject: Re: Visual 6502 Bug
PostPosted: Wed Jul 31, 2013 1:18 am 
Offline

Joined: Tue Dec 25, 2007 4:57 am
Posts: 109
MichaelM wrote:
I would be curious to see a description (or schematic) of this process as it implemented in the 6502.


Hi Michael,

Thanks for an explanation. First step, I examine and identify each transistor. I put them into Microsoft Access. Second step, I use query to group some transistors. Third step, when I finish analyze all group of transistors, I will be ready to redraw ALU and decimal mode schematic.

A lot of work to do.

Take care,
Bryan Parkoff


Top
 Profile  
Reply with quote  
 Post subject: Re: Visual 6502 Bug
PostPosted: Wed Jul 31, 2013 1:23 am 
Offline
User avatar

Joined: Mon Apr 23, 2012 12:28 am
Posts: 760
Location: Huntsville, AL
Look forward to seeing your results.

_________________
Michael A.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: