flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > One Character prints? Goto page 1, 2 Next |
Author |
|
Daedalus 25 Feb 2008, 00:09
Hey guys,
When I compile the code from fancy in this topic, add it to the bootsector of an floppy image with BFI (Build Floppy Image), load it into Bochs, I see.. well, nothing (as in, it boots, "Booting from floppy", but the next line remains empty). Almost the same goes for my own code, but it only shows the 'A', while I expect it to loop from 'A' on and on and on: Code: use16 org 0x7c00 start: mov ah, 0x0E mov bh, 0x00 mov bl, 0x07 mov al, 65 .nextchar: int 0x10 inc al jmp .nextchar times 510-($-$$) db 0 dw 0xAA55 I kept it "simple" on purpose, so without a check if al is some value or something, just to see if this would work, and it doesn't! This code also leaves the 'A': Code: use16 org 0x7c00 start: mov ah, 0x0E mov bh, 0x00 mov bl, 0x07 mov al, 65 int 0x10 mov al, 66 int 0x10 jmp start times 510-($-$$) db 0 dw 0xAA55 I'm kinda in the dark here, having absolutely no clue what I am doing wrong. TIA, Nick Last edited by Daedalus on 25 Feb 2008, 01:06; edited 1 time in total |
|||
25 Feb 2008, 00:09 |
|
Daedalus 25 Feb 2008, 00:46
Sorry if I sound quite stupid here, but if you meant that I should press either esc or alt-x, that doesn't do anything.
|
|||
25 Feb 2008, 00:46 |
|
edfed 25 Feb 2008, 00:49
you can try to make it with another sub int10
for exemple 9 or A or write your own putchar did youi test it with a org 100h .COM code? it works as well on .com and on .bin for BOOT edit: you don't sounds so stupid, just you ask for a question that was largelly aborded and resolved in the past. but, this is the place to ask for theses things. and we are there to reply, so, it's not stupid. note, if you write your own boot, you SHALL write all. if not, it's not fun. trying to make everything without BIOS. this is FUN. Last edited by edfed on 25 Feb 2008, 00:54; edited 1 time in total |
|||
25 Feb 2008, 00:49 |
|
Daedalus 25 Feb 2008, 00:54
The second example also doesn't respond to esc or alt-x, that should print AB of course.
Writing my own doesn't really seem useful here.. int 0x10,E works, but it seems to hang after one go. Well, I suppose I can though. Let me look up where the videomemory is while this problem is solved... I didn't test it with 100h .COM code, for I cannot run .COM files on my computer (x64). |
|||
25 Feb 2008, 00:54 |
|
edfed 25 Feb 2008, 01:01
hum
esc is not assumed to exit in this mode. for me, it only print a non end ABABABABABABABABABABABABA string there is no responce to escape or alt-x support for these key shall be made by programmer. |
|||
25 Feb 2008, 01:01 |
|
Daedalus 25 Feb 2008, 01:04
Ah man, that's what it's supposed to do! I really don't get why it doesn't work now, hahahaha. Well thanks for your help, good to hear my code does work, but.. just not here. If anybody has got an idea as of why (wrong configfile for Bochs? x64? Lack of luck?) please reply. I'm off to bed edfed (so you won't wait for a reply), thanks for your help.
|
|||
25 Feb 2008, 01:04 |
|
edfed 25 Feb 2008, 01:06
try it in real boot.
|
|||
25 Feb 2008, 01:06 |
|
sinsi 25 Feb 2008, 07:52
You are assuming that the video BIOS is preserving AX (and BX). A better way is
Code: use16 org 0x7c00 start: mov ah, 0x0E mov al, 65 .nextchar: mov bh, 0x00 mov bl, 0x07 push ax int 0x10 pop ax inc al jmp .nextchar times 510-($-$$) db 0 dw 0xAA55 or use a byte variable to store/load/inc |
|||
25 Feb 2008, 07:52 |
|
edfed 25 Feb 2008, 08:05
what about vectorial font render?
i have a problem with it. there are true-type, open-type, type1, and others instead to code the font, i think about coding the function to display the existing ones... but google don't know what is the algorithm or structure it only know it use beziers-curves and some posts on various forums... the polution of the net is coming, the main results of google for a question are the questions themselves on forums... for exemple, now, this post will probably appear as a result in google to the question "font render". beziers curves is not really a problem as it is a proportional, mean, interpolate algo... but there is no doc easy to find about the format of a vectorial font... if we support the existing fonts in pure asm, an important step will be done... |
|||
25 Feb 2008, 08:05 |
|
revolution 25 Feb 2008, 08:41
The vector fonts are bezier curves you ninny They are combinations of lines and curves. So Google is giving the the proper information.
Have a look here -->How To Draw TrueType Glyph Outlines. |
|||
25 Feb 2008, 08:41 |
|
Daedalus 25 Feb 2008, 09:32
Even when I preserve the values like that, it doesn't work. Like I said, I've used fancy's code from that other thread and that doesn't do anything as well. I think I'm doing something else wrong.
I first use sinsi's code, then I changed it to movs to no avail. Still the same result. |
|||
25 Feb 2008, 09:32 |
|
sinsi 25 Feb 2008, 10:02
Oops, if that is all of your code then you need to set up a stack...
Code: start: sub ax,ax mov ss,ax mov sp,0x7c00 ... |
|||
25 Feb 2008, 10:02 |
|
Daedalus 25 Feb 2008, 10:24
No use, my code so far:
Code: use16 org 0x7C00 start: xor ax, ax mov ds, ax mov sp, 0x7C00 .nextchar: mov ah, 0x0E mov al, 65 mov bh, 0x00 mov bl, 0x07 int 0x10 jmp .nextchar times 510-($-$$) db 0 dw 0xAA55 Even if it's "no use" as in it still doesn't do anything, I am learning, so thanks a lot nonetheless! |
|||
25 Feb 2008, 10:24 |
|
sinsi 25 Feb 2008, 10:47
Not "mov ds,ax" but "mov ss,ax"
[edit] Just installed bochs 2.3 Using the following code and booting from it in Bochs 2.3 gives me a continually scrolling screen ("abcdef"etc.) which is what should happen. Code: format binary as 'img' use16 org 0x7c00 start: sub ax,ax mov ss,ax mov sp,start mov ah, 0x0E mov bh, 0x00 mov bl, 0x07 mov al, 65 .nextchar: int 0x10 inc al jmp .nextchar times 510-($-$$) db 0 dw 0xAA55 |
|||
25 Feb 2008, 10:47 |
|
Daedalus 25 Feb 2008, 20:11
Yeey, thanks a lot.
format binary as img doesn't do anything specific but change the extension right? Besides that, I know that ss points to the stack segment, but what do I need to do with it? I've read osdev.org and osdever.org, but they both don't mention it on their bootloader tutorials. I know segment registers point to some place, but not what they are used for by the computer itself, only by the programmers. I understand that the stack segment must be at 0x0000 and the stack pointer to the first command in my program? Why is that? Or do you have a good read for that? I even wonder why it works because I've read that the BIOS stores ISR vectors there? Won't we overwrite those or something? Please explain, and thanks for the working code. |
|||
25 Feb 2008, 20:11 |
|
edfed 25 Feb 2008, 22:08
i prefer the method to set the stack in another segment. for example, 5000h:0
when you push a value to stack, you make it: sub sp, value.size mov [ss:sp],value for pop, it's the reverse: mov value,[ss:sp] add sp,value.size so, with stack at 0:7c00h, you will overwrite the IVT (IVT is 1024 bytes leng.) if you make more than 15360 stages of words push. it's not realistic, but possible, and will force the PC to reboot xause int will be bad supported. in case of separate stack segment, it's better, and let you push up to 64 Kbytes. to remember: push decrement the stack pointer pop increment the SP so, setting a separate SS:SP to 1000h:0FFFCh ( 65532 bytes) if the last F is not a F, but a C, it's because of eventual pop, and to align the first push to a 4 bytes boundary. ss:sp can be 1000h:0 too, and then the stack will be 64 KB leng. |
|||
25 Feb 2008, 22:08 |
|
Daedalus 25 Feb 2008, 23:47
Thanks for that explanation! So if I push a value now, won't it overwrite the code @ 0000:7C00h, since it's basically a mov?
|
|||
25 Feb 2008, 23:47 |
|
edfed 26 Feb 2008, 00:11
no, the push first decrement the SP
and then mov the value at SS:SP so, if the original SP was 7C00h, then the value will be stocked at SP-value.size you can take a pen paper and draw some diagrams to understand it better. note: for "all" µP sparcr, pic, etc.. the SS:SP is always the same mechanism. a temp stack can be used to make a dynamic data zone. but stack is just a save of context, it is not to be param passing purposes. so, i council to avoid the straxk params if the goal is to make a multi asm code. |
|||
26 Feb 2008, 00:11 |
|
Daedalus 26 Feb 2008, 00:15
Oh, I misread. Thought push incremented, pop decremented. Doesn't MingW pass all it's parameters through the stack? What's wrong with it?
|
|||
26 Feb 2008, 00:15 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.