Re: Variable values are lost




"NiTiN" asked:

I've got some really simple code that boots the system and displays a
string. I've looked at a couple of examples and I'm aware of the load
to 0x7c00. My jump references are fine but when I try to access
variables, I get nulls instead of the actual data.

I'd try a colon

helloMsg: db 'A'
__
wolfgang
_________________________
Here's the source code:
bits 16
org 0x7c00

jmp start

helloMsg db 'A'

start:
mov al, [helloMsg] ;copy the A
cmp al, 65
jne wrongChar

call printChar ;print the A
jmp end

wrongChar:
mov al, 66 ;print B if wrong character
call printChar

end:
jmp $

printChar:
mov ah, 0eh
;mov al, 65
mov bh, 0h
mov bl, 7h
int 10h
ret

;510 bytes plus the 2 byte signature
zero_padding: times 510 - ($ - $$) db 0

;boot signature
boot_sig: dw 0xaa55


The output I get on running this code is 'B' when it should be 'A'. I
must be missing something.

My setup is VMWare running on Windows, and an NASM compiler.

Any help is appreciated.

Regards,
Nitin


.



Relevant Pages

  • [2] Lock-free questions ...
    ... {$IFDEF FreePascal} ... MOV EDI, sNum32 ... JMP @@EXIT; ... JMP @@EXIT ...
    (comp.programming.threads)
  • Re: 8031 question
    ... AUXBUF EQU 0; TRICK - BAFER ... BUFFER EQU 100H; PREPARE FOR OUTPUT ... MOV R0,#TEMPDIV; TEMPERATURU CITA SAMO U KRUGU 1 ... JMP EQSEC; ...
    (sci.electronics.design)
  • Skybucks CircleV1
    ... A fun bot/warrior which literally circles around on a circle of jumps ... ;author Skybuck Flying ... mov 50, 2879 ... jmp 255 ...
    (rec.games.corewar)
  • Skybucks DiagVert Line Jumper V1
    ... ;strategy Jumps to Jumps on a diagonal and vertical line to try and stay ... alive and execute others code ... mov 50, 128 ... jmp 129 ...
    (rec.games.corewar)
  • Skybucks Vertical Line Jumper V1
    ... ;strategy Jumps to Jumps on a horzintal line to try and stay alive and ... ;history 2 november 2007 ... mov 50, 127 ... jmp 128 ...
    (rec.games.corewar)