|   |
![]() |
|||||
Home |
This page has not been adapted to SB-Assembler Version 3 yet.
I have included this chapter for those of you who want to learn the main features of the SB-Assembler fast. This chapter presents the most important features of the SB-Assembler. Details about all features can be found in the separate chapters of this user guide.
I'll use an example 8051 program in this quick start chapter that demonstrates the most important features of the SB-Assembler.
This example program doesn't excel in usefulness which never was my intention anyway.
The program can be typed in with any text editor (not a word processor). Save the file in the directory that contains the program SBASM.COM and the Cross-Overlay 8051.SBA. You can use any file name you like, e.g. TEST.ASM Then type at the MS-DOS prompt: SBASM TEST
The listing will be sent to the screen this time.
This listing can be halted by pressing any key (if you're fast enough with this short program).
Pressing another key will continue the assembly process.
When the MS-DOS prompt returns a new file has been created with the name TEST.HEX. This new file contains the generated code in Intel Hex format.
.CR 8051 Select the 8051 Cross-Overlay
.TF TEST.HEX,INT Send code in Intel Hex format to
; this file
.OR $0000 Program starts at this address
STACK .EQ $70 Begin of stack
SP .EQ $81 SFR register for stack pointer
P1 .EQ $90 SFR register for port P1
DELAY .EQ 100 Delay loop count
START MOV SP,#STACK Initialize stack
MOV P1,#%1111.1111 Initialize port
.LOOP CLR P1.3 Make bit 3 of P1 low
CALL SHORT Take a short delay
SETB P1.3 Make bit 3 of P1 high
CALL LONG Take a long delay
JMP .LOOP Repeat for ever
SHORT MOV R0,#DELAY Prepare delay counter
.LOOP NOP Do nothing for a while
DJNZ R0,.LOOP Repeat 100 times
RET
LONG MOV R0,#DELAY*2 Prepare delay counter
.LOOP NOP Do nothing for a while
DJNZ R0,.LOOP Repeat 200 times
RET
Some of you may notice a few peculiarities if you're already familiar with other assemblers.
Others don't know what the fuss is all about.
And still others don't have the faintest idea of what is happening here.
Finally a little note on the 8051 Cross Overlay:
Special Function Registers (SFR registers) of the 8051 processor are not pre-defined!
Therefore all used SFRs should be declared using normal .EQ directives.
You may create an include file containing all declarations of the SFR registers available to your specific processor if you want.
This makes the SB-Assembler flexible because other 8051 members may have SFR registers not found on the basic version of the processor.
That's not all!
The SB-Assembler offers many more features than listed in this small example.
All features are documented in detail in other chapters.
|