lalbod
Blog Subscribe Syndicate Search Contact Me  
Topics
1 ASM disscusion
Ada Programming
ASP Programming
Assembly Programming
BASIC Programming
C# Programming
C/C++ Programming
Cobol Programming
Cold Fusion Programming
Delphi Programming
Disassembly
Flash Programming
Forth Programming
Fortran Programming
HTML Programming
Java Programming
Javascript Programming
JSP Programming
Lisp Programming
Logo Programming
Lua Programming
Pascal Programming
Perl Programming
PHP Programming
Prolog Programming
Python Programming
Ruby Programming
Tcl Programming
Visual Basic Programming
XML Programming
Members
Sign In

Entries in "1 ASM disscusion"
1
BIN 2 DEC
0 Comments / Subscribe To Comments
Published: Oct.05.2008 @ 3:04 pm | Last edited: Oct.05.2008 @ 7:49 am

x=(1110,1)2  y=(1101)2  / perevesti v bazu 5 i 9 programno , a potom umnojiti programno x(5)*y(5) i

x(9)*y(9) 

===================================

http://gwydir.demon.co.uk/jo/numbers/binary/bases.htm

http://en.wikipedia.org/wiki/Binary_numeral_system

======================================

M = akNk+ak-1Nk-1+...+a1N1+a0

M = (ak)*N^k+(ak-1)*N^(k-1)+...+(a1)N1+a^0

y(1101)=M

ak = pervaia tsifra iz nomera [1]101

ak-1 = vtoraia tsifra iz nomera 1[1]01

N = baza / (1101)2   / tobish 2 / N=2

k = eto kvadrat  / / v programe eto "p"

k-1= eto kvadrat -1 / / v programe eto "p-1"

======================================

#include <stdio.h>
#include <conio.h>
#include <math.h>

main()
{
int i=1,y,p=0,nmax=1,a[3];
y=1101;

for (i=1;i<=10;i++)
{
nmax*=(1*10)+1;
if (y<nmax) {p=i;break;}
}
printf("%i",p);


for (i=0;i<=p;i++)
{
a[i]=?????
}


getch();}

DEMO4
0 Comments / Subscribe To Comments
Published: Jul.27.2008 @ 5:46 pm

 ; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

;                 Build this with the "Project" menu using
;                        "Console Assemble & Link"

comment * «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

There is another method of allocating space for uninitialised data in
MASM that can only be done within a procedure. The use of LOCAL variables
is possible in a procedure because the memory from the "stack" can be
used in this way.

In MASM, allocating a LOCAL uninitialised variable is done at the beginning
of a procedure BEFORE you write any code in the procedure. With memory
allocated on the stack, it can only be used within that procedure and is
deallocated at the end of the procedure on exit.

    LOCAL MyVar:DWORD       ; allocate a 32 bit space on the stack
    LOCAL Buffer[128]:BYTE  ; allocate 128 BYTEs of space for TEXT data.

Variables created on the stack in this manner are sometimes called
automatic variables and their main advantage is being fast, flexible
and easy to use.

This demo also shows how to get user input from the console using "input".
It also introduces a simple procedure that has a value passed to it and
the procedure uses a PROTOTYPE to enable size and parameter count checking
to make the code more reliable.

««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««« *

    .486                                    ; create 32 bit code
    .model flat, stdcall                    ; 32 bit memory model
    option casemap :none                    ; case sensitive
 
    include \masm32\include\windows.inc     ; always first
    include \masm32\macros\macros.asm       ; MASM support macros

  ; -----------------------------------------------------------------
  ; include files that have MASM format prototypes for function calls
  ; -----------------------------------------------------------------
    include \masm32\include\masm32.inc
    include \masm32\include\gdi32.inc
    include \masm32\include\user32.inc
    include \masm32\include\kernel32.inc

  ; ------------------------------------------------
  ; Library files that have definitions for function
  ; exports and tested reliable prebuilt code.
  ; ------------------------------------------------
    includelib \masm32\lib\masm32.lib
    includelib \masm32\lib\gdi32.lib
    includelib \masm32\lib\user32.lib
    includelib \masm32\lib\kernel32.lib

  ; --------------------------------------------------------------
  ; This is a prototype for a procedure used in the demo. It tells
  ; MASM how many parameters are passed to the procedure and how
  ; big they are. This makes procedure calls far more reliable as
  ; MASM will not allow different sizes or different numbers of
  ; parameters to be passed. Note that a C calling convention
  ; procedure CAN have a variable number of arguments but these
  ; examples use the normal Windows STDCALL convention which is
  ; different.
  ; --------------------------------------------------------------
    show_text PROTO :DWORD

    .code                       ; Tell MASM where the code starts

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

start:                          ; The CODE entry point to the program

    call main                   ; branch to the "main" procedure

    exit

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

main proc

    LOCAL txtinput:DWORD        ; a "handle" for the text returned by "input"

    mov txtinput, input("Type some text at the cursor : ")
    invoke show_text, txtinput

    ret

main endp

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

show_text proc string:DWORD

    print chr$("This is what you typed at the cursor",13,10,"     *** ")
    print string                ; show the string at the console
    print chr$(" ***",13,10)

    ret

show_text endp

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

end start                       ; Tell MASM where the program ends

DEMO3
2 Comments / Subscribe To Comments
Published: Jul.27.2008 @ 5:01 pm

 ; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

;                 Build this with the "Project" menu using
;                       "Console Assemble and Link"

comment * «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

A normal component of almost all programs is data. It can be either numeric
data or text data. In MASM you have the distinction between data that is
initialised with a value or UNinitialised data that just reserves the
space to write data to.

Initialised data has this form.

.data
  var1  dd  0                           ; 32 bit value initialised to zero
  var2  dd  125                         ; 32 bit value initialised to 125
  txt1  db  "This is text in MASM",0    ; A zero terminated sequence of TEXT

  array dd 1,2,3,4,5,6,7,8              ; 8 x 32 bit values in sequence

Uninitialised data has this form.

.data?
  udat1 dd ?                            ; Uninitialised single 32 bit space
  buffa db 128 dup (?)                  ; 128 BYTES of uninitialised space

««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««« *

    .486                                    ; create 32 bit code
    .model flat, stdcall                    ; 32 bit memory model
    option casemap :none                    ; case sensitive
 
    include \masm32\include\windows.inc     ; always first
    include \masm32\macros\macros.asm       ; MASM support macros

  ; -----------------------------------------------------------------
  ; include files that have MASM format prototypes for function calls
  ; -----------------------------------------------------------------
    include \masm32\include\masm32.inc
    include \masm32\include\gdi32.inc
    include \masm32\include\user32.inc
    include \masm32\include\kernel32.inc

  ; ------------------------------------------------
  ; Library files that have definitions for function
  ; exports and tested reliable prebuilt code.
  ; ------------------------------------------------
    includelib \masm32\lib\masm32.lib
    includelib \masm32\lib\gdi32.lib
    includelib \masm32\lib\user32.lib
    includelib \masm32\lib\kernel32.lib


    .data
      txtmsg db "I am data in the initialised data section",0

    .code                       ; Tell MASM where the code starts

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

start:                          ; The CODE entry point to the program

    call main                   ; branch to the "main" procedure

    exit

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

main proc

    print OFFSET txtmsg         ; the "OFFSET" operator tells MASM that the text
                                ; data is at an OFFSET within the file which means
                                ; in this instance that it is in the .DATA section

    ret                         ; return to the next instruction after "call"

main endp

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

end start                       ; Tell MASM where the program ends


Current Page 1
1

   
| Report Member | Free Blog BlogText.org