Jump to content

NASM Random Character

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
JMC31337

JMC31337

    Learning Programmer

  • Members
  • PipPipPip
  • 32 posts
heres a random letter generator in 16 bit DOS using NASM...taking the old code (NASM random number generator) and changing the hex codes we can do modulo's on the binary values we convert the numbers to capital letters...
[bits 16]
[org 100h]
[section .text]
jmp start
xxx:
mov ah,02ch         ;sys time
int 21h
and dl,1fh                 ;100/th sec mod 32 enough remainder for 26 letters
cmp dl,19h                ; verify number 0-25
ja xxx
add dl,41h                 ; add 65 (ascii for A) for letter A-Z
mov [di],dl
ret
delay:
;mov cx,0
yyy:
mov dx,0a00h
zzz:
xor ax,ax
dec ax
cmp dx,0
jne zzz
loop yyy
ret
start:
mov di,numb
call xxx
inc di
call delay
call xxx
inc di
call delay
call xxx
mov ah,9h
mov dx,numb
int 21h
int 20h

numb db 4
        db 0
times 4 db 0
           db "$"

Edited by Jordan, 18 February 2009 - 06:49 AM.
Use Code Tags

"Your Life Is Your Crime, It's Punishment Time"

#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
Moved to the correct section. Please use [noparse]
[/noparse] tags when posting code.