Case Study

Wednesday, October 7, 2015

Midterm Exam For 4th Year Students, Due 10/8/2015

create a simple ASM program that will allow user
to select a choices available
and display a correspoding text display
upon successful selection of choice

Example:

Menu
1. ORder
2. Exit
Enter Choice:__

If Choice is 1, Display a text "You chose Ordering Function";
If Choice is 2, Display a text "You chose to exit";

ASM code for using Addition in Arithmetic / Logical Instruction Set

.model small
.stack 100h
.data
message db "Enter a Number $"
message2 db "Enter 2nd Number $"
message3 db " +  $"
message4 db " = $"
.code
main proc
mov ax,seg message
mov ds,ax
mov dx,offset message
mov ah,9h
int 21h

mov ah, 1h ;store input in al
int 21h

mov bl,al

mov ax,seg message2
mov ds,ax
mov dx,offset message2
mov ah,9h
int 21h

mov ah, 1h ;store input in al
int 21h

mov cl,al

mov dl,bl
mov ah,2h
int 21h

mov ax,seg message3
mov ds,ax
mov dx,offset message3
mov ah,9h
int 21h

mov dl,cl
mov ah,2h
int 21h

mov ax,seg message4
mov ds,ax
mov dx,offset message4
mov ah,9h
int 21h

sub bl,30h  ;converts to decimal
sub cl,30h

add bl,cl
add bl,30h

mov dl,bl     ;prints character
mov ah,2h
int 21h

mov ah, 4ch
int 21h

endp
end main

Tuesday, October 6, 2015

Basic ASM Code for Input/ Output Operation

.model small
.stack 100h
.data
prompt  db  'Enter your name (7 Chars Max):$'
greet   db  "Hello $"
nam     db  8 dup(?) ; 7 plus term char $
Ast     db  "*$"
crlf    db  13, 10, 24H
.code
main   proc
mov     ax, seg prompt
mov     ds,ax

Start:
; Display Name prompt ; lea (load effective address)
lea     dx, prompt
mov     ah, 9
int     21h

mov     cx, 7   ; get 7 chars
lea     si, nam ; buffer to hold name
lea     dx, Ast ; display *

balik:
; get char typed
mov     ah, 7
int     21h
; save in our buffer, current pos in si
mov     byte ptr[si], al

; Display Asterick
; Asterick already in dx
mov     ah, 9
int     21h

; increase our buffer pointer
inc     si

; No need for the "slow" loop instruction
dec     cx
jnz     balik ; jump if not zero

; properly terminate our string
mov     byte ptr[si], "$"

; insert blank line
lea     dx, crlf
mov     ah, 9
int     21h

; display hello
lea     dx, greet
mov     ah, 9
int     21h

; Now display entered name
lea     dx, nam
; outputs the input
mov     ah, 9
int     21h

; exit
mov     ah, 4ch
int     21h
main   endp
end main

Wednesday, November 9, 2011

N4M Davao

Visit http://www.n4mdavao.ph

The site is locally made for local people in Davao City.

Thursday, June 16, 2011

Basic PHP: Connecting to MYSQL Database

Here is a simple code that will connect us from our MYSQL Database.
First and foremost. We need to create the database name first.
I will not explain the creation of database using MYSQL here since It will
consume more time explaining.

One we have the database ready.

We need a simple PHP script to make a connection:
Assuming we have our local webserver running.

Heres the simple code:

Save this as. Connect.php


$db_host = "localhost";
$db_user = "root";
$db_pass = "xxx"; --- xxx represents your password given to your database.
$db_name = "xxx"; ---- xxx represents the name of your database created.

mysql_connect($db_host,$db_user,$db_pass,$db_name);



That's it. The Code is fairly simple enough to understand.
Once you are connected to the database. You may now be able to create
PHP scripts to ADD, DELETE, VIEW , EDIT datas.

Thanks a lot

Friday, July 30, 2010

Creating a simple code using PHP to capture barcode scanner entry

The code

Barcode scanner is just like a keyboard. So, we use javascript to set focus on the input field to force the value to load within the input field.


Try this one below with your favorite barcode scanner and see it in action. The script used here is written above.



Thursday, July 29, 2010

Introduction to PHP Programming Language

What is PHP?

* PHP stands for PHP: Hypertext Preprocessor
* PHP is a server-side scripting language, like ASP
* PHP scripts are executed on the server
* PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid,PostgreSQL,Generic ODBC, etc.)
* PHP is an open source software
* PHP is free to download and use