flat assembler
Message board for the users of flat assembler.

Index > OS Construction > OS Doesn't print string!!!

Goto page 1, 2, 3, 4  Next

Do you think that it is possible to create a semi-useful OS in 512 BYTES???
Yes
47%
 47%  [ 19 ]
No
45%
 45%  [ 18 ]
Undecided
7%
 7%  [ 3 ]
Total Votes : 40

Author
Thread Post new topic Reply to topic
adefeo



Joined: 12 Jan 2004
Posts: 46
Location: Bellmore, Long Island, New York
adefeo 01 Aug 2004, 14:17
I am trying to write a simple realmode OS that prints a string to the screen and halts. The code below is what I have, but it doesn't work. What's wrong???

msg db 'Quick86/OS 0.01 (build COCO)',13,10,0
Code:
;BOOT.ASM 
;Quick86/OpratingSystem BootLoader 0.01 
;This file is licensed under the 
;GNU General Public License version 2 or later 
use16 

start: 
mov ax, 0x07C0 
mov ss, ax 
mov bp, 0          
mov sp, 0      
mov ds, ax      
mov ax, 0x07E0 
mov es, ax 
jmp loadkern 

loadkern: 
mov ah, 0x02 
mov al, 0x02 
mov ch, 0x02 
mov cl, 0x02 
mov dh, 0x00 
mov dl, 0x00 
mov bx, 0x1000 
mov es, bx 
mov bx, 0x0000 

mov ax, 0x1000 
mov ds, ax 

jmp 0x1000:0x0000 

times 512-($-start)-2 db 0 
dw 0xAA55 
    

And this is the Kernel:

Code:


mov si, msg 
call print 
call hang 

print: 
mov ah, 0x0E 
mov bh, 0x07 
mov bl, 0x09 
nextchar: 
lodsb 
cmp al, 0 
je return 
int 0x10 
jmp nextchar 
return: 
ret 

hang: 
jmp hang
    


I Install with the following comands:

copy boot.asm+kern.asm os.out
rawrite -f os.out -d a
Post 01 Aug 2004, 14:17
View user's profile Send private message Visit poster's website AIM Address Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv 01 Aug 2004, 14:31
Where is your int 13h? Anyway the "parameters" to your int (if it actually exist) looks wrong, but I did not have time to check the interrupt list.
Post 01 Aug 2004, 14:31
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4 02 Aug 2004, 00:47
adefeo wrote:
I am trying to write a simple realmode OS that prints a string to the screen and halts. The code below is what I have, but it doesn't work. What's wrong???

msg db 'Quick86/OS 0.01 (build COCO)',13,10,0
Code:
;BOOT.ASM ;Quick86/OpratingSystem BootLoader 0.01 ;This file is licensed under the ;GNU General Public License version 2 or later use16 start: mov ax, 0x07C0 mov ss, ax mov bp, 0          mov sp, 0      mov ds, ax      mov ax, 0x07E0 mov es, ax jmp loadkern loadkern: mov ah, 0x02 mov al, 0x02 mov ch, 0x02 mov cl, 0x02 mov dh, 0x00 mov dl, 0x00 mov bx, 0x1000 mov es, bx mov bx, 0x0000 ;*******************************readsector:int 0x13                     ;There should be something like this herejc readsector                              ;*******************************mov ax, 0x1000 mov ds, ax jmp 0x1000:0x0000 times 512-($-start)-2 db 0 dw 0xAA55     

And this is the Kernel:

Code:
mov si, msg call print call hang print: mov ah, 0x0E mov bh, 0x07 mov bl, 0x09 nextchar: lodsb cmp al, 0 je return int 0x10 jmp nextchar return: ret hang: jmp hang    


I Install with the following comands:

copy boot.asm+kern.asm os.out
rawrite -f os.out -d a

Roticv is right, there is no int 13h, try the mods as indicated.
\\\\|////
(@@)
ASHLEY4.
Post 02 Aug 2004, 00:47
View user's profile Send private message Reply with quote
Foamplast



Joined: 07 May 2004
Posts: 36
Location: Saratov, Russia
Foamplast 10 Aug 2004, 21:34
Two years ago I wrote a program that being written to the boot sector loads into the memory, reads sectors of HDD using ports (LBA mode), displays a message and executes loaded sectors.

So then, it is possible to have useful program in 512 bytes.
Post 10 Aug 2004, 21:34
View user's profile Send private message Visit poster's website Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc 10 Aug 2004, 21:39
Quote:
Two years ago I wrote a program that being written to the boot sector loads into the memory, reads sectors of HDD using ports (LBA mode), displays a message and executes loaded sectors.

So then, it is possible to have useful program in 512 bytes.


