Making Snake Boot Sector Game in Assembly (x86)

  Рет қаралды 11,103

Nir Lichtman

Nir Lichtman

Күн бұрын

In this video I will make a simple boot sector snake game in Assembly that runs using BIOS interrupts.
Documentation:
FASM - flatassembler....
IBM BIOS Interface - ia801505.us.ar...
Intel 8086 User Manual - edge.edx.org/c...
Code:
github.com/nir...

Пікірлер: 51
@LB4FH
@LB4FH 6 ай бұрын
I love these small bytes of low-level programming, great work
@maxscott3349
@maxscott3349 6 ай бұрын
I like that it just overwrites the text in your console
@multiamphetaminsaft
@multiamphetaminsaft 5 ай бұрын
Wow, got my PC crashed but this was defenitly worth it!!! Please more low level stuff 👾
@ItsCOMMANDer_
@ItsCOMMANDer_ 6 ай бұрын
Got it running on my android phone (via limbo vm)
@varshneydevansh
@varshneydevansh 6 ай бұрын
Dude I was planning for so long to make a pong like game for the boot loader. Thanks for inspiring.
@pianissimo7121
@pianissimo7121 6 ай бұрын
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.
@A5A5A5A5h
@A5A5A5A5h 6 ай бұрын
I once built a LISP interpreter in real mode using C. This is definitely too much for me. 😂 Nice video as always btw 👍
@low-key-gamer6117
@low-key-gamer6117 6 ай бұрын
you are the defiiniton of mad genius!
@YetAnotherSysAdmin
@YetAnotherSysAdmin 6 ай бұрын
Great informative videos! Keep it up. Never been very deep into ASM but like seeing low level code - if that makes sense.
@radderek007
@radderek007 6 ай бұрын
Luv your style. From the docs … Lo level learning … hi level thinking
@eugenesorokin6602
@eugenesorokin6602 6 ай бұрын
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
@milk-it
@milk-it 6 ай бұрын
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!
@twobob
@twobob 6 ай бұрын
hah. I saw your post and already had a go at this!!! Glad this was picked
@jhaydadzie0510
@jhaydadzie0510 2 ай бұрын
Please what did you use to control the snake, because when i press on w the snake stops moving
@maxmuster7003
@maxmuster7003 6 ай бұрын
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
@plato4ek
@plato4ek 6 ай бұрын
Yeah! You've put the links to the docs. 👍
@adrok8644
@adrok8644 2 ай бұрын
nice tutorial.
@ItsCOMMANDer_
@ItsCOMMANDer_ 6 ай бұрын
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 6 ай бұрын
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 6 ай бұрын
I use NASM on linux with intel syntax.
@aliaxxei
@aliaxxei 6 ай бұрын
Doesn't boot tho :) Thanks for the video, it was nice to recall this experience.
@ItsCOMMANDer_
@ItsCOMMANDer_ 6 ай бұрын
Why? Vm kr real hardware, if real hardware (and maybe vm) yoili have to select csm/legacy boot, thta could be the issue
@EnLopXf
@EnLopXf 6 ай бұрын
I'm waiting for next Win API tutorials
@nirlichtman
@nirlichtman 6 ай бұрын
Next video will be Windows API related
@ChandrashekarCN
@ChandrashekarCN 6 ай бұрын
💖💖💖💖
@EStartive
@EStartive 6 ай бұрын
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 6 ай бұрын
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 6 ай бұрын
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 6 ай бұрын
I guess the game need less than 64 kb.
@shad578
@shad578 6 ай бұрын
What is your github?
@nirlichtman
@nirlichtman 6 ай бұрын
nir9
@shad578
@shad578 6 ай бұрын
Ok ​@@nirlichtman
@GlorytoTheMany
@GlorytoTheMany 6 ай бұрын
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.
@nngnnadas
@nngnnadas Ай бұрын
you probably could have quite esily use dl the low byte for collumn and high byte for the row or something like that.
@AhmadAlMutawa_abunoor
@AhmadAlMutawa_abunoor 6 ай бұрын
Very nice. Would the game still work if you implemented the growing of the snake after handling food?
@EinSatzMitX
@EinSatzMitX 6 ай бұрын
Why not?
@nirlichtman
@nirlichtman 6 ай бұрын
Yes, just skipped that to not overcomplicate the vid :)
@EinSatzMitX
@EinSatzMitX 6 ай бұрын
@@nirlichtman also you would have to stay below 512 bytes, if you really wanted to have the game in the boot sector
@maxmuster7003
@maxmuster7003 6 ай бұрын
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 4 ай бұрын
@@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.
@anon_y_mousse
@anon_y_mousse 6 ай бұрын
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.
@maxmuster7003
@maxmuster7003 6 ай бұрын
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
@ABCABC-sw8mh
@ABCABC-sw8mh 6 ай бұрын
The snake eats the boot logs 😂😂
@jazzd2k
@jazzd2k 6 ай бұрын
nice video, do it for uefi also, it would be great 😊
@Algorithmswithsubham
@Algorithmswithsubham 6 ай бұрын
😮😮😮😮😮😮😮
@bebdaumon3948
@bebdaumon3948 6 ай бұрын
😎😎👍👍
@maxmuster7003
@maxmuster7003 6 ай бұрын
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
Making Minimalist Web Server in Assembly on Linux (x64)
18:31
Nir Lichtman
Рет қаралды 36 М.
Making Simple Graphical Linux Distro from Scratch
17:19
Nir Lichtman
Рет қаралды 61 М.
GIANT Gummy Worm Pt.6 #shorts
00:46
Mr DegrEE
Рет қаралды 88 МЛН
Running With Bigger And Bigger Lunchlys
00:18
MrBeast
Рет қаралды 102 МЛН
How do Cats Eat Watermelon? 🍉
00:21
One More
Рет қаралды 8 МЛН
The Importance of Resource Cleanup in C
7:02
Nir Lichtman
Рет қаралды 6 М.
Making a Very Minimal Windows Executable in C
7:48
Nir Lichtman
Рет қаралды 91 М.
It’s Been a Good Run, Phone Providers.
26:31
Data Slayer
Рет қаралды 4,7 МЛН
Pushing the limits of floppy disk boot sectors: sectorLISP
14:24
The Oldskool PC
Рет қаралды 10 М.
The Office but everyone thinks they have talent - The Office US
12:07
Boot Sector Games
8:07
The 8-Bit Guy
Рет қаралды 1,4 МЛН
I Made a Weird Chess AI from Scratch
6:38
nextProgram
Рет қаралды 290 М.
Mastering Memory: Allocation Techniques in C, C++, and ARM Assembly
17:05
Why Roller Coaster Tycoon is a Game Development Masterpiece
11:59
Tech Stories
Рет қаралды 1,1 МЛН
Как удалить компромат с компьютера?
0:20
Лена Тропоцел
Рет қаралды 1,3 МЛН
Где купить колонку Алиса в ОАЭ или США ?
0:17
Electronics_latvia
Рет қаралды 3,1 МЛН
iPhone 16/16 Pro Unboxing: End of an Era!
11:21
Marques Brownlee
Рет қаралды 6 МЛН