32bit asm problem

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
iota

32bit asm problem

Post by iota »

i wanted to try my asm grfx code in [bits 32] insted of [bits 16].
the code works in 16 bit but not 32 bit could some one tell me why this code wont work
[bits 32]
start:
mov ah, 0
mov ax, 0x13
int 0x10
mov ah, 0x0c
mov al, 4
mov cx, 10
mov dx, 15
int 0x10
jmp halt
halt: jmp halt
i am using nasm to compile and gcc ld command to make a flat binary.
if anycould help me with this problem i would be gr8tfull.
regards leon pegg aka iota
Brill

RE:32bit asm problem

Post by Brill »

Firstly, your switching from 16bit to 32bit mode. I'm presuming that from the start function and code content that you haven't switched to protected mode. You can't run 32bit code in real mode (what you're probably in) which happens to be a 16bit environment.
Second, you're using interrupt 10h. If you are somehow in protected mode is that a proper protected mode interrupt you've setup? In protected mode you can't use real mode interrupts, unless you enable virtual86 mode or setup your own interrupts.

Brill
fdyne

RE:32bit asm problem

Post by fdyne »

eheh your mov ax,0x13 in [bits32] becomes mov eax,10CD0013h, and the int10h vanishes !!!!!!!!!
why?
because now the processor works in 32bit-default mode and if you don't put 66h in front of the mov instruction to reverse 32bit to 16bit operand the instruction will be executed in 32 bit mode operand, 'eating' the int 10h and transforming it in the next 16 bit of the immediate value.
regards,

[email protected]
Post Reply