assembly - checking Visual C++ breakpoints (not stopping)

I'm working with Visual C++ installed on a Windows Virtual Machine (VMWare). As there is no way to make the debugger stop at breakpoints, I wondered if there was a problem with the breakpoints mechanism itself, maybe due to the fact I'm working in a VM (?). ___asm int 3 works fine, and I can debug through the code and Disassembly Window, reaching my breakpoints. Is there a way to check if they are inserted correctly? here the source code window during debugging and here the Disassembly windowIt breaks at __asm int 3;, but it doesn't at. double...Read more

assembly - How do I print SVGA Info on the screen in tasm?

I am complete beginner to assembly, and graphics, any help would be appreciated. I got the svga info, but when i print it, it won't print anything. If anyone can explain why that would be great. Here is the code. If there is anymore explanations needed for what I have done let me know.MODEL SMALL.STACK 64.DATAgetinfo: VbeSignature db 'VESA' ; VESA VbeVersion dw 0000h ; Version OemStringPtr dd ? ; Producer Capabilities db 4 dup (?); Reserved VideoModePtr dd ? ; Modes TotalMemory dw ...Read more

assembly - Using the mouse in a game

I’m trying to do a game (really basic) that a character printed on a random place (in graphic mode).And then if the player pressed with the mouse on it, it changes to other random place.I did some function - which calculating a random place, print the character, and then checked if the player pressed on it If no continue to check, if yes jumps to the beginning and calculating a random place print and more...But I have a problem.Until the pressing everything works fine but then, after I pressed it starts from the beginning.But it doesn’t wait un...Read more

assembly - Is it okay to mix legacy SSE encoded instructions and VEX encoded ones in the same code path?

Along with the introduction of AVX, Intel introduced the VEX encoding scheme into the Intel 64 and IA-32 architecture. This encoding scheme is used mostly with AVX instructions. I was wondering if it's okay to intermix VEX-encoded instructions and the now called "legacy SSE" instructions.The main reason for me asking this question is code size. Consider these two instructions :shufps xmm0, xmm0, 0vshufps xmm0, xmm0, xmm0, 0I commonly use the first one to "broadcast" a scalar value to all the places in an XMM register. Now, the instruction set s...Read more

assembly - Does pushl %esp update ESP before or after storing?

The pushl Y86 instruction both decrements the stack pointer by 4 and writes a register value to memory. So it's not clear what the processor should do when it executes the instruction pushl %esp, since the register being pushed is being changed by the same instruction. Two possible events can occur:(1) push the original value of %esp, or (2) push the decremented value of %esp.In light of this, how could we modify this code-equivalent of pushl REG to account for, and accomdate, these ambiguities (being that REG can be %esp as well as any other r...Read more

assembly - Need conversion from MASM to NASM

Attached Files:File dosbox_003.png (5.722 KB)Write a NASM which will:Display your name on one line. (Use int 21h, function 9. The characters for carriage return and linefeed are 0Dh and 0Ah, respectively.)On the next line, display a prompt (once again using int 21h, function9) and read three characters from the keyboard (using int 21h, fcn 1.) Store the characters in appropriately labeled byte variables.Print the three characters, one per line, (Depending on how you implement this, use either int 21h, function 9, or function 2, your choice.)...Read more

How does one create a timer or counter in assembly?

I'm thinking that the computer keeps time by using the CMOS battery. It keeps time by counting the number of pulses per second produced by the battery, a counter.My confusion is how exactly a module such as time in python works, or any other application with a timer for that matter. I'm assuming that it will have to access directly, or indirectly to a lower level module built into the operating system ie; written in assembly? If this is the case, could someone shed some light on how exactly assembly code can update a register without being able...Read more

assembly - PIC18f46k42 UART not receiving

The TL;DR first: UART1 receiver isn't receiving; please tell me what I'm doing wrong.More detailed version:I'm currently working on a project that uses UART to send status reports between two PIC18f46k42 chips. Previous tests on a prototype board using a f8722 chip worked fine, but after switching to the f46k42, I've only been able to get the transmitter to work; the receive buffer does not fill at all.I've checked and rechecked the setup described in the documentation (page 480 of the datasheet has a basic checklist), so I've concluded that th...Read more

assembly - Switch to and from 16-bit Real Mode and 32-bit Protected Mode

I'm interested in writing my own microkernel with graphics support. However, as far as I know there is no way to change the graphics mode without interrupt 0x10, which requires Real Mode. How can I switch between Real and Protected Mode during the application's runtime? I have seen an article on osdev.org, but since I am new to assembly I cannot work out how to implement this.Technical details:Ubuntu 16.04.4 LTSGCC 7.3.0 cross-compiler (i686-elf)NASM 2.11.08 assembler, but inline GAS-style syntax is fine...Read more

x86 - 8086 assembly on DOSBox: Bug with idiv instruction?

I was helping a friend of mine debug his program, and we narrowed it down to an issue which occurs even here:.MODEL small.STACK 16.CODEstart: mov ax, 044c0h mov bl, 85 idiv blexit: mov ax, 4c00h int 21hend startAfter assembling it with tasm 4.1, and running it on DOSBox 0.74, it goes into an infinite loop. When inspecting it with turbo debugger one can see it happens after the idiv instruction, which for some reason modifies the cs and ip registers, and after two seemingly random instructions restores them to point to the idiv li...Read more

(x86 Assembly) Jumping back to location before you jumped?

I'm trying to jump back to the location I jumped from in an 16-bit x86 instruction set program. I'm currently doing a long jump to a location outside of the sector (1 sector over) but I want to jump back after the my code outside of the sector has run. ;Loading new file into segmented memory 0001:2345mov bx, 0x0001 ;Setting the location to load the module into memorymov es, bxmov ds, bxmov bx, 0x2345mov ah, 02 ;Set to read diskmov al, 1 ;Reading 1st sector from diskmov ch, 0 ;First cylindermov cl, 2 ;Reading the physical second sec...Read more

Why does esp move 0xC down after 1 push in this x86 assembly code?

I wrote this small program to measure how far esp is decremented after a push. The entire program is not in here but the relevant part is:format PE consoleentry maininclude 'macro/import32.inc'section '.data' data readable writeablemsg db "The esp address is: %.8X\n", 0p db "pause>nul", 0some_num dd 0section '.code' code readable executablemain:mov eax, esppush ebp ; store caller's base ptrmov ebp, esp ; Set this func's base ptrpush eaxpush msgcall [printf]push esppush msgcall [printf]The two addresses which get printed to the console are 0x...Read more

assembly - How does the program counter know where the next instruction is in memory?

I've always been told that it increments by 4 to fetch the next instruction (when there are no jumps or such things), but does this mean that instructions are limited to having 3 arguments?Am I right in thinking the program looks like this in memory:0: LOAD1: eax2: 0x303: <zeroed out because the next instruction has to be at 4>4: LOAD5: ebx6: 0x347: <zeroed out because the next instruction has to be at 8>8: ADD9: ecx10: eax11: ebx12: <Next instruction>Etc.This may not be exactly valid assembly but you get my point (I also know...Read more