flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Im a noob at fasm and need help - keypress detection |
Author |
|
edemko 08 Aug 2010, 11:59
Code: ;wait for a key mov ah,$10 int $16 ;e.. i'm weak in this sphere |
|||
08 Aug 2010, 11:59 |
|
bitshifter 08 Aug 2010, 13:42
Hello computertrick, welcome to fasm forum.
There are many "Hello World" bootsectors in the OS construction area. I have recently posted a FAT12 compliant one here... http://board.flatassembler.net/topic.php?t=11774 There are also many good topics in the DOS section. Also, use the "Search" button to help find topics... |
|||
08 Aug 2010, 13:42 |
|
Tyler 08 Aug 2010, 14:20
I just made this for the fun of it:
Code: format binary as 'img' org 0x7c00 use16 start: cli mov ax,0 mov ds,ax mov es,ax mov fs,ax mov gs,ax mov ss,ax ; [Edit] Added stack setup mov sp,0x7c00 ; How's that, bitshifter? ; [/Edit] sti mov si,didnt_do_hw call print_ascii .again: mov si,nl call print_ascii mov di,0x500 call scan_ascii cmp ax,0 je .done mov si,nl call print_ascii mov si,ax call print_ascii jmp .again .done: cli hlt ; al = char ; No output. ; No regs trashed. print_char: push ax bx mov ah,0xe mov bx,0x7 int 0x10 pop bx ax ret ; No input. ; al = ascii char ; ah get_char: mov ah,0 int 0x16 ret ; si = char* buffer ; No output. ; No regs trashed. print_ascii: push si ax .next: lodsb cmp al,0 je .end call print_char jmp .next .end: pop ax si ret ; di = char* buffer ; ax = char* buffer ; No regs trashed. scan_ascii: mov ax,di push ax .next: call get_char cmp al,0xd je .end stosb call print_char jmp .next .end: mov al,0 stosb pop ax sub di,ax cmp di,1 je .null ret .null: mov ax,0 ret ; I was going to use this, but turns out, I don't need it. Oh well... cmp_ascii: push di si lodsb mov ah,byte[di] sub al,ah jne .end cmp ah,0 jne cmp_ascii .end: mov ah,0 pop si di ret didnt_do_hw db 'I didn',"'",'t do my homework. I went to some random forum and prayed on innocent forummers and had them slave for me, to do my homework... lolzzz',0xd,0xa,0xd,0xa,'Enter a string and I',"'",'ll echo it:',0 nl db 0xa,0xd,0 times 510 - ($ - $$) db 0 dw 0xaa55 It's bootable as a boot sector. To test it(the image below), set it as a floppy disk for a VM and boot the VM from the floppy.
Last edited by Tyler on 08 Aug 2010, 22:58; edited 1 time in total |
|||||||||||
08 Aug 2010, 14:20 |
|
edemko 08 Aug 2010, 16:22
Quote:
or look here(read the four posts - not all the topic): http://board.flatassembler.net/topic.php?t=11576 http://board.flatassembler.net/topic.php?t=11576&start=15 http://board.flatassembler.net/topic.php?t=11576&start=16 http://board.flatassembler.net/topic.php?t=11576&start=19 |
|||
08 Aug 2010, 16:22 |
|
bitshifter 08 Aug 2010, 16:25
You should set the stack pointer to a valid place...
Code: ... cli mov ss,ax mov sp,0fffch ; 0ffffh, minus 2 = last word, minus 1 for alignment sti ... |
|||
08 Aug 2010, 16:25 |
|
GhostXoPCorp 08 Aug 2010, 20:43
You arent just making an os to show off to your youtube buddies right?
If you are new to fasm please read the entire document on the main page, print it, download it, even read it twice. Then you should have it down. IF you really read it. It should cover a good part of the needed to know knowedge for fasm/os development. After that, The information given to you now will be more clear. Trust me, Im not stupid when i say "It WILL help to read ALL of it, TWICE" because then half of what u want to know, ull already know half of, but this is all coming from a guy who has been in osdevelopment and fasm for 2 years. But u will have a great start if you do what ive recommended. P.S this is only if you decide you want to make an os and continue making it. Dont know the little things that will get you through, learn it all, you might make somethign better then you thought you were going to make And im sure you know, that only programs u make will run on boot, remember, dependencies, you have to make your own everything im sure you knew that tho |
|||
08 Aug 2010, 20:43 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.