Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  nodelist  faq  login

Don't sweat it -- it's only ones and zeros. -- P. Skelly


programming / alt.lang.asm / Re: pong 256 bytes

SubjectAuthor
* pong 256 bytesKerr-Mudd,John
`* Re: pong 256 bytesMateusz Viste
 `* Re: pong 256 bytesKerr-Mudd,John
  `* Re: pong 256 bytesMateusz Viste
   +* Re: pong 256 bytesKerr-Mudd,John
   |`* Re: pong 256 bytesMateusz Viste
   | `* Re: pong 256 bytesKerr-Mudd,John
   |  `* Re: pong 256 bytesKerr-Mudd,John
   |   `* Re: pong 256 bytesMateusz Viste
   |    `* Re: pong 256 bytesKerr-Mudd,John
   |     `* Re: pong 256 bytesMateusz Viste
   |      `* Re: pong 256 bytesKerr-Mudd,John
   |       `* Re: pong 256 bytesMateusz Viste
   |        `* Re: pong 256 bytesKerr-Mudd,John
   |         `* Re: pong 256 bytesKerr-Mudd,John
   |          `* Re: pong 256 bytesSteve
   |           +- Re: pong 256 bytesMateusz Viste
   |           `* Re: pong 256 bytesKerr-Mudd,John
   |            +* Re: pong 256 bytesKerr-Mudd,John
   |            |`- Re: pong 256 bytesMateusz Viste
   |            `* Re: pong 256 bytesSteve
   |             `* Re: pong 256 bytesKerr-Mudd,John
   |              `* Re: pong 256 bytesKerr-Mudd,John
   |               `* Re: pong 256 bytesKerr-Mudd,John
   |                `* Re: pong 256 bytesSteve
   |                 `- Re: pong 256 bytesKerr-Mudd,John
   `* Re: pong 256 bytessrc153
    `- Re: pong 256 bytesFrank Kotler

Pages:12
Subject: Re: pong 256 bytes
From: Kerr-Mudd,John
Newsgroups: alt.lang.asm
Organization: dis
Date: Fri, 6 Sep 2019 12:24 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: notsay...@invalid.org (Kerr-Mudd,John)
Newsgroups: alt.lang.asm
Subject: Re: pong 256 bytes
Date: Fri, 6 Sep 2019 12:24:58 -0000 (UTC)
Organization: dis
Lines: 62
Message-ID: <XnsAAC2887FF86B3admin127001@144.76.35.198>
References: <XnsAAACA2EB9767Dadmin127001@144.76.35.198> <5d55acc7$0$31410$426a74cc@news.free.fr> <XnsAAACCF2D3678admin127001@144.76.35.198> <5d570a2e$0$3376$426a74cc@news.free.fr> <XnsAAADDDEF89029admin127001@144.76.35.198> <5d5724b6$0$6468$426a34cc@news.free.fr> <XnsAAAE628A5F2B4admin127001@144.76.35.198> <XnsAABDC809FE765admin127001@144.76.35.198> <5d6c3b18$0$15185$426a74cc@news.free.fr> <XnsAABE62AA7444Eadmin127001@144.76.35.198> <5d6cfa9a$0$21584$426a74cc@news.free.fr> <XnsAABEA7F809BB1admin127001@144.76.35.198> <5d6d4faf$0$15196$426a34cc@news.free.fr> <XnsAABEC212AE02Eadmin127001@144.76.35.198> <XnsAABF60BC267B7admin127001@144.76.35.198> <c1.2b8.46N5HB$06q@NOVOSAD3.EMBARQ.COM> <XnsAABF86B7DECE0admin127001@144.76.35.198> <c1.2b8.46NhKb$06r@NOVOSAD3.EMBARQ.COM> <XnsAAC0D436BAB79admin127001@144.76.35.198> <XnsAAC1B5B549C5Cadmin127001@144.76.35.198>
Injection-Date: Fri, 6 Sep 2019 12:24:58 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="3f748916810eed9d55902e437ba273c3";
logging-data="25815"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Sdpgpj0+/OkSy0fGBuUiZj4Vnghw4On0="
User-Agent: Xnews/2006.08.24
Cancel-Lock: sha1:mQ+NUNmuI2kf7G6v4tWG6wlO8Cc=
View all headers
On Thu, 05 Sep 2019 16:51:39 GMT, "Kerr-Mudd,John"
<notsaying@invalid.org> wrote:

