عدنان شاہد (خاموش تماشائی)

Computer Architecture and Assembly Language [ Irvine32.inc ]

Assembly Language Program taking user input and displaying on screen.

section .bss ;data num1 resb 5 num2 resb 5 section .data msg db ' Elementary Arithmetic', 0xa ;string to be printed len equ $ - msg ;length of the string breakLine db " ", 0xa lenBreakLine equ $ - breakLine msg2 db "Enter 2 numbers, and I'll show you the sum, difference, product, quotient, and remainder.", 0xa len2 equ $ - msg2 firstnum db "First number:", 0xa lenfirstnum equ $ - firstnum secnum db "Second number:", 0xa lensecnum equ $ - secnum section .text global _start ; OUT PUT mov edx,len ;message length mov ecx,msg ;message to write mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel ; BREAK THE LINE mov edx,lenBreakLine ;BreakLine length mov ecx,breakLine ;message to write mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel ; OUT PUT THE INSTRUCTIONS mov edx,len2 ;message length mov ecx,msg2 ;message to write mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel ; BREAK THE LINE mov edx,lenBreakLine ;BreakLine length mov ecx,breakLine ;message to write mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel ; Enter First Number Message mov edx,lenfirstnum ;BreakLine length mov ecx,firstnum ;message to write mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel ;Read and store the user input First mov eax, 3 mov ebx, 2 mov ecx, num1 mov edx, 5 ;5 bytes (numeric, 1 for sign) of that information int 80h ; Enter Second Number Message mov edx,lensecnum ;BreakLine length mov ecx,secnum ;message to write mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel ;Read and store the user input Second mov eax, 3 mov ebx, 2 mov ecx, num2 mov edx, 5 ;5 bytes (numeric, 1 for sign) of that information int 80h ;Output the number entered mov eax, 4 mov ebx, 1 mov ecx, num1 mov edx, 5 int 80h mov eax,1 ;system call number (sys_exit) int 0x80 ;call kernel

 

Q. Write program in assembly language Using Irvine32, Perform all arithmetic operations on 2 numbers ( entered by the user).

INCLUDE Irvine32.inc .data intro_1 BYTE " Elementary Arithmetic", 0 intro_2 BYTE "Enter 2 numbers, I'll show you the sum, difference, product, quotient, and remainder. ",0 prompt_1 BYTE "First number: ", 0 prompt_2 BYTE "Second number: ", 0 prompt_3 BYTE " remainder " num1 DWORD ? ;integer to be entered by user num2 DWORD ? res1 DWORD ? res2 DWORD ? res3 DWORD ? res4 DWORD ? remainder DWORD ? goodBye BYTE "Ok Bye!, ", 0 .code main PROC ;Introduce programmer mov edx, OFFSET intro_1 call WriteString call CrLf ;Display Message of program mov edx, OFFSET intro_2 call WriteString call CrLf call CrLf ;Get First Number mov edx, OFFSET prompt_1 call WriteString call ReadInt mov num1, eax call CrLf ;Get Second Number mov edx, OFFSET prompt_2 call WriteString call ReadInt mov num2, eax call CrLf ;addition Calculate mov eax, num1 mov ebx, num2 add eax, ebx mov res1, eax ;Subtraction Calculate mov eax, num1 mov ebx, num2 sub eax, ebx mov res2, eax ;Multiplication Calculate mov eax, num1 mov ebx, num2 mul ebx mov res3, eax ;Multiplication Calculate mov eax, num1 mov ebx, num2 div ebx mov res4, eax mov remainder, edx ;Report result Addition mov eax, num1 call WriteDec mov al,'+' call WriteChar mov eax, num2 call WriteDec mov al,'=' call WriteChar mov eax, res1 call WriteDec call CrLf ;Report result subtraction mov eax, num1 call WriteDec mov al,'-' call WriteChar mov eax, num2 call WriteDec mov al,'=' call WriteChar mov eax, res2 call WriteDec call CrLf ;Report result Multiplication mov eax, num1 call WriteDec mov al,'x' call WriteChar mov eax, num2 call WriteDec mov al,'=' call WriteChar mov eax, res3 call WriteDec call CrLf ;Report result Division mov eax, num1 call WriteDec mov al,'%' call WriteChar mov eax, num2 call WriteDec mov al,'=' call WriteChar mov eax, res4 call WriteDec mov edx, OFFSET prompt_3 call WriteString mov eax, remainder call WriteDec call CrLf call CrLf ;Say "Good-bye" mov edx, OFFSET goodBye call WriteString call CrLf exit ; exit to operating system main ENDP END main

 

The post Computer Architecture and Assembly Language [ Irvine32.inc ] appeared first on Adnan Shahid.

