flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Simple bootloader in machine codes

Author
Thread Post new topic Reply to topic
MIHIP



Joined: 14 Feb 2013
Posts: 130
MIHIP 17 May 2015, 16:46
Hey, guys! Today i am created a small bootloader in machine codes on Wct.

Screenshot (so small, sorry):

Image

Source code (with Russian comments):
https://github.com/Mihip/Wct/blob/master/Source/IDE/example_bootloader.h

or

Code:
/ *
Source code Wct Bootloader
Version 1.0
(C) 2015, Wct Studio
www.wctsite.tk
* /

Lp BP hm // in the address register SI put posts
Pi AL aa // Call the print line
Pl OP // Eternal loop for the correct operation of the program

/ * The procedure for printing characters (procedure 1) * /

Le AP // Put in the AH register the number of AP (15). We explain the BIOS-in fact
// We need to bring one character to the screen. The AL register
// Stores the ASCII value of our message
Lh AA // The register BH - 0, respectively, this is the page number
Ld AH // Well, register BL - 7, which means that we will be output
// Light gray text on a black background

Mn BA // As soon as we see Mn - just remember that this interruption
// At this point the interrupt 16 (decimal)
// And hex - familiar to us interrupt 0x10.
// This interrupt BIOS - video service

Md // Exit procedures

/ * The procedure for string output (procedure 2) * /

// Print characters (procedure 3)

Ik AE // Put in the AL register value from the SI
Eg // Inkrenment (increase by one) SI register

Ai MA // If the value of register AL - 0 (ie, the string has ended), the
He AF // finish the program (execution procedure 4)
// - 5 bytes forward command Md (exit the program)

Pi PN oo // If the string is not finished, then the procedure 1
// Ie character output, which is in AL

Pl OE // Take next character from a string (the implementation of the procedure 3)

Md // All rounds and exit

FH GD HE CA // ASCII: Wct (blank)
GO GP GF CA // one (blank)
GM GO HG GF // love
Aa // End of line required to complete zero, ie Aa Smile

/ * We have left space, up to 512 bytes, we need to write the missing Aa (0) * /

Aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
aa aa aa aa aa aa aa

// Up to 512 bytes we miss only two bytes ..

Ff KK // FF KK - signature boot the computer to understand,
// This is the loader, and it must be loaded in
// Memory. The windows have the signature "MZ" & "PE", but here
// This is the work.    

(translated in google translate, sorry, i don't have a free time to translate it manually)

How to build Question

Just copy this code, go to http://wctsite.tk/build & paste code, save .bin file and pack it.
Good luck! Have a good day & code Wink
Post 17 May 2015, 16:46
View user's profile Send private message Visit poster's website Reply with quote
MIHIP



Joined: 14 Feb 2013
Posts: 130
MIHIP 18 May 2015, 15:41
Image
Post 18 May 2015, 15:41
View user's profile Send private message Visit poster's website Reply with quote
dstyl



Joined: 23 Jul 2015
Posts: 67
dstyl 06 Aug 2015, 08:41
Cool stuff ill try it out, why not make demoscene stuff? OS demo with some catchy blinking isnt that common
Post 06 Aug 2015, 08:41
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.