flat assembler
Message board for the users of flat assembler.

Index > OS Construction > A simple request...

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 18 Dec 2006, 01:35
I would like to prove to my C++ teacher in school, sometime, that you can write programs that don't need windows (since based on his pessimistic view on assembly, he might not think it's possible). So, since i still don't know how to do it, i would like to ask some one to write a simple program that i could burn to a CD and have it run from the boot menu that'll display some text. Do me a favor and fully comment it. I'm requesting it here, rather than using the hello world thing for box, so i know for sure it'll run with nothing extra needed for any programs.
Post 18 Dec 2006, 01:35
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 18 Dec 2006, 02:22
Theres lots of examples on the board, including demo made for 512b compo.
Go through this topic http://board.flatassembler.net/topic.php?t=2164&start=60

Tomasz Grysztar bootable Tetris game would be a good demo to show.
Post 18 Dec 2006, 02:22
View user's profile Send private message Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 18 Dec 2006, 02:31
you mean that 360 byte thing? I tried burning that to a CD and running it but it didn't work until i used DOSBOX. I might have to write the CD a special way... I've never actually made a boot disk before so if there's somthing other than the put in CD folder and clicking burn method, please tell me. lol
Post 18 Dec 2006, 02:31
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 18 Dec 2006, 03:26
Here the code done by Tomasz Grysztar for the 512b compo.
assemble its as a bin file and use rawrite to put it on a floppy.
If you do not have floppy, maybe someone else will make a image.
Code:
; TetrOS; version 1.01 (05-09-2004); coded by Privalov; For your playing pleasure, it's a boot-sector Tetris game.; The quick help on keys:;   Left - move left;   Right - move right;   Up - rotate;   Down - drop;   Esc - new game at any time; Requires VGA and 386 or higher processor.org 7C00hROWS = 23DELAY = 4virtual at 46Ch  clock dw ?end virtualvirtual at bp  current dw ?  current_column db ?  current_row dw ?  last_tick dw ?  delay dw ?  random dw ?  score dw ?end virtuallabel well at 9000hlabel pics at well-2*64        cli        xor     ax,ax        mov     ss,ax        mov     ds,ax        mov     es,ax        mov     sp,0FFFEh        sti        push    ax        push    start        retfstart:        mov     al,13h        int     10h        mov     di,3*4        mov     ax,int_3        stosw        xor     ax,ax        stosw        mov     bp,8000h        mov     di,pics        mov     cx,64        inc     ax        rep     stosb        mov     ah,15        mov     dx,7      @@:        mov     al,15        stosb        mov     al,ah        mov     cl,6        rep     stosb        mov     al,8        stosb        mov     ah,7        dec     dx        jnz     @b        mov     cl,8        rep     stosb        mov     ax,[clock]        mov     [last_tick],ax        mov     [random],ax        mov     byte [current_row+1],well shr 8        xor     ax,ax        mov     [score],ax        dec     ax        stosw        stosw        stosw        mov     cl,ROWS    new_piece:        mov     ax,1100000000000011b        rep     stosw      @@:        mov     bx,[random]        mov     ax,257        mul     bx        inc     ax        mov     cx,43243        div     cx        mov     [random],dx        and     bx,7        cmp     bx,7        je      @b        shl     bx,1        mov     ax,[pieces+bx]        mov     [current],ax        mov     word [current_column],6 + ((3+ROWS-4)*2) shl 8        xor     ch,ch        mov     ax,test_piece        int3        mov     al,draw_piece and 0FFh        int3        or      ch,ch        jz      update_screen        xor     bp,bpprocess_key:        xor     ah,ah        int     16h        mov     al,ah        dec     al        jz      start        or      bp,bp        jz      process_key        mov     si,rotate        cmp     al,48h-1        je      action        mov     si,left        cmp     al,4Bh-1        je      action        mov     si,right        cmp     al,4Dh-1        je      action        cmp     al,50h-1        je      drop_down        jmp     main_loopaction:        call    do_move        jmp     update_screendrop_down:        mov     si,down        call    do_move        jz      drop_downupdate_screen:        mov     bx,7        mov     dx,12h        mov     ah,2        int     10h        mov     cl,12      @@:        mov     ax,[score]        shr     ax,cl        and     al,0Fh        cmp     al,10        sbb     al,69h        das        mov     ah,0Eh        int     10h        sub     cl,4        jnc     @b        push    es 0A000h        pop     es        mov     si,well+3*2        mov     di,320*184+112      draw_well:        lodsw        push    si        xchg    bx,ax        shr     bx,2        mov     dl,12      draw_row:        shr     bx,1        salc        and     ax,64        mov     si,pics        add     si,ax        mov     al,8      copy_line:        mov     cx,8        rep     movsb        add     di,320-8        dec     ax        jnz     copy_line        sub     di,320*8-8        dec     dx        jnz     draw_row        sub     di,320*8+12*8        pop     si        cmp     si,well+(3+ROWS)*2        jb      draw_well        pop     esmain_loop:        mov     ah,1        int     16h        jnz     process_key        mov     ax,[clock]        sub     ax,[last_tick]        cmp     al,DELAY        jb      main_loop        add     [last_tick],ax        mov     si,down        call    do_move        jz      update_screen    lay_piece:        mov     dx,1        mov     si,well+3*2        mov     di,si        mov     cx,ROWS      check_row:        lodsw        cmp     ax,1111111111111111b        je      remove_row        stosw        dec     cx        jmp     check_next_row      remove_row:        shl     dx,1      check_next_row:        cmp     si,well+(3+ROWS)*2        jb      check_row        add     [score],dx        jmp     new_piecedo_move:        mov     ax,clear_piece        int3        push    dword [current]        call    si        xor     ch,ch        mov     al,test_piece and 0FFh        int3        mov     al,draw_piece and 0FFh        pop     edx        or      ch,ch        jz      @f        mov     dword [current],edx      @@:        int3      no_move:        retdown:        sub     byte [current_row],2        retleft:        dec     [current_column]        retright:        inc     [current_column]        retrotate:        mov     cx,3     @@:        bt      [current],cx        rcl     dx,1        add     cl,4        cmp     cl,16        jb      @b        sub     cl,17        jnc     @b        mov     [current],dx        retint_3:        mov     di,[current_row]        mov     bx,4      on_piece_row:        mov     dx,[current]        mov     cl,bh        shr     dx,cl        and     dx,1111b        mov     cl,[current_column]        add     cl,4        shl     edx,cl        shr     edx,4        call    ax        add     bh,4        scasw        dec     bl        jnz     on_piece_row        iretclear_piece:        not     dx        and     [di],dx        rettest_piece:        test    [di],dx        jz      @f        or      ch,1      @@:        retdraw_piece:        or      [di],dx        retpieces dw 0010001000100010b       dw 0010011000100000b       dw 0010001001100000b       dw 0100010001100000b       dw 0000011001100000b       dw 0100011000100000b       dw 0010011001000000brb 7C00h+510-$dw 0AA55h    


