flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Pause... |
Author |
|
Dex4u 17 Jun 2011, 23:19
See edfed RTC code
http://board.flatassembler.net/topic.php?p=65358#65358 |
|||
17 Jun 2011, 23:19 |
|
Overflowz 18 Jun 2011, 10:20
Dex4u
Thank you. Also, can you tell me what "in" and "out" instructions does ? I read documentation but I can't understand much.. Is there some tutorial for beginners ? Thanks. How about this one, it should work under dos right ? Code: mov ah,0x86 mov cx,microseconds int 0x15 eh.... why this code doesn't work ?.. Code: format binary start: mov ax,0x07C0 mov ds,ax mov si,text_string call print_string jmp $ text_string db "Hello World ",0 delays: ;DL=DeLay in second mov ax,0 out 70h,al in al,71h ;al = seconds of time ror ax,8 @@: out 70h,al in al,71h sub al,ah je @b dec dl jne delays ret print_string: mov ah,0eh .repeat: lodsb cmp al,0 je .done int 10h mov dl,3 call delays jmp .repeat .done: ret times 510-($-$$) db 0 dw 0xAA55 Trying to print characters with delays like H (after 3 seconds).. e (after 3 seconds).. l.. and so on.. |
|||
18 Jun 2011, 10:20 |
|
ManOfSteel 18 Jun 2011, 10:52
Overflowz wrote: Also, can you tell me what "in" and "out" instructions does ? I read documentation but I can't understand much.. In short, in/out is how you communicate with ports: out writes data, in reads data. If you have anything more specific to ask, then please do. But I'm pretty sure it's all there in great details in the Intel manuals. Overflowz wrote:
It's a BIOS interrupt. It should work under DOS but I can't tell for sure. Why are you asking this here and not in the DOS subforum? |
|||
18 Jun 2011, 10:52 |
|
Overflowz 18 Jun 2011, 11:06
I'm trying to write simple OS.. not graphics and things like that cause I'm just totally newbie about that. I read up some tutorial and understood these and worked fine when booted from VMware:
Code: format binary start: mov ax,0x07C0 ;BIOS reads boot loader from this address mov ds,ax ;moving it into data segments (I guess, whole my code is in data section) mov si,text_string ; print characters.. call print_string ; jmp $ ;infinite loop text_string db "Hello World ",0 print_string: mov ah,0eh .repeat: lodsb cmp al,0 je .done int 10h jmp .repeat .done: ret times 510-($-$$) db 0 ;fill 0s to be 512 bytes dw 0xAA55 ;boot sig Can you tell me which interrupts wont work there ? I know only int 21h won't work. |
|||
18 Jun 2011, 11:06 |
|
edfed 18 Jun 2011, 12:54
with very little code overhead, it is possible to use PIT to do delays.
and you know what? this kind of delay is less CPU consuming than RTC or DEC reg method. just use an over int8 handler to update some counter, compared to some value in the application, and just do a Code: mov [delay.time],value call delay like ever, this function is easy to use, but behind the call delay, there will be a fully halted system. only irqs will update the execution of this function. then, type a key, move the mouse, or just the 18.2 interrupt. but only the pit interrupt will be effective for this function. means that even if an irq wakes the function (because of hlt instruction inside the delay loop), it will do nothing else than a value compare with 0, and a jne .loop. the int8 over handler is responsible of the counter update, that is passed with the value in delay.time. means that in fact, you implement a timer in the machine, exactlly like if you connect a timer component on a digital electronic board. the way to install a handler over a handler is easy, just save somewhere the far pointer to the original handler taken from the IVT, put your handler's far pointer in the IVT, and in the over handler, don't forget to do a jmp to the far pointer to old handler. the old handler is responsible of the iret, then, your code will be simple like Code: newint8: dec [delay.time] jmp far dword[delay.oldint8] int 8 vector is the 32 bits far pointer at linear 8*4 the first word is the 16 bits offset. the second is the 16 bits segment. |
|||
18 Jun 2011, 12:54 |
|
Dex4u 18 Jun 2011, 16:40
If you just want a delay so people can read some text on screen.
Your can use the Vertical retrace of the monitor. In a bare metal environment, it would be refreshed 60 times a second Once you know that you can use it in some code to delay for any number of seconds. Example: if you want a 10 second delay, simply multiply 10 by 60 move the result in to ecx and do a loop that number of times, in between the loops calling the below function. Code: FullVertWait: pushad mov dx,0x03da Vr: in al,dx test al,8 jnz Vr Nvr: in al,dx test al,8 jz Nvr popad ret |
|||
18 Jun 2011, 16:40 |
|
Overflowz 18 Jun 2011, 18:36
damn.. you guys know very much )) I'd better learn first what is IRQ or PIT or things like that.. Can someone suggest me some tutorials on it ? Thank you
|
|||
18 Jun 2011, 18:36 |
|
xleelz 18 Jun 2011, 18:46
Here's the Best tutorial around: http://www.intel.com/products/processor/manuals/
_________________ The person you don't know is the person that could help you the most... or rape you, whichever they prefer. |
|||
18 Jun 2011, 18:46 |
|
egos 18 Jun 2011, 22:14
Quote: just use an over int8 handler to update some counter, compared to some value in the application Code: mov ax,[46Ch] mov [base],ax wait: hlt mov ax,[46Ch] sub ax,[base] cmp ax,91 ; 5*18.2 jb short wait |
|||
18 Jun 2011, 22:14 |
|
Overflowz 02 Jul 2011, 21:01
xleelz
Which one should I download from there can you tell me please ? Because of I've downloaded these two files http://board.flatassembler.net/topic.php?p=55709#55709 but there is nothing information about IRQ or things like that.. Where should I start ? |
|||
02 Jul 2011, 21:01 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.