This is somewhat a simple project I wrote by getting help from google groups I always recommend.
assemble this code using this command:
nasm -o 1.com 1.asm
This is somewhat a simple project I wrote by getting help from google groups I always recommend.
assemble this code using this command:
nasm -o 1.com 1.asm
ORG 100h
MOV si,sp ; Save stack pointer!
input_loop:
XOR ax,ax
INT 16h ; Use int16 to get a keystroke
CMP al,' ' ; is it a space char?
JE input_loop ; if space, get another char
PUSH ax ; Save current char on stack top!
CMP al,13 ; Terminating CR?
JNE input_loop
POP ax ; Get rid of last pushed char (terminating CR)
JMP test_stack
disp_loop:
POP dx ; DL will get the pushed char
MOV ah,2
INT 21h
test_stack:
CMP si,sp ; Is the stack back where we started?
JNE disp_loop
done: ; So,exit
MOV ax,0x4C00
INT 0x21
debug
e300"choose 1 letter of d' ff. y,Y/R,r/g,G/B,b- Letter to Color: ","$"
e400"the equivalent color is: ","$"
e500"yellow","$"
e600"red","$"
e700"gold","$"
e800"blue","$"
e900"do you to try Again??!! Y/N","$"
e200"invalid inpUt","$"
a100
mov ah, 09
mov dx, 310
int 21
mov ah, 01
int 21
CMP al, 59
JE 012F
CMP al, 79
JE 012F
CMP al, 52
JE 0166
CMP al, 72
JE 0166
CMP al, 47
JE 0187
CMP al, 67
JE 0187
CMP al, 42
JE 01A8
CMP al, 62
JE 01A8
JNE 01C5
int 21
mov ah, 02
mov dl, 0a
int 21
mov dl, 0d
int 21
mov ah, 09
mov dx, 400
int 21
mov ah, 09
mov dx, 500
int 21
mov ah, 02
mov dl, 0a
int 21
mov dl, 0d
int 21
mov ah, 09
mov dx, 900
int 21
mov ah, 01
int 21
CMP al, 59
JE 0123
CMP al, 4E
JE 0156
JNE 0175
mov ah, 02
mov dl, 0a
int 21
mov dl, 0d
int 21
mov ah, 09
mov dx, 400
int 21
mov ah, 09
mov dx, 600
int 21
mov ah, 09
mov dx, 900
int 21
JMp 0173
mov ah, 02
mov dl, 0a
int 21
mov dl, 0d
int 21
mov ah, 09
mov dx, 400
int 21
mov ah, 09
mov dx, 700
int 21
mov ah, 09
mov dx, 900
int 21
Jmp 0173
mov ah, 02
mov dl, 0a
int 21
mov dl, 0d
int 21
mov ah, 09
mov dx, 400
int 21
mov ah, 09
mov dx, 800
int 21
mov ah, 09
mov dx, 900
int 21
JMP 0173
Technically that's not a string reversal. If you were to push your characters into a buffer, then reverse them, that's a string reversal!
But your code appears to be okay! Do you have a specific problem?
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.