资源说明:myasm51,小型的51单片机汇编器源码。
基于Linux环境下编写的小型的51单片机汇编器,源码开放,采用lex和yacc两个扫描和分析工具创建,代码小巧,易于研读和分析。对汇编源程序2遍扫描完成汇编,可以生成列表文件,Intel的Hex格式的文件及.bin格式的映像文件,后两种文件可以直接下载到单片机上运行。源码程序包内包含若干示例汇编源程序(.asm),proteus的格式的数字种的仿真文件,用以测试编译结果,另有编译后的dos下的可执行文件myasm51.exe,可以在windows的命令窗口下运行。另外提供一个简明的用户手册以供参考。以下为程序包的README:
What is Myasm51
===============
Myasm51 is an open source mini-assembler for the Intel MCS-51 family of
microcontrollers or the compatible ones, distributed under the GPL license.
By scanning the source file in two pass, Myasm51 translates a symbolic code
in text file (assembly language source) into a machine executable object file.
During the first pass, the assembler builds a symbol table from the symbols
and labels used in the source file. In the second pass, the assembler maps
the source file into machine code and generates the listing file through what
it receives in the first pass. Myasm51 is an absolute assembler and only
generates absolute object files in the plain binary file (with .bin extension)
or the Intel Hex file (with .Hex extension) which can be read by any ROM
programmer to burn the object code into the ROM space of microcontrollers.
How to make
===========
We assume that the UNIX utilities yacc and lex have been installed in you system,
and following these steps to build Myasm51 by the super user 'root' in the Linux or the
UNIX cloned system.
# tar zxf myasm51-gk-20151208_121306.tar.gz
# cd myasm51
# make
# cp myasm51 /usr/local/bin
done.
How to use
==========
[root@rh9 myasm51]# cd examples
[root@rh9 examples]# myasm51
Myasm51 Assembler. Ver 0.01
Release 1, (20151231_165818)
Snallie@tom.com, Wed Sep 30 17:28:09 CST 2015
built: Dec 31 2015 - 17:04:44
Usage: myasm51 [-o] [-F<0|1>] [-C] [-d] in.asm
where -ob to output binary file 'in.bin'
-oh to output hex file 'in.hx' (default format)
-oH to output Intel Hex file 'in.Hex'
-F to fill free bit with 0 or 1, (default 0)
-C to turn on/off symbol case sensitive, (default on)
-d to turn on/off the parser debug mode, (default off)
[root@rh9 examples]# myasm51 dclk7seg2.asm
Myasm51 Assembler. Ver 0.01
Release 1, (20151231_165818)
Snallie@tom.com, Wed Sep 30 17:28:09 CST 2015
built: Dec 31 2015 - 17:04:44
;;;; Starting 1st Pass...
;;;; 1st Pass proceeded.
;;;; Starting 2nd Pass...
;;;; 2nd Pass proceeded.
dclk7seg2.hx, 340(0x154) bytes assembled.
[root@rh9 examples]# nl -ba dclk7seg2.hx |more
...
25 0000: | 25 .ORG 0
26 0000: 02 00 30 | 26 PowerON: LJMP Reset
27 | 27
28 0003: | 28 .ORG 0X0003
29 0003: 02 00 03 | 29 EXT_INT0_VECTOR: LJMP EXT_INT0_VECTOR
30 | 30
31 000B: | 31 .ORG 0X000B
32 000B: 02 00 7E | 32 TIMER_T0_VECTOR: LJMP TIMER_T0_INT
33 | 33
34 0013: | 34 .ORG 0X0013
...
[root@rh9 examples]# myasm51 -Cn pm51.asm
Myasm51 Assembler. Ver 0.01
Release 1, (20151231_165818)
Snallie@tom.com, Wed Sep 30 17:28:09 CST 2015
built: Dec 31 2015 - 17:04:44
;;;; Starting 1st Pass...
;;;; 1st Pass proceeded.
;;;; Starting 2nd Pass...
;;;; 2nd Pass proceeded.
pm51.hx, 7760(0x1e50) bytes assembled.
[root@rh9 examples]# nl -ba pm51.hx |more
1 | 1 ; PAULMON 8051 Debugger by Paul Stoffregen
2 | 2 ; Please distribute freely -- may not be sold, period.
3 | 3
4 | 4 ; .command +h58 ;set page height to 58 in listing file...
5 | 5
6 | 6 .equ start,0000h ;address for start of EPROM (0000h)
7 | 7 .equ program,2000h ;address for program loading location
8 | 8
9 0000: | 9 .ORG start
10 0000: 02 0B 08 | 10 rst: lJMP poweron
11 | 11
12 0003: | 12 .org start+3 ;ext int #0
13 0003: 02 20 03 | 13 LJMP program+3
14 000B: | 14 .org start+11 ;timer #0
15 000B: 02 20 0B | 15 LJMP program+11
16 0013: | 16 .org start+13h ;external interrupt routine #1
17 0013: 30 8A 03 | 17 jnb tcon.2,intr0
18 0016: 02 20 13 | 18 ljmp program+13h ;don't do ssrun if edge trigger'd
19 0019: 01 45 | 19 intr0: ajmp step ;but do ssrun if level trigger'd
20 001B: | 20 .org start+1bh ;timer #1
21 001B: 02 20 1B | 21 ljmp program+1bh
22 0023: | 22 .org start+23h ;serial port
23 0023: 02 20 23 | 23 ljmp program+23h
24 002B: | 24 .org start+2bh ;timer #2 (8052 only)
25 002B: 02 20 2B | 25 ljmp program+2bh
...
[root@rh9 examples]# myasm51 -oH -Cn pm51.asm
Myasm51 Assembler. Ver 0.01
Release 1, (20151231_165818)
Snallie@tom.com, Wed Sep 30 17:28:09 CST 2015
built: Dec 31 2015 - 17:04:44
;;;; Starting 1st Pass...
;;;; 1st Pass proceeded.
;;;; Starting 2nd Pass...
;;;; 2nd Pass proceeded.
pm51.Hex, 7760(0x1e50) bytes assembled.
[root@rh9 examples]# nl -ba pm51.Hex |more
1 :03000000020B08E8
2 :03000300022003D5
3 :03000B0002200BC5
4 :03001300308A032D
5 :03001600022013B2
6 :0200190001459F
7 :03001B0002201BA5
8 :0300230002202395
9 :03002B0002202B85
10 :02003000A188A5
11 :02003200A180AB
...
More about Myasm51
==================
For more information, see doc/myasm51_guide.pdf.
Bug report
==========
Please send email to Snallie@tom.com
==========
Enjoy fun.
Snallie@tom.com
Thu Dec 31 17:43:48 CST 2015
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。