Discussion:
assembly code find error
(too old to reply)
Own Muhammad
2023-07-10 19:39:48 UTC
Permalink
[org 0x0100]

jmp start

section data

name db'Name:Ali shan',0

vuid db'VUID :bc210410288',0

vuid_asc db'vuid sorted:001122488'
,0
vuid_desc db'vuid sorted:884221100',0

Current_values db vuid-vuid



section text
start;
mov ah,0
mov al,3
int 0x10

mov ah,0x0e
mov si,name
call print_string_color

mov al,0x0d
int 0x10
mov al,0x0a
int 0x10
mov si,current_values
call print_string_color

mov ax,0
mov es,ax
cli
mov word[es:9*4],kbisr
mov [es:9*4+2],cs
sti
l1:
mov ah,0
int 0x16
cmp al,27
jne l1
mov ax,0x4c00
int 0x21

kbisr:
push ax
push es
mov ax,0xb800
mov es,ax
in al,0x60
cmp al,0x2a
je.left_shift_pressed
cmp al,0x36
je.right_shift_pressed

mov ax,0
int 0x10
jmp.end

.left_shift_pressed:
mov ax,0
int 0x10
mov ah,0x0e
mov si,name
call print_string_color

mov al,0x0d
int 0x10
mov al,0x0a
int 0x10
mov si,vuid
call print_string_color

mov al,0x0d
int 0x10
mov al,0x0a
int 0x10
mov si,vuid_desc
call print_string_color

jmp end
.right_shift_pressed:
mov ax,0
int 0x10
mov ah,0x0e
mov si,name
call print_string_color

mov al,0x0d
int 0x10
mov al,0x0a
int 0x10

mov si,vuid
call print_string_color
mov al,0x0d
int 0x10
mov al,0x0a
int 0x10

mov ah,0x0e
mov si,vuid_asc
call print_string_color

.end:
mov al,0x20
out 0x20,al
pop es
pop ax
iret
print_string_color:
lodsb
cmp al,0
je.done
mov ah,0x0e
mov bh,0
int 0x10
jmp priny_string_color

.done:
ret
R.Wieser
2023-07-11 06:30:27 UTC
Permalink
Own Muhammad,

[snip code]

I think you forgot to include the explanation to what the code is supposed
to do and what it does instead (what the problem is). And ofcourse also
what you did yourself to find the problem.

Start explaining with why you are intercepting int 9 (but not restoring it
<-- which just /might/ be the whole problem ....).

Regards,
Rudy Wieser
Kerr-Mudd, John
2023-07-11 09:42:20 UTC
Permalink
On Tue, 11 Jul 2023 08:30:27 +0200
Post by R.Wieser
Own Muhammad,
[snip code]
I think you forgot to include the explanation to what the code is supposed
to do and what it does instead (what the problem is). And ofcourse also
what you did yourself to find the problem.
Start explaining with why you are intercepting int 9 (but not restoring it
<-- which just /might/ be the whole problem ....).
There's at least 2 syntax/spelling errors in the code as posted, just from
a quick glance.

It looks as if someone is trying to hack together some code from
something borrowed from elsewhere with not much understanding of what it's
(supposed) to do.
--
Bah, and indeed Humbug.
R.Wieser
2023-07-11 11:28:21 UTC
Permalink
John,
with not much understanding of what it's (supposed) to do.
... Almost as if the code is an assignment from a teacher who tries to
figure out how much the student picked up from his tutoring.

Regards,
Rudy Wieser
Just_Craig
2023-08-02 11:58:51 UTC
Permalink
Post by R.Wieser
John,
with not much understanding of what it's (supposed) to do.
... Almost as if the code is an assignment from a teacher who tries to
figure out how much the student picked up from his tutoring.
Regards,
Rudy Wieser
i suspect as much -
https://www.studocu.com/row/document/virtual-university-of-pakistan/introduction-to-assembly-language/org-0x0100-well/64920331
R.Wieser
2023-08-02 14:46:48 UTC
Permalink
Just_Craig,
Post by Just_Craig
Post by R.Wieser
... Almost as if the code is an assignment from a teacher who tries to
figure out how much the student picked up from his tutoring.
Regards,
Rudy Wieser
i suspect as much -
https://www.studocu.com/row/document/virtual-university-of-pakistan/introduction-to-assembly-language/org-0x0100-well/64920331
Thats a good find. :-)

Though I assumed that the posted code was provided by the teacher, to see if
the students would be able to figure out which mistakes where made in it and
fix them (spelling as well as method and missing/extra commands).

In regard to the link, I only see the "scroll a window in the screen" INT 10
, AX=0x0600 call. - which isn't even part of the solution (the result are
supposed to be on fixed lines on the screen).

I must say that the part "it prints your VUID in the ascending order" is ...
iffy to me (just "display 'hello world' " would have done as well and would
not be confusing). On the other hand, it shows that the poster didn't
overthink that part, and just put it into a string (instead of going for a
sorting routine). Point for the poster I guess.

Regards,
Rudy Wieser

Loading...