flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > UART Problem |
Author |
|
BAiC 20 Apr 2014, 01:06
I'm pretty sue you need an ORG to begin with. is there a specific UART your targetting? I recall there being more than one.
|
|||
20 Apr 2014, 01:06 |
|
baldr 20 Apr 2014, 04:33
BAiC wrote: I'm pretty sue you need an ORG to begin with. ----8<---- chain_x, Why do you think it fails? Modem's RD LED doesn't blink or what? UART has internal loopback mode, it might be useful for testing purposes. |
|||
20 Apr 2014, 04:33 |
|
BAiC 20 Apr 2014, 19:24
baldr: if you use far calls or the "int" instruction then the value of CS prior to entry will fuck with the code. you also need an ORG for absolute addressing of memory inside the code. using an ORG is the first step to initializing CS to a deterministic value.
Code: ORG 0x7C00 jmp 0:$+5;initialize CS to zero, IP to the address of the next instruction. |
|||
20 Apr 2014, 19:24 |
|
baldr 20 Apr 2014, 20:13
BAiC,
Well, next instruction will be there if and only if cs==0 on entry (because your jump is essentially jmp 0:0x7C05, i.e. 5-bytes nop in this case). |
|||
20 Apr 2014, 20:13 |
|
l_inc 20 Apr 2014, 23:10
baldr
Quote: Well, next instruction will be there if and only if cs==0 on entry Not necessarily. I heard of some BIOSes initializing cs:ip to $7c0:0 instead of 0:$7c00. Thus it was generally a good practice to start the boot code with the suggested far jump. _________________ Faith is a superposition of knowledge and fallacy |
|||
20 Apr 2014, 23:10 |
|
chain_x 21 Apr 2014, 06:25
it loads from the SeaBIOS and works fine
the only problem is that the UART not do anything |
|||
21 Apr 2014, 06:25 |
|
chain_x 21 Apr 2014, 13:08
yes it works now
i disabled DLAB Code: %define com1 0x3f8 bootentry: cli mov ax,0x07c0 mov ds,ax mov ss,ax mov es,ax mov sp,0x0800 sti call setup_uart cld mov ax,0xb800 mov es,ax xor di,di mov si,fo mov ax,10 push ax pop cx rep movsw hang: mov dx,com1+3 in al,dx push ax and al,127 out dx,al ; disable DLAB mov dx,com1 mov al,'K' out dx,al pop ax add dx,3 out dx,al ; set LCR back jmp hang setup_uart: mov dx,com1+1 mov al,0 out dx,al mov dx,com1+3 mov al,0x80 out dx,al mov dx,com1 mov al,0x01 out dx,al mov dx,com1+1 mov al,0x00 out dx,al mov dx,com1+3 mov al,0x03 out dx,al mov dx,com1+2 mov al,0xC7 out dx,al mov dx,com1+4 mov al,0x0B out dx,al xor ax,ax xor dx,dx ret fo: db "H",0x0f,"e",0x0f,"y",0x0f," ",0x0f,"W",0x0f,"o",0x0f,"r",0x0f,"l",0x0f,"d",0x0f,"!",0x0f buffer: times 510-($-$$) db 0 signature: dd 0xAA55 |
|||
21 Apr 2014, 13:08 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.