From: Robert Myers on
On Jun 5, 2:05 pm, gnoir...(a)nospicedham.No-SpAm.gmail.com wrote:
> Hello everybody,
>
> I have to do a breakout game in ASM 8086 for a study project. I don't know how to do the obstacle management. I'm stuck on it. Should I use an array with the positions of the obstacles ? Please, I need your help.
>
> Thanks to read my post.
>
> Best Regards,
>
> Gnoirzox

Is this take-home exam true-false?

Robert.
From: Frank Kotler on
gnoirzox(a)nospicedham.No-SpAm.gmail.com wrote:
> Hello everybody,
>
> I have to do a breakout game in ASM 8086 for a study project.
> I don't know how to do the obstacle management. I'm stuck on it.
> Should I use an array with the positions of the obstacles ?
> Please, I need your help.

True. :)

(in case it's a true-false question)

I'm not a "gamer" but I think I can imagine what a "breakout game" would
involve. I don't see how you'd do it *without* some kind of array.
Question is, what kind? (I think) I doubt if an array of x, y positions
would be the best way. It occurs to me that you may already have an
array at hand that might be suitable - namely the screen itself. I
envision "open space" to be black, and the "obstacles" some other color.
If the offset into which you propose to write your "guy" is non-black,
you've got a collision. Perhaps the situation is more complicated than I
imagine.

You wouldn't want to be reading from screen memory - very slow. You'd
want a buffer with a "copy" of your screen. Do your "work" in that
buffer, and when you've finished "updating", copy ("blit"?) it to the
screen. "movsd" is fairly fast, but not available on 8086. If this 8086
is equipped with an 8087, you can use FPU registers to copy memory. Else
"movsw" is probably okay. Perhaps you're already doing that?

Give us an idea how you've done whatever you've got done so far,
Gnoirzox. Particularly how the "obstacles" are created. Might give us an
idea what you're up against.

(does comp.arch want to be "in on this"? might want to drop that group?)

Best,
Frank
From: s_dubrovich on
On Jun 5, 1:05 pm, gnoir...(a)nospicedham.No-SpAm.gmail.com wrote:
> Hello everybody,
>
> I have to do a breakout game in ASM 8086 for a study project. I don't know how to do the obstacle management. I'm stuck on it. Should I use an array with the positions of the obstacles ? Please, I need your help.
>
> Thanks to read my post.
>
> Best Regards,
>
> Gnoirzox

ASCII character cells or sprites?
questions, questions, oh well ->

http://en.wikipedia.org/wiki/Collision_detection

The breakout game I recall was like a single person 'pong'. oh yeah,
wiki..

http://en.wikipedia.org/wiki/Breakout_(video_game)

hey, Wozniak did the prototype, I didn't know that, or if I did I'd
forgotten.

-so say 3 character cells on a row is a brick- array of 'brick'
row,col positions should get you started.

hth

Steve
From: gnoirzox on
Thanks Frank and Steve for trying help me. No, I didn't know that I could use the buffer. I use directly screen memory, it's a little bit low but before I used interruptions 10h and 21h, so It was very slow. I'll try 'movsd' or 'movsw'. To help you to understand how I display obstacle, I post my code here:

obstacle PROC
mov bx, 40
mov al, 12
mov cx, 2

mov [00h], al
mov [02h], bx
mov [04h], al
mov [06h], bx

call position_centre

position_verti1:
mov bx, 40
mov al, [00h]
inc al

call position_verticale

mov [00h], al

position_hori1:
mov al, 12
mov bx, [02h]
dec bx

call position_horizontale

mov [02h], bx

position_verti2:
mov bx, 40
mov al, [04h]
dec al

call position_verticale

mov [04h], al

position_honri2:
mov al, 12
mov bx, [06h]
inc bx

call position_horizontale

mov [06h], bx

cmp bx, 50
je init
jmp position_verti1

position_centre PROC
push cx
push bx
push ax

mov ah, 160
mul ah
shl bx, 1
add bx, ax
mov ch, 02Bh ;equal mov ch, '+'
xchg ch, cl
mov es: [bx], cx

pop ax
pop bx
pop cx

ret
position_centre endp

position_horizontale PROC
push cx
push bx
push ax

mov ah, 160
mul ah
shl bx, 1
add bx, ax
mov ch, 02Dh ;equal "mov ch, '-'"
xchg ch, cl
mov es: [bx], cx

pop ax
pop bx
pop cx

ret
position_horizontale endp

position_verticale PROC
push cx
push bx
push ax

mov ah, 160
mul ah
shl bx, 1
add bx, ax
mov ch, 07Ch ;equal "mov ch, '|'"
xchg ch, cl
mov es: [bx], cx


pop ax
pop bx
pop cx

ret
position_verticale endp

Best Regards

Gnoirzox


On 06/05/2010 22:35:28:456 Frank Kotler <fbkotler(a)nospicedham.myfairpoint.net> wrote:


>
> gnoirzox(a)nospicedham.No-SpAm.gmail.com wrote:
> > Hello everybody,
> >
> > I have to do a breakout game in ASM 8086 for a study project.
> > I don't know how to do the obstacle management. I'm stuck on it.
> > Should I use an array with the positions of the obstacles ?
> > Please, I need your help.
>
> True. :)
>
> (in case it's a true-false question)
>
> I'm not a "gamer" but I think I can imagine what a "breakout game" would
> involve. I don't see how you'd do it *without* some kind of array.
> Question is, what kind? (I think) I doubt if an array of x, y positions
> would be the best way. It occurs to me that you may already have an
> array at hand that might be suitable - namely the screen itself. I
> envision "open space" to be black, and the "obstacles" some other color.
> If the offset into which you propose to write your "guy" is non-black,
> you've got a collision. Perhaps the situation is more complicated than I
> imagine.
>
> You wouldn't want to be reading from screen memory - very slow. You'd
> want a buffer with a "copy" of your screen. Do your "work" in that
> buffer, and when you've finished "updating", copy ("blit"?) it to the
> screen. "movsd" is fairly fast, but not available on 8086. If this 8086
> is equipped with an 8087, you can use FPU registers to copy memory. Else
> "movsw" is probably okay. Perhaps you're already doing that?
>
> Give us an idea how you've done whatever you've got done so far,
> Gnoirzox. Particularly how the "obstacles" are created. Might give us an
> idea what you're up against.
>
> (does comp.arch want to be "in on this"? might want to drop that group?)
>
> Best,
> Frank
From: s_dubrovich on
On Jun 12, 5:41 am, gnoirzox <gnoir...(a)nospicedham.gmail.com> wrote:
> Thanks Frank and Steve for trying help me. No, I didn't know that I could use the buffer. I use directly screen memory, it's a little bit low but before I used interruptions 10h and 21h, so It was very slow. I'll try 'movsd' or 'movsw'. To help you to understand how I display obstacle, I post my code here:

Oh, so this is more about 'display' of a maze in ascii for a maze type
of game?

Your code is an interesting attempt, to dynamically build the maze
thru code intructions.

But consider the maze as data, it is static, it would not change once
the game begins.

In fact you can pre define the maze as a block of data, and copy that
to the video memory directly to display it.

Since you mention int21h and such, I infer that the code should run on
msDos or in win9x..XP by CMD.EXE

To help you get started, to show what Frank, and I also, mean about
copying a 'buffer' to screen memory, here is my example written in
NASM.

(A quick comment about your code first: obstacle PROC doesn't have a
matching endp, so check that first, a bad block structure would give
you problems as well.)

Ex.
;; prtmaze.nsm
;; Note: demo direct vid mem write of data maze.
;; Uses RomBios calls only
;; Nasm Syntax,
;; NASM version 0.98.38 compiled on Sep 12 2003
;;
;; NASM -@prtmaze.mak
;; prtmaze.mak makefile contains:
;; -f bin
;; -l prtmaze.LST
;; -E prtmaze.TXT
;; -o prtmaze.COM
;; prtmaze.NSM

Cols EQU 12 ;; test Maze demo
Rows EQU 11
Attr EQU 1Fh ;; wht on blu

Scrn EQU 0B800h ;; assume color

[SECTION .cseg vstart=0100h] ;; for .COM

main: ;; fill sreen with background
Fill_Scr_Init:
mov [VidCol], byte 0
mov [VidRow], byte 0
mov [Vid_Pg], byte 0
call SetPgCurs ;; setup curs pos

Fill_Scr:
mov ah, [VidRowMax]
inc ah
mov al, [VidColMax]
inc al
mul ah
mov cx, ax ;; filler count->cx

mov bl, [FAttr]
mov bh, [Vid_Pg] ;; see Vid_Serv.Mod
mov al,[ FillChar]
mov ah, 09h
INT 10h

;-; jmp Done
jmp printMaze

;;---------------------------------------------------55
;; Entry: AH.02, BH. pg#, DH.RowPos, DL.ColPos
;; Caller Presets VidParams struc before calling.

SetPgCurs: ;; from pg struc into bios state.
mov ax, [word VidCol] ;; 2 params.
xor bx, bx
mov bh, byte [Vid_Pg]
mov dx, ax
mov ax, 0200h
INT 10h
RET

;;---------------------------------------------------55
;; Print out MyMaze by writing to Video Memory.

printMaze:
mov si, MyMaze
mov di, 0
mov dx, Scrn ;; Video Disply Memory Segment
mov ES, dx
mov ah, Attr

prtRows:
mov cx, Rows

loopRows:
push cx

prtCols:
mov cx, Cols

loopCols:
lodsb ;; AL <- [SI++] byte from MyMaze
stosw ;; AH -> [DI++] word (attribute:character)
loop loopCols ;; while cx

add DI, (160-(Cols*2)) ;; to next line
pop cx ;; Row count
loop loopRows

Done:
mov ah, 0
int 16h
int 19h

align 16

[SECTION .dseg vfollows=.cseg] ;; for .COM
VidCol db 0
VidRow db 0
Vid_Pg db 0

VidRowMax db 24
VidColMax db 79

FAttr db 6Fh ;; Fill Attr: wht on brn, or yuk.
FillChar db 0B0h ;; blobs B0..B2, Solid 0DBh

;;-Data-
MyMaze:
db '+----------+'
db '| '
db '| +--------+'
db '| |'
db '+-+ +----+-+'
db '| | | |'
db '| + + + + +'
db '| | | |'
db '+----+ +---+'
db '| |'
db '+-+ +------+'

;; eof

hth,

Steve

>
[snipped code, see previous msg for that]

> Best Regards
>
> Gnoirzox
>