On Wed, 04 Sep 2019 19:51:26 GMT, "Kerr-Mudd,John"
<notsaying@invalid.org> wrote:

On Wed, 04 Sep 2019 11:24:03 GMT, Bogus@Embarq.com (Steve) wrote:

"Kerr-Mudd,John" <notsaying@invalid.org> writes:
On Tue, 03 Sep 2019 12:04:54 GMT, Bogus@Embarq.com (Steve) wrote:

Hi,

   I tried the program without much luck.
What keys are intended to be used?  It
could also be a bad testing environment?


It's Ctrl for down; Alt for up


--
Bah, and indeed, Humbug.

Hi,

   Thanks to both for replying.  The program
works well in a Windows 2000 NTVDM and
DOS 6.2.  No delay in an OS/2 VDM.  And the
"ball" seems to disappear every so often.

; ah; the old ball gets deleted before writing it at is new location; if
the vsync delay is large that would account for it. The opposite would be
a smeared 2 pixel ball at times. But that would cost more code.

And I don't play it very well.

just anticipate the ball. there's no fancy angles!


Because 'Blue' (1) is barely visible; I thought I'd try just saving
the score on screen as such, yet draw the dots in Bright White

[]
B013CD10B800A0500731FF31C949F3AABA5F0052BD0100BEA000B864FF00E03C
0274043CC67502F6DC01EE89C389F7B60EE897005B81FEE600720D502C0538D8
587405720243434BBF3D01E84D0074B453723297B402CD16A804740142A80874
014AB401CD16752C52BADA03ECA80875F8ECA80874FB5B9731FFFDE81D00FC59
748289DA519C89C389F7B600E83C009D738BEB83B80300CD1058C3B10238CB72
06B1BD38CB720288CB39FE750D38D8722E8D4F0A38C87327F7DDB60AB10AE80A
00E2FBB600E8030080EB0C575052B84001B700F7E34301C75A268835585FC357
5081F73D01268A0540ABB90F00983C0691F3AB585F9CE8C1FF9DC3

{changed to latest hex}

Any other bugs? If not, I'll post my code and any of you who still code
in x86 can critic^w enhance what I've done.

cpu 8086!

--
Bah, and indeed, Humbug.


Subject: Re: pong 256 bytes
From: Steve
Newsgroups: alt.lang.asm
Organization: Aioe.org NNTP Server
Date: Sun, 8 Sep 2019 14:24 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Path: i2pn2.org!i2pn.org!aioe.org!.POSTED.n3DUoT/dABXGNSNFLyj6RA.user.gioia.aioe.org!not-for-mail
From: Bog...@Embarq.com (Steve)
Newsgroups: alt.lang.asm
Subject: Re: pong 256 bytes
Date: Sun, 08 Sep 2019 14:24:15 GMT
Organization: Aioe.org NNTP Server
Lines: 37
Message-ID: <c1.2b8.46RD7g$06s@NOVOSAD3.EMBARQ.COM>
References: <XnsAAACA2EB9767Dadmin127001@144.76.35.198> <5d55acc7$0$31410$426a74cc@news.free.fr> <XnsAAACCF2D3678admin127001@144.76.35.198> <5d570a2e$0$3376$426a74cc@news.free.fr> <XnsAAADDDEF89029admin127001@144.76.35.198> <5d5724b6$0$6468$426a34cc@news.free.fr> <XnsAAAE628A5F2B4admin127001@144.76.35.198> <XnsAABDC809FE765admin127001@144.76.35.198> <5d6c3b18$0$15185$426a74cc@news.free.fr> <XnsAABE62AA7444Eadmin127001@144.76.35.198> <5d6cfa9a$0$21584$426a74cc@news.free.fr> <XnsAABEA7F809BB1admin127001@144.76.35.198> <5d6d4faf$0$15196$426a34cc@news.free.fr> <XnsAABEC212AE02Eadmin127001@144.76.35.198> <XnsAABF60BC267B7admin127001@144.76.35.198> <c1.2b8.46N5HB$06q@NOVOSAD3.EMBARQ.COM> <XnsAABF86B7DECE0admin127001@144.76.35.198> <c1.2b8.46NhKb$06r@NOVOSAD3.EMBARQ.COM> <XnsAAC0D436BAB79admin127001@144.76.35.198> <XnsAAC1B5B549C5Cadmin127001@144.76.35.198> <XnsAAC2887FF86B3admin127001@144.76.35.198>
Reply-To: Bogus@Embarq.com
NNTP-Posting-Host: n3DUoT/dABXGNSNFLyj6RA.user.gioia.aioe.org
X-Complaints-To: abuse@aioe.org
X-Notice: Filtered by postfilter v. 0.9.2
X-Newsreader: IBM NewsReader/2 2.0
View all headers
Hi,