Last edited by Dex4u on 19 Dec 2006, 19:45; edited 1 time in total
Post 18 Dec 2006, 03:26
View user's profile Send private message Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 18 Dec 2006, 03:42
i lost my floppy last year, and i don't have any here anymore. I havn't seen any at the local walmart... any suggestions on how to write it to a bootable CD?
Post 18 Dec 2006, 03:42
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
tantrikwizard



Joined: 13 Dec 2006
Posts: 142
tantrikwizard 18 Dec 2006, 17:07
kohlrak wrote:
i lost my floppy last year, and i don't have any here anymore. I havn't seen any at the local walmart... any suggestions on how to write it to a bootable CD?


Most NERO distributions have the ability to create bootable CDs. The distribution I have requires a floppy or a disk image. You may find WinImage useful for injecting a boot sector into a disk or floppy image http://www.winimage.com. If you have linux or cygwin you can use dd to inject into a floppy disk:
Code:
dd if=boot.bin of=/dev/fd0    

or a floppy disk image:
Code:
dd if=boot.bin of=bootdsk.img count=512 notrunc    
or something like that, check the syntax with
Code:
dd --help    
to be sure
Post 18 Dec 2006, 17:07
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 19 Dec 2006, 05:58
As for creating a disk image in the first place.... Or does that come with winimage? Because my cd software that comes with my exturnal burner, happens to have support for burning what i am pretty sure are images. I never thought of actually going as far as injecting it into the image, but that'd be a nice way of going about it. lol But, since it's shareware and i'm still living with my father, i will need to find a way to manually inject stuff into the image, but hopefully i'll be able to understand how it's done by looking at a simple hex of it. But i can figure that out myself. What i need now is a standard image file that i can use with it. Would it happen to be a file the size of a CD with nothing but 00s in it?

By the way, the software i'm stuck with using for burning CDs is Roxio. If i knew everything about the format of an image i'd hex my own image together and i wouldn't need a sharewear program to do it. lol That's what i'm gonna do with the XM format so i can create my own XM files and programs to make those XM files.
Post 19 Dec 2006, 05:58
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
bubach



