flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 26 Jun 2010, 01:39
Code: test [fs:ebx+120h],10001001b ;bits 7, 3 and 0 are tested jz .continue |
|||
![]() |
|
LocoDelAssembly 26 Jun 2010, 01:59
Code: test dword [fs:ebx+120h], (1 shl 0) or (1 shl 3) or (1 shl 7) ; or just ", 89h" Once all those bits are zero the ZF flag will turn on so the jnz will not jump to "demo" again. Here a macro that can test for zero all the bits you may want: Code: ; Result in ZF macro all_zero operand, [bit*] { common local mask mask = 0 forward mask = mask or (1 shl bit) if bit < 0 | bit > 63 ; fasm will catch the rest of the errors when assembling TEST err 'out of range' end if common test operand, mask } ;Usage example all_zero dword [fs:ebx+120h], 7, 0, 3 |
|||
![]() |
|
gabiz_ro 26 Jun 2010, 02:33
revolution wrote:
I'll try this becouse seems more simple. I have tried but at compile I get error Code: test[fs:ebx+120h],10001001b operand size not specified I forget to tell that I run this in a PCI option rom,after bios end POST and start bootloader. I also have one question. There ia a error register and I need to clear. If bit is 1 signaling a error status I need to write 1 at that bit to clear error.writing 0 have no efect. I try to read then write value back but seems isn't working Code: mov eax,[fs:ebx+130h] mov [fs:ebx+130h],eax is that ok? Thanks for fast response. |
|||
![]() |
|
LocoDelAssembly 26 Jun 2010, 02:54
Quote:
Use "test dword [fs:ebx+120h],10001001b" Quote:
Yes, but are you sure you have to write one instead of zero? Maybe you're supposed to do this: Code: ; I'm supposing it is bit0, change as you need and dword [fs:ebx+130h], (-1) xor 1 |
|||
![]() |
|
gabiz_ro 26 Jun 2010, 03:02
In datasheet specify that
Clear the PxSERR register, by writing ā1sā to each implemented bit location If no error is 0 and error is 1 then you need to write 1 to each bit is 1 to clear them How can I read dword at [fs:ebx+120h] and print it on screen? I have searched but most finds was for text display or too complex for me to adapt to my need. Thanks again. |
|||
![]() |
|
LocoDelAssembly 26 Jun 2010, 03:16
Well, perhaps the device is sensible to unimplemented bit locations and the value you read you are not supposed to write it back. Maybe you should use "mov dword[fs:ebx+130h], NUMBER_WITH_IMPLEMENTED_BITS_ON"
Another problem could be that the CPU's MTTR are not covering the device properly and hence, the memory accesses end up cached instead of forwarded to the device as soon as you make them. Quote: How can I read dword at [fs:ebx+120h] and print it on screen? |
|||
![]() |
|
gabiz_ro 26 Jun 2010, 03:27
Quote: Does Int10h work in your execution environment? Not sure, I suppose is working. right now I'm using this Code: push es push ax mov ax,0xB800 mov es,ax mov byte[es:0x9C],'S' pop ax pop es with different caracter like a marker to see where is freezing in some cases. |
|||
![]() |
|
LocoDelAssembly 26 Jun 2010, 17:54
Code: print_hex: ; DX = Row ; AX = Col ; ECX = NUMBER (Assuming 80x25 mode) pushad push es push $B800 pop es imul di, dx, 80 add di, ax shl di, 1 mov edx, ecx mov ecx, 8 mov ah, 7 ; GRAY FONT; BLACK BACKGROUND .writeNibble: rol edx, 4 mov si, dx and si, $F mov al, [cs:.lut+si] stosw loop .writeNibble pop es popad ret .lut db '0123456789ABCDEF' BTW, I think you are working with AHCI? Is your BIOS supporting it? In case it is not then you should really check if the HBA is mapped in a memory region the processor doesn't apply any caching. [edit]Added shl di, 1[/edit] Last edited by LocoDelAssembly on 26 Jun 2010, 19:05; edited 1 time in total |
|||
![]() |
|
gabiz_ro 26 Jun 2010, 18:49
Yes is about AHCI.But BIOS not supporting.
HBA is mapped to E0200000h Sorry if is a silly questions but how I use this how I set what memory address to print or I need to call print_hex but then from where is taken address to read. Thanks for help. |
|||
![]() |
|
LocoDelAssembly 26 Jun 2010, 19:05
To print 12345678 on the center of the screen use this:
Code: mov ecx, 12345678h mov dx, 25/2 mov ax, 80/2 - 8/2 call print_hex To print some memory then simply replace the "mov ecx, 12345678h" with, say, "mov ecx, [fs:ebx+130h]". PS: Note that I've edited my previous post to fix a bug |
|||
![]() |
|
gabiz_ro 26 Jun 2010, 20:19
Thank you.
Is working fine. Now I hope I have more chance to initialize controller in ahci mode. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.