Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Beginner's problem (Urgent !!)

popohomapopohoma Member Posts: 4
Hi everybody,

I am a beginner of assembly language. I have a hard time to program this things. My professor ask me to write a program which can display all the ASCII code(from 0 to 255). I try to write by myself, however, I have no clue how it works. Here is my program(not finish yet).

;Beginning of the program

code segment
assume cs:code,ds:code
org 100h
mov ah,0
mov al,3
int 10h

start: mov ax,0B800h
mov es,ax
mov bx,0d
mov ax,0
l:
mov es:[bx],ax
mov byte ptr es:[bx+1],17h
inc bx
inc ax
cmp ax,256
jne l
mov ah,4ch
int 21h
code ends
end start
; end of the program

There are few problems in the program:
1. I want to print out all the ASCII code, however, I only can print half of them. For example, I can see 'B', but not 'C', or I can see
'D', but not 'E'. I guess it's something wrong with the "byte" problem of operand or register???
2. I don't know how to go to another line. It's like "
" in C++ and Java.
3. The program suppose have white in foreground and blue in background, however, I can see various of strange color with respect to each ASCII code, why is that??

Moreover, I don't know if there is some web site has good resource of how to write beginner's language. I need both tutorial notes and plus good example(program) to support the argument. Please let me know if you have. Thanks for everybody. This is my assignment of my class, it's due on monday, so I hope you guys can help me out as soon as possible. Thanks again.

From Allen

Comments

  • PecaStasPecaStas Member Posts: 2
    : Hi everybody,
    :
    : I am a beginner of assembly language. I have a hard time to program this things. My professor ask me to write a program which can display all the ASCII code(from 0 to 255). I try to write by myself, however, I have no clue how it works. Here is my program(not finish yet).
    :
    : ;Beginning of the program
    :
    : code segment
    : assume cs:code,ds:code
    : org 100h
    : mov ah,0
    : mov al,3
    : int 10h
    :
    : start: mov ax,0B800h
    : mov es,ax
    : mov bx,0d
    : mov ax,0
    : l:
    : mov es:[bx],ax
    : mov byte ptr es:[bx+1],17h
    : inc bx
    : inc ax
    : cmp ax,256
    : jne l
    : mov ah,4ch
    : int 21h
    : code ends
    : end start
    : ; end of the program
    :
    : There are few problems in the program:
    : 1. I want to print out all the ASCII code, however, I only can print half of them. For example, I can see 'B', but not 'C', or I can see
    : 'D', but not 'E'. I guess it's something wrong with the "byte" problem of operand or register???
    : 2. I don't know how to go to another line. It's like "
    " in C++ and Java.
    : 3. The program suppose have white in foreground and blue in background, however, I can see various of strange color with respect to each ASCII code, why is that??
    :
    : Moreover, I don't know if there is some web site has good resource of how to write beginner's language. I need both tutorial notes and plus good example(program) to support the argument. Please let me know if you have. Thanks for everybody. This is my assignment of my class, it's due on monday, so I hope you guys can help me out as soon as possible. Thanks again.
    :
    : From Allen
    :
    :

    1. each char on the screen represents 2 bytes on video memory:
    lower byte is ascii of character, upper byte is the color of char,
    |char|color|char|color|char|color|char|color
    offset (BX) 0 1 2 3 4 5 6 7
    char on screen 0 1 2 3
    so after instruction 'mov byte ptr es:[bx+1],17h' you must
    increment bx by two
    inc bx
    inc bx
    or add bx,2

    2. after the start there is 'mov bx,0d'
    offset 0d is adress of the color of character on the screen,
    (but it must be adress of the character)
    you must change it to 0c or 0e (it must be even num.)



  • Shawn CarterShawn Carter Member Posts: 0

    ___ / http://forcoder.org / free ebooks and video tutorials about || Perl Ruby R Delphi Objective-C C++ C Python Visual Basic Java C# Swift Visual Basic .NET Go PL/SQL MATLAB JavaScript Assembly PHP Scratch Transact-SQL Hack Rust SAS Bash COBOL Fortran Awk Lisp Kotlin Clojure Apex ABAP Scheme FoxPro ML Dart Logo Prolog D Julia Scala Alice VBScript LabVIEW Ada Erlang Crystal F# Lua || ________

Sign In or Register to comment.