That's more of a monitor program than an OS. A monitor is all that's needed to load/run programs, but it's really an OS. Btw, do you still have the code to that program? I'd like to see it Smile
Post 10 Aug 2004, 21:39
View user's profile Send private message Visit poster's website Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4 11 Aug 2004, 03:05
I think it would be fun, to have a small compation, to see who could make the best OS (as in most functional) that fits in 512 bytes.

I many year's ago made a number of small games that fitted in the boot sector of a floppy, the idea was to have them on the floppy, instead of the normal mesage, so when people left a floppy in the a: drive,a mesage came up saying "You have left a disk in the A: drive, remove the disk and press esc to continue, or press the A key to play a game etc.

\\\\|////
(@@)
ASHLEY4.
Post 11 Aug 2004, 03:05
View user's profile Send private message Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 11 Aug 2004, 03:41
Hey! the first contest on this forum. You could define the rules (fits in 512 bytes) and the deadline date.

Nice Smile
Post 11 Aug 2004, 03:41
View user's profile Send private message Yahoo Messenger Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4 11 Aug 2004, 04:51
Then i would not be eligible to enter Crying or Very sad.
This is some code for a small game (needs finishing) that fits on boot sector instead of that silly mesage.
Code:
; small game demo, compile with fasm.; c:\fasm game.asm game.comorg 0x100use16start:        mov   al,0x13        int   0x10LetsGo:        push  word 0x8000        pop   es        push  cs        pop   ds        mov   cx,0xffff        mov   al,20        rep   stosb        call  PutLine        mov   si,BallY2        mov   bx,[si-6]        mov   dx,[si-4]        cmp   dx,195        jb    CmpY        jmp   NegYCmpY:        cmp   dx,1        jg    AddYNegY:        neg   word [si]AddY:        add   dx,[si]        sub   si,2        cmp   bx,310        jb    CmpX        jmp   NegXCmpX:        cmp   bx,6        jg    AddXNegX:            neg   word [si]AddX:        add   bx,[si]        sub   si,8        mov   di,dx        imul  di,320        add   di,bx        mov   cl,4BALL:        mov   [es:di], dword 0x5C5C5C5C        add   di,320        loop  BALL        mov   [si+4],bx        mov   [si+6],dx        push  es        pop   ds        push  word 0xA000        pop   es        mov   cx,32000        xor   si,si        mov   di,si        rep   movsw        mov   ah,0x11        int   0x16        jz    LetsGo        mov   ax,0x0003        int   0x10        retPutLine:        mov   al,15   mov   di,158                                        mov   cl,198Dog:    add   di,319                        stosb                        loop  Dog        xor   di,di                                 call  Hline        xor   dx,dx                      xor   di,di        mov   cl,199                Gridlp3:        stosb                        add   di,318        stosb                   loop  Gridlp3        call  Hline        ret               Hline:        mov   al,15        mov   cx,319        rep   stosb                        retBallX1   dw      160BallY1   dw      100BallX2   dw      -1BallY2   dw      -1    

Only about 178 bytes.

\\\\|////
(@@)
ASHLEY4.
Post 11 Aug 2004, 04:51
View user's profile Send private message Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 11 Aug 2004, 13:13
ASHLEY4 wrote:
Then i would not be eligible to enter Crying or Very sad.

Question Question
Post 11 Aug 2004, 13:13
View user's profile Send private message Yahoo Messenger Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4 11 Aug 2004, 17:41
Would i not have a advantage, if i set the rules ? .

\\\\|////
(@@)
ASHLEY4.
Post 11 Aug 2004, 17:41
View user's profile Send private message Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 11 Aug 2004, 18:17
If the rules are simple and clearly stated since the beginning, I don't see any problem. Moreover, it would be even more interesting.

A draft could be:

1st Fasm Coders' Contest wrote:

