www.flickr.com

Convert a string into capital Assembly Language

Saturday, October 29, 2011 Posted by Glenn Von Posadas

;ASK FOR STRING
;CONVERT THE STRING TO CAPITAL
;author: glenn posadas www.glennvon.com

@ps macro st
mov ah,09h
lea dx, st
int 21h
endm

@pc macro var
mov ah,02h
mov dl,var
int 21h
endm

cseg segment para 'code'
assume cs:cseg,ds:cseg,es:cseg,ss:cseg
org 100h


start: jmp begin
glenn db ?

;-----------------
s1 label byte
maxlen db 41 ; 40 is max
len db ?
val db 41 dup(?)
;--------------------

s2 db 'Enter a string(small caps max:40): $'
s3 db 10,13,'Input: $'
s4 db 10,13,'Output: $'

count db ?
madeline db ? ;holds the characters

begin:

mov ax,03h
int 10h

@ps s2
mov ah,0Ah
lea dx,s1
int 21h


@ps s3 ;display na ung ininput
lea bx,val
mov al,len ;transfer muna dito, kasi bawal ang len to count
mov count,al

iput: ;input
mov al,[bx] ;ililipat mo ung isaisang laman ng bx sa al,tapos inc bx
mov madeline,al
@pc madeline
inc bx
dec count
cmp count,0
jnz iput


@ps s4
lea bx,val
mov al,len
mov count,al

oput: ;output
mov al,[bx]
mov madeline,al
sub madeline,32
@pc madeline
inc bx
dec count
cmp count,0
jnz oput
je exit



exit:

int 20h
cseg ends
end start

glenn von

Author: Glenn Posadas

20 year old 5th year Computer Engineering Student, a blogger, photographer, programmer, and an electronics hobbyist; a Christian who loves God very much..

Sharing is so Easy:
StumpleUpon DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google Twitter FaceBook

Post a Comment

Drop a comment. Thank you guys!