flat assembler
Message board for the users of flat assembler.
Index
> DOS > getting data from i/o port |
Author |
|
cylo 10 Nov 2004, 08:11
hello!
i am realy new in assembler and need to get an memory mapped register adress through a i/o port. i program on a amd geode gx1 cpu. http://tech.parvus.com/documents/GeodeGX1.pdf i need to get the gx_base adress which is saved in the gc register index B8h (p.98 ). to do that i have to use the memory i/o port 22h/23h (p.53). i have to set the index in 22h with a OUT(?) instructuion to get data through the 23h port. but i dont realy know how the syntax could be look like... need help! [Matrix_Spell_Checking=adjust,reason="there are memory mapped i/o ports and they are mapped by device ex.: $a000 so use with mov, xor ... so topic name should be without memory"]Matrix[/Matrix_Spell_Checking] |
|||
10 Nov 2004, 08:11 |
|
cylo 10 Nov 2004, 16:39
Code: mov dx,$22 mov al,$B8 out dx,al mov dx,$23 in al,dx mov al,myvar i didnt get it... right? |
|||
10 Nov 2004, 16:39 |
|
bubach 10 Nov 2004, 17:19
right, except:
Code: mov [myvar], al |
|||
10 Nov 2004, 17:19 |
|
Matrix 10 Nov 2004, 18:19
yeah, you're right, you can also do this cause posrt number is below 255
Code: mov al,$B8 out $22,al in al,$23 mov [myvar],al myvar rb 1 ; reserve 1 bytes for myvar however using dx can give the ability for a relocateable port addressing example: Code: mov [baseaddress],$378 ; reset initial value ( printer port 1 ) call readprinterstatus call readdata int 20h readprinterstatus: mov dx,baseaddress add dx,1 ; this will read status register in al,dx ret readprinterdata: mov dx,baseaddress ; this will data port in al,dx ret baseaddress dw $278 ; initial value ( printer port 2 ) |
|||
10 Nov 2004, 18:19 |
|
cylo 10 Nov 2004, 19:17
okay. this code works better... :p
mov al,$B8 out $22,al in al,$23 mov [myvar],al but in the sheet is written that only bit 1:0 of the 8bit gc register has the gx_base adress i need. how can i filter this two bits? |
|||
10 Nov 2004, 19:17 |
|
ASHLEY4 10 Nov 2004, 19:59
The best thing you can do is get this code, it works in the same way as the code you want, but its for sound, you can see from the code how it is done,(not the wav bit, but the AC97 bit).
http://www.programmersheaven.com/zone10/cat592/23237.htm \\\\||//// (@@) ASHLEY4. Batteries not included, Some assembly required. |
|||
10 Nov 2004, 19:59 |
|
Matrix 10 Nov 2004, 19:59
you know basic instructions no?
Code: ;get bit 2 from al test al,100b ; binary ; now bit is in carry ;get bit 2 from al same with complex 386 microcode bt ax,2 ; put bit 2 in carry ; now bit is in carry ;or if you don't care al is destroyed do: and al,100b ; binary setnz al ; this puts not zero flag in al ;or if you don't care al is destroyed do: shr al,2 ; shift arithmetical right 2 bits and al,1 ; mask out bit 0 ; now al has the bit 2 ;or if you don't care al is destroyed do: shr al,3 ; shift arithmetical right 2 bits ; now carry has bit 2 ;u can use carry like: jc label1 ; not carry label1: carry: |
|||
10 Nov 2004, 19:59 |
|
cylo 10 Nov 2004, 20:47
okay now i got it...
Code: and al,3 that gives me the result i am looking for. sorry i am a asm noob |
|||
10 Nov 2004, 20:47 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.