Difference between revisions of "CSC270 Assembling 6800 Assembly Programs on OSX/Windows"

From dftwiki3
Jump to: navigation, search
(Testing the Installation)
(Installation on Mac OSX)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
--[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 10:59, 19 March 2016 (EDT)
 
--[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 10:59, 19 March 2016 (EDT)
 
----
 
----
 +
<br />
 +
{|
 +
|
 +
__TOC__
 +
|
 
<bluebox>
 
<bluebox>
 
These instructions will allow you to install TASM, the Turbo Assembler, on your OSX/Windows machine, and generate listings of 6800 assembly programs.
 
These instructions will allow you to install TASM, the Turbo Assembler, on your OSX/Windows machine, and generate listings of 6800 assembly programs.
 
</bluebox>
 
</bluebox>
 +
|}
 
<br />
 
<br />
 
=Installation on Windows=
 
=Installation on Windows=
Line 9: Line 15:
 
* To download TASM, go to [http://trimtab.ca/2010/tech/tasm-5-intel-8086-turbo-assembler-download/ this page], and go to the end of the page, to find the [http://trimtab.ca/assets/files/tasm.zip download link].
 
* To download TASM, go to [http://trimtab.ca/2010/tech/tasm-5-intel-8086-turbo-assembler-download/ this page], and go to the end of the page, to find the [http://trimtab.ca/assets/files/tasm.zip download link].
 
* Follow the directions to install TASM.  You won't need TLINK or any of the other executables for CSC270.
 
* Follow the directions to install TASM.  You won't need TLINK or any of the other executables for CSC270.
* Jump to the subsection below on testing your installation.
+
* Jump to the subsection below on [[CSC270_Assembling_6800_Assembly_Programs_on_OSX/Windows#Testing_the_Installation| testing your installation.]]
 
<br />
 
<br />
 +
 
=Installation on Mac OSX=
 
=Installation on Mac OSX=
 
<br />  
 
<br />  
* If you haven't already done so, you will need to install '''wine''', which is a Windows Emulator for the Mac, and will allow you to run a large number of Windows programs on your Mac.  This [http://www.davidbaumgold.com/tutorials/wine-mac/ page] has instructions on how to install '''wine'''.  There are other tutorials on the Web, if this one doesn't work for you.
+
* If you haven't already done so, you will need to install '''wine''', which is a Windows Emulator for the Mac, and will allow you to run a large number of Windows programs on your Mac.  You have several options:
 +
::* The fastest option is probably to get a disk image from [https://sourceforge.net/projects/darwine/ this site]
 +
::* If that doesn't work for you, then this other [http://www.davidbaumgold.com/tutorials/wine-mac/ page] has longer instructions on how to install '''wine'''.  Installing with [http://brew.sh/ brew] or with [https://www.macports.org/ MacPorts] is also a possibility, although a potentially hairy experience...
 
* To download TASM, go to [http://trimtab.ca/2010/tech/tasm-5-intel-8086-turbo-assembler-download/ this page], and go to the end of the page, to find the [http://trimtab.ca/assets/files/tasm.zip download link].
 
* To download TASM, go to [http://trimtab.ca/2010/tech/tasm-5-intel-8086-turbo-assembler-download/ this page], and go to the end of the page, to find the [http://trimtab.ca/assets/files/tasm.zip download link].
 
* The downloaded file should end up in your ~/Downloads directory.
 
* The downloaded file should end up in your ~/Downloads directory.
Line 107: Line 116:
 
* Don't worry about the errors.  They are generated by tasm, and it doesn't like some of the memory accesses we are doing at the 6800 level.  The good news is that tasm generated a listing file nonetheless, and it should be in your folder:
 
* Don't worry about the errors.  They are generated by tasm, and it doesn't like some of the memory accesses we are doing at the 6800 level.  The good news is that tasm generated a listing file nonetheless, and it should be in your folder:
 
   
 
   
  ls
+
  ls                                 (On a Mac)
 +
DIR                              (On Windows)
 
  6800.LST 6800.asm 6800.asm~ macros.asm macros.asm~
 
  6800.LST 6800.asm 6800.asm~ macros.asm macros.asm~
 
   
 
   
 
* List/print 6800.LST to get the opcodes for the instructions:
 
* List/print 6800.LST to get the opcodes for the instructions:
 
   
 
   
  cat 6800.LST
+
  cat 6800.LST               (On a Mac)
 +
TYPE 6800.LST            (On Windows)
 
   
 
   
 
: You should get a listing similar to the one below:
 
: You should get a listing similar to the one below:

Latest revision as of 09:52, 23 March 2016

--D. Thiebaut (talk) 10:59, 19 March 2016 (EDT)



These instructions will allow you to install TASM, the Turbo Assembler, on your OSX/Windows machine, and generate listings of 6800 assembly programs.


Installation on Windows


  • To download TASM, go to this page, and go to the end of the page, to find the download link.
  • Follow the directions to install TASM. You won't need TLINK or any of the other executables for CSC270.
  • Jump to the subsection below on testing your installation.


Installation on Mac OSX


  • If you haven't already done so, you will need to install wine, which is a Windows Emulator for the Mac, and will allow you to run a large number of Windows programs on your Mac. You have several options:
  • The fastest option is probably to get a disk image from this site
  • If that doesn't work for you, then this other page has longer instructions on how to install wine. Installing with brew or with MacPorts is also a possibility, although a potentially hairy experience...
  • To download TASM, go to this page, and go to the end of the page, to find the download link.
  • The downloaded file should end up in your ~/Downloads directory.
  • Double click on the tgz file you have downloaded. It should expand to a folder named TASM.
  • Copy TASM32.EXE from the BIN folder into a folder where you keep all your executables. On my Mac, I keep all executable in a folder called ~/bin.
  • Make sure the ~/bin folder is in your path, which is defined in your ~/.bash_profile file:
PATH=/Users/thiebaut/bin:/Users/thiebaut/Qt5.2.0/5.2.0/clang_64/bin:$PATH:.

  • With your favorite editor (mine is emacs) create a new bash script called tasm. This is how I do it in a Terminal window:
cd
cd bin
emacs -nw tasm

and copy the following lines in it:
#! /bin/bash

wine ~/bin/TASM32.EXE $@
(Note: there should be no space at the beginning of each line, and the #! line should be the first one in the script.)
  • Make the script you just created executable:
chmod +x ~/bin/tasm

  • You are now ready to test your installation.


Testing the Installation


  • Still in Terminal, change to a new directory where you will keep all your 6800 assembly programs.
  • Create a new file in this directory. It will contain a collection of macros that emulate all the 6800 instructions. This file is called macros.asm and is available macros.asm.
  • Create a sample 6800 assembly file, which you will call 6800.asm:


              PAGE   65,132
              TITLE  Example 6800 Program
; ---------------------------------------------------------------
; 6800.asm
; D. Thiebaut
; Demonstrates the use of byte variables, jumps, and
; functions.
; ---------------------------------------------------------------
include       macros.asm

data          SEGMENT       
              ASM6800
              ORG       0001
a             DB        3
b             DB        4
result        DB        ?
              ENDS
        
code          SEGMENT
              ORG       0010
              LDAA      a
              ADDA      b
              STAA      result

INFLOOP:      JSR       0FE52H
              DB        0B0H
              JSR       DELAY
              JSR       0FE52H
              DB        0EDH
              JSR       DELAY
              BRA       INFLOOP

DELAY:        LDX       # 0FFFFh
LOOP0:        DEX
              BNE       LOOP0
              RTS

code          ENDS
              END


  • Save the file in your new folder. You should now have two files there, 6800.asm and macros.asm.
  • Assemble 6800.asm and generate a listing file:
tasm /l 6800.asm
Turbo Assembler  Version 5.0  Copyright (c) 1988, 1996 Borland International

Assembling file:   6800.asm
**Error** 6800.asm(24) LDAA(13) Relative quantity illegal
**Error** 6800.asm(25) ADDA(13) Relative quantity illegal
**Error** 6800.asm(26) STAA(9) Relative quantity illegal
Error messages:    3 
Warning messages:  None
Passes:            1


  • Don't worry about the errors. They are generated by tasm, and it doesn't like some of the memory accesses we are doing at the 6800 level. The good news is that tasm generated a listing file nonetheless, and it should be in your folder:
ls                                 (On a Mac)
DIR                              (On Windows)
6800.LST	6800.asm	6800.asm~	macros.asm	macros.asm~

  • List/print 6800.LST to get the opcodes for the instructions:
cat 6800.LST                (On a Mac)
TYPE 6800.LST             (On Windows)

You should get a listing similar to the one below:


Turbo Assembler	 Version 5.0	    03-19-16 11:13:28	    Page 1
6800.asm
Example	6800 Program


      1				     ; ---------------------------------------------------
      2				     ;	6800.asm
      3				     ;	D. Thiebaut
      4				     ;	Demonstrates the use of	byte variables,	jumps, and
      5				     ;	functions.
      6				     ;	--------------------------------------------------
      7
      8				     ;
      9				     ; ---------------------------------------------------
     10				     include	   macros.asm
1    11
1    12
     13
     14	0000			     data	   SEGMENT
     15						   ASM6800
     16						   ORG	     0001
     17	0001  03		     a		   DB	     3
     18	0002  04		     b		   DB	     4
     19	0003  ??		     result	   DB	     ?
     20	0004					   ENDS
     21
     22	0000			     code	   SEGMENT
     23						   ORG	     0010
     24						   LDAA	     a
1    25	0010  96 01r				   DB	     096h,i
     26						   ADDA	     b
1    27	0012  9B 02r				   DB	     09Bh,i
     28						   STAA	     result
1    29	0014  97 03r				   DB	     097h,i
     30
     31	0016			     INFLOOP:	   JSR	     0FE52H
1    32	0016  BD				   DB	     0BDh
1    33	0017  FE52				   DW	     OFFSET 0FE52H
     34	0019  B0				   DB	     0B0H
     35						   JSR	     DELAY
1    36	001A  BD				   DB	     0BDh
1    37	001B  0026r				   DW	     OFFSET DELAY
     38						   JSR	     0FE52H
1    39	001D  BD				   DB	     0BDh
1    40	001E  FE52				   DW	     OFFSET 0FE52H
     41	0020  ED				   DB	     0EDH
     42						   JSR	     DELAY
1    43	0021  BD				   DB	     0BDh
1    44	0022  0026r				   DW	     OFFSET DELAY
     45						   BRA	     INFLOOP
1    46	0024  20				   DB	     020h
1    47	0025  F0				   DB	     i
     48
     49	0026			     DELAY:	   LDX	     # 0FFFFh
1    50	0026  CE				   DB	     0CEh
1    51	0027  FFFF				   DW	     0FFFFh
     52	0029			     LOOP0:	   DEX
1    53	0029  09				   DB	     009h
     54						   BNE	     LOOP0
1    55	002A  26				   DB	     026h
1    56	002B  FD				   DB	     i
     57						   RTS
1    58	002C  39				   DB	     039h
     59
     60	002D			     code	   ENDS