![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Jul 2005
Posts: 158
Rep Power: 0
![]() |
Help with simple program
Okay I'm done with school for a while and I decided to toy with systems programming after a crash course in assembly I decided to try something. The program boots but doesn't execute properly. I've examined my code but I haven't found any problem. So if you could help me I'd really appreciate. It was assembled in NASM.
[BITS 16] ORG 0 mov AH,0x0 mov AL,0x0 int 0x10; enter 40x25 B/W text video mode continue: int 0x16;read key strokes cmp AH,0x1C0D;test for an enter key stroke je exit mov AL,AH int 10;display character jmp continue exit: mov AH,0x0 int 19;warm boot times 510-($-$$) db 0x0;fill up empty bytes dw 0xAA55;make bootable
__________________
Geeks may not be cool now but in the long run they prosper. |
|
|
|
|
|
#2 |
|
King of Portal
|
I'll refer you to the following posts I started here where I had similar inquiries and problems and also to a tutorial I posted on another forum:
http://flatassembler.net/
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
Join Date: Jul 2005
Posts: 158
Rep Power: 0
![]() |
Thanks I tried to fix a few things but it's still broke and I have no clue where. Guess this is what I get for diving in headfirst if anyone could take a look I'd appreciate it.
[BITS 16] ORG 0 jmp initiate nop times 59 db 0xFF initiate: mov AH,0x0 mov AL,0x0 int 0x10;set video jmp main main: continue: int 0x16;read keyboard cmp AH,0x5A; test for enter key je end; close mov AL,AH mov AH,0x0E mov BH,1 int 10;display character mov AH,0 jmp continue; end: jmp terminate terminate: mov AH,0x0; int 19; times 510-($-$$) db 0x0 dw 0xAA55;make bootable
__________________
Geeks may not be cool now but in the long run they prosper. Last edited by teencoder; May 29th, 2007 at 1:29 AM. Reason: typos |
|
|
|
|
|
#4 |
|
King of Portal
|
Where exactly does the program fail? Does it not accept the enter key at all? I suggest before trying to accept input, trying to output something beforehand. Also, some of your labels and instructions like jmp main and main: are unecessary, as is the jmp terminate with the terminate: label right after.
Also check out this post at the flatassembler page http://board.flatassembler.net/topic.php?t=6088 That program prints Hello World! waits for a key press and when a key is entered it powers down, which I think is sort of what you're trying to achieve.
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis |
|
|
|
|
|
#5 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
end: jmp terminate terminate: Now suppose you remove the worthless jump. The end and terminate labels now represent the same address. That doesn't consume any code or take any time, but what the hell good is it, except for introducing confusion? I don't care how many trees you kill. Use a pencil and paper to solidify your thoughts. Trace lines from here to there. Disentangle spaghetti. Better to kill a tree than an innocent person when your critical code goes south.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Language display in program | Prm753 | C++ | 3 | May 30th, 2006 5:45 PM |
| PLS Help me in a very simple (noob) program about textfields and textareas. | javaN00b | Java | 3 | Mar 29th, 2006 9:45 PM |
| problem...a simple program... | n00b | C++ | 13 | Sep 22nd, 2005 5:08 AM |
| Simple VB Program | jaymunee80 | Visual Basic | 2 | Jul 6th, 2005 4:56 AM |
| Errors when compiling simple program | n3o_X | Java | 3 | Feb 20th, 2005 1:31 PM |