Jump to content

help on TASM video buffer pls

- - - - -

  • Please log in to reply
17 replies to this topic

#1
helpmepls

helpmepls

    Newbie

  • Members
  • Pip
  • 9 posts
it is currently moving to the right. can someone teach me how to move the whole screen to the top?i really need help


.MODEL SMALL
.STACK 64
.DATA
;DATA FILE ARE LOCATED HERE

.CODE
MAIN PROC FAR
MOV AX,0B800h
MOV DS,AX
;CODE FILES ARE LOCATED HERE
MOV AL,03
INT 10H


HULAT:
MOV AH,00
INT 16H

CMP AL,'D'
JNZ HULAT
JMP RIGHT





RIGHT:
MOV BX,01DEH
MOV SI,01DCH

MOV AX,0000H
MOV AL,[BX]

PUSH AX

MOV CX,79

AGAIN:
MOV AL,[SI]
MOV BYTE PTR[BX],AL
SUB BX,2
SUB SI,2
LOOP AGAIN

POP AX
MOV [BX],AL

JMP HULAT


MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN

#2
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,705 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
Do you want to scroll the screen upwards when the user presses a certain key? Here's how to scroll the screen up by one line.

mov     ax, 0601h   [I]; AH=06h, AL is # of lines to shift up[/I]
[I];if you want to clear the whole screen put AL=0[/I]

mov     bh, 07h     [I]; screen attr to fill blank lines @ bottom[/I]
xor     cx, cx     [I] ; CH=upper left row, CL=upper left column (0,0)[/I]
mov     dx, 184fh   [I]; DL=lower right row, CL=lower right column[/I]

[I]; 184fh corresponds to row 24, column 79. NOTE: I'm assuming you're
; using video mode 3 like you have at the beginning of your code. If you[/I]
[I]; use a different video mode you're going to have to change the coordi-
; nates.[/I]

int     10h

Edited by dargueta, 09 March 2010 - 08:03 PM.
Edited formatting

sudo rm -rf /

#3
helpmepls

helpmepls

    Newbie

  • Members
  • Pip
  • 9 posts
thank u very much 4 the help bro. can u pls teach me what part of the program should i put or replace your codes? im still a bit new and cant seem to make the program to work=(

#4
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,705 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
I know what your code does, but what do you want it to do?
sudo rm -rf /

#5
helpmepls

helpmepls

    Newbie

  • Members
  • Pip
  • 9 posts
i have to make the screen go left,right top,down using wasd, i already got it to move to the left and right. but i have no idea how to make it go to the top and bottom. i was hoping to learn how to make it go up and down =)

#6
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,705 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
Ok, well you just need to use your if condition that you used for going right but change the key and labels. For example
mov    ah, 00h
int    16h

cmp    al, 'D'
je    do_right
cmp    al, 'S'
je    do_down
cmp    al, 'A'
je    do_left
cmp    al, 'W'
je    do_right

You would put my code in the do_down part, and the code for scrolling up is identical except you put 07h into AH instead of 06h.
sudo rm -rf /

#7
helpmepls

helpmepls

    Newbie

  • Members
  • Pip
  • 9 posts
.MODEL SMALL
.STACK 64
.DATA
;DATA FILE ARE LOCATED HERE

.CODE
MAIN PROC FAR
MOV AX,0B800h
MOV DS,AX
;CODE FILES ARE LOCATED HERE
MOV AL,03
INT 10H


HULAT:
MOV AH,00
INT 16H

CMP AL,'D'
JNZ HULAT
JMP RIGHT




RIGHT: MOV AX,0601H
MOV BH,07H

XOR CX,CX
MOV DX,0184FH






AGAIN:
MOV AL,[SI]
MOV BYTE PTR[BX],AL
SUB BX,2
SUB SI,2
LOOP AGAIN

POP AX
MOV [BX],AL

JMP HULAT


MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN

#8
helpmepls

helpmepls

    Newbie

  • Members
  • Pip
  • 9 posts
sorry buy i still cant get it to work. even just going up. where do u mean should i put your code? i tried replacing right w/ ur code but i cant get it to work

.MODEL SMALL
.STACK 64
.DATA
;DATA FILE ARE LOCATED HERE

.CODE
MAIN PROC FAR
MOV AX,0B800h
MOV DS,AX
;CODE FILES ARE LOCATED HERE
MOV AL,03
INT 10H


HULAT:
MOV AH,00
INT 16H

CMP AL,'D'
JNZ HULAT
JMP RIGHT




RIGHT: MOV AX,0601H
MOV BH,07H

XOR CX,CX
MOV DX,0184FH






AGAIN:
MOV AL,[SI]
MOV BYTE PTR[BX],AL
SUB BX,2
SUB SI,2
LOOP AGAIN

POP AX
MOV [BX],AL

JMP HULAT


MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN

#9
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,705 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
No, that's not what I meant. First you need to test for w and s, and use my code for those, not the up/down.
.MODEL SMALL
.STACK 64
.DATA
;DATA FILE ARE LOCATED HERE

