tasm

Unable to keep a square a full square while moving it

僤鯓⒐⒋嵵緔 提交于 2019-12-01 22:54:09
I have been trying to draw a box in assembly and move it horizontally across the screen. The code of printing the square itself works for me but when I try to make it move it is not working very well. I can see it moving but not as a full square, if you get my point. My code: in Assembly Tasm STA SEGMENT STACK DB 0FFFeH DUP(?) STA ENDS DATA SEGMENT ;----------- ;VARIABLES HERE xpos dw 50h ypos dw 50h color db 9h constat equ 0ffffh siNum dw ? diNum dw ? numOFtime dw 0h ;------------- DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA,SS:STA START : MOV AX,DATA MOV DS,AX ;start coding here: mov ah, 0

Reading a two digit number in assembly and storing it in a variable

北慕城南 提交于 2019-12-01 13:34:18
I need to a program in assembly to read a two digit number from the user, store it in a variable and later print it. I have tried a lot, but could not get through. Here is my coding. .model small .stack 100h .data msg db "Enter a number: $" msg2 db "You have entered: $" num1 db 0 num2 db 0 temp db 0 ten db 10 readNum db 0 t2 db 0 t1 db 0 .code mov ax,@data mov ds,ax call read call endL call write proc endL mov dl,0ah mov ah,02h int 21h ret endp proc read mov dx,offset msg mov ah,09h int 21h mov ah,01h int 21h mov num1,al mul ten mov temp,al mov dl,temp add dl,48 mov ah,02h int 21h mov ah,01h

TASM 1.4 - Changing background color without clearing the screen?

↘锁芯ラ 提交于 2019-12-01 11:41:07
I'm using Tasm 1.4. I'm trying to change the color of the background and text without clearing the previous text, but it always ends up on clearing the previous text although the colors are changed. For example: mov ah,09h lea dx,text1 int 21h ;displays text1 mov ah,01h int 21h ;I input a character mov ah,06h mov bh,42h mov cx,0000h mov dx,184fh int 10h ;I use this to change the text and background color mov ah,02h mov bh,00h mov dh,0ch mov dl,20h int 10h ;along with this mov ah,09h lea dx,text2 int 21h ;displays text2 mov ah,02h mov dl,al int 21h ;displays the inputted character Now what

Reading a two digit number in assembly and storing it in a variable

喜夏-厌秋 提交于 2019-12-01 11:30:43
问题 I need to a program in assembly to read a two digit number from the user, store it in a variable and later print it. I have tried a lot, but could not get through. Here is my coding. .model small .stack 100h .data msg db "Enter a number: $" msg2 db "You have entered: $" num1 db 0 num2 db 0 temp db 0 ten db 10 readNum db 0 t2 db 0 t1 db 0 .code mov ax,@data mov ds,ax call read call endL call write proc endL mov dl,0ah mov ah,02h int 21h ret endp proc read mov dx,offset msg mov ah,09h int 21h

Assembly difference between TASM and MASM

馋奶兔 提交于 2019-11-30 23:55:54
I am learning TASM at University, but information regarding TASM on the web seems to be very limited. I have found more information on MASM. My question is, what is the different between MASM and TASM? There aren't so much differences, but there are some. Check out this article: http://faqs.cs.uu.nl/na-dir/assembly-language/x86/borland.html Look for 'ideal' mode; btw, TASM can work with MASM syntax. TASM = Turbo Assembler (a Borland product) MASM = Macro Assembler (a Microsoft product) ...often mistaken for "Microsoft Assembler" In terms of raw assembly language, they should be virtually

Assembly difference between TASM and MASM

喜你入骨 提交于 2019-11-30 17:48:34
问题 I am learning TASM at University, but information regarding TASM on the web seems to be very limited. I have found more information on MASM. My question is, what is the different between MASM and TASM? 回答1: There aren't so much differences, but there are some. Check out this article: http://faqs.cs.uu.nl/na-dir/assembly-language/x86/borland.html Look for 'ideal' mode; btw, TASM can work with MASM syntax. 回答2: TASM = Turbo Assembler (a Borland product) MASM = Macro Assembler (a Microsoft

What does `dup (?)` mean in TASM?

大憨熊 提交于 2019-11-30 11:46:13
I have this code here, but I'm unfamiliar with the syntax. STACK16_SIZE = 100h stack16 db STACK16_SIZE dup (?) I think dup means we declare a variable of type array, as this is a stack, but I'm not sure. So what does dup mean in TASM, exactly? STACK16_SIZE dup (?) means to duplicate the data in parenthesis by STACK16_SIZE times. It is equivalent to writing ?, ?, ?, ?, ... (100h times) The data in parens is "uninitialized data". That is, memory is allocated, but not set to any particular value on load. Assembly does not provide an array "type". If it does, it is only for debuggers for use when

How many ways to set a register to zero?

一个人想着一个人 提交于 2019-11-30 10:46:40
问题 I'm curious how many ways are there to set a register to zero in x86 assembly. Using one instruction. Someone told me that he managed to find at least 10 ways to do it. The ones I can think of are: xor ax,ax mov ax, 0 and ax, 0 回答1: There are a lot of possibility how to mov 0 in to ax under IA32... lea eax, [0] mov eax, 0FFFF0000h //All constants form 0..0FFFFh << 16 shr eax, 16 //All constants form 16..31 shl eax, 16 //All constants form 16..31 And perhaps the most strange... :) @movzx:

What does `dup (?)` mean in TASM?

微笑、不失礼 提交于 2019-11-30 07:27:34
问题 I have this code here, but I'm unfamiliar with the syntax. STACK16_SIZE = 100h stack16 db STACK16_SIZE dup (?) I think dup means we declare a variable of type array, as this is a stack, but I'm not sure. So what does dup mean in TASM, exactly? 回答1: STACK16_SIZE dup (?) means to duplicate the data in parenthesis by STACK16_SIZE times. It is equivalent to writing ?, ?, ?, ?, ... (100h times) The data in parens is "uninitialized data". That is, memory is allocated, but not set to any particular

How many ways to set a register to zero?

风流意气都作罢 提交于 2019-11-29 22:17:43
I'm curious how many ways are there to set a register to zero in x86 assembly. Using one instruction. Someone told me that he managed to find at least 10 ways to do it. The ones I can think of are: xor ax,ax mov ax, 0 and ax, 0 There are a lot of possibility how to mov 0 in to ax under IA32... lea eax, [0] mov eax, 0FFFF0000h //All constants form 0..0FFFFh << 16 shr eax, 16 //All constants form 16..31 shl eax, 16 //All constants form 16..31 And perhaps the most strange... :) @movzx: movzx eax, byte ptr[@movzx + 6] //Because the last byte of this instruction is 0 and... @movzx: movzx ax, byte