Forum: Assembly 22 Hours Ago |
| Replies: 5 Views: 107 That's actually kind of funny, I usually have a hard time
not breaking my programs down into procedures.
I think it is essential to know what pieces of code
to encapsulate into procedures and how... |
Forum: Assembly 1 Day Ago |
| Replies: 5 Views: 107 I'm sorry I didn't know that you were required to let the
user enter a fourth character.
So they can enter a variable number of chars up to the
maximum amount,
and always use a termination... |
Forum: Assembly 1 Day Ago |
| Replies: 1 Views: 92 But I know, you are a coder.
Your code does work ;)
MOV A,#8d ; value for the factorial (1-8max)
MOV B,A ; B=A
MOV C,#1d ; C=1
here: ; LOOP
SUB B,C ; B-1
MUL AB ; AxB
CMP B,C ;if B=1 |
Forum: Assembly 1 Day Ago |
| Replies: 5 Views: 107 I wrote up an NASM source with similar functions to your
own code. A function for reversing the array, for
adding the two arrays as unpacked BCS, and for entering
values are here. Call to array... |
Forum: Assembly 3 Days Ago |
| Replies: 4 Views: 384 CBW - Convert Byte to Word
Sign extends the byte in AL into the word in AX.
Sign extension is merely copying the sign bit into the rest
of a datatype when a signed value is moved into a larger... |
Forum: Assembly 8 Days Ago |
| Replies: 3 Views: 273 As to storing multiple things in a variable,
a word is really two contiguous bytes:
albl dw 0
;same as
albl2 db 0, 0
and can hold two asci values.
If we reserve room for an array of bytes: |
Forum: Assembly 10 Days Ago |
| Replies: 2 Views: 251 On the MS-DOS system functions for input I usually
use, atimes a Carriage-Return character is at the
end of the buffer lest the maximum count of
characters is met. 21/3F
0xd ends the input, that... |
Forum: Assembly 10 Days Ago |
| Replies: 4 Views: 299 [[[AxxAxLLlaLLLaXBxG]]]]
mov cx, 0x10
mov ax, 0x123
db 0x66
shl ax, cl ; shift 0x123 into high-word of EAX
db 0x66
shr ax, cl ; shift back into low-word of EAX, that is, AX
You would need... |
Forum: Assembly 14 Days Ago |
| Replies: 1 Views: 287 I am trying to create an active TSR which prints an 'A'
when the ESC key is pressed, it doesn't work.
Can anyone tell me what's wrong?
bits 16
org 100h
jmp init.tsr |
Forum: Assembly 15 Days Ago |
| Replies: 6 Views: 7,176 Func AH=2 INT 13h Disk Services:
CH=Low eight bits of cylinder number
CL=Sector number should start at 1
bits 6-7 represent two high bits of cylinder number (hard disk only).
So the MBR would be... |
Forum: Assembly 17 Days Ago |
| Replies: 2 Views: 248 80X86 Speeding up word memory access.
When the address of the first byte of a word lies
at an odd address the processor must make two memory
fetches for each byte of the word.
But if the address... |
Forum: Assembly 17 Days Ago |
| Replies: 3 Views: 261 IF ESI=OFFSET ARR and Addr ARR=00000100h
[ESI+ESI] -> DS:00000200h 256 bytes past first byte of array |
Forum: Assembly 17 Days Ago |
| Replies: 3 Views: 261 .data
arrayD WORD 10, -60, 30
.code
mov esi, OFFSET arrayD
mov ax, [esi+0] ; AX=10 initialize AX to value of
; first word
add ax,... |
Forum: Assembly 17 Days Ago |
| Replies: 1 Views: 245 mov ds, seg buff ; works in MASM
mov si, offset buff
All you need is the segment address on which the buff string
lies, this is because your generating an .EXE.
Here's one way to wait for a... |
Forum: Assembly 18 Days Ago |
| Replies: 1 Views: 278 mov eax, dword [esi] ;moves first position of array into eax
And also moves a double word EAX=44434241h, I think so,
not sure.
To read each byte at a time do:
xor eax, eax
mov al, byte [esi]... |
Forum: Assembly 18 Days Ago |
| Replies: 3 Views: 337 HLT will save CS:IP or CS:EIP of instruction after hlt
and stop instruction execution until a external interrupt
or NMI is issued.
It puts the processor in a halt state.
HLT is a priviledged... |
Forum: Assembly 18 Days Ago |
| Replies: 1 Views: 262 Give me convience or give me death...
This is 16-bit code, but it should give you the
general idea, the LOOPZ will decrement CX even if the ZeroFlag
is clear (no Zero Result), both LOOPZ and... |
Forum: Assembly 22 Days Ago |
| Replies: 2 Views: 377 To change,
newmem2:
mov eax,0x3e8
so that EAX will be loaded with the value
0x3e8+0x100 replace with:
mov eax,0x3e8+0x100
This varient of mov instruction has immediate as the source
operand,... |
Forum: Assembly 22 Days Ago |
| Replies: 2 Views: 252 You loaded your counter variable starting at counter+2 which
causes the ASCII character 5 to be printed on the screen,
that is the initializer you used for the first byte of the
array at counter:... |
Forum: Assembly 22 Days Ago |
| Replies: 3 Views: 302 The reason jibberish is output to the consol is because
DX is to contain the offset of a dollar-sign '$' terminated string.
mov dx, offset msg
mov ah, 0x9
int 0x21
int 0x20
msg db 'hello... |
Forum: Assembly 24 Days Ago |
| Replies: 2 Views: 250 An Overflow in assembly occurs when the result of
an arithmetic instruction is larger than the destination
operand. For instance, a Divide Overflow occurs when
the quotient is larger than the... |
Forum: Assembly 24 Days Ago |
| Replies: 1 Views: 276 You are indexing into the IVT when interrupts are enabled,
and the timer tick INT 8 calls INT 1c, and INT 8 is called
by external hardware.
This means the interrupt is being called while your... |
Forum: Assembly 24 Days Ago |
| Replies: 19 Views: 653 To print out your commandline arguments with
function 9, simply add a '$' to the end of the actual command tail.
example:
xor bx, bx
mov bl, [0x80]
mov byte [bx+0x81],'$'
mov bx, 0x81
But... |
Forum: Assembly 25 Days Ago |
| Replies: 19 Views: 653 16-bit OS dos I need help vortex reign....
Hello, to answer your question NASM16 is a 16-bit (80x86) assembler
for MS-DOS.
To access commandline parameters, they are passed by the
loader (your... |
Forum: Assembly 25 Days Ago |
| Replies: 6 Views: 972 Another way to print out the value of a byte in hEx is:
printb: ; Byte with value to print is in AL
push ax
shr al, 4
call printasc
pop ax
push ax
and al, 0xf |
Forum: Assembly 26 Days Ago |
| Replies: 1 Views: 234 start:
my_arr db ? ; the instruction pointer is running into junk!!!
mov dl, [my_arr] ; you didn't read any char from the keyboard
mov [my_arr], al
add dl, '0'
mov ah, 2h
int 21h
change... |
Forum: Assembly 26 Days Ago |
| Replies: 1 Views: 356 Color text-mode memory lies at segment 0xb800 and is 4000 bytes
in length 80*25*2 cuz each visible character on the screen
is accompanied by a text attribute byte.
00000000 Text Attribute Byte... |
Forum: Assembly 28 Days Ago |
| Replies: 2 Views: 298 PAINT_A_PIXEL example code...
bits 16
org 100h
start:
mov ax, 0xa000
mov es, ax
call govideo |
Forum: Assembly 28 Days Ago |
| Replies: 3 Views: 326 Suprisingly I did not know that JA was for unsigned
and JG was for signed, etc...
Thanks for the post wildgoose! |
Forum: Assembly 28 Days Ago |
| Replies: 8 Views: 344 Oh I see what you are saying wildgoose!
With packed BCD's you could use the DAS instruction to count-down
in your program using a decimal value...
mov bh, '8'
mov bl, '0'
sub bh, 0x30
sub... |
Forum: Assembly 28 Days Ago |
| Replies: 8 Views: 344 Sorry I made a mistake in my last post,
it should have been 9*10^1
mov cx, 1
mov ax, 10
call pow
mov bx, 9 ; result is in AX
mul bx |
Forum: Assembly 29 Days Ago |
| Replies: 2 Views: 298 Painting pixels, not so much tedious work.
Try MCGA mode 13h you can set this using the video bios,
if you are in 32-bit code try passing down the call to the
BIOS through the DPMI server.... |
Forum: Assembly 29 Days Ago |
| Replies: 8 Views: 344 No...
I was implying that you would have to do math.
Here's an example for value 91:
mov al, [char] ; DS:[char]=0x39
sub al, 0x30
xor ah, ah ; base
mov cx, 0xa ; power
call pow |
Forum: Assembly 30 Days Ago |
| Replies: 8 Views: 344 So you used the ASCII value of the digit character in a count
down variable, limiting the number of seconds from 0-9.
Here's how you could use a two digit number:
For 19 for example, this would... |
Forum: Assembly 30 Days Ago |
| Replies: 2 Views: 278 If your looking for an actual hard-wired address you could
use to retrieve the current time, or at least clock ticks,
I think this would be contained in the BIOS data area,
which starts at... |
Forum: Assembly 30 Days Ago |
| Replies: 3 Views: 326 JL or JB / JC ; Jump less-than or jump below
JG or JA ; Jump greater-than or jump above
The CMP instruction subtracts the dest-src from each other,
and updates the FLAGS which can be tested by... |
Forum: Assembly 30 Days Ago |
| Replies: 7 Views: 356 |
Forum: Assembly 30 Days Ago |
| Replies: 7 Views: 356 I have modified your code, and discovered the problem
really was that the string wasn't null-terminated,
this code works:
bits 16
org 100h
start:
mov dx, buf
mov ah, 0xa |
Forum: Assembly 33 Days Ago |
| Replies: 7 Views: 356 I'm sorry if your frustrated, I also notice this:
mov ax,seg buff
mov ds,ax
mov dx,offset buff
mov ah,0ah ; string input
int 21h
push ax ; AH=0Ah AL=last char read
; how is this... |
Forum: Assembly 34 Days Ago |
| Replies: 5 Views: 513 To set up stack 64KB in length for segment number
0x8000, you would load SP with 0000, it may sound strange
but when something is pushed on the stack 0000 will become
FFFE because PUSH decrements... |