LMC – Little Man Computer Program [ list largest

Here is  a program that reads three values as input and output these numbers in order from largest to smallest.

INP STA 91 INP STA 92 INP STA 93 LDA 92 SUB 91 BRP STEP2 LDA 92 STA 99   LDA 91   STA 92 LDA 99 STA 91 STEP2 LDA 93 SUB 92 BRP STEP3 LDA 93 STA 99 LDA 92 STA 93 LDA 99 STA 92 STEP3 LDA 92 SUB 91 BRP STEP4 LDA 92 STA 99 LDA 91 STA 92 LDA 99 STO 91 STEP4 LDA 93 OUT LDA 92 OUT LDA 91 OUT HLT

 

Adnan Shahid / UI UX Designer, Graphics, Mobile, Print,Css3, Html5, bootstrap, Responsive Design
a2dstudio
adnanshahid.com

Twitter  Facebook  Google +  LinkedIn 

This e-mail message may contain confidential or legally privileged information and is intended only for the use of the intended recipient(s). Any unauthorized disclosure, dissemination, distribution,

The post LMC – Little Man Computer Program [ list largest appeared first on Adnan Shahid.

caspio Programing

Here is some code snippet to replace <br> to <p> tag in CKEDITOR

Below code will convert the normal textarea to ckeditor and will replace the breakline tag to paragraph tag on pressing enter.

<script type="text/javascript" src="https://c0abg481.caspio.com/scripts/CKEditor/ckeditor.js" ></script><script type="text/javascript"> CKEDITOR.editorConfig = function( config ) { config.toolbarGroups = [ { name: 'document', groups: [ 'mode', 'document', 'doctools' ] }, { name: 'clipboard', groups: [ 'clipboard', 'undo' ] }, { name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] }, { name: 'forms', groups: [ 'forms' ] }, { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] }, { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi', 'paragraph' ] }, { name: 'links', groups: [ 'links' ] }, { name: 'insert', groups: [ 'insert' ] }, { name: 'styles', groups: [ 'styles' ] }, { name: 'colors', groups: [ 'colors' ] }, { name: 'tools', groups: [ 'tools' ] }, { name: 'others', groups: [ 'others' ] }, { name: 'about', groups: [ 'about' ] } ]; config.removeButtons = 'Save,Templates,Cut,Undo,Find,Scayt,Form,Strike,Subscript,Superscript,CopyFormatting,RemoveFormat,Blockquote,CreateDiv,JustifyLeft,JustifyCenter,JustifyRight,JustifyBlock,BidiLtr,BidiRtl,Language,Anchor,Unlink,Link,Image,Flash,Table,HorizontalRule,Smiley,SpecialChar,PageBreak,Iframe,FontSize,Font,Format,Styles,TextColor,NewPage,Preview,Print,PasteText,Paste,Copy,Redo,PasteFromWord,Replace,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,BGColor,ShowBlocks,SelectAll,About';}; CKEDITOR.replace('InsertRecordAccountNote',{enterMode: CKEDITOR.ENTER_P});</script>

Ping me if there is work related to Caspio. thanks

The post caspio Programing appeared first on Adnan Shahid.

Steps for Ruby on rails installation on windows 10 [64 bit]

rubyonrailsIDE

Following are the Steps for setting Ruby on Rails on windows 10 :

  1.  Goto http://railsinstaller.org/en
  2.  Download Installer for windows, at the moment its Ruby 2.2 installer
  3. Install and select github option in installer.
  4. If there is error in terminal after installation (in messages)
    • update git from git-scm.com
    • overright folder C:/RailsInstaller/Git *while installing git-scm
    • Check the Option while installing  “select :Use Git From The Windows Command prompt”
  5. Install https://nodejs.org/en/
  6. update rails Command is >> gem install rails –no-ri –no-rdoc
  7. Check all versions>>rails –v [if error check in command line check the rails.bat file in bin folder of Ruby in rails installer]**********my rails works with this bat file*************
    @ECHO OFF
    IF NOT “%~f0” == “~f0″ GOTO :WinNT
    ECHO.This version of Ruby has not been built with support for Windows 95/98/Me.
    GOTO :EOF
    :WinNT
    @”%~dp0ruby.exe” “%~dpn0” %************************
    >>ruby -vv
    >>git –version

 

Other Recommended software 

  1. Install Ruby mine.
  2. Git Desktop

lecture 3 – Assignment 3 & 4

Assignment # 3

Create a before and after image using a stamp tool and post on the social media.

Assignment # 4

Use Text Tool and add some word to any image and post to social media.

Assignment 1

Assignment # 1 [ course]

Please post links in the comment section so every one can view each other profile.

Thanks

Pages