The scope is to code the most complex operating system that fits on boot sector of a floppy disk.
The rules are:
1. Valid entries are those posted here in the OS construction forum within 1/10/2004 00:00 (GMT)
2. The maximum size for all code and data required is limited to 512 bytes.
3. The OS should be stand alone and boot without any external assistance.
4. Complexity is given by number of different features.
5. The OS must run in BOCHS (any version, with any settings as long as they are provided) because it is the easy way to prove that OS runs in at least one hardware configuration.
6. There is no limits to the used algorithms or data compression as long as decompressor fits within given limit.
7. The winner is defined by public vote and arbitrated by (someone that don't want to participate)
8. ??
Post 11 Aug 2004, 18:17
View user's profile Send private message Yahoo Messenger Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4 11 Aug 2004, 22:51
What about bios, that can be called a external assistance ?.

\\\\|////
(@@)
ASHLEY4.
Post 11 Aug 2004, 22:51
View user's profile Send private message Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 11 Aug 2004, 23:26
Maybe limiting point 5 above to use only BOCHS default bios?
Post 11 Aug 2004, 23:26
View user's profile Send private message Yahoo Messenger Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4 12 Aug 2004, 00:49
I am not a fan of bochs, not the program, but the idea that you emulat a pc, use a real pc to test.
I would like the rules to be very simple, it must not be bigger than 512 bytes and that it fits on the boot sector of a floppy, you can use bios, or any other, but it must be no bigger than 512 byte's
we all have vote and you can not vote for your self, the winner will be able to have letters after his/her name for one year like "TOP GEEK" .

The idea is to end up with the Worlds smallest useable OS.

ps: I think you should be allowed to use external programs, but for demo only,not as part of the os.
eg: you could load a com file from disk to show your os can do this, but what that com file does can not be taken into counted.

\\\\|////
(@@)
ASHLEY4.
Post 12 Aug 2004, 00:49
View user's profile Send private message Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc 12 Aug 2004, 11:08
Quote:
I am not a fan of bochs, not the program, but the idea that you emulat a pc, use a real pc to test.


What if you use some non-standard hardware feature that doesn't work on all computers? For instance, I have a really simple hard disk driver (100 lines of assembly) that requires some tweaking for each computer it runs on (timings and such). Using Bochs as a standard allows all of us to test it. And we don't all have floppy drives either Smile

Personally, I'm going to attempt to write a protected mode OS/monitor in 512 bytes; just to see if I can do it. I really hope we do go through with the contest.
Post 12 Aug 2004, 11:08
View user's profile Send private message Visit poster's website Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4 12 Aug 2004, 15:41
Quote:
What if you use some non-standard hardware feature that doesn't work on all computers? For instance, I have a really simple hard disk driver (100 lines of assembly) that requires some tweaking for each computer it runs on (timings and such). Using Bochs as a standard allows all of us to test it. And we don't all have floppy drives either Smile.


I do not say that, there is no place for BOCHS, (for people with 1 computer, for debugging, etc), but should not be compulsory for this contest.

As for making a os, it should work on 90% of pc, keep it simple, do not use non-standard hardware feature and by carefully programming and testing most code can be tweeted to run on standard hardware.
Also floppy images can be put a cd-rw as a bootable and booted from the cd, as it emulates a floppy, so you do not need a floppy for testing.
To use BOCHS for anything, other than what i put above is admitting defeat as a OS maker. your OS becomes nothing more than a program, you mays well make a OS for a web browser.

PS: I for one am a fan of your work crc Smile.

\\\\|////
(@@)
ASHLEY4.
Post 12 Aug 2004, 15:41
View user's profile Send private message Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 12 Aug 2004, 17:59
The idea with BOCHS is to have a "standard hardware implementation". If your OS runs in BOCHS, certainly sure it will run in nearly all PCs. The contrary is not true.
Otherwise why you can determine if a contestant's entry will run on 90% PC or what's a non-standard hardware feature?

Sorta MissUniverse with all girls using the same bikini Laughing
Post 12 Aug 2004, 17:59
View user's profile Send private message Yahoo Messenger Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc 12 Aug 2004, 20:32
I agree with pelaillo - it's good to have a standard implementation for testing. Let's say you use VESA2. None of my computers implement this properly, so I couldn't test your OS. I agree: your OS should run on real hardware. But there advantages to using Bochs:

  • It's a standard
  • If it works on Bochs, it will work on at least 90% of PC's in my experience
  • It saves reboots when testing


Quote:
Also floppy images can be put a cd-rw as a bootable and booted from the cd, as it emulates a floppy, so you do not need a floppy for testing.


What if you don't have a CD-R/RW drive or access to one? For instance, the PC I formerly used to test my OSes no longer has a working floppy drive, and has no CD-ROM drive. I can copy files across my LAN to it, but it doesn't support network booting either. So I'm limited to testing via Bochs on that machine now.

Quote:
PS: I for one am a fan of your work crc .

Thank you! I like your work too. Smile
Post 12 Aug 2004, 20:32
View user's profile Send private message Visit poster's website Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4 12 Aug 2004, 22:22
So we keep rule 5) "The OS must run in BOCHS (any version, with any settings as long as they are provided) because it is the easy way to prove that OS runs in at least one hardware configuration."

Don't you just love democracy Smile.

Does any one else want to ? any of the rules or add some ?.
What about none members, can they take part ?.


.Smile. Now were can i down load BOCHS at this time of night!.

\\\\|////
(@@)
ASHLEY4.
Post 12 Aug 2004, 22:22
View user's profile Send private message Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc 13 Aug 2004, 11:11
Quote:
Now were can i down load BOCHS at this time of night!.

From http://bochs.sf.net of course Smile

Quote:
Does any one else want to ? any of the rules or add some ?

The only rule I dislike is #6: There is no limits to the used algorithms or data compression as long as decompressor fits within given limit.

I feel that compression is cheating a little, because the compressed code doesn't really fit in 512 bytes without help...
Post 13 Aug 2004, 11:11
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2, 3, 4  Next

< 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.