flat assembler
Message board for the users of flat assembler.
Index
> DOS > String to Standart Output always in same line Goto page 1, 2 Next |
Author |
|
edfed 01 Dec 2011, 17:18
you have to displace the cursor before to rewrite over a field.
|
|||
01 Dec 2011, 17:18 |
|
DJ Mauretto 01 Dec 2011, 17:22
Hello Try This:
Code: org 100H MOV AX,0013H INT 10H @@: MOV AX,0x2C00 INT 21H MOV SI,Time ADD SI,1 MOVZX AX,CH ; Hour CALL @Bin2Ascii_16 MOVZX AX,CL ; Minute MOV SI,Time ADD SI,4 CALL @Bin2Ascii_16 MOVZX AX,DH ; Second MOV SI,Time ADD SI,7 CALL @Bin2Ascii_16 MOVZX AX,DL ; 1/100 Seconds MOV SI,Time ADD SI,10 CALL @Bin2Ascii_16 MOV AX,0200H XOR BX,BX MOV DH,12 ; Row MOV DL,14 ; Column INT 10H MOV DX,Time MOV AX,0900H INT 21H MOV DI,Time MOV AL,30H MOV [DI],AL MOV [DI+ 1],AL MOV [DI+ 3],AL MOV [DI+ 4],AL MOV [DI+ 6],AL MOV [DI+ 7],AL MOV [DI+ 9],AL MOV [DI+ 10],AL MOV AX,0100H INT 16H JZ @B MOV AX,0003H INT 10H RET @Bin2Ascii_16: PUSHA MOV CX,10 @@: XOR DX,DX DIV CX ADD DL,30H MOV [SI],DL SUB SI,1 OR AX,AX JNZ @B POPA RET Align 16 ;------ ; DATA ;------ Time DB 30h,30h,':' DB 30h,30h,':' DB 30h,30h,':' DB 30h,30h DB '$' _________________ Nil Volentibus Arduum |
|||
01 Dec 2011, 17:22 |
|
Cmostransistor 01 Dec 2011, 18:38
At first thanks for the fast reply.
Your code works very good, but it cant figure out how to change mine. How i need to change this?: Code: format MZ stack 100h segment daten zeit db 'hh:mm:ss:hs0$' segment ute entry ute:start start: mov ax,daten mov ds,ax mov ah,2Ch int 21h mov al,ch call formatieren mov [zeit],al add ah,'0' mov [zeit+1],ah mov al,cl call formatieren mov [zeit+3],al add ah,'0' mov [zeit+4],ah mov al,dh call formatieren mov [zeit+6],al add ah,'0' mov [zeit+7],ah mov al,dl call formatieren mov [zeit+9],al add ah,'0' mov [zeit+10],ah call ausgabe jmp short start call ende ausgabe: mov dx,zeit mov ah, 09h int 21h ret ende: mov ah,4ch int 21h formatieren: xor ah,ah mov bl,10 div bl add al,'0' ret Some german words in there, sorry. |
|||
01 Dec 2011, 18:38 |
|
DJ Mauretto 01 Dec 2011, 19:29
learn this
Code: format MZ stack 100h segment daten zeit db 'hh:mm:ss:hs0$' segment ute entry ute:start start: mov ax,daten mov ds,ax mov ax,0013h int 10h mov ax,0003h int 10h mov dx,3d4h mov ax,2d0ah ; Cursor Off out dx,ax @@: mov ah,2Ch int 21h mov al,ch call formatieren mov [zeit],al add ah,'0' mov [zeit+1],ah mov al,cl call formatieren mov [zeit+3],al add ah,'0' mov [zeit+4],ah mov al,dh call formatieren mov [zeit+6],al add ah,'0' mov [zeit+7],ah mov al,dl call formatieren mov [zeit+9],al add ah,'0' mov [zeit+10],ah mov ax,0200h xor bx,bx mov dh,1 ; Row mov dl,34 ; Column int 10h call ausgabe mov ah,01 int 16h jz @b xor ax,ax int 16h mov dx,3d4h mov ax,0d0ah ; Cursor On out dx,ax mov ah,4ch int 21h ausgabe: mov dx,zeit mov ah, 09h int 21h ret formatieren: xor ah,ah mov bl,10 div bl add al,'0' ret _________________ Nil Volentibus Arduum |
|||
01 Dec 2011, 19:29 |
|
Tomasz Grysztar 01 Dec 2011, 20:27
The line break in DOS consist of two characters, CR=13 and LF=10. CF is Carriage Return and it moves cursor back to the start of the line, while LF is Line Feed and moves cursor down to the next line.
So to do what you need, it is enough to use just alone CR character. Modify your "zeit" definition this way: Code: zeit db 'hh:mm:ss:hs0',13,'$' |
|||
01 Dec 2011, 20:27 |
|
freecrac 02 Dec 2011, 15:12
Another method for an output to the screen (without involving software interupts) is to write any ASCII directly to the videoram. The address of the textmode(3) on VGAs begin in 0B800:0 and for monochrom displays in 0B00:0.
The content of the textram includes the ASCII-byte itself and its attribute-byte with the foreground and background color. This picture shows an output of this textram: Depending on how many rows we are using for a line and how many lines we using for our hole screen (example 132x25, 80x25 or 80x50 etc.), we have to calculate the offset-address in that form: Row * 2 * Line. http://de.wikipedia.org/wiki/Textmodus Dirk |
|||
02 Dec 2011, 15:12 |
|
smiddy 02 Dec 2011, 18:33
freecrac wrote: Another method for an output to the screen (without involving software interupts) is to write any ASCII directly to the videoram. The address of the textmode(3) on VGAs begin in 0B800:0 and for monochrom displays in 0B00:0. I'm at work, just getting a sneak into what is being posted. I have some codes that can put the text modes up to 160 columns. I'll post them later...I researched them in 2004 and 2005, there are likely more now. |
|||
02 Dec 2011, 18:33 |
|
smiddy 03 Dec 2011, 17:31
Ok, here's one for 160 x 64:
Code: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ScreenMode160x64 - Change screen size if machine is capable. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ScreenMode160x64: pusha mov ax,4F02h ; VESA Call mov bx,6Bh ; 160 x 64 screen size int 10h ; Call the interrupt cmp al,4Fh ; Compare to check if call is supported jne .Done ; If not supported, head out cmp ah,1 ; Compare to see if the call was successful jne .Done ; If not successful, head out ; If successful, update BIOS push es ; Save ES mov ax,0 ; Place 0 into AX mov es,ax ; Put 0 into ES mov ax,160 ; Place number of columns in AX mov [es:44Ah],ax ; Set number of columns in BDA mov al,63 ; Place number of columns in AL mov [es:484h],al ; Set number of rows - 1 in BDA pop es ; Restore original ES .Done: popa ret |
|||
03 Dec 2011, 17:31 |
|
freecrac 05 Dec 2011, 05:51
smiddy wrote: Ok, here's one for 160 x 64: But the Vesa-Bios on my card do not support this modenumber because: Starting with VBE version 2.0, VESA will no longer define new VESA mode numbers and it will no longer be mandatory to support these old mode numbers. So we have to use the modelist inside of our VESA-Bios instead. VBE mode numbers begin at 100h. The format of VBE mode numbers is as follows: D0-D8 = Mode number If D8 == 0, this is not a VESA defined VBE mode If D8 == 1, this is a VESA defined VBE mode D9-D12 = Reserved by VESA for future expansion (= 0) D11 = Refresh Rate Control Select If D11 == 0, Use current BIOS default refresh rate If D11 == 1, Use user specified CRTC values for refresh rate D12-13 = Reserved for VBE/AF (must be 0) D14 = Linear/Flat Frame Buffer Select If D14 == 0, Use Banked/Windowed Frame Buffer If D14 == 1, Use Linear/Flat Frame Buffer D15 = Preserve Display Memory Select If D15 == 0, Clear display memory If D15 == 1, Preserve display memory (For more details take a look into the vbe3.pdf in the puplic area from vesa.org. Need register and/or login.) Code: Vesamodi of my colorfull GTX 295: (All values are hexadecimal) 0100 X=0280 Y=0190 8Bit 0101 X=0280 Y=01E0 8Bit 0102 X=0320 Y=0258 4Bit 0103 X=0320 Y=0258 8Bit 0104 X=0400 Y=0300 4Bit 0105 X=0400 Y=0300 8Bit 0106 X=0500 Y=0400 4Bit 0107 X=0500 Y=0400 8Bit 010E X=0140 Y=00C8 10Bit 010F X=0140 Y=00C8 20Bit 0111 X=0280 Y=01E0 10Bit 0112 X=0280 Y=01E0 20Bit 0114 X=0320 Y=0258 10Bit 0115 X=0320 Y=0258 20Bit 0117 X=0400 Y=0300 10Bit 0118 X=0400 Y=0300 20Bit 011A X=0500 Y=0400 10Bit 011B X=0500 Y=0400 20Bit 0130 X=0140 Y=00C8 8Bit 0131 X=0140 Y=0190 8Bit 0132 X=0140 Y=0190 10Bit 0133 X=0140 Y=0190 20Bit 0134 X=0140 Y=00F0 8Bit 0135 X=0140 Y=00F0 10Bit 0136 X=0140 Y=00F0 20Bit 013D X=0280 Y=0190 10Bit 013E X=0280 Y=0190 20Bit 0145 X=0640 Y=04B0 8Bit 0146 X=0640 Y=04B0 10Bit 014A X=0640 Y=04B0 20Bit 0160 X=0500 Y=0320 8Bit 0161 X=0500 Y=0320 20Bit 0162 X=0300 Y=01E0 8Bit 017B X=0500 Y=02D0 20Bit 017C X=0780 Y=04B0 8Bit 017D X=0780 Y=04B0 20Bit This batchfile can be used to get the VESA-Info: Code: @echo off echo e cs:0100>tmp.deb echo B8 00 4f BF 00 02 CD 10>>tmp.deb echo g=cs:0100 0108>>tmp.deb echo d cs:200>>tmp.deb echo q>>tmp.deb debug <tmp.deb >Vesa.info del tmp.deb This Vesa.info-file contains the pointer to the modelist and the modelist of the vesa-bios: Quote:
With one of these vesamodi from our modelist we can get the modinfo. This batchfile use the vesamode "017D" from the modelist above: Code: @echo off echo e cs:0100>tmp.deb echo B8 01 4f BF 00 03 B9 7D 01 CD 10>>tmp.deb echo g=cs:0100 010B>>tmp.deb echo d cs:0300>>tmp.deb echo q>>tmp.deb debug <tmp.deb >VesaMode.info del tmp.deb This VesaMode.info-file contains informations about the vesamode "017D". Quote:
Dirk |
|||
05 Dec 2011, 05:51 |
|
DJ Mauretto 05 Dec 2011, 08:12
This is my VBE utility
http://board.flatassembler.net/topic.php?p=115773#115773 Anyway you are OFFTOPIC _________________ Nil Volentibus Arduum |
|||
05 Dec 2011, 08:12 |
|
freecrac 05 Dec 2011, 13:47
DJ Mauretto wrote: This is my VBE utility Inside of your VBE utility-sources i found only an old VBE 1-modetable and inside of the code the modenumber 11Bh are in use i think for the resolution of 1280x1024x16M. On this way it isn´t possible to know, if this resolution exist on modern VBE 2/3 Bios and mayby if an other number is linked to this resolution. Quote: Anyway you are OFFTOPIC Some VESA-Bios provide extended textmodes and so it is possible to use them also with a standard output. I am not sure if it OFFTOPIC, because they are rare in use? @smiddy: On wich videocard do you test this textmode? My posting above pointed to the circumstance that newer VBE-cards maybe no longer use the older modenumbers from VBE 1. Since VBE 2 the bios include an own modetable with maybe different modenumbers. These numbers can be vary between manufactureres and/or productlines. If we want to know which resolution exist using the VBE-bios, then we have to check every modenumber in the modelist of our bios with VBE-function 4F01h step by step, til we can found our resolution and/or mode attribut that we are looking for, or the modelist ends with the endmarker FFFFh. The ModeAttributes field is defined as follows: Quote:
.. Personally i prefer the highest VBE-mode 1920x1200x32 of my colorfull GTX 295, because this is the native resolution of my 28" LCD monitor. (Any other resolution will be interpolate and results an unsharper view.) For a text-output in this mode it is possible to read the ASCII character table of the bios(example: 8x8 from vector 1F) and to paint/enlarge any letter dot by dot. (This is of course far away from any standard output.) Dirk Last edited by freecrac on 05 Dec 2011, 15:51; edited 1 time in total |
|||
05 Dec 2011, 13:47 |
|
DJ Mauretto 05 Dec 2011, 15:50
Quote: Inside of your VBE utility-sources i found only an old VBE 1-modetable and inside of the code the modenumber 11Bh are in use i think for the resolution of 1280x1024x16M. Quote: Some VESA-Bios provide extended textmodes and so it is possible to use them also with a standard output. I am not sure if it OFFTOPIC, because they are rare in use? The topic is about this not vbe: Quote: Hello together, Open a new tread for vesa vbe _________________ Nil Volentibus Arduum |
|||
05 Dec 2011, 15:50 |
|
freecrac 05 Dec 2011, 16:09
DJ Mauretto wrote:
Now i added the attribut-table of the VBE-modeinfo in my posting above which shows that it is possible to use VBE-Modes with a TTY standard output methode. Sorry, if you dont read the vbe3-documentation for that i give the reference, then maybe you can´t know this importend detail. The interpretation of the term "DOS-console" and also "standard output" can be vary on this way, they are not closer specified. And this alway open a brighter view of possibilities. I hope the same to you. Dirk |
|||
05 Dec 2011, 16:09 |
|
DJ Mauretto 05 Dec 2011, 17:12
Quote: Now i added the attribut-table of the VBE-modeinfo in my posting above which shows that it is possible to use VBE-Modes with a TTY standard output methode. Sorry, if you dont read the vbe3-documentation for that i give the reference, then maybe you can´t know this importend detail. Hey, What is your problem ? The english language ? THE TOPIC IS ABOUT UPDATE CURSOR ADDRESS, NOT VESA VBE? DO YOU UNDERSTAND THIS ? IF YOU WANT TO DO VESA VBE GURU OPEN A NEW THREAD... _________________ Nil Volentibus Arduum |
|||
05 Dec 2011, 17:12 |
|
DJ Mauretto 05 Dec 2011, 17:14
Quote: Sorry, if you dont read the vbe3-documentation for that i give the reference, then maybe you can´t know this importend detail. Stupid Beginner... _________________ Nil Volentibus Arduum |
|||
05 Dec 2011, 17:14 |
|
freecrac 05 Dec 2011, 17:41
DJ Mauretto wrote:
LOL. (Playing an angry boy and shouting not needed.) Maybe you are joking. The Topic is to prevent that the output takes place in a new line. Nothing else! And be sure that can also be solved without to read or set the cursor position. Beside this view we have to handle different resolutions that we can use. So it is importend to check that parameter, so that our routine can be used on different wise. If you don´t have an interest in those details then shut down., or use some more freindly words instead of shouting blurb. Dirk |
|||
05 Dec 2011, 17:41 |
|
DJ Mauretto 05 Dec 2011, 18:31
Quote: Im currently creating a programm which reads the current System Time (using int21 2ch) and writes it constantly into the DOS-console (using int21 09h) DO YOU UNDERSTAND THIS WORDS ? The user is a beginner and for now he use dos function... IF YOU USE DOS FUNCTION YOU MUST UPDATE THE CURSOR WHEN DISPLAY STRINGS... DO YOU UNDERSTAND ? VESA VBE IS OFF TOPIC... WHEN USER WILL ASK HIGH RESOLUTION VIDEO MODE YOU CAN REPLY WITH VESA VBE....BUT FOR NOW NO DO YOU UNDERSTAND OR NOT ? Anyway i showed the example to the user. You can open a new thread for vesa vbe and teach us _________________ Nil Volentibus Arduum |
|||
05 Dec 2011, 18:31 |
|
freecrac 05 Dec 2011, 20:20
DJ Mauretto wrote:
Stop your shouting now! Quote: The user is a beginner and for now he use dos function... It is also a beginner lesson to write a string directly to the videoram, to prevent an output in a new line. And your are not the one who have to tell us how we have to learn a beginner lesson. Quote: IF YOU USE DOS FUNCTION YOU MUST UPDATE THE CURSOR WHEN But if we won´t use DOS-functions than you are shouting and screaming like a dying big, häh, are you totally crazy boy? Quote: DO YOU UNDERSTAND ? Yes your are a dying big, and please SHUT DOWN boy! Dirk |
|||
05 Dec 2011, 20:20 |
|
DJ Mauretto 05 Dec 2011, 20:48
Quote: Stop your shouting now! Quote: It is also a beginner lesson to write a string directly to the videoram, to prevent an output in a new line. And your are not the one who have to tell us how we have to learn a beginner lesson. Open a new thread and teach us to write directly in Videoram.. Beginner Quote: But if we won´t use DOS-functions than you are shouting and screaming like a dying big, häh, are you totally crazy boy? I'm not a boy, I'm 43, I'm not interested to use dos funtion or not, but the user has decided to use the dos functions The user did not ask how to write directly to video RAM, anyway you are out of context, open a new thread and teach us how to write directly in video ram and how use vesa vbe Quote:
the only stupid boy here is you _________________ Nil Volentibus Arduum |
|||
05 Dec 2011, 20:48 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.