6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Tue Jun 25, 2024 11:08 pm

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: 65org16 Assembler
PostPosted: Sun Nov 24, 2013 1:01 am 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 899
I am mulling over an FPGA design that would support 65org16. As part of 'due diligence' I started locating the tools, the assembler being the first. I had a hard time tracking down the links from previous discussions. ElEctric_EyE suggested that I start a new thread.

BigEd's thread http://forum.6502.org/viewtopic.php?f=2&t=1851 is a good starting point, but
-HXA page has no mention of 65org16 and is for Windows only (I am running Linux);
-dev65 requires a pre-release patch?
-py65 is a simulator, not an assembler;
-BigEd's assembler/simulator is great, but not a command-line tool;
-where is the patch for David Beasley's asm6502.py?

So my options are a lot more limited than I thought.

ElEctric_EyE suggested bitwise's As65 and an assembler from teamtempest. May I have some links?

Any help is greatly appreciated.
=============================================================
REPLY SUMMARY
I got hxa to work for linux. Recipe here: http://forum.6502.org/viewtopic.php?f=10&t=2783#p30554
ElEctric_EyE uses Bitwise's As65 in Windows with some extras provided for download herehttp://forum.6502.org/viewtopic.php?f=10&t=2783#p30556

_________________
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut


Last edited by enso on Mon Nov 25, 2013 10:36 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: 65org16 Assembler
PostPosted: Sun Nov 24, 2013 2:26 am 
Offline

Joined: Mon Mar 02, 2009 7:27 pm
Posts: 3258
Location: NC, USA
This thread deserves your full attention Bitwise and teamtempest have generously posted links to their 65Org16 assemblers there.

_________________
65Org16:https://github.com/ElEctric-EyE/verilog-6502


Top
 Profile  
Reply with quote  
 Post subject: Re: 65org16 Assembler
PostPosted: Sun Nov 24, 2013 2:41 am 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 899
I was hoping for a few quick links... That thread has already eaten up a lot of my time...

EDIT

Actually, that thread (and its branches) may have made more sense in real time to a dedicated 65org16 user. I will surely read every line at some point in the near future. In the meantime, I am just trying to implement the basic A core.

So please, can someone point me to an assembler that works from a linux command line? Hopefully without making me sweat for a few days getting it to work. If not I'll have to roll my own...

_________________
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut


Top
 Profile  
Reply with quote  
 Post subject: Re: 65org16 Assembler
PostPosted: Sun Nov 24, 2013 6:34 am 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 899
Update: hxa seems to work in linux under wine. Here is a quickstart guide I wish I'd found an hour ago:

-Unzip to your home directory.
-Create a test directory. From the hxa distro DEMO directory, copy the following into your test directory:
--- DEMO040.A
--- I6502.A
---Create a Makefile along the lines of:
Code:
test.bin: test.hxa
   wine Z:/home/enso/hxa0201w/HXA_TW.exe DEMO040.A

---Modify the source file to contain something like this for output files
Code:
        .listfile "test.lst"
        .errfile "test.err"
        .objfile  "test.obj"

hxa tends to capitalize your filenames.
Once that works, you are in business.

_________________
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut


Last edited by enso on Thu Dec 05, 2013 11:09 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: 65org16 Assembler
PostPosted: Sun Nov 24, 2013 1:55 pm 
Offline

Joined: Mon Mar 02, 2009 7:27 pm
Posts: 3258
Location: NC, USA
Ok, I wanted to see how you would progress before I told you how I program the 65Org16.b softcore using the FPGA blockRAM. Indeed, this is how one can do it from scratch step by step, but I use Bitwise's As65 on a WinXP SP3 machine and using a tool Arlet provided. I will provide them here I hope he doesn't mind!

1) Download As65: http://www.obelisk.demon.co.uk/files/65016.zip
2) In the 65o16 folder, open the Makefile and modify it into something like mine below. I modified the extension from .ink to .txt so I could upload it. Change it back to .ink.
3) Download Arlet's bin2hex & bin2coe and place them inside the 65O16 folder. I modifed the extension from .exe to .txt. Change them back to .exe.
4) Download the 65Org16.b Macro's from Github and paste them into the boot.asm file like in my example below.
5) Write your assembly, open up the command prompt window, change directory to the 65O16 folder and type in 'nmake'. This will create the boot.hex & boot.coe files needed for Xilinx ISE.

