What is the problem my code?
stacksg segment para stack 'stack'
stacksg ends
datasg segment para 'data'
msg db "A. $", 0
datasg ends
codes segment para 'code'
assume ss:stacksg, ds:datasg, cs:codes
mov ax, datasg
mov ds, ax
;------------ ur programm
mov al,4
mov bh,0
int 10h
mov bh,0
mov bl,1001b
mov ah,0Bh
int 10h
mov ax,0
int 33h
mov ax,01h
int 33h
;mov dx,101h
;mov cx,161h
lable1:
mov ah,10h
int 16h
cmp al,48h ;up key (arrow) 24dec
je lable
cmp al,50h ;Down key (arrow) 24dec
je lable2
lable:
mov ax,03h
int 33h
mov ax,04h
int 33h
dec dx
cmp dx,0
jne lable1
lable2:
mov ax,03h
int 33h
mov ax,04h
int 33h
inc dx
cmp dx,199h
jne lable1
;------------ end of program
mov ax, 4c00h
int 21h
codes ends
end
I get a full blue screen with a big mouse cursor (arrow to the upper left). What is it supposed to do, what is your specific problem?
deleted
in your code, you have an empty stack segment
i guess that means no stack space ?
it's also helpful to use the model and segment "shortcut" directives...
.MODEL Small
.386
.STACK 1024
OPTION CaseMap:None
;####################################################################################
.DATA
s$Hello db 'Hello World!',0Dh,0Ah,24h
;************************************************************************************
; .DATA?
;####################################################################################
.CODE
;************************************************************************************
_main PROC
;----------------------------------
;DS = DGROUP
mov ax,@data
mov ds,ax
;----------------------------------
;display the string
mov dx,offset s$Hello
mov ah,9
int 21h
;----------------------------------
;wait for key press
WaitKy: mov ah,1
int 16h
jz WaitKy
mov ah,0
int 16h
;----------------------------------
;terminate
mov ax,4C00h
int 21h
_main ENDP
;####################################################################################
END _main
deleted
mov al,4
mov bh,0
int 10h
Int 10h needs the function in AH but you don't set it to anything.
set video mode 4 ???
i don't remember what mode 4 is, but that doesn't sound right
that's what it is, though - lol
mov ax,4
Mode 4 is a CGA emulation mode, 320x200, 4-color (2bpp), 1 page, starting address B8000h.
on my machine, the cursor is the size of texas - lol
i used to use mode 13h a lot for graphics
i remember having to make my own cursor because it was too big :P
but, i don't think it was as big as this one
here is a cursor i used to use for mode 13h (320x200 256 colors)
i used words instead of bytes - the high byte was used as the z-buffer :P
but, you can use this as a template to make whatever you like
the 0 words are transparent
; F6 = black
; FE = white
;
CBMEXI DW 0F6h,0,0,0,0,0,0
DW 0F6h,0F6h,0,0,0,0,0
DW 0F6h,0FEh,0F6h,0,0,0,0
DW 0F6h,0FEh,0FEh,0F6h,0,0,0
DW 0F6h,0FEh,0FEh,0FEh,0F6h,0,0
DW 0F6h,0FEh,0FEh,0FEh,0FEh,0F6h,0
DW 0F6h,0FEh,0FEh,0FEh,0FEh,0FEh,0F6h
DW 0F6h,0FEh,0FEh,0FEh,0FEh,0F6h,0
DW 0F6h,0F6h,0F6h,0FEh,0FEh,0F6h,0
DW 0,0,0,0F6h,0FEh,0FEh,0F6h
DW 0,0,0,0F6h,0F6h,0F6h,0
Thanks, everyone :eusa_clap:
I changed the code as follows.
There is a problem with move up.its work any key . :icon_eek:
.model small
.stack
.code
start:
; mov ax, datasg
; mov ds, ax
;------------ ur programm
mov al,4
mov bh,0
int 10h
mov bh,0
mov bl,1001b
mov ah,0Bh
int 10h
mov ax,0
int 33h
mov ax,01h
int 33h
;mov dx,101h
;mov cx,161h
lable1:
mov ah,10h
int 16h
cmp ah,48h ;upArrow key
je lable
cmp ah,50h ;DownArrow key
je lable2
cmp ah,4Dh ;RightArrow key
je lable3
cmp ah,4Bh ;LeftArrow key
je lable4
lable:; Moved up
mov ax,03h
int 33h
dec dx
mov ax,04h
int 33h
cmp dx,0
jne lable1
lable2:; Moved Down
mov ax,03h
int 33h
inc dx
mov ax,04h
int 33h
cmp dx,199h
jne lable1
lable3:; Moved right
mov ax,03h
int 33h
inc cx
mov ax,04h
int 33h
cmp dx,199h
jne lable1
lable4:; Moved left
mov ax,03h
int 33h
dec cx
mov ax,04h
int 33h
cmp dx,199h
jne lable1
;------------ end of program
mov ax, 4c00h
int 21h
end start
that's because of the logic in this part
int 16h
cmp ah,48h ;upArrow key
je lable
cmp ah,50h ;DownArrow key
je lable2
cmp ah,4Dh ;RightArrow key
je lable3
cmp ah,4Bh ;LeftArrow key
je lable4
lable:; Moved up
notice that, if none of the conditions are met, the "Moved up" code is executed
you can fix it like this
int 16h
cmp ah,50h ;DownArrow key
je lable2
cmp ah,4Dh ;RightArrow key
je lable3
cmp ah,4Bh ;LeftArrow key
je lable4
cmp ah,48h ;upArrow key
jne test_something_else
lable:; Moved up
the last test is for the upArrow key
if it's not upArrow - do something else
the "something else" can be test the mouse or go back and wait for another key
Thank you my friend
Why is the cursor out screen left and bottom.unless the screen is 320 x 200
that's more of a computer issue than a cursor issue
many modern computers do not display 320x200 modes very well
it's not uncommon to see part of the display rastor chopped off :P
but, on the bottom and right, the cursor has always nearly disappeared,
as the cursor "hot-spot" is typically the upper-left part of the cursor, at the tip of the arrow
the hot-spot is where the actual cursor position is percieved to be
this still holds true with recent versions of windows
Thank you and everyone