flat assembler
Message board for the users of flat assembler.
Index
> Main > Problems reading IVT and saving to a buffer |
Author |
|
revolution 22 Jul 2010, 01:06
Maybe you need two 'inc cx', to match the two 'inc bx', for each word transferred.
Also, think about using 'rep movsw' |
|||
22 Jul 2010, 01:06 |
|
edfed 22 Jul 2010, 01:14
hello.
about IVT, it is only a memory, no matter of the organisation when yuo transfert datas, just know the count of bytes to tranfert, and it is ok. then: Code: mov ax,0 mov gs,ax mov cx,256*4/2 mov di,0 @@: mov ax,[gs:di] mov [ivt+di],ax loop @b that's all fo the data transfert for the view of the ivt, it depends onwhat you say by "view". in hexadecimal? for this, you should create a text that represent your ivt in the form you want. after, you call the DOS int to display text, but before, you should convert the datas in plain text. |
|||
22 Jul 2010, 01:14 |
|
Walkerboh 22 Jul 2010, 02:09
Thank you both! This will be enough to get me going again after work tomorrow I initially tried the movsw string operation but took it out when i still had problems, i thought maybe i was corrupting a register somehow. Once i get the values into a buffer I plan to convert them into a string in hexadecimal format.
|
|||
22 Jul 2010, 02:09 |
|
bitshifter 22 Jul 2010, 03:12
I think if just viewing them it is better to do it this way...
Please note that i have a serious buzz going and no PC to test this... If you prove it works correctly then you can start to optimize it (for size) Code: org 100h use16 cld mov ah,09h mov dx,g_header int 21h xor si,si mov fs,si mov cx,si print_ivt: mov dx,cx mov di,g_format+2 call store_hex mov dx,[fs:si] mov di,g_format+18 call store_hex mov dx,[fs:si+2] mov di,g_format+10 call store_hex mov ah,09h mov dx,g_format pusha ; paranoid int 21h popa add cx,1 add si,4 cmp cx,256 jl print_ivt mov ah,07h int 21h mov ax,4c00h int 21h store_hex: ; DX = value ; ES:DI -> dest pusha mov cx,4 @@: rol dx,4 mov al,dl and al,0Fh cmp al,10 sbb al,069h das stosb loop @b popa ret g_header db 'INT CS IP',13,10,'$' g_format db '0x???? 0x???? 0x????',13,10,'$' _________________ Coding a 3D game engine with fasm is like trying to eat an elephant, you just have to keep focused and take it one 'byte' at a time. |
|||
22 Jul 2010, 03:12 |
|
Walkerboh 22 Jul 2010, 22:17
Indeed it works! Thanks for the code to study =D
|
|||
22 Jul 2010, 22:17 |
|
ouadji 23 Jul 2010, 19:44
I don't understand ..
What OS do you use for programming in 16bit code and be able to use int_21? you don't use windows ? maybe a DOS emulation ? thank you |
|||
23 Jul 2010, 19:44 |
|
bitshifter 23 Jul 2010, 22:53
I have Win-XP2 and it lets me use DOS/BIOS interrupts.
The values returned from my proggy were not IBM-PC BIOS. I think windows must have remapped them on me. To really test it out you would put code in bootsector. Assuming you replace DOS interrupts with BIOS interrupts. Then i think it will give the correct results. |
|||
23 Jul 2010, 22:53 |
|
Walkerboh 25 Jul 2010, 18:54
I'm having a little trouble understanding exactly how a portion of your code works bitshifter. In the store_hex procedure, I believe you are taking 4 bits at a time from the value in dx and converting it to its hex equivalent on the ASCII table where you then stosb the value. What's the purpose of
CMP al,10 SBB al,069h DAS The best I can guess is you're using CMP to set CF, but why are you subtracting 069h+CF from al..wouldn't that always be a negative number since the max value of 4 bits is 15? store_hex procedure: Code: @@: rol dx,4 mov al,dl and al,0Fh cmp al,10 sbb al,069h das stosb loop @b |
|||
25 Jul 2010, 18:54 |
|
Picnic 25 Jul 2010, 19:05
This might clear things up for you
Code: cmp al, 10 ; Sets the carry flag if it's a digit. ; Remember, JB (Below) = JC (Carry). sbb al, 69h ; subtract 70 (BCD) for digits ; subtract 69 (BCD) for letters das ; BCD fix for subtraction: ; (1)00..(1)09 - 70 = 30..39 = '0'..'9' ; (1)10..(1)15 - 69 = 41..46 = 'A'..'F' |
|||
25 Jul 2010, 19:05 |
|
Walkerboh 26 Jul 2010, 00:55
It sure did, thanks
|
|||
26 Jul 2010, 00:55 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.