![]() |
![]() |
| Home | Skelix OS | Programming | Reading Notes | Personal |
| Assembler |
|
This is an assembler
of a assembly
language I wrote, if you are familiar with gdb, then you will like this
command line.
![]() It can assemble
source files and
disassemble the output file
![]() In this program, you
can execute
the output file that you assembled
![]() It prints all prime
numbers under
100
The source file like this .data:0x64 .last:1 .factor:1 .out_fmt:3 .main savip jmp %init_data loda %1 stra %last .next loda $last adda %1 stra %last stra %factor cmpa %0xa ja %print .lc mul $factor cmpa %0x64 ja %next mvap subp %1 loda %0 stra %data: loda $factor adda %1 stra %factor loda $last jmp %lc loda %47 # 'd' stra %out_fmt lodp %1 loda %3 # ' ' stra %out_fmt: addp %1 loda %0 # '\0' stra %out_fmt: lodp %0 .lc0 lodb %data: cmpb %0 jne %disp addp %1 cmpp %0x64 je %over jmp %lc0 .disp leaa $out_fmt leab $data: io %0 addp %1 cmpp %0x64 je %over jmp %lc0 .over loda %0 stop .init_data loda %1 lodp %0 .LC stra %data: adda %1 cmpa %0x65 je %ok addp %1 jmp %LC .ok retIt also has some commands like "enter", "edit" etc, if you are familiar with debug under DOS, then you are gonna love them. Download source file |
| MSQL |
This
was a simple java
assignment originally, it means to check whether the given ISBN number
is valid or not, but I expand it to a system which provides APIs to
support all kinds of frontends, here is one of them, and I also wrote
two frontends support CUI.![]() And the mechanism
below all these
frontends is a set of SQL language I call it MSQL. I'm kind of proud of
this work, actually not proud of the application itself but
pround of getting this 6000-line application done in one week as a Java
beginner.
Download source file |
| OS Emulator |
| This
2000-line assembly
code in TASM emulates an OS kernel in real-mode, it supports multiple
ttys and switchs tasks with software method. Bad news is I can not find the source code, my ex-laptop was broken and my files are all messy because backup files in emergency. So only the Exe file on my hand Download Exe file |
| Language Parser |
| This
a PASCAL-like
expression parser I wrote years
ago, it reads the input file and translate it to assembly-like language
with the symbol table, or it dumps error message in details if any
error happens. For example, it get input like this: x := 3 y := x z := x + 1 x := 1 + x z := (7) + yThen we can get the out put like : ASSIGN CT0 x ASSIGN x y PLUS x CT1 T0 ASSIGN T0 z PLUS CT2 x T1 ASSIGN T1 x PLUS CT3 y T2 ASSIGN T2 z |+| const table |+| CT0 3.000000 CT1 1.000000 CT2 1.000000 CT3 7.000000If we let it get some incorrect input file, say c.in tt : 3 y := (tt-)* 7.8.6 + z: =3x (3) := z--3;Then it print out some error message ![]() Download source file |
| Demand Paging Emulator |
| This
program is sort of
interesting, it emulates the demand paging by creating swap files for
every virtual process, you can check the situation of each file by its
swap file, and it create a log file about the process of a session. You can type "help" and "help <command>" at any time to get help messages, at that time I was fancy with gdb, so I learned this style from it. If you are familiar with gdb, then you will like this command line style vm: !!!IMPORTANT!!! Please delete all swapxxx file except 'swap_pmt' under this directory which created by this program last time, or this program may not work properly! vm: Input '! delete_file_shell_command <return>' after prompt(not include quote), if you did not clean this directory. vm: Write all output information to 'log' file?(y/n)vm: ----------------------------------------- vm: Starting log at Sat Sep 2 02:35:06 2006. (vm) vm: =====> Creating a new process. vm: Get a free pcb, pid is 0. vm: Get a free frame 37 for process info. vm: Set frame 37 used. vm: Get a free frame 38 for the first instruction to execute. vm: Set frame 38 used. vm: Process 0 was created. (vm) vm: =====> Creating a new process. vm: Get a free pcb, pid is 1. vm: Get a free frame 39 for process info. vm: Set frame 39 used. vm: Get a free frame 40 for the first instruction to execute. vm: Set frame 40 used. vm: Process 1 was created. (vm) Used frame map: 0000: ff ff ff ff ff 80 00 00 00 00 00 00 00 00 00 00 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 (vm) vm: =====> Process 1 read page 7. vm: Page 7 is not present vm: Get a free frame 41. vm: Set frame 41 used. vm: Read page 7 from program file to frame 41. (vm) vm: =====> Process 0 write page 1010. vm: Page 1010 is not present vm: Get a free frame 42. vm: Set frame 42 used. vm: Read page 1010 from program file to frame 42. (vm) vm: =====> Process 1 read page 915. vm: Page 915 is not present vm: Get a free frame 43. vm: Set frame 43 used. vm: Read page 915 from program file to frame 43. (vm) vm: =====> Process 0 write page 748. vm: Page 748 is not present vm: Get a free frame 44. vm: Set frame 44 used. vm: Read page 748 from program file to frame 44. (vm) vm: =====> Process 1 read page 230. vm: Page 230 is not present vm: Get a free frame 45. vm: Set frame 45 used. vm: Read page 230 from program file to frame 45. (vm) vm: End log at Sat Sep 2 02:35:25 2006. vm: ------------------------------------You can check details of this session in "log" file Download source file |
| Special Thanks |
| Mohammed Barakat <medo_elkorsan@yahoo.com> | He has corrected some English errors in this page |
| Home |