"Kerr-Mudd,John" <notsaying@invalid.org> writes:
On Thu, 05 Sep 2019 16:51:39 GMT, "Kerr-Mudd,John"
<notsaying@invalid.org> wrote:

On Wed, 04 Sep 2019 19:51:26 GMT, "Kerr-Mudd,John"
<notsaying@invalid.org> wrote:

On Wed, 04 Sep 2019 11:24:03 GMT, Bogus@Embarq.com (Steve) wrote:
<Snip>
Hi,

   Thanks to both for replying.  The program
works well in a Windows 2000 NTVDM and
DOS 6.2.  No delay in an OS/2 VDM.  And the
"ball" seems to disappear every so often.

; ah; the old ball gets deleted before writing it at is new location; if
the vsync delay is large that would account for it. The opposite would be
a smeared 2 pixel ball at times. But that would cost more code.

   The monitor claims 70 Hz.  Seems to disappear
less often than the older version.

And I don't play it very well.

just anticipate the ball. there's no fancy angles!

   There is an unfortunate disconnect between
knowing the theory and its implementation.

<Snip>

Cheers,

Steve N.


Subject: Re: pong 256 bytes
From: Kerr-Mudd,John
Newsgroups: alt.lang.asm, comp.lang.asm.x86
Organization: dis
Date: Mon, 9 Sep 2019 09:59 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: notsay...@nospicedham.invalid.org (Kerr-Mudd,John)
Newsgroups: alt.lang.asm,comp.lang.asm.x86
Subject: Re: pong 256 bytes
Date: Mon, 9 Sep 2019 09:59:22 -0000 (UTC)
Organization: dis
Lines: 271
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <XnsAAC56FD57254admin127001@144.76.35.198>
References: <XnsAAACA2EB9767Dadmin127001@144.76.35.198> <5d55acc7$0$31410$426a74cc@news.free.fr> <XnsAAACCF2D3678admin127001@144.76.35.198> <5d570a2e$0$3376$426a74cc@news.free.fr> <XnsAAADDDEF89029admin127001@144.76.35.198> <5d5724b6$0$6468$426a34cc@news.free.fr> <XnsAAAE628A5F2B4admin127001@144.76.35.198> <XnsAABDC809FE765admin127001@144.76.35.198> <5d6c3b18$0$15185$426a74cc@news.free.fr> <XnsAABE62AA7444Eadmin127001@144.76.35.198> <5d6cfa9a$0$21584$426a74cc@news.free.fr> <XnsAABEA7F809BB1admin127001@144.76.35.198> <5d6d4faf$0$15196$426a34cc@news.free.fr> <XnsAABEC212AE02Eadmin127001@144.76.35.198> <XnsAABF60BC267B7admin127001@144.76.35.198> <c1.2b8.46N5HB$06q@NOVOSAD3.EMBARQ.COM> <XnsAABF86B7DECE0admin127001@144.76.35.198> <c1.2b8.46NhKb$06r@NOVOSAD3.EMBARQ.COM> <XnsAAC0D436BAB79admin127001@144.76.35.198> <XnsAAC1B5B549C5Cadmin127001@144.76.35.198> <XnsAAC2887FF86B3admin127001@144.76.35.198> <c1.2b8.46RD7g$06s@NOVOSAD3.EMBARQ.COM>
Injection-Info: h2725194.stratoserver.net; posting-host="8b3e28c6c86ec14f2dadd20ea01a94e2";
logging-data="21963"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX194TEYNU+KPfXGRPXbYGmo2PtApVqhHt5g="
User-Agent: Xnews/2006.08.24
Cancel-Lock: sha1:NHkYChMGwfrtCQbnHQ/H62wUA9Q=
View all headers
Pong in <256 for 8086, MCGA.
Alt=Dn,Ctl=Up, any key to exit
Score shown on top line, currently game resets after 6 losses.

