flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Help me with my code

Author
Thread Post new topic Reply to topic
BOTOKILLER



Joined: 07 Jan 2011
Posts: 154
Location: Ukraine
BOTOKILLER 07 Jan 2011, 16:17
Hello people Wink

I have current code in FASM :

use16
org 7C00h

mov dx, 2h

BEGIN:
mov ah, 0Eh
mov al, 0Dh
int 10h
mov al, 'E'
int 10h
mov al, 'n'
int 10h
mov al, 't'
int 10h
mov al, 'e'
int 10h
mov al, 'r'
int 10h
mov al, ' '
int 10h
mov al, 'n'
int 10h
mov al, 'u'
int 10h
mov al, 'm'
int 10h
mov al, 'b'
int 10h
mov al, 'e'
int 10h
mov al, 'r'
int 10h
mov al, ':'
int 10h
xor ax, ax
jmp INPUT

INPUT:
INT 16h
sub al, 30h
mov ah, 0h
PUSH AX
dec dx
cmp dx, 0h
je FINISH
jne BEGIN

FINISH:
pop ax
pop bx
mov ah, bl
add al, ah
add al, 30h
mov ah, 0Eh
int 10h
OLOLOOP:
jmp OLOLOOP


times 420 nop
db 55h, 0AAh

I just learn about boot sector but, this code doesnt compiles after i changed JNE and JE instructions .....
Help me i dont know may be it compillers bug or something because everythinng worked befor i changed those 2 lines.


Description: this is what happens when i try to compile my code
Filesize: 63.17 KB
Viewed: 4300 Time(s)

LOLsnap4.JPG



_________________
_______________________________
NSOS
Post 07 Jan 2011, 16:17
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 07 Jan 2011, 17:31
1. Please use [code] tags around your code. That puts it into scrollable window, and so your post with long takes less space. Also, your code gets colorized and spaces aren't ignored.

2. You posted in wrong section of forum. "Compiler internals" is supposed to be about compiler internals, this thread is now moved to OS development section.
Post 07 Jan 2011, 17:31
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
pearlz



Joined: 07 Jun 2010
Posts: 55
Location: Viet Nam
pearlz 07 Jan 2011, 18:41
Hi! that's complie OK in my Conputer.
je <-> jz
jne <-> jnz
Post 07 Jan 2011, 18:41
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 07 Jan 2011, 18:45
2. He's asking about a compiler generated error message.

The error is caused by another process has exclusive write permissions, blocking Fasm from writing to the file.
Post 07 Jan 2011, 18:45
View user's profile Send private message Reply with quote
pearlz



Joined: 07 Jun 2010
Posts: 55
Location: Viet Nam
pearlz 07 Jan 2011, 18:47
you not open "boot.bin" at the same time???????????
Post 07 Jan 2011, 18:47
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 07 Jan 2011, 23:58
Quote:
2. He's asking about a compiler generated error message.

Oooh, sorry.

Maybe your boot sector was executed somehow (as DOS .com file under Windows) and didn't exit properly. Hit CTRL+ALT+DEL, start Task Manager, and look if you can't find it as running process. If you find it, kill it.
Post 07 Jan 2011, 23:58
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
me239



Joined: 06 Jan 2011
Posts: 200
me239 21 Jan 2011, 05:43
I noticed that you have a lot of bugs. First off, you need to optimize your printing routine
Code:
mov si, text
call printf
printf:
lodsb
cmp al, 0
je pdone
mov ah, 0eh
int 10h
jmp printf
pdone:
ret
text db "Enter number: ", 0
    

I'm not sure what you're trying to do with the input as all you are doing is converting ascii to decimal and back. Anyways, it's still ridden with bugs. Here is a better way to do it
Code:
xor ax, ax
int 16h
mov ah, 0eh
int 10h
    

I based this code off what you have already have done so if it doesn't do what you intended it's not my fault. One last thing, end your code with the following
Code:
times 510-($-$$) db 0
dw 0aa55h
    

instead of
Code:
times 420 db 0
dw 0aa55h
    
Post 21 Jan 2011, 05:43
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 22 Jan 2011, 02:27
Also dont forget to select the display page with BH = page index.
Code:
; al = character
mov ah,0eh
mov bh,0 ;first page!
int 10h
    
Post 22 Jan 2011, 02:27
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.