;CODE FILES ARE LOCATED HERE
.CODE
MAIN PROC FAR
    MOV AX,0B800h
    MOV DS,AX        
    MOV AL,03
    INT 10H

    HULAT:
        MOV AH,00
        INT 16H

[COLOR=Red]        CMP AL,'D'
        JZ  RIGHT
        
        CMP AL, 'A'
        JZ  LEFT
        
        CMP AL, 'W'
        JZ  UP
        
        CMP AL, 'S'
        JZ  DOWN

        JMP HULAT
        
    DOWN:
        ; MY CODE FOR GOING DOWN HERE
        
    UP:
        ; MY CODE FOR GOING UP HERE
        
    LEFT:
        ; YOUR CODE FOR GOING LEFT HERE[/COLOR]
        
    RIGHT:
        MOV BX,01DEH
        MOV SI,01DCH
        MOV AX,0000H
        MOV AL,[BX]
        PUSH AX
        MOV CX,79

        AGAIN:
            MOV AL,[SI]
            MOV BYTE PTR[BX],AL
            SUB BX,2
            SUB SI,2
            LOOP AGAIN

        POP AX
        MOV [BX],AL
        JMP HULAT

    MOV AH,4CH
    INT 21H
MAIN ENDP
END MAIN

Edited by dargueta, 11 March 2010 - 01:23 PM.
Added code

sudo rm -rf /

#10
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,705 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
Cheap shot, using your sig to post links... :glare:

EDIT: This no longer makes any sense because the spam post before me was removed.

Edited by dargueta, 14 March 2010 - 01:08 PM.

sudo rm -rf /

#11
helpmepls

helpmepls

    Newbie

  • Members
  • Pip
  • 9 posts
Thank u very much dargueta i really appreciate your help:) i tried the code u showed me, sorry but unfortunately i still cant get it to work. only the right and up was working. when i pressed A and S it went right.



i got it to go left and right using this codes and inserted ur up code but it doesnt seem to work:crying:

Quote

;THE FORM OF AN ASSEMBLY LANGUAGE PROGRAM
;NOTE: USING SIMPLIFIED SEGMENT DEFINITION
.MODEL SMALL
.STACK 64
.DATA
;DATA FILE ARE LOCATED HERE

.CODE
MAIN PROC FAR
MOV AX,0B800h
MOV DS,AX
;CODE FILES ARE LOCATED HERE
MOV AL,03 ;MAKING YOUR SCREEN 80X25
INT 10H


HULAT:
MOV AH,00
INT 16H

CMP AL,'D'
JNZ HULAT_l
JMP RIGHT
;WAITING FOR A KEY TO BE PRESSED

CMP AL, 'W'
JZ UP

HULAT_l: CMP AL,'d'
JNZ HULAT_a
JMP RIGHT


HULAT_a: CMP AL,'a'
JNZ HULAT_b
JMP LEFT

HULAT_b: CMP AL,'A'
JNZ HULAT_SMALLQ
JMP LEFT





HULAT_SMALLQ: CMP AL,'q'
JNZ HULAT_BIGQ
JMP GWA



HULAT_BIGQ: CMP AL,'Q'
JNZ HULAT
JMP GWA


UP:
mov ax, 0601h
mov bh, 07h
xor cx, cx
mov dx, 184fh
int 10h

LEFT:
MOV BX,0000H ;MOVING THE THIRD LINE
MOV SI,0002H




MOV CX,25 ;REPEATING PROCESS 25 TIMES




STEP1_L: PUSH CX
MOV AL,[BX]

PUSH AX

MoV CX,79

AGAIN_L:
MOV AL,[SI]
MOV BYTE PTR[BX],AL
ADD BX,2
ADD SI,2
LOOP AGAIN_L

POP AX
MOV [BX],AL

ADD BX,0A0H
ADD SI,0A0H
SUB BX,9EH
SUB SI,9EH

POP CX
LOOP STEP1_L
JMP HULAT





RIGHT:
MOV BX,009EH ;MOVING THE THIRD LINE
MOV SI,009CH

MOV AX,0000H


MOV CX,25 ;REPEATING PROCESS 25 TIMES




STEP1_R: PUSH CX
MOV AL,[BX]

PUSH AX

MoV CX,79

AGAIN_R:
MOV AL,[SI]
MOV BYTE PTR[BX],AL
SUB BX,2
SUB SI,2
LOOP AGAIN_R

POP AX
MOV [BX],AL

ADD BX,0A0H
ADD SI,0A0H
ADD BX,9EH
ADD SI,9EH

POP CX
LOOP STEP1_R
JMP HULAT





GWA:



MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN



i also tried doing this code to go up but i cant seem to make it loop. pls help me

Quote

.MODEL SMALL
.STACK 64
.DATA
;DATA FILE ARE LOCATED HERE

