flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
cod3b453 24 Apr 2013, 16:43
You can find the specification here http://msdn.microsoft.com/en-gb/library/windows/hardware/gg463080.aspx
|
|||
![]() |
|
superos 25 Apr 2013, 14:34
Thank you.
Besides, I have a little problem with the code for displaying text. Code: pisz_tekst: pusha .powtorz: lodsb mov bh, 0 cmp al, 0 je .gotowe call pisz_litere ; je[li znak to zero to zakoDcz mov ah, 0Eh int 10h ; w przeciwnym razie go drukuj jmp .powtorz ; i przenie[ si do nazstpnego znaku .gotowe: popa ret pisz_litere: pusha mov ah, 0Eh int 10h popa ret Unfortunately, the text is not displayed. At the beginning of the cursor around the screen goes crazy, and after three seconds it. Unfortunately, previous letters disappear (entered manually). I refer to a function like this: Code: mov si, komunikat1 call pisz_tekst ........ komunikat1 db "Test",0 Has anyone already had this problem? |
|||
![]() |
|
baldr 25 Apr 2013, 16:47
superos,
Well, there are some problems. You're using int10/0E service twice for the same character (first inside pisz_litere(), second right after call). With this error corrected, your code runs fine (you must ensure proper ds for lodsb). |
|||
![]() |
|
superos 25 Apr 2013, 17:24
Thanks for the reply. I did not notice that repeats
![]() Code: pisz_tekst: pusha mov ds, si .powtorz: lodsb mov bh, 0 cmp al, 0 je .gotowe ; je[li znak to zero to zakoDcz mov ah, 0Eh int 10h ; w przeciwnym razie go drukuj jmp .powtorz ; i przenie[ si do nastpnego znaku .gotowe: popa ret What must I do to be displayed a text? 2.I have another question. Do anyone know how to capture clicking the "windows" on the keyboard? I tried with: Code: czekaj_na_nacisniecie_klawisza: mov ax,0 mov ah,10h int 16h ret but I managed to capture key "windows" or "menu", but others like "a, b, c ..." Do anyone know how to read these nonstandard keys? |
|||
![]() |
|
baldr 25 Apr 2013, 19:41
superos,
You set up ds incorrectly (most probably so). Show your entire code (I think you are using format MZ, aren't you?). As to your second question, have you tried int16/10 from plain DOS (not NTVDM or any other emulator)? Under Windows WinKey and AppKey are handled differently than regular keys. I quickly brewed simple example with two segments: Code: format MZ segment @CODE entry @CODE:start start: mov ax, @DATA mov ds, ax ; ds contains @DATA selector mov ah, 0Fh int 10h ; get active page in bh mov si, banner ; now ds:si = @DATA:banner call printsz .next: mov ah, 10h int 16h cmp ax, 011Bh ; Esc? je .done ; yes, finish mov dx, ax ; no, pass BIOS scan code call printwx ; to print function mov ax, 0E00h + ' ' ; print ' ' to separate numbers int 10h ; using int10/0E (ax = 0E20h) jmp .next .done: mov si, crlf call printsz mov ax, 4C00h int 21h ;;; Print (int10/0E) ASCIIZ ;;; Expects: ds:si = far pointer to ASCIIZ ;;; bh = video page for output printsz: push ax mov ah, 0Eh .next: lods byte [ds:si] test al, al jz .done int 10h jmp .next .done: pop ax ret ;;; Print hex word ;;; Expects: dx = word to print ;;; bh = video page for output printwx: call @f @@: xchg dh, dl ;;; fall through ;;; Print hex byte ;;; Expects: dl = byte to print ;;; bh = video page for output printbx: call @f @@: ror dl, 4 ;;; fall through ;;; Print hex nibble ;;; Expects: dl[3:0] = nibble to print ;;; bh = video page for output printnx: push ax mov ax, 0E0Fh and al, dl cmp al, 10 sbb al, 69h das int 10h pop ax ret segment @DATA banner db "Press keys to see their BIOS int16/10 codes (Esc to quit)" crlf db 13, 10, 0 |
|||
![]() |
|
superos 26 Apr 2013, 15:00
My code:
Code: mov si, komunikat1 mov ax, 0 mov ds, ax call pisz_tekst Ok, thanks for your help baldr. Your code did not want too much work, but he told me a lot. As I write its own operating system, I can use DOS, so I would have keyboard support in bios. Do you know how to use can interrupt the BIOS check if you press the Windows key? |
|||
![]() |
|
superos 27 Apr 2013, 13:33
Welcome. I have a problem with the service diskette. I tried this code:
Code: bufor_dysku db 512 dup(1),0 odczytaj_liste_plikow: mov dh,0 mov dl, [bootdev] mov cx,19 mov ah, 2 ;funkcja odczytaj sektory mov al, 1 ;liczba sektorow do przeczytania mov si,bufor_dysku mov es,si mov bx,0 ;offset bufora int 0x13 ret bootdev db 0 unfortunately it does not work. Does anyone know how to solve this problem? Would have been nice, as if someone had a library to support FAT32 - it would be much easier for me. Regards. |
|||
![]() |
|
baldr 29 Apr 2013, 06:55
superos,
Be careful. You repeat the very same error again: es should contain selector, and you load it with offset of bufor_dysku (this should go to bx). If BIOS service fails, it returns status code (if you supply it, that may help). Does your boot device really have sector 0/0/19? |
|||
![]() |
|
DOS386 29 Apr 2013, 07:09
> Does anyone know where there is a specification for FAT32
Spec of BAD filesystem FAT28: http://www.jafile.com/uploads/dos386/fat28ms.pdf (100 KiB PDF) > have been nice, as if someone had a library to support FAT32 - it > would be much easier for me. http://www.fullfat-fs.co.uk/ |
|||
![]() |
|
BAiC 29 Apr 2013, 16:07
you need to divide the address of the buffer by 16 before storing in a segment register (assuming 16bit code). if it's not aligned on a 16byte boundary then you need to also store (address and 15) into bx.
Code: bufor_dysku db 512 dup(1),0 odczytaj_liste_plikow: mov dh,0 mov dl, [bootdev] mov cx,19 mov ah, 2 ;funkcja odczytaj sektory mov al, 1 ;liczba sektorow do przeczytania mov si,bufor_dysku/16 mov es,si mov bx,bufor_dysku and 15;offset bufora int 0x13 ret _________________ byte me. |
|||
![]() |
|
baldr 29 Apr 2013, 17:47
BAiC,
Your suggestion will be valid iff bufor_dysku is an offset in segment 0; for any other segment selector you need to take in account that selector too. And why bother to convert perfectly valid 0:bufor_dysku far pointer into (also perfectly valid) bufor_dysku shr 4:bufor_dysku and 15 huge pointer? |
|||
![]() |
|
BAiC 29 Apr 2013, 19:12
baldr: read my fucking post: I explicitly declared that it assumes 16bit code. a segment selector is protected mode (32bit code).
_________________ byte me. |
|||
![]() |
|
superos 01 May 2013, 12:39
baldr
I have corrected my mistake. It turned out that the track is 18 sectors. nay even in the 18 - 36 sectors varies head ... Code: mov ah, 2 ;funkcja odczytaj sektory mov al, 1 ;liczba sektorow do przeczytania mov ch, 0 ;numer [cie|ki mov cl, 2 ;numer sektora niby |e 19 mov dh,1 ;numer gBowicy It works perfectly. But now I have a problem with searching for files on the disk. Here is my code: Code: ;funkcja ladowania plików pod dany adres ;bx - sciezka ;si - docelowe miejsce laduj_sciezke: pusha push bx mov bx,bufor_dysku ;offset bufora mov ah, 2 ;funkcja odczytaj sektory mov al, 1 ;liczba sektorow do przeczytania mov ch, 0 ;numer [cie|ki mov cl, 2 ;numer sektora niby |e 19 mov dh,1 ;numer gBowicy mov dl, [bootdev] mov si,0 mov es,si int 0x13 call restartuj_naped pop bx ;sprawdzanie nazwy pliku mov cx,16 pnazw: mov si,0 mov ds,si mov si,bufor_dysku pusha mov dl,0 petla1: lodsb mov di,0 mov es,di mov di,bx mov ah,byte[es:di] cmp al,ah jne dalejbonie add si, 20 inc dl cmp dl,11 jne petla1 ;<==== Code if it's the file you need. dalejbonie: mov dh,11 sub dh,dl mov dh,0 add si, dx mov [adresst],si popa mov si, [adresst] loop pnazw popa ret adresst dw 0 I do not know what is wrong. Even my eyes hurt from looking for that "something" ... I corrected the post. I'm sorry for the mistakes, but I translated by Google Translate. I'm sorry again. I mistook the nickname. ![]() Last edited by superos on 01 May 2013, 15:57; edited 1 time in total |
|||
![]() |
|
BAiC 01 May 2013, 13:48
Quote:
my mistake? _________________ byte me. |
|||
![]() |
|
baldr 01 May 2013, 15:19
BAiC wrote: baldr: read my fucking post: I explicitly declared that it assumes 16bit code. a segment selector is protected mode (32bit code). Intel® 64 and IA-32 Architectures Software Developer’s Manual, rev. 046US, Vol. 1 wrote: 3.4 BASIC PROGRAM EXECUTION REGISTERS Intel® 64 and IA-32 Architectures Software Developer’s Manual, rev. 046US, Vol. 3 wrote: 20.1 REAL-ADDRESS MODE ![]() ----8<---- superos, mov ah, byte [es:di] always retrieves first character of file name you're searching for (since neither bx nor di are advanced). If the character matches that of first directory entry, you increase pointer by 20 (now it'll point to reserved byte right before modification time) and continue comparison (with that first character !?). If character doesn't match, you do some calc with dh, then zero it (!) and add resulting dx to si (as a result, comparison will restart). How does this supposed to work? |
|||
![]() |
|
BAiC 01 May 2013, 15:46
Quote:
Intel has a history of writing the current version of their documentation from the perspective of the current model. When protected mode was developed the term "selector" was used to refer to the selection of a segment within the Global/Local Descriptor Table. as such; in normal conversation between people who know anything about the Intel Architecture a segment selector is a reference to atleast the Protected Mode model. _________________ byte me. |
|||
![]() |
|
superos 01 May 2013, 16:07
All code files in a directory search is to work like this: the bx I give the path to the file (for now just the name of the file in the root directory) and ds: si gives the address to which to read the file.
Sorry if Google Translate again, again I feel bad translate. I also have a problem with service interruption 0 - divide by zero. Well, breaking up is doing, but the mode when the end make a new start to perform over and over again. Here is my code: Code: ;setting interrupt cli mov ax,0 ;zerowanie mov es,ax ;zerowanie mov [es:0],word dzielenie_przez_zero ;offset mov [es:2],word 0 ;segment sti ;main function of interrupt dzielenie_przez_zero: cli push ds push es pusha mov bl, 1fh mov dl,0 mov dh,0 mov si, 80 mov di,25 call rysuj_kwadrat mov dh,12 mov dl,37 call przesun_kursor mov ax,0 mov ds,ax mov si,komunikat5 ;tekst "wystapiB bBd dzielenia przez zero" call pisz_tekst call odswiez_GUI popa pop es pop ds sti iret |
|||
![]() |
|
BAiC 01 May 2013, 16:29
superos: post all of your code, not simply a section of the code.
_________________ byte me. |
|||
![]() |
|
superos 01 May 2013, 16:44
Well, just about the last problem - the code it works fine, but it's performed in a circle. If I call it the "call" works fine, but if by "mov al, 0 div al" is invoked over and over again. I will not give the whole code, because it is contained in seven files, and each of them is long.
|
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.