Forum: Assembly 2 Days Ago |
| Replies: 2 Views: 206 I don't see whats wrong, but:
mov ax, 0x8000
cwd ; sign extended word to dword, a.e. DX=FFFF
div bx ; DX:AX / BX
; try XOR'ing DX to zero. |
Forum: Assembly 2 Days Ago |
| Replies: 6 Views: 513 You could turn the multi-digit value into unpacked BCDS...
jmp start
buf times 2 db 0
start:
mov dx, buf
mov cx, 2
mov bx, 0
mov ah, 3fh ; Read Dev/File Handle |
Forum: Assembly 9 Days Ago |
| Replies: 2 Views: 219 deadstag db 'aCiDI0',6,'I0AcId'
; damn six gets iNvErTeD \/
mov bx, deadstag+6
not byte [bx] ; six got changed to something ELSE |
Forum: Assembly 9 Days Ago |
| Replies: 7 Views: 562 15. shl ax, 12
actually a byte is 8-bits so shl ax, 8 to get AL into AH
16. mov byte [store + 0],ah
You are storing the hex digits into two separate bytes, the attributes
are actually contained... |
Forum: Assembly 9 Days Ago |
| Replies: 4 Views: 331 Whether the operands are 8-bit or 16-bit is specified in the
opcode of the instruction by the word bit (bit 0), also
whether REG field in the modR/M specifies the destination
operand is determined... |
Forum: Assembly 11 Days Ago |
| Replies: 4 Views: 331 Here's what some of the values mean in the modR/M byte:
Operands Mod Reg R/M Displacement
Reg,Reg 11 XXX XXX Here R/M is treated as Reg ... |
Forum: Assembly 15 Days Ago |
| Replies: 5 Views: 411 To print any value to the screen the value is converted into
ASCII characters to be printed out on the console.
For instance the following code converts the value into the
ASCII hexadecimal... |
Forum: Assembly 16 Days Ago |
| Replies: 1 Views: 386 This should fix the problem with your code.
You see, an 8-bit divisor divides by the dividend in AX, so do this:
xor ah, ah ; right here, add this instruction
mov al, scounter
div bl |
Forum: Assembly 19 Days Ago |
| Replies: 7 Views: 562 Ok, well I made code that accepts a hexadecimal number
at the command line and prints an 'A' with the specified
background/foreground colors.
bits 16
org 100h
start:
mov cx, 2 |
Forum: Assembly 20 Days Ago |
| Replies: 4 Views: 427 Well, device independence is when an abstract
interface is provided for software to access
the hardware without intimate knowledge
of the hardware configuration of the host
system upon which it... |
Forum: Assembly 20 Days Ago |
| Replies: 7 Views: 562 So your getting a hexadecimal value from the command
line in the form of asci characters???
Couldn't tell exactly what your code was doing.
Heres an example, the asci string '72' is specified as... |
Forum: Assembly 20 Days Ago |
| Replies: 4 Views: 427 Those compilers pump out assembler for you,
I say its technically for convience because the program
could be coded on the bare metal,
Remember for code to do anything it eventually has to
have... |
Forum: Assembly 21 Days Ago |
| Replies: 1 Views: 587 I don't know what is wrong with your code,
I didn't take a long look at it, I am used to staring at 16-bit code.
I noticed you are using the linear address of the color video
ram 000B8000, I do... |
Forum: Assembly 21 Days Ago |
| Replies: 4 Views: 427 Give me convience or give me death!
The would-be programmer is
introduced in some way to what could
be compared to a CS101 course.
He is taught about algorithms,
variables, procedures,... |
Forum: Assembly 22 Days Ago |
| Replies: 1 Views: 480 There is no standard library for assembly language,
of course implementation of the aforementioned routines
are done on the bare metal.
You may want to fetch yourself a good old book on
assembly... |
Forum: Assembly 22 Days Ago |
| Replies: 4 Views: 567 Here's my code if it will help.
Hope I don't go to heck, any more delusional thoughts???
bits 16
org 100h
bum:
mov dx, isr1_grave
mov ax, 0x2501 |
Forum: Assembly 22 Days Ago |
| Replies: 4 Views: 567 You have two problems in your interrupt 1 handler:
registers are not pushed and restored,
your divisor is zero.
Also when divisor is 8-bits, AX / divisor
hence:
mov ax, 10h
div byte [nl] |
Forum: Assembly 33 Days Ago |
| Replies: 5 Views: 467 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 33 Days Ago |
| Replies: 5 Views: 467 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 34 Days Ago |
| Replies: 1 Views: 468 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 34 Days Ago |
| Replies: 5 Views: 467 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 Nov 5th, 2009 |
| Replies: 4 Views: 597 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 Oct 31st, 2009 |
| Replies: 3 Views: 454 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 Oct 30th, 2009 |
| Replies: 2 Views: 415 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 Oct 30th, 2009 |
| Replies: 4 Views: 440 [[[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 Oct 25th, 2009 |
| Replies: 1 Views: 422 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 Oct 24th, 2009 |
| Replies: 6 Views: 7,484 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 Oct 23rd, 2009 |
| Replies: 2 Views: 297 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 Oct 22nd, 2009 |
| Replies: 3 Views: 295 IF ESI=OFFSET ARR and Addr ARR=00000100h
[ESI+ESI] -> DS:00000200h 256 bytes past first byte of array |
Forum: Assembly Oct 22nd, 2009 |
| Replies: 3 Views: 295 .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 Oct 22nd, 2009 |
| Replies: 1 Views: 365 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 Oct 21st, 2009 |
| Replies: 1 Views: 341 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 Oct 21st, 2009 |
| Replies: 3 Views: 422 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 Oct 21st, 2009 |
| Replies: 1 Views: 339 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 Oct 18th, 2009 |
| Replies: 2 Views: 436 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 Oct 18th, 2009 |
| Replies: 2 Views: 284 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 Oct 18th, 2009 |
| Replies: 3 Views: 356 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 Oct 15th, 2009 |
| Replies: 2 Views: 282 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 Oct 15th, 2009 |
| Replies: 1 Views: 348 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 Oct 15th, 2009 |
| Replies: 19 Views: 805 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... |