I only perform the last step when writing my programs. Everything else is one time only!

EDIT: I almost forgot the Verilog code for the ROM has to include the location like such. You can see ISE only uses the .coe file, but alot of EEPROM programmers use the .hex:
Code:
//4Kx16 ROM, i.e. initialized FPGA blockRAM
`timescale 1ns / 1ps

module ROM ( input clk,
             input rst,
             input [11:0] addr,
             output reg [15:0] dout
             );

reg [15:0] RAM [4095:0];

initial $readmemh("C:/65016PVBRAM2/boot.coe",RAM,0,4095);

always @(posedge clk)
   if (rst)
      dout <= 0;
      else
         dout <= RAM[addr];
               
endmodule


Attachments:
boot.asm [740.3 KiB]
Downloaded 80 times
bin2hex.txt [23.31 KiB]
Downloaded 94 times
bin2coe.txt [23.14 KiB]
Downloaded 91 times
File comment: Makefile.ink
Makefile.txt [2.09 KiB]
Downloaded 99 times

_________________
65Org16:https://github.com/ElEctric-EyE/verilog-6502
Top
 Profile  
Reply with quote  
 Post subject: Re: 65org16 Assembler
PostPosted: Sun Nov 24, 2013 5:16 pm 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 899
Thanks. My workflow is slightly different - I don't use the 'coe' files and patch the bitstream directly with data2mem (from Xilinx), picoblaze style. When I work on just the bootloader code, the entire makefile runs in less then 3 seconds, including configuring the FPGA.

I made modifications to bin2mem to convert a binary file to a 16-bit .mem file suitable for 'data2mem'. I think it is originally written by Michael. Here it is:
Attachment:
bin2mem16.src.zip [1.12 KiB]
Downloaded 84 times


My Makefile, ripped from the CHOCHI bitstream makefile deals with the assembler output like this:
Code:
        bin2mem16 boot.bin boot.mem
   data2mem -bm ../bootload/bram.bmm -bd ../bootload/boot.mem -bt top.nocode.bit -o b top.bit


Basically, this injects the assembled code into a 'blank BRAM' bitstream called 'top.nocode.bit' using specifications in 'bram.bmm' and binary code in 'boot.bin'.

I am happy to have two assembler options. Now I only the darned LED would start blinking!

_________________
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut


Top
 Profile  
Reply with quote  
 Post subject: Re: 65org16 Assembler
PostPosted: Sun Nov 24, 2013 5:32 pm 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 899
I just realized that I need stack RAM in page 1, presumably starting at 1FFFF. Does the stack pointer get initialized there?

I am only using the low 16 address lines, so the stack writes on initialization (I think?) will overwrite the vectors... Nothing is quick and easy...

_________________
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut


Top
 Profile  
Reply with quote  
 Post subject: Re: 65org16 Assembler
PostPosted: Sun Nov 24, 2013 5:56 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10834
Location: England
I think the stack pointer isn't initialised (or is zero) but also there are no pushes during reset. So, your bootup sequence ought to initialise the stack fairly early.

(Glad you found fixes to both the assembler stories. If you chmod +x the *.exe, and have it in a dir which is on your PATH, you shouldn't need the "wine" prefix for HXA. Perhaps we need a simple recipe to install into /usr/local/bin or /opt/hxa)

Cheers
Ed


Top
 Profile  
Reply with quote  
 Post subject: Re: 65org16 Assembler
PostPosted: Sun Nov 24, 2013 7:03 pm 
Offline

Joined: Mon Mar 02, 2009 7:27 pm
Posts: 3258
Location: NC, USA
Are you using the .b core? If you are, there is a 'REGFILE_INIT.COE' file the cpu looks for to initialize the registers including the stack. It goes in your Xilinx project folder.
I will have to inquire about your method of programming the FPGA later!


Attachments:
REGFILE_INIT.txt [193 Bytes]
Downloaded 79 times

_________________
65Org16:https://github.com/ElEctric-EyE/verilog-6502
Top
 Profile  
Reply with quote  
 Post subject: Re: 65org16 Assembler
PostPosted: Sun Nov 24, 2013 7:17 pm 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 899
No, I am using BigEd's core to start with...

I am going to start a new thread as the assembler is no longer an issue...

_________________
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 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: