152 Posted Topics

Member Avatar for jonnyboy12

The print routine is translating the value of AX into ASCI characters and printing them using Function 2 of the MS-DOS Function Request Interrupt.

Member Avatar for NotNull
0
115
Member Avatar for jannyboy

fs:[0x30] memory operand in direct addressing mode with segment override prefix to segment register FS. It means "use segment address in register FS" and an "offset of 00000030 into this segment"

Member Avatar for NotNull
0
79
Member Avatar for dipanshu_

An indirect far call uses a memory variable to contain a 32-bit far pointer to the target upon which to transfer execution control. A far pointer in 16-bit assembly language has the following format: XLo-WordXHi-WordX [OffsetXX][Segment] Here are some examples: [code] push SegmentAddress push offset RETF ; pops last two …

Member Avatar for NotNull
0
209
Member Avatar for fares_silawi

The text attribute byte immediately follows the character byte in video ram. Text attributes can also be specified with INT 10/09 Write Char and Attr at hardware cursor. Here is the format of the text attribute byte: [HHHHLLLL] H-High Nibble= Background Color L-Low Nibble= Foreground Color [code] mov cx, b800h …

Member Avatar for Goalatio
0
3K
Member Avatar for bd338

The reason your data couldn't be declared at the beginning of your code, unless there was a jump as the first instruction, is because execution begins at the beginning of your executable image in memory at 0000:7C00 and if data was at the beginning it would be executed as instructions, …

Member Avatar for gerard4143
0
216
Member Avatar for johann_2

Here's a quick way to print out the value of DL. [code] mov al, dl ; value must be in range of 0-99 aam add ah, 30h add al, 30h push ax mov dl, ah mov ah, 2 int 21h pop ax mov dl, al mov ah, 2 int 21h …

Member Avatar for NotNull
0
229
Member Avatar for Hanyouslayer

Your memory model is small, so you are generating an .EXE yet you are using a RET to terminate. MS-DOS does not push a NULL-WORD for .EXE programs. You define main: as a subroutine, who is calling you. I believe RET 0 does not return a value it just pops …

Member Avatar for NotNull
0
196
Member Avatar for katjaschmidt

Why do you want to do this? That is, manipulate the return address on the stack? If you use a hardwired value like +8, you may need to change it when you alter the assembly source. In 32-bit assembly, CALL pushes a 32-bit return address on the stack for a …

Member Avatar for katjaschmidt
0
107
Member Avatar for JONZ

[code] ARR DW 0x1234, 0x5678, 0x9ABC MOV BX, OFFSET ARR ; BX now contains offset of array MOV [Pointer_Var], BX ; Pointer_Var now contains offset of array [/code] If you set up a pointer variable, you will have to load the 16-bit offset into a register before you can use …

Member Avatar for NotNull
0
61
Member Avatar for Nicholas_Roge

Does 64-bit Windows still run 32-bit applications? The code your showing is for 16-bit DOS, and I believe DOS emulation is not available under 64-bit Windows. Try this: get DOS Box if available for Windows 7, , and mount the directory containing your 16-bit assembler, your code and your linker. …

Member Avatar for gerard4143
0
97
Member Avatar for NotNull
Member Avatar for NotNull
-1
419
Member Avatar for Behi Jon

To get the offset of the last byte in a string: [code] ;MASM Syntax LEA SI, STR_ADDR + LENZ DEC SI [/code] [code] ;NASM Syntax LEA SI, [STR_ADDR + LENZ] DEC SI [/code] 100 S 101 T 102 R 103 Z Length is 4 100+4=104-1=103 STR_ADDR+LENGTH=Address of first byte past …

Member Avatar for NotNull
0
114
Member Avatar for linuxdude

Its being used to access local vars. sub esp, 16 The stack pointer has 16 subtracted from it to reserve room for 4 doublewords as local variables on the stack. mov DWORD PTR [ebp-4], 5 Copies 5 into first doubleword on the stack. Take a look at the stack at …

Member Avatar for NotNull
0
4K
Member Avatar for operator494d

He probably made a mistake [DI] defaults to DS, so it should have been DS : DI

Member Avatar for NotNull
0
84
Member Avatar for Behi Jon

I added DEC SI to line 23, and your code now works. BITS 16 ORG 100h [code] JMP DEADSTACG STRZ DB 'txeT desreveR$' DEADSTACG: LEA BX, [STRZ] MOV SI, BX MOV CX, 13 A10: INC SI DEC CX JNZ A10 dec si ; well there you go... DO_REVERSE: CMP BX, …

Member Avatar for NotNull
0
88
Member Avatar for vista

This line: [code] MOV dl, [countlist+eax] [/code] Uses the letter as an index into an array of 26 bytes which represents one of the 26 letters of the english alphabet. 'A'=65 - 65 =0, index 0 into the array, the array's first byte represents the character A and whenever 'A' …

Member Avatar for sDJh
0
6K
Member Avatar for ibrahim_commu

The exercise you want to do is actually a pretty simple one, the best solution would be to have an array of dataitems like this: GRADE, STUDENT, GRADE, STUDENT if the grades and student numbers were in the range of 0..255 they could be stored in a byte otherwise a …

Member Avatar for NotNull
0
80
Member Avatar for Happy Family

This page might help: [url]http://www.frontiernet.net/~fys/snd.htm[/url]

Member Avatar for NotNull
0
62
Member Avatar for Blackeagle

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 representation of a value. [code] PrintHexW: push ax shr ax, 8 call PrintHexB pop ax push ax …

Member Avatar for NotNull
0
123
Member Avatar for 825

You could turn the multi-digit value into unpacked BCDS... [code] jmp start buf times 2 db 0 start: mov dx, buf mov cx, 2 mov bx, 0 mov ah, 3fh ; Read Dev/File Handle int 21h sub byte [buf], 0x30 sub byte [buf+1], 0x30 [/code] '21'=3231-3030=0201

Member Avatar for b1083
0
118
Member Avatar for Fenrir190

I don't see whats wrong, but: [code] mov ax, 0x8000 cwd ; sign extended word to dword, a.e. DX=FFFF div bx ; DX:AX / BX ; try XOR'ing DX to zero. [/code]

Member Avatar for NotNull
0
157
Member Avatar for Goalatio

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 a command line parameter, it makes the asci-values 37h and 32h. So why not create an …

Member Avatar for Goalatio
0
296
Member Avatar for losh177

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 Mem (Direct Addressing Mode) 00 XXX 110 [Lo-Byte][Hi-Byte] [BX+SI] 00 XXX 000 [BX+SI+Displacement] 01 XXX 000 [Byte] [BX+SI+Displacement] 10 XXX 000 [Lo-Byte][Hi-Byte] [BX+DI] 00 …

Member Avatar for losh177
0
154
Member Avatar for kekekerush

deadstag db 'aCiDI0',6,'I0AcId' ; damn six gets iNvErTeD \/ mov bx, deadstag+6 not byte [bx] ; six got changed to something ELSE

Member Avatar for NotNull
0
98
Member Avatar for asmnewbie3

This should fix the problem with your code. You see, an 8-bit divisor divides by the dividend in AX, so do this: [code] xor ah, ah ; right here, add this instruction mov al, scounter div bl [/code]

Member Avatar for NotNull
0
177
Member Avatar for NotNull

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, recursive functions, data structures and arrays. One of the fundamental steps for any program development is ease of program …

Member Avatar for NotNull
0
148
Member Avatar for magava

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 not know why your message wouldn't be being displayed. …

Member Avatar for NotNull
-1
429
Member Avatar for scriptkiddy

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 language, there are plenty of them out there. In assembly language it is qwite easy to have …

Member Avatar for NotNull
0
1K
Member Avatar for lacompsr

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: [code] mov ax, 10h div byte [nl] [/code]

Member Avatar for NotNull
0
159
Member Avatar for RobBrown

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 reversal is commented out. After three characters have been read in either a + …

