Making Snake Boot Sector Game in Assembly (x86)

  Рет қаралды 9,900

Nir Lichtman

Nir Lichtman

3 ай бұрын

In this video I will make a simple boot sector snake game in Assembly that runs using BIOS interrupts.
Documentation:
FASM - flatassembler.net/docs.php?ar...
IBM BIOS Interface - ia801505.us.archive.org/18/it...
Intel 8086 User Manual - edge.edx.org/c4x/BITSPilani/E...
Code:
github.com/nir9/welcome/tree/...

Пікірлер: 48
@LB4FH
@LB4FH 3 ай бұрын
I love these small bytes of low-level programming, great work
@maxscott3349
@maxscott3349 3 ай бұрын
I like that it just overwrites the text in your console
@ItsCOMMANDer_
@ItsCOMMANDer_ 3 ай бұрын
Got it running on my android phone (via limbo vm)
@multiamphetaminsaft
@multiamphetaminsaft 2 ай бұрын
Wow, got my PC crashed but this was defenitly worth it!!! Please more low level stuff 👾
@low-key-gamer6117
@low-key-gamer6117 3 ай бұрын
you are the defiiniton of mad genius!
@varshneydevansh
@varshneydevansh 3 ай бұрын
Dude I was planning for so long to make a pong like game for the boot loader. Thanks for inspiring.
@pianissimo7121
@pianissimo7121 3 ай бұрын
I haven't watched the video, but I am guessing the code in not production ready(joking). But the main reason I am subbed to your channel is that it gives me confidence for some odd reason. Seeing you show how your read the documentation and perform such simple application makes it seem like even I can do it. Once I am done with whatever I am learning, I will go through your channel and try to implement a lot of the simpler stuff myself.
@YetAnotherSysAdmin
@YetAnotherSysAdmin 3 ай бұрын
Great informative videos! Keep it up. Never been very deep into ASM but like seeing low level code - if that makes sense.
@radderek007
@radderek007 3 ай бұрын
Luv your style. From the docs … Lo level learning … hi level thinking
@A5A5A5A5h
@A5A5A5A5h 3 ай бұрын
I once built a LISP interpreter in real mode using C. This is definitely too much for me. 😂 Nice video as always btw 👍
@eugenesorokin6602
@eugenesorokin6602 3 ай бұрын
well, good video, thanks, it's pleasant to see pc's asm. by the way nobody (yet) cancelled tabstops in asm. the first tab is for labels, second for the code mnemonics
@twobob
@twobob 3 ай бұрын
hah. I saw your post and already had a go at this!!! Glad this was picked
@milk-it
@milk-it 3 ай бұрын
If I saw that screen appear with the text "Booting from Hard Disk..." and a snake crawling back on my old XT, I would've thought it was infected with the BIOS Snake Virus!
@plato4ek
@plato4ek 3 ай бұрын
Yeah! You've put the links to the docs. 👍
@jazzd2k
@jazzd2k 3 ай бұрын
nice video, do it for uefi also, it would be great 😊
@maxmuster7003
@maxmuster7003 3 ай бұрын
Intel developer manual pdf from MS and Ralph Browns Interrupt List original within some zip archiv + html version with a table of interrupt numbers online
@AhmadAlMutawa_abunoor
@AhmadAlMutawa_abunoor 3 ай бұрын
Very nice. Would the game still work if you implemented the growing of the snake after handling food?
@EinSatzMitX
@EinSatzMitX 3 ай бұрын
Why not?
@nirlichtman
@nirlichtman 3 ай бұрын
Yes, just skipped that to not overcomplicate the vid :)
@EinSatzMitX
@EinSatzMitX 3 ай бұрын
@@nirlichtman also you would have to stay below 512 bytes, if you really wanted to have the game in the boot sector
@maxmuster7003
@maxmuster7003 3 ай бұрын
OSdevWiki Detecting memory: By far the best way to detect the memory of a PC is by using the INT 0x15, EAX = 0xE820 command. This function is available on all PCs built since 2002, and on most existing PCs before then. It is the only BIOS function that can detect memory areas above 4G. It is meant to be the ultimate memory detection BIOS function.
@xormak3935
@xormak3935 Ай бұрын
@@EinSatzMitX I know this is late but if you're referring to the 512 bytes listed after assembly, that's just the binary being forced into a default binary alignment. The actual code he wrote probably doesn't scratch that limit at all, so adding the growing of the snake shouldn't be an issue at all.
@GlorytoTheMany
@GlorytoTheMany 3 ай бұрын
Was my comment deliberately moderated or was it automatically removed by the algorithm? If the former, it's OK; if the latter, I'd reword and post it again. Anyway, it was about how I also implemented a boot sector game which is also a hybrid executable so it can be started from DOS too.
@aliaxxei
@aliaxxei 3 ай бұрын
Doesn't boot tho :) Thanks for the video, it was nice to recall this experience.
@ItsCOMMANDer_
@ItsCOMMANDer_ 3 ай бұрын
Why? Vm kr real hardware, if real hardware (and maybe vm) yoili have to select csm/legacy boot, thta could be the issue
@ChandrashekarCN
@ChandrashekarCN 3 ай бұрын
💖💖💖💖
@EnLopXf
@EnLopXf 3 ай бұрын
I'm waiting for next Win API tutorials
@nirlichtman
@nirlichtman 3 ай бұрын
Next video will be Windows API related
@ItsCOMMANDer_
@ItsCOMMANDer_ 3 ай бұрын
Also fits into a qr which is a nice bonus, but what advantage does fasm have over gas (gnu assembler, aka default linux assembler), also, snake no lengthen :( (ik it would be much harder (speaking from experience (also in asm but with linux)))
@nirlichtman
@nirlichtman 3 ай бұрын
Nice, didn't think about that :) I prefer FASM if I am writing x86 since gas uses by default the AT&T syntax which in my opinion is less intuitive. gas does have an option to set intel syntax but from what I read it is pretty buggy when using intel syntax.
@maxmuster7003
@maxmuster7003 3 ай бұрын
I use NASM on linux with intel syntax.
@anon_y_mousse
@anon_y_mousse 3 ай бұрын
This makes me wonder how small you can get it and still use graphics. For that matter, what's the smallest you can get the source code, assuming we don't allow a unique code golf language just to play snake.
@bebdaumon3948
@bebdaumon3948 3 ай бұрын
😎😎👍👍
@ABCABC-sw8mh
@ABCABC-sw8mh 3 ай бұрын
The snake eats the boot logs 😂😂
@subhamcoder
@subhamcoder 3 ай бұрын
😮😮😮😮😮😮😮
@shad578
@shad578 3 ай бұрын
What is your github?
@nirlichtman
@nirlichtman 3 ай бұрын
nir9
@shad578
@shad578 3 ай бұрын
Ok ​@@nirlichtman
@EStartive
@EStartive 3 ай бұрын
Wouldn't this be able to fit on a floppy disk? Would be cool if this was ran on like a Windows 95 computer lol
@npc_code
@npc_code 3 ай бұрын
3½-inch had 1,44mb so yes plenty of space. But it would be a nice video idea to do it on real hardware.
@nirlichtman
@nirlichtman 3 ай бұрын
Yes, this is a nice idea I wanted to also show this running on a real computer and also talk a little about disassembling the binary using Rizin but since the video turned out quite long in the end, I will do these stuff in a separate video
@maxmuster7003
@maxmuster7003 3 ай бұрын
I guess the game need less than 64 kb.
@maxmuster7003
@maxmuster7003 3 ай бұрын
We can write ASCII and color directly into the screen memory without to set the cursor. Example: mov ax, x0b800 mov es, ax cld mov di, (row*80*2) + (collum*2) mov ah, color mov al, ASCII stosw
@maxmuster7003
@maxmuster7003 3 ай бұрын
How to exchange 8 ASCII character capital letter A - H with some new pixel using 8x16 character size on 80x25 text screen. ABCD EFGH All values are hexadecimal: mov ax,1110 ; function of user character mov bp,0118 ; buffer with character mov cx,8 mov dx,41 ; start with "A" xor bl,bl mov bh,10 ; 16 int 10 ret org 0118 DB 0,0,1,7,1f,3f,7f,7f,7f,7e,7c,7c,7c,7c,7c,7c DB 0,3f,ff,ff,ff,ff,ff,ff,1f,f,7,7,7,7,7,7 DB 0,fc,ff,ff,ff,ff,ff,ff,f8,f0,e0,e0,e0,e0,e0,e0 DB 0,0,80,e0,f8,fc,fe,fe,fe,7e,3e,3e,3e,3e,3e,3e REM 00000000 00000000 00000000 00000000 REM 00000000 00111111 11111100 00000000 REM 00000001 11111111 11111111 10000000 REM 00000111 11111111 11111111 11100000 REM 00011111 11111111 11111111 11111000 REM 00111111 11111111 11111111 11111100 REM 01111111 11111111 11111111 11111110 REM 01111111 11111111 11111111 11111110 REM 01111111 00011111 11111000 11111110 REM 01111110 00001111 11110000 01111110 REM 01111100 00000111 11100000 00111110 REM 01111100 00000111 11100000 00111110 REM 01111100 00000111 11100000 00111110 REM 01111100 00000111 11100000 00111110 REM 01111100 00000111 11100000 00111110 REM 01111100 00000111 11100000 00111110 DB 7c,7c,7c,7c,7c,3e,3f,3f,1f,7,3,1,0,0,0,0 DB 7,7,7,7,7,7,1f,fe,fc,fc,ff,c0,f0,7f,f,0 DB e0,e0,e0,e0,e0,e0,f8,7f,3f,3f,ff,3,f,fe,f0,0 DB 3e,3e,3e,3e,3e,7c,fc,fc,f8,e0,c0,80,0,0,0,0 REM 01111100 00000111 11100000 00111110 REM 01111100 00000111 11100000 00111110 REM 01111100 00000111 11100000 00111110 REM 01111100 00000111 11100000 00111110 REM 01111100 00000111 11100000 00111110 REM 00111110 00000111 11100000 01111100 REM 00111111 00011111 11111000 11111100 REM 00111111 11111110 01111111 11111100 REM 00011111 11111100 00111111 11111000 REM 00000111 11111100 00111111 11100000 REM 00000011 11111111 11111111 11000000 REM 00000001 11000000 00000011 10000000 REM 00000000 11110000 00001111 00000000 REM 00000000 01111111 11111110 00000000 REM 00000000 00001111 11110000 00000000 REM 00000000 00000000 00000000 00000000
Making Minimalist Web Server in Assembly on Linux (x64)
18:31
Nir Lichtman
Рет қаралды 35 М.
Making Simple Graphical Linux Distro from Scratch
17:19
Nir Lichtman
Рет қаралды 51 М.
Stupid Barry Find Mellstroy in Escape From Prison Challenge
00:29
Garri Creative
Рет қаралды 20 МЛН
Wait for the last one! 👀
00:28
Josh Horton
Рет қаралды 68 МЛН
A simple BIOS for my breadboard computer
21:53
Ben Eater
Рет қаралды 326 М.
Making Minimalist Web Server in C on Windows
10:52
Nir Lichtman
Рет қаралды 8 М.
Making Minimalist Chat Server in C on Linux
14:28
Nir Lichtman
Рет қаралды 39 М.
Diving into Windows Keyboard Driver
10:29
Nir Lichtman
Рет қаралды 66 М.
Reverse Engineering Simple Windows Driver
12:09
Nir Lichtman
Рет қаралды 7 М.
Pushing the limits of floppy disk boot sectors: sectorLISP
14:24
The Oldskool PC
Рет қаралды 10 М.
Async Rust Is A Bad Language | Prime Reacts
28:46
ThePrimeTime
Рет қаралды 87 М.
Adding Simple System Call in Linux Kernel
7:44
Nir Lichtman
Рет қаралды 13 М.
30 Beginner Vim Commands in 7 Minutes
7:13
Nir Lichtman
Рет қаралды 9 М.
What the hell is Zellij?
8:00
typecraft
Рет қаралды 59 М.
Нашел еще 70+ нововведений в iOS 18!
11:04
Will the battery emit smoke if it rotates rapidly?
0:11
Meaningful Cartoons 183
Рет қаралды 27 МЛН
Неразрушаемый смартфон
1:00
Status
Рет қаралды 1,4 МЛН