Joined: 17 Sep 2004
Posts: 341
Location: Trollhättan, Sweden
bubach 19 Dec 2006, 11:09
you could pad the asm file with "db 0" so it assembles to the right size, you can do that with (IIRC) "rb FILE_STARTLABEL+FILESIZE_IN_BYTES-$"
Post 19 Dec 2006, 11:09
View user's profile Send private message Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 19 Dec 2006, 11:50
I would do that, but i don't know the format. It it simply a file the size of a CD filled with 0s? If so, shouldn't the boot sector be zero, and i could easily create an image file by taking 702 * 1024 * 1024 then subtracting the size of my program so far, then compile it and i could use that?
Post 19 Dec 2006, 11:50
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 19 Dec 2006, 12:33
there: http://board.flatassembler.net/topic.php?t=3954 you can find a project, which produces valid floppy image while compilation. then you can point it to use as boot image while burning cd (select option "floppy image")
Post 19 Dec 2006, 12:33
View user's profile Send private message Visit poster's website Reply with quote
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 19 Dec 2006, 13:19
muhaha!!! kohlrak, I don't believe that such an ignorant person can exist... Does he know about DOS? Or does he think that DOS was created under Windows Vista? But Bill thought that it's better not to show Vista till 2006 in commercial purposes? to my mind, this man doesn't cost any time to lose.
Post 19 Dec 2006, 13:19
View user's profile Send private message Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 19 Dec 2006, 21:41
Zhak, i am experienced with my burning program comming up with many errors if the CD image is not in a certain format. Now if you don't mind, i'd like to learn how it's done, and you have not provided one bit of evidence of your accusations against me, nor do you have anything constructive in this post to say, so i will say something to you. Grow up.
Post 19 Dec 2006, 21:41
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 19 Dec 2006, 21:54
kohlrak: i think zhak was talking about your techer, not about you. He deserves aplogize
Post 19 Dec 2006, 21:54
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 19 Dec 2006, 21:56
Oh, pardon me, Zhak. I honestly appologize irregardlessly of weather a mod says so or not (not disrespect), but it's been a long day and some stuff has been goin' on so i'm a little jumpy. Please forgive me.
Post 19 Dec 2006, 21:56
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 20 Dec 2006, 00:31
@kohlrak, you can burn DexOS as a demo, you will find ISO here:
http://www.dex4u.com/download.htm
Its a older ver, has the ISO are not kept as up to data as the images
Post 20 Dec 2006, 00:31
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 20 Dec 2006, 02:27
Dex4u wrote:
Here the code done by Tomasz Grysztar for the 512b compo.
assemble its as a bin file and use rawrite to put it on a floppy.
If you do not have floppy, maybe someone else will make a image.


I never got this originally (though I vaguely remember reading about the contest). Cool stuff!

And it works in DOSBOX 0.65 too (boot tetros.bin)! Smile Much simpler than writing to floppy.

EDIT: Score in hex, that's probably a first! Here's a screenie for everyone to marvel at. Laughing


Description:
Filesize: 1.45 KB
Viewed: 18250 Time(s)

tetros.png


Post 20 Dec 2006, 02:27
View user's profile Send private message Visit poster's website Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 20 Dec 2006, 03:21
Just booted it up here and then tried menuet. Havin' a little trouble with menuet, but i'm gonna see if i can use some other examples too, incase it's not convincing enough that it's not a simple source code that can run as-well. (I'm gonna attempt to run a DVD, and i might be able to find a temporary replacement for a floppy, i just noticed that there is an emulation setting on my burner, so i can emulate a floppy, the real question will be if i burn the image, could i directly just put any old size bin file and it'll try to boot the bin..? Well, one way to find out, i'm taking it step by step, but if it works i can just use this emulation file that my burning thing made and store it on my jump drive for debugging apps later. If this test works (i havn't tried the non-image bin yet) does anyone want me to upload the 1.44 floppy emulation file?
Post 20 Dec 2006, 03:21
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 20 Dec 2006, 03:37
Cool i did not know you could do the "boot filename.bin"
The latest DosBox works for CdPod too, which means, it emulates vesa2 .

PS: It does not emulate the atapi as the cd player does not work in DosBox.


Description:
Filesize: 1.8 KB
Viewed: 18238 Time(s)

CdPod.png


Post 20 Dec 2006, 03:37
View user's profile Send private message Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 20 Dec 2006, 04:37
Crap, it's more than just the bin file. I'm gonna start asking people offline if they have a floppy that they'd trade for an unused CD-RW. (They have no clue what they'd loose out on. lol)

Dex4u works great, except that i can't access a few menues and since i'm running it from a CD i can't save anything so i really can't do my asm development in it, not that it really matters anyway since i don't think it can read my USB drive.
Post 20 Dec 2006, 04:37
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
TmX



Joined: 02 Mar 2006
Posts: 843
Location: Jakarta, Indonesia
TmX 20 Dec 2006, 05:11
rugxulo wrote:
Dex4u wrote:
Here the code done by Tomasz Grysztar for the 512b compo.
assemble its as a bin file and use rawrite to put it on a floppy.
If you do not have floppy, maybe someone else will make a image.


I never got this originally (though I vaguely remember reading about the contest). Cool stuff!

And it works in DOSBOX 0.65 too (boot tetros.bin)! Smile Much simpler than writing to floppy.

EDIT: Score in hex, that's probably a first! Here's a screenie for everyone to marvel at. Laughing


how do you do that ?
put the tetros.bin in the same directory as dosbox ?
Post 20 Dec 2006, 05:11
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  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.