Advice needed on SBC

Building your first 6502-based project? We'll help you get started here.
User avatar
floobydust
Posts: 1394
Joined: 05 Mar 2013

Re: Advice needed on SBC

Post by floobydust »

BigDumbDinosaur wrote:
Mike Naberezny wrote:
I had always used UV EPROMs but I tried an EEPROM for the first time when I built the SBC-2.
I continue to use AMD 27C256 EPROMs, which are rated at 55ns, as no EEPROM will keep up with my POC V1 unit at 12.5 MHz. Atmel (aka Microchip) continues to produce an OTP version of the 27C256 in a 45ns rating.
A few years ago, I bought a tube (I think qty. 20) of brand new Atmel AT28C256 EEPROMs in PLCC-32 rated at 70ns. I can't remember if it was Mouser, Digikey or Newark, but it was from one of their normal distributors. I also found an old gold-pinned ceramic adapter in my old stash and soldered one of these on it so I could use it in place of the standard 28-pin DIP version. I've been running this at 12MHz on my earlier dual-board setup. Not the most timing-efficient board setup, as it uses 3-chips for I/O and ROM decode plus memory write qualifications (74HC00, 74HC30, 74HC138). It has been running for a few months non-stop with EhBasic running a looped program (Bill O's Mandelbrot Basic program).

I also picked up some 70ns Atmel pieces in DIP-28 a while back from UtSource.... they do work, but I've not actually tried one in the 12MHz board setup yet.... I probably should, as it should verify if they are really 70ns parts. I have found the Atmel parts are pretty conservative on ratings... I've been running several of their 150ns EEPROMs with a 10MHz clocked CPU for several years now without a single glitch. Of course, your mileage may vary...
User avatar
Floopy
Posts: 40
Joined: 26 Jul 2018

Re: Advice needed on SBC

Post by Floopy »

I finally got another set of probes for my logic analyzer. I was going to test them out on one of my boards but when I read the data nothing seemed right. I messed around for about 2 hours before I started the question the working state of the computer. Anyway, when I swapped out the 65C02 it seemed to work? I'm just running a loop. The analyzer triggers after the reset.

Code: Select all

*$8000 
8000 LDA #50
8002 JMP $8000
END
Very simple, when I use the suspicious processor it first looks at $FFFA then $FFFB (I have $8000 written in) then it jumps to $8002 and after that I'm not sure what it's thinking.

I attached a very crude capture of the screen. (it's not great) The top capture one is the working processor.

What's happening? Did I blow it, I'm usually cautious of static discharge? Side question; does anyone else have a Tektronix 1240 or 1241? I'm having problems using the disassembly cartridge. It's a bit disappointing, these cost 7$ a piece and with my salary I count every penny!
Attachments
Capture.JPG
-Floopy
Chromatix
Posts: 1462
Joined: 21 May 2018

Re: Advice needed on SBC

Post by Chromatix »

Looks to me as though A1 is stuck high on the "bad" CPU. The first few cycles show it low, but once it goes high, it stays there. That could indicate the low-side pin driver is blown.
User avatar
Floopy
Posts: 40
Joined: 26 Jul 2018

Re: Advice needed on SBC

Post by Floopy »

Chromatix wrote:
Looks to me as though A1 is stuck high on the "bad" CPU. The first few cycles show it low, but once it goes high, it stays there. That could indicate the low-side pin driver is blown.
What a shame :( I'll have to be more careful bout static discharge probably. These are so fragile.

I'm working on writing some 1602 LCD routines. It's so much different to program. Different way of thinking and organizing. It's very easy to make mistakes. That's why I'm using the LA to follow the program. I only do it when all else seems lost though because running through lots of hexadecimal numbers is not my cup of tea. (Ah it need to be an 8 not a 0)
I only have NMOS 6502s left. Good thing I put a jumper on the board to select between the two.
-Floopy
Chromatix
Posts: 1462
Joined: 21 May 2018

Re: Advice needed on SBC

Post by Chromatix »

I also think A2 is stuck low. See how the $FFFF near the top turns into $FFFB, and the Reset vector pull is from the wrong pair of addresses for A1 to be the only faulty line.

So another plausible root-cause is due to shorting A1 and A2 together while one was driving high and the other low.
User avatar
Floopy
Posts: 40
Joined: 26 Jul 2018

Re: Advice needed on SBC

Post by Floopy »

Chromatix wrote:
I also think A2 is stuck low. See how the $FFFF near the top turns into $FFFB, and the Reset vector pull is from the wrong pair of addresses for A1 to be the only faulty line.

So another plausible root-cause is due to shorting A1 and A2 together while one was driving high and the other low.
Maybe when I was hooking it up the LA (over 29 input lines are needed for disassembly). The data/address pins are all connected to a single header.
-Floopy
User avatar
Floopy
Posts: 40
Joined: 26 Jul 2018

Re: Advice needed on SBC

Post by Floopy »

BigDumbDinosaur wrote:
Floopy wrote:
Anyone have recommendations for writing programs?
The Kowalski 65C02 editor/assembler/simulator is what I use.
So I got tired of rewriting everything by hand and I thought I would give the assembler a go. I'm a bit confused on the syntax though. Is there a document explaining how the syntax works? I've never used an assembler of any kind. This isn't my field of expertise.

For example, I'd like to define the variables to be in a specific area of memory.
-Thanks!
-Floopy
Chromatix
Posts: 1462
Joined: 21 May 2018

Re: Advice needed on SBC

Post by Chromatix »

The general idea is to assign constants (or labels, which amount to the same thing) with the addresses of your variables. You can then use them in place of literal addresses.

The special label * refers to the current point of assembly. You can assign to * in order to start laying down code at a specific place. Other labels are defined by placing them in the code, starting in the first column. Actual instructions should have whitespace before them, and appear one per line.

The 6502 has a number of different addressing modes, which each have a distinctive syntax which follows the instruction mnemonic. Immediates are prefixed with #, indirections are surrounded by brackets, and indexes are indicated by a comma followed by the index register name. Zero-page is automatically selected for addresses that fit in one byte, versus absolute for two-byte addresses.

Once you have those basics down, look into macros.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8774
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: Advice needed on SBC

Post by GARTHWILSON »

Floopy wrote:
For example, I'd like to define the variables to be in a specific area of memory.
I'm not familiar with the Kowalski assembler; but assemblers normally have some way to ORG (ie, set the ORiGin, ie, where you begin laying down code, data, or assigning variables), which takes care of what you're saying. You can use the ORG directive as many times as you want. It's not just a one-time thing. Also, if you want to force a variable to be at a particular exact address, you can make it an equate. For example if you want variable FOOBAR to be at address $001A, you can have a line that says something like

Code: Select all

FOOBAR:  EQU  $1A
and then if you do for example LDA FOOBAR, it will lay down A5 1A (load accumulator with the contents found at address $1A in ZP).

A good macro assembler has way more capability and flexibility than you probably imagine, and removes all kinds of anticipated barriers.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
User avatar
Floopy
Posts: 40
Joined: 26 Jul 2018

Re: Advice needed on SBC

Post by Floopy »

Wow thanks! .ORG, I'm also using the document on http://exifpro.com/utils.html as a reference. I think I've got it figured out, it's really nice! It's nice to see the explanation to the instructions show up as I type them.
-Floopy
User avatar
BigDumbDinosaur
Posts: 9428
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Advice needed on SBC

Post by BigDumbDinosaur »

Chromatix wrote:
...indirections are surrounded by brackets...
You mean parentheses, such as LDA (PTR1),Y.

In 65C816 assembly language, brackets are used to denote long indirections, such as LDA [PTR1],Y. In this case, PTR1 is assumed to contain a 24-bit address in little endian format.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
BigDumbDinosaur
Posts: 9428
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Advice needed on SBC

Post by BigDumbDinosaur »

Floopy wrote:
Wow thanks! .ORG, I'm also using the document on http://exifpro.com/utils.html as a reference.
Note, however, that the version of the Kowalski simulator at that site is out-of-date.
Quote:
I think I've got it figured out, it's really nice! It's nice to see the explanation to the instructions show up as I type them.
If you search forum posts for Kowalski you will turn up additional information. For example, here's a list of assembler pseudo-ops (aka directives) you can use:

Code: Select all

IO_AREA           ;define console I/O area address
.ASCII .BYTE .DB  ;define static data, e.g., strings, tables, etc.
.ASCIS            ;like .BYTE, but EOS defined with bit 7 set
.DBYTE .DD        ;assembles big-endian word
.DCB              ;equivalent to *=*+N, where N is arg to .DCB,...
                  ;w/optional initialization pattern, e.g., .DCB 10,$FF
.DS .RS           ;equivalent to *=*+N, where N is arg to .DS
.DW .WORD         ;assembles little-endian word
.ELSE             ;conditional assembly directive
.END              ;marks end of source file, optional
.ENDIF            ;marks end of conditional assembly
.ENDM             ;marks end of macro definition
.ENDR             ;marks end of repeated text
.ERROR            ;emits error message & halts assembly
.EXITM            ;halt continued macro expansion
.IF               ;start conditional assembly
.INCLUDE          ;insert contents of named source file
.IO_WND           ;define I/O window size (cols, rows)
.MACRO            ;marks start of macro definition
.OPT              ;set assembly options
.ORG              ;set start of assembly address, also * = <addr>
.PARAMTYPE        ;determine macro parameter type
.REF              ;determine if label/symbol was defined
.REPEAT .REPT     ;repeat following text N times
.ROM_AREA         ;set write-protected address range
.SET              ;(re)defines variable value, e.g., .SET .=
.START            ;sets simulator start of execution
.STR .STRING      ;generates text string, 1st byte is length (0-255)
.STRLEN           ;determines macro parameter string length
Incidentally, you can set the assembler's program counter with .ORG or with *=. You can also use *=*+N to advance the program counter, where N is the number of bytes to advance. Similarly, *=*-N works in reverse.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
BigDumbDinosaur
Posts: 9428
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Advice needed on SBC

Post by BigDumbDinosaur »

GARTHWILSON wrote:
Also, if you want to force a variable to be at a particular exact address, you can make it an equate. For example if you want variable FOOBAR to be at address $001A, you can have a line that says something like

Code: Select all

FOOBAR:  EQU  $1A
and then if you do for example LDA FOOBAR, it will lay down A5 1A (load accumulator with the contents found at address $1A in ZP).
In the Kowalski assembler, that would be written as:

Code: Select all

FOOBAR    =$1a
Note that the assembler requires that all labels and symbols start in the first column. Everything else must start in column two or beyond.

You might also find reference to the following useful.

Code: Select all

	.opt proc65c02,caseinsensitive
;KOWALSKI ASSEMBLER LOGICAL, BITWISE & ARITHMETIC OPERATORS
;
;
;	number radices...
;
;	    @	  binary, e.g., @01011010
;	    $	  hex, e.g., $5a
;	    none  decimal
;
test0001 =@00001111
test0002 =test0001 << 4        ;logical shift left 4 bits
test0003 =test0002 >> 4        ;logical shift right 4 bits
test0004 =test0001 & test0002  ;bitwise AND
test0005 =test0001 | test0002  ;bitwise OR
test0006 =test0001 && test0002 ;logical AND
test0007 =test0001 || test0002 ;logical OR
test0008 =!0                   ;bitwise NOT
test0009 =$5a ^ test0005       ;bitwise XOR
test0010 =4 == 3               ;equality test
test0011 =4 == 4               ;equality test
test0012 =4 != 3               ;inequality test
test0013 =4 != 4               ;inequality test
test0014 =4 > 3                ;greater-than test
test0015 =4 < 3                ;lesser-than test
test0016 =~1                   ;2s complement
;
;
;	arithmetic operators...
;
;	    +	addition
;	    -	subtraction
;	    *	multiplication
;	    /	division
;	    %	modulo
;
sum      = 5   + 6             ;evaluates to 11
diff     = sum - 6             ;evaluates to 5
prod     = 5   * 6             ;evaluates to 30
quot     =prod / diff          ;evaluates to 6
mod      =prod % sum           ;evaluates to 8
;
;
;	example using square brackets to alter evaluation precedence...
;
test0017 =5 + 6 * 2            ;evaluates to 17
test0018 =[5 + 6] * 2          ;evaluates to 22
;
	.end
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
Floopy
Posts: 40
Joined: 26 Jul 2018

Re: Advice needed on SBC

Post by Floopy »

A bit of an update:
Balancing projects and college is an interesting experience. I got into electronics because it looked like a great side hobby, but now it's eating more and more time. Although I don't regret it!

I had a few 1602 LCDs lying around and I thought it would be nice to be able to display text. I wrote a few routines to take care of the interfacing and it works great!
I just had some issues with the timing on the LCD. I also had some issues in my "delay" routine. Thank fully I finally got the disassembly software to work on my logic analyzer and it helped track down the bug. Although now my SBC looks like it's on life-support.

I'm currently running the LCD with an 8 bit data bus and 3 extra lines for the control pins. If I could reduce it down to just 4 bit (send two 4 bit instructions instead of one 8 bit) then I could use the extra I/O on the VIA for exterior control.

Thank you all for the information, I wouldn't be here without any of you!
Attachments
100_0629.JPG
-Floopy
User avatar
Michael
Posts: 633
Joined: 13 Feb 2013
Location: Michigan, USA

Re: Advice needed on SBC

Post by Michael »

Floopy wrote:
... I'm currently running the LCD with an 8 bit data bus and 3 extra lines for the control pins. If I could reduce it down to just 4 bit (send two 4 bit instructions instead of one 8 bit) then I could use the extra I/O on the VIA for exterior control.
Have you considered using an LCD "Backpack"? The PCF8574 based I2C backpacks work well, too.
Attachments
K8LH 2-Pin Backpacks.png
3-Pin 74HC595 LCD 8-Bit Mode Backpack.jpg
Post Reply