![]() |
|||
Download |
|||
Freeware |
Shareware |
Sample Programs |
User Manual |
MICROPROCESSOR SIMULATOR
[editor][assembler][debugger][animator][virtual applications][examples]
General Overview The Visual Simulator supplies, debugging errors (which occurs at present or during working) and watching assembly programs working (which are written in assembly language) in a visual way after compiling in an assembler. In Visual Simulator there are editor, assembler, debugger, animator and virtual application units. Users can write programs in assembly language for 6502 microprocessor at settled editor. They can assemble it (in assembler) and watch working process in simulator (in debugger). If requires they can watch how programs (their own program or ready program) were worked by microprocessor (in animator). Users can control some devices visually like Input and output ports (PIA A and B ports) leds, micro-switches, traffic lamps and 7 segment display.
When main window opens there are upper menus, menu bar and tool bar. Tool bar separates five main groups. Tools, which are settled upper left side, are related in file processing. Tools, which are lower left side, are related in window opening. From the beginning of the left side there are disassembler icon to show machine codes and icons which show register contents and a program log icon which shows different memory locations (0. page data segment, 1. page stack segment, 2. page program segment) and keeps registers and codes present values. Editor is a window, which was opened from file menu or main menu and used for writing programs for 6502 microprocessor in assembly language. Result of selection causes a free editing window opening. The assembly program that was written in editor can be kept in .asm extension and can be opened and edit. In upper side of the editor window there is name and path of working program. The left side of the editor is used for putting breakpoint. There is a red circle appears in the breakpoint line.
The program that is written in editor was loaded to memory its codes are not assembled. With selection of Assembler button program occurs with its command codes in another window. In program window there are address (hex), command codes (two section), program and explanations. Program that was assembled can be kept in hex extension. In hex window direct addresses are settle down instead of address labels. When comparing addresses this supplies easiness to programmer. This window was reached from tools section in main menu with pushing disassemble button.
Yukarıdaki tanımlamayla, veri bölümünde bir dizi baytlık hex veya ondalık veya string veriler yerleştirilmiştir. VALUE ve TAB etiketli adreslere bu veriler sıralanmıştır. .DATA'nın yanındaki $20 ifadesi altındaki verilerin bellekte yerleşeceği orijin noktasını verir. Program alanına yerleşecek kodların tanımlanması .CODE Adres ifadesi ile yapılır. Kodlar bellekte hangi adresten itibaren yerleşecekse .CODE'nin yanına o adres yazılır.
Burada .BYTE ifadesi kendinden sonra gelecek verinin bayt cinsinde olduğunu gösterir. 6502 mikroişlemcisi 8-bitlik bir işlemci olduğundan verilerin tanımlanmasında sadece BYTE talimatı yeterli olacaktır. When Debugger button was pushed units, registers, data fields, program fields and stack fields which helps programmer to debugging are open. Then program was worked step-by-step or normally and observed. Debugger was controlled with buttons above. Button at the left side is used for operating program continuously it’s own speed. In this speed program was not watched. Second button is used for operating program step-by-step. To operate program this button was pushed by mouse or space bar button in keyboard. It is user dependent button in program watching that’s why it is the most ideal choosing. Third button is used for operating program step-by-step but in a defined speed. Speed can be set from simulation\alternatives in pull down menu. Button at the right side is used for stop program when ever you want at the same time this button can be used for stop point. Button which is second from right is used for reset and restart program. REGISTER WINDOW This window shows content of PIA I/O registers and 6502 microprocessor’s registers which programmer can watch during program work. Microprocessor registers A,X,Y are general purpose, PC,SP and flags are special purpose registers. Flags in registers are N (negative), V (oVerflow), B (Break), D (Decimal), I (Interrupt), Z (Zero) and C (Carry) the eighth register is invisible for future using.
Registers, which were used in A, and B ports in 6502 or 6820 are also in this window under PIA. Dataset, which were loaded to these ports, were seen in this window at the same time. Memory Field Window In 6502 microprocessor memory was separated 256 pages, every page occurs 256 byte. Separating pages supplies more easy arrival to data. The first page of memory that is to say zero page (0000-00FF) was planned as a data field. If a page includes 256 byte data, extra dataset can be located empty pages. In this microprocessor second page was reserved as a stack field. In this section hex response dataset, which was declared at the beginning of the program, was seen with its ASCII response.
Stack Pointer (SP) shows the end of (01FF) this address field (0100-01FF) directly. Every data, which was loaded to stack, decreases its value one (01FE) and this goes so that finish of this field. Second
page was used to write program codes. In 6502 microprocessor program
usually starts from 0200 address (CODE $0200 or ORG $0200). Codes,
which converted to machine code, can be seen from this window. At
the same time you can see every code’s ASCII response from right side
of this window. When animator button in simulator window was pushed monitor was cleaned and a new image was done. In this image there are microprocessor registers, internal and external communication ways, address solving units, memory (RAM and ROM) and PIA I/O units.
Control
console has been planned as three sections. In present process section
working programs hex codes (machine codes) can be seen lightened.
In state section program get command code, solve code and operate
can be seen. If a section was lightened it means program is working
in this phase. Control section checks program working. The bar, which
is lower right side, is speed bar. Speed can be changed while program
is running. The switch, which is right side, was used to exit from
animator. Here
a series of application, which were applied in microprocessor application
set, was shown virtually in simulator. Applications;
Programs can control these devices according to 0400 and 0403 PIA I/O setting. When programs come across this addresses they do necessary things with an intelligent process. Users can use this registers in their own program with their addresses or their nick names (CRA, DDRA, ORA and CRB, DDRB, ORB). In
PIA programming 0400, 0401, 0402 and 0403 were reserved to registers.
0401 was reserved for CRA, 0403 was reserved for CRB, 0400 was shared
between DDRA and ORA. This sharing were done with the second bit of
CRA. When second bit is zero this mean DDRA was selected, when it
is 1 ORA was selected. In B port 0403 CRB, 0402 was shared between
DDRB and ORB. Sharing was done with second bit like A port.
ASSEMBLER DIRECTIVES In Assembly language program writing two order word were used. One of them is commands. Commands are a short description of order word which tell microprocessor what to do. Second order words were named as directives. These give orders only to assembler. In other words a shortening of order words which were used to help sending order words to microprocessor. When assembling an assembly program with assembler, assembler adapts memory allocation and various label names to their real names according to directives and leaves command codes to microprocessor. Command Segment Directives .CODE <address> With
this definition assembler declare that program will be located from
the beginning of the <…….> address. Command lines must be started
after that expression.
Address
which is after “.CODE” instruction means that command codes will be
located from the beginning of 0200 address. .DATA $20 This
directive shows that dataset will be located in the memory from the
beginning of the 0200. This determines dataset which was used by program.
Data segment can be declared lots of times according to programmer’s
wish. VALUE .BAYT $25, 45, -23, $5F .DATA $5050 START .BYTE $AA, 89, $C5 In data
directives data can be given decimal or hexadecimal. If nothing was
written in front of the number and number is little than 255 than
it was accepted decimal. If there is a $ sing in front of the number,
it’s right hand value between 0 and F and at most two column (registers
are 8-bits) than this was excepted as hexadecimal. In program
writing labels, which was used to declare address, can be written
in upper case, lower case or Turkish but it wasn’t recommended to
use Turkish characters in program. In labels there mustn’t include any blank. Blank shows parts between label, command and operand. There
must be at least one blank between label, command and explanations.
Explanations must start with (;). Explanations can be written in command
line or in a line with which starts a (;). 6502
microprocessor has 8-bits data lines and registers for that reason
dataset in data fields were declared as bytes. Dataset as bytes must
start with .BYTE instruction. String data can be defined with .BYTE
instruction if desired. Comma must be put at the start and end of
the string. This
instruction declares to assembler that the program was finished. This
must be put at the end of the program.
In this
program codes which were written between .CODE $0200 and BRK do some
subtract, move and subroutine calls. Commands which are after RTS
(Return From Subroutine) shows that where will program go if someone
pushes interrupt buttons.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||