.CODE
MAIN PROC FAR
MOV AX,0B800h
MOV DS,AX
;CODE FILES ARE LOCATED HERE
MOV AL,03 ;MAKING YOUR SCREEN 80X25
INT 10H


HULAT:
MOV AH,00
INT 16H

CMP AL,'W'
JNZ HULAT_l
JMP UP




HULAT_l: CMP AL,'w'
JNZ HULAT_SMALLQ
JMP UP

HULAT_SMALLQ: CMP AL,'q'
JNZ HULAT_BIGQ
JMP GWA



HULAT_BIGQ: CMP AL,'Q'
JNZ HULAT
JMP GWA



UP:
MOV BX,0A0H
MOV SI,0140H

MOV AX,0A0H


MOV CX,25




STEP1: PUSH CX
MOV AL,[BX]

PUSH AX

MoV CX,79

AGAIN:
MOV AL,[SI]
MOV BYTE PTR[BX],AL
ADD BX,2
ADD SI,2
LOOP AGAIN

POP AX
MOV [BX],AL

ADD BX,0A0H
ADD SI,0A0H
SUB BX,9EH
SUB SI,9EH

POP CX
LOOP STEP1
JMP HULAT


GWA:



MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN


#12
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,705 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
As far as I can tell, this is what you need to do. Stuff in red is what you need to change, stuff in blue is what you need to add.
;THE FORM OF AN ASSEMBLY LANGUAGE PROGRAM
;NOTE: USING SIMPLIFIED SEGMENT DEFINITION
.MODEL SMALL
.STACK 64
.DATA
;DATA FILE ARE LOCATED HERE

.CODE
    ;CODE FILES ARE LOCATED HERE
    MAIN PROC FAR
    MOV AX,0B800h
    MOV DS,AX

    MOV AL,03 ;MAKING YOUR SCREEN 80X25
    INT 10H


    HULAT:
        ;WAITING FOR A KEY TO BE PRESSED
        MOV AH,00
        INT 16H

        CMP AL,'D'
        [COLOR=RED]JZ RIGHT[/COLOR]
        
        CMP AL,'d'
        [COLOR=RED]JZ RIGHT[/COLOR]

        CMP AL, 'W'
        JZ UP
        
        [COLOR=BLUE]
        CMP AL, 'w'
        JZ UP
        [/COLOR]
[COLOR=Blue]        CMP AL, 'S'
        JZ DOWN

        CMP AL, 's'
        JZ DOWN[/COLOR]

        HULAT_a:
            CMP AL,'a'
            [COLOR=Red]JZ LEFT[/COLOR]

        HULAT_b:
            CMP AL,'A'
            [COLOR=RED]JZ LEFT[/COLOR]

        HULAT_SMALLQ:
            CMP AL,'q'
            [COLOR=RED]JZ GWA[/COLOR]

        HULAT_BIGQ:
            CMP AL,'Q'
            JNZ HULAT
            JMP GWA
            
        UP:
            mov ax, 0601h
            mov bh, 07h
            xor cx, cx
            mov dx, 184fh
            int 10h
            [COLOR=BLUE]JMP HULAT[/COLOR]

        [COLOR=BLUE]DOWN:
            mov ax, [B]07[/B]01h
            mov bh, 07h
            xor cx, cx
            mov dx, 184fh
            int 10h
            JMP HULAT[/COLOR]

        LEFT:
            MOV BX,0000H    ;MOVING THE THIRD LINE
            MOV SI,0002H
            MOV CX,25       ;REPEATING PROCESS 25 TIMES

            STEP1_L:
                PUSH CX
                MOV AL,[BX]
                PUSH AX
                MoV CX,79
                AGAIN_L:
                    MOV AL,[SI]
                    MOV BYTE PTR[BX],AL
                    ADD BX,2
                    ADD SI,2
                LOOP AGAIN_L
                POP AX
                MOV [BX],AL
                ADD BX,0A0H
                ADD SI,0A0H
                SUB BX,9EH
                SUB SI,9EH
                POP CX
            LOOP STEP1_L
            JMP HULAT
            
        RIGHT:
            MOV BX,009EH ;MOVING THE THIRD LINE
            MOV SI,009CH
            MOV AX,0000H
            MOV CX,25 ;REPEATING PROCESS 25 TIMES
            STEP1_R:
                PUSH CX
                MOV AL,[BX]
                PUSH AX
                MoV CX,79
                AGAIN_R:
                    MOV AL,[SI]
                    MOV BYTE PTR[BX],AL
                    SUB BX,2
                    SUB SI,2
                    LOOP AGAIN_R
                POP AX
                MOV [BX],AL
                ADD BX,0A0H
                ADD SI,0A0H
                ADD BX,9EH
                ADD SI,9EH
                POP CX
                LOOP STEP1_R
            JMP HULAT
            
        GWA:
            MOV AH,4CH
            INT 21H
MAIN ENDP
END MAIN 

Edited by dargueta, 14 March 2010 - 01:31 PM.
Bug

sudo rm -rf /




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users