Hex:

aB013CD10B800A0500731FF31C949F3AABA5F0052BD0100BEA000B864FF00E03C
0274043CC67502F6DC01EE89C389F7B60EE897005B81FEE600720D502C0538D8
587405720243434BBF3D01E84D0074B453723297B402CD16A804740142A80874
014AB401CD16752C52BADA03ECA80875F8ECA80874FB5B9731FFFDE81D00FC59
748289DA519C89C389F7B600E83C009D738BEB83B80300CD1058C3B10238CB72
06B1BD38CB720288CB39FE750D38D8722E8D4F0A38C87327F7DDB60AB10AE80A
00E2FBB600E8030080EB0C575052B84001B700F7E34301C75A268835585FC357
5081F73D01268A059840AB3C06B90F0091F3AB585F9CE8C1FF9DC3


Source Code nasm: comments welcome:
(I hope I've killed all the spare tabs; apologies for any format
messiness)

; SMALLPONG v2.1j5f
org 0x100;; MJ 251!  works!
;;
;;dots show score on top line; held as colour; prt white dots as score
; from Brad Smith's pong21 255; 6/29/2008
;http://rainwarrior.ca/dragon/pong256.html
cpu 8086
%define  SCREEN_WIDTH        320
%define  SCREEN_HEIGHT       200
%define  SCREEN_X_MID        SCREEN_WIDTH / 2
%define  SCREEN_Y_MID        SCREEN_HEIGHT / 2
%define  SCREEN_SIZE         SCREEN_WIDTH * SCREEN_HEIGHT

%define  PADDLE_LEFT_X       0
%define  paddle_left_y       dx  ; dl ; dh=prtclr
%define  PADDLE_RIGHT_X      SCREEN_WIDTH  - 3 ; (was -1) make visible on
my scrn
;%define  paddle_right_y     ; now on stack
%define  PADDLE_TOP          2 ; allow top line for score
%define  PADDLE_MID          SCREEN_Y_MID - (PADDLE_SIZE/2)
%define  PADDLE_BOTTOM       (SCREEN_HEIGHT-1) - PADDLE_SIZE

%define  ball_x              si
%define  ball_y              ax ; actually al ; ah is dircn
%define  ball_dx             bp ;word [BALL_DX]
%define  ball_dy             ah ; -1 at start
;; %define temp1             cx
%define  BALL_MID_X          SCREEN_X_MID
%define  BALL_MID_Y          SCREEN_Y_MID
%define  BALL_TOP            PADDLE_TOP
%define  BALL_BOTTOM         SCREEN_HEIGHT-2 ;; (PADDLE_BOTTOM +
PADDLE_SIZE) - 1

%define  PADDLE_SIZE         10
%define  AI_THRESHOLD        SCREEN_WIDTH - 90
%define  LOSE_LIMIT          6

