Glouton et Voraces
Bonjour,
Ceux qui ont pris le temps de mater la vignette et les balises savent déjà que mon titre est un piège. En effet, on ne va pas parler de Vidéopac aujourd'hui, mais bien d'Atari 2600. Mon but était de faire un petit jeu en bAtari Basic, car je suis totalement n00b en assembleur. Mais finalement, comme certains le savent déjà, je suis passé rapidement à autre chose. Alors, histoire que mes investigations ne volent pas en fumée, voici un screenshot et le code source minimaliste compilable sous Visual bAtari Basic et exécutable avec l'émulateur Stella.
;
; All-purpose bits for various jobs.
;
dim _BitOp_01 = y
dim _Bit0_Reset_Restrainer = y
;
; Defines the edges of the playfield for an 8 x 8 sprite.
; If your sprite is a different size, you`ll need to adjust
; the numbers.
;
const _P_Edge_Top = 9
const _P_Edge_Bottom = 88
const _P_Edge_Left = 1
const _P_Edge_Right = 153
;
; Disables the score. (We don`t need it in this program.)
;
const noscore = 1
;
; PROGRAM START/RESTART
;
__Start_Restart
;
; Mutes volume of both sound channels.
;
AUDV0 = 0 : AUDV1 = 0
;
; Clears all normal variables.
;
a = 0 : b = 0 : c = 0 : d = 0 : e = 0 : f = 0 : g = 0 : h = 0 : i = 0
j = 0 : k = 0 : l = 0 : m = 0 : n = 0 : o = 0 : p = 0 : q = 0 : r = 0
s = 0 : t = 0 : u = 0 : v = 0 : w = 0 : x = 0 : y = 0 : z = 0
;
; Sets starting position of player0.
;
player0x = 77 : player0y = 53
player1x = 10 : player1y = 10;
;
; Sets playfield color.
;
COLUPF = $2C
;
; Sets background color.
;
COLUBK = 0
;
; Restrains the reset switch for the main loop.
;
; This bit fixes it so the reset switch becomes inactive if
; it hasn't been released after being pressed once.
;
_Bit0_Reset_Restrainer{0} = 1
;
; Defines shape of player0 and player1 sprites
;
player0:
%00111100
%01111110
%11000011
%10111101
%11111111
%11011011
%01111110
%00111100
end
player1:
%10100101
%11111111
%11111111
%11111111
%11111111
%11011011
%01111110
%00111100
end
;
; MAIN LOOP (MAKES THE PROGRAM GO)
;
__Main_Loop
;
; Sets color of player0 and player1 sprites
;
COLUP0 = $2E
COLUP1 = $96
;
; Moves player0 sprite with the joystick while keeping the
; sprite within the playfield area.
;
if joy0up && player0y > _P_Edge_Top then player0y = player0y - 2
if joy0down && player0y < _P_Edge_Bottom then player0y = player0y + 2
if joy0left && player0x > _P_Edge_Left then player0x = player0x - 2
if joy0right && player0x < _P_Edge_Right then player0x = player0x + 2
;
; Moves player1 sprite to player0 location
;
if player1x < player0x then player1x = player1x + 1
if player1x > player0x then player1x = player1x - 1
if player1y < player0y then player1y = player1y + 1
if player1y > player0y then player1y = player1y - 1
;
; Displays the screen.
;
drawscreen
;
; Turns off reset restrainer bit and jumps to beginning of
; main loop if the reset switch is not pressed.
;
if !switchreset then _Bit0_Reset_Restrainer{0} = 0 : goto __Main_Loop
;
; Jumps to beginning of main loop if the reset switch hasn't
; been released after being pressed.
;
if _Bit0_Reset_Restrainer{0} then goto __Main_Loop
;
; Restarts the program.
;
goto __Start_Restart
Voilà. C'est donc un jeu avec un smiley poursuivi par un fantôme. Pas de score. Aucun but. Mais ça permet de voir un peu la gueule du code source de ce basic dédié à l'Atari 2600.
A+
GhisMart - Ghisloban - Sokoban
Commenter cet article