Member Avatar for NotNull
0
173
Member Avatar for surfer2009

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 JNE here ;jump back == Magically becomes …

Member Avatar for NotNull
0
152
Member Avatar for urbancalli

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 datatype. When it is a byte being copied into a …

Member Avatar for NotNull
0
156
Member Avatar for Goalatio

As to storing multiple things in a variable, a word is really two contiguous bytes: [code] albl dw 0 ;same as albl2 db 0, 0 [/code] and can hold two asci values. If we reserve room for an array of bytes: [code] albl2 times 64 db 0 [/code] albl2 is …

Member Avatar for Goalatio
0
159
Member Avatar for NotNull

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? [code] bits 16 org 100h jmp init.tsr int1c: push ds push ax push cs pop ds call checkdos2 jc int1c_e cmp byte [hotkey_found], …

Member Avatar for mathematician
0
182
Member Avatar for Goalatio

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 is, from the console. 0D or 13 the Carriage Return is the end of line …

Member Avatar for Goalatio
0
1K
Member Avatar for brando|away

[[[AxxAxLLlaLLLaXBxG]]]] [code] 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 [/code] You would need to use bitshifting to extract the values of the registers 32-bit …

Member Avatar for NotNull
0
142
Member Avatar for Alex_

It might be that the 16-bit code you have been given pertains to when a task requests to terminate on a single tasking operating system. Or if it refers to multi-tasking, then it is not just an intermediary but free's a task from a list of tasks to execute and …

Member Avatar for Alex_
-1
171
Member Avatar for amrani.ah

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 at Cylinder/Track 0 head 0 Sector 1 "NOTE ABOUT BOOT DISKS: im not sure about …

Member Avatar for NotNull
0
233
Member Avatar for NotNull

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 of the first byte of the word lies at an even address …

Member Avatar for Evenbit
0
156
Member Avatar for kevincarroll

*PROTECTED MODE STUFF* If you are running as an application program, then you application is most likely running in another ring of the processor and most likely will not be able to execute privileged instructions like SGDT and LGDT. Applications programs address space is limited by the LDT, and does …

Member Avatar for mathematician
0
217
Member Avatar for RayvenHawk

[code] .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, [esi+2] ; AX=AX + -60 = -50 add ax, [esi+4] ; AX=AX + 30 = -20 call DumpRegs call WaitMsg exit [/code] In …

Member Avatar for NotNull
0
143
Member Avatar for Alex_

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 key press: [code] waitkey: mov ah, 0x6 mov dx, 0xff int …

Member Avatar for NotNull
0
250
Member Avatar for amw2326

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] mov ebx, 'b' ;moves first letter comparison (b) into ebx cmp ebx, …

Member Avatar for NotNull
0
152
Member Avatar for dmanw100

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 instruction in virtual 8086 mode, and will have no effect in the Windows Console.

Member Avatar for NotNull
0
192
Member Avatar for wilen

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, and this has memory operand as source: mov eax,[0x3e8+0x100] Using a hardwired offset could cause an Access Violation. Once you …

Member Avatar for wilen
0
179
Member Avatar for Ronen444

The reason jibberish is output to the consol is because DX is to contain the offset of a dollar-sign '$' terminated string. [code] mov dx, offset msg mov ah, 0x9 int 0x21 int 0x20 msg db 'hello world$' [/code] To print out the value contained in the registers you will …

Member Avatar for Evenbit
0
11K
Member Avatar for rayda

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: Make these changes: [code] singleNumber: mov bx,offset counter mov [bx+0],al ; changed +2 to +0 …

Member Avatar for rayda
0
170
Member Avatar for punchinello

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 operand used to store the quotient part of the result. A segment selector is a value placed in a …

Member Avatar for punchinello
0
91
Member Avatar for Goalatio

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 parent process) into offset 81h in your PSP. You have your origin set to 100h so I assume …

Member Avatar for Goalatio
0
3K
Member Avatar for xixpsychoxix

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 changing its interrupt vector. Try disabling interrupts with a CLI instruction, if under DOS …

Member Avatar for NotNull
0
82

The End.