Black    equ 0
Blue     equ 1
Green    equ 2
Red      equ 4
Yellow   Equ Bright+Green+Red
White    equ 7
Bright   equ 8
PADDLE_COLOUR equ Bright+Green
SCORE_COLOUR  equ Bright+White
BALL_COLOUR   equ Yellow
start:
         mov al,0x13         ; set VGA 320x200 [9]
         int 0x10
new_game:
         mov ax,0xA000
        push ax
        pop es               ; es:di pts to screen
         xor di,di           ; cls
         xor cx,cx
         dec cx              ;FA00 + a bit
         rep stosb           ;need al=0! also resets scores to 0
         mov paddle_left_y,PADDLE_MID
;         mov paddle_right_y,paddle_left_y
        push  paddle_left_y  ;paddle_right_y on stack
         mov ball_dx,1

game_loop:

;set_new_ball:  ; top of loop
         mov ball_x,BALL_MID_X
         mov ax,BALL_MID_Y+0x100*-1 ; ah<=-1
no_new:

;move_ball:      add movement to ball_x,ball_y
         add al,ball_dy      ; move ball vert
         cmp al,BALL_TOP     ; chk bounce vertical
         je invert_dy
         cmp al,BALL_BOTTOM
         jne ball_not_bottom
       invert_dy:
         neg ball_dy
         ball_not_bottom:
         add ball_x,ball_dx  ; move ball hztl

;prt_ball:
         mov bx,ball_y
         mov di,ball_x
         mov dh,BALL_COLOUR
         call put_pixel      ; plot at (X,Y) di,bx : color dl

;right_paddle_AI:
;        mov bx,paddle_right_y
        pop bx ;paddle_right_y
         cmp ball_x,AI_THRESHOLD
         jc no_move
       push ax
         sub al,(PADDLE_SIZE / 2)
         cmp al,bl ; ball_y v paddle_right_y
       pop ax
         jz no_move
         jc mv_up
         inc bx
         inc bx
        mv_up:
         dec bx
        end_ai:
        no_move:

;draw_right_paddle: ; reqs ballx/y
;        mov paddle_right_y,bx
         mov di,PADDLE_RIGHT_X
         call do_paddle      ; paddle at (X,Y) di,bx
         jz new_game
        push bx              ; store paddle_right_y
         jc new_ball

         ;; ry on stack, bx=ly
;left_paddle_move: inkey to al, dx up/dn
         xchg ax,di          ; save ball_y
         mov ah,2            ; get keyshift status
         int 0x16
         test al,4 ;Ctrl
         jz not_dn
         inc paddle_left_y   ; move paddle down
    not_dn:
         test al,8 ;Alt
         jz not_up
         dec paddle_left_y   ; move paddle up
    not_up:
;         cmp al,3  ; both shifts to exit - also txt mode
;         jne game_loop
 ;        cbw
         mov ah,1            ; any key to exit
         int 0x16
         jnz Quit
;         jz game_loop
;delay_: ;  wait for vsync [15]
       push paddle_left_y
   vsync_active:
         mov dx,0x03DA       ; checking retrace
         in al,dx
         test al,8
         jnz vsync_active
   vsync_retrace:
         in al,dx
         test al,8
         jz vsync_retrace
       pop bx                ; mov bx,paddle_left_y

;         mov ax,ball_y
         xchg ax,di          ; restore ball_y
;draw_left_paddle:  ; ball_x, ball_y, di=PADDLE_X, bx=paddle_y
        ; bx=paddle_y already
         xor di,di           ; di=PADDLE_LEFT_X
         std                 ; for score drawing
         call do_paddle      ; paddle at (X,Y) di,bx
         cld
        pop cx               ; drop PR_Y if restarting
         jz new_game
         mov paddle_left_y,bx
        push cx

new_ball: ; must clr old ball 1st!
        pushf
;clear_ball:
         mov bx,ball_y
         mov di,ball_x
 ;        cwd ; dl=0  ? not always
         mov dh,Black        ; clear ball
         call put_pixel      ; plot at (X,Y) di,bx : color dl

Click here to read the complete article
Pages:12
rocksolid light 0.7.2
clearneti2ptor