Jump to content

OldAtAtari

Members
  • Content Count

    163
  • Joined

  • Last visited

Community Reputation

60 Excellent

About OldAtAtari

  • Rank
    Chopper Commander

Profile Information

  • Gender
    Male
  • Location
    Oak Ridge, NC

Recent Profile Visitors

1,689 profile views
  1. I wanted to see what the assembly command INC does, so I looked it up. I already knew that INA would increment the accumulator. So INC will increment the value stored at a specific memory location, in this case, the memory referred to as "_score". So score++ looks like it loads the value from memory into the accumulator, increments that, and then stores it back into memory (three steps) whereas ++score simply increments the score where it sits in memory (one step). I had no idea! Learn something every day. I read about INC in this document (about the 6502, not the 65C02, but still looks really good): https://www.atariarchives.org/alp/appendix_1.php And that's part of a book found in the Atari Archives: https://www.atariarchives.org/sitemap.php But here's a nice document regarding the 65C02: http://www.retroisle.com/general/6502ref.html
  2. Thanks for putting this template together, Karri. I'm learning a lot from it.
  3. I love that! I didn't know you could do that. I still want to learn assembly, so it will be great to see how it translates. Thank you!
  4. Is the following a proper pre-increment, as opposed to what I did before? Is it as simple as using ++x instead of x++? Thanks. if (JOY_BTN_FIRE(joy) && jump == 0) { jump=1; lynx_snd_play(1, musicptr.music3); ++score; }
  5. Getting there. Now the boy jumps as the tree moves from right to left. And there's a score that increments each time the boy jumps. There is no collision detection yet. Code, messy with extra pieces and too few comments, but here for documentation. Feel free to pick it apart and criticize it: #include <lynx.h> #include <conio.h> #include <joystick.h> #include <tgi.h> #include <stdlib.h> unsigned char checkInput(void); extern unsigned char reset; void lynx_snd_init (); void lynx_snd_pause (); void lynx_snd_continue (); void __fastcall__ lynx_snd_play (unsigned char channel, unsigned char *music); void lynx_snd_stop (); typedef struct { unsigned char *music0; unsigned char *music1; unsigned char *music2; unsigned char *music3; } song_t; extern song_t musicptr; extern unsigned char tree[]; extern unsigned char odd_dude[]; static SCB_REHV_PAL Stree = { BPP_4 | TYPE_NORMAL, 0x10, 0x20, 0, tree, 0, 0, 0x0100, 0x100, {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef} }; static SCB_REHV_PAL Sodd_dude = { BPP_4 | TYPE_NORMAL, 0x10, 0x20, 0, odd_dude, 0, 0, 0x0100, 0x100, {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef} }; /* ----------------- Road -------------------- */ unsigned char pixel[] = { 3, 0x84, 0, 0 }; static SCB_REHVST_PAL Spixel = { BPP_1 | TYPE_BACKGROUND, 0x30, 0x20, 0, pixel, 50, 50, 0x2800, 0x800, 0x00, 0x100, {0x68} }; void polygon(int x1, int y1, int w1, int x2, int y2, int w2, unsigned char color) { Spixel.hpos = x1; Spixel.vpos = y1; Spixel.hsize = w1 << 8; Spixel.vsize = (y2 - y1 + 1) << 8; Spixel.tilt = (x2 - x1) * 256 / (y2 - y1); Spixel.stretch = (w2 - w1) * 256 / (y2 - y1); Spixel.penpal[0] = color; tgi_sprite(&Spixel); } void drawsegment(int lanes, int x1, int y1, int w1, int x2, int y2, int w2) { int l1; int l2; int r1; int r2; int lanew1; int lanew2; int lanex1; int lanex2; int lane; l1 = w1 >> (lanes + 2); l2 = w2 >> (lanes + 2); r1 = w1 >> (lanes + 1); r2 = w2 >> (lanes + 1); // Draw left yellow rumble line polygon(x1 - w1 - r1 + 1, y1, r1, x2 - w2 - r2 + 1, y2, r2, COLOR_YELLOW); // Draw road polygon(x1 - w1, y1, w1, x2 - w2, y2, w2, COLOR_GREY); lanew1 = w1 * 2 / lanes; lanew2 = w2 * 2 / lanes; lanex1 = x1 - w1 + lanew1; lanex2 = x2 - w2 + lanew2; for (lane = 1; lane < lanes; lanex1 += lanew1, lanex2 += lanew2, lane++) { polygon(lanex1 - l1 / 2, y1, l1, lanex2 - l2 / 2, y2, l2, COLOR_WHITE); } polygon(x1 - 1 + l1 / 2, y1, w1, x2 - 1 + l2 / 2, y2, w2, COLOR_GREY); // Draw right yellow rumble line polygon(x1 + w1, y1, r1, x2 + w2, y2, r2, COLOR_YELLOW); // Draw right cleanup polygon(x1 + w1 + r1 - 1, y1, r1, x2 + w2 + r2 - 1, y2, r2, COLOR_DARKGREY); } void draw_tree (int x, int y, int scale) { Stree.vpos = y; Stree.hpos = x + 0 * 256 / 256; Stree.vsize = 33; Stree.hsize = 33; tgi_sprite(&Stree); // Stree.hpos = x - 110 * 256 / 256; // tgi_sprite(&Stree); } void draw_dude (int dx, int dy, int scale) { Sodd_dude.vpos = dy; Sodd_dude.hpos = dx + 0 * 256 / 256; Sodd_dude.vsize = 35; Sodd_dude.hsize = 35; tgi_sprite(&Sodd_dude); // Sodd_dude.hpos = dx - 110 * 256 / 256; // tgi_sprite(&Sodd_dude); } void drawscreen(int x, int y, int dx, int dy, int turn, int score) { int y2; int scale1, scale2; char textScore[20]; itoa(score, textScore, 10); scale1 = 3 * y + 8; y2 = y + ((20 * scale1) >> 8); scale2 = 3 * y2 + 8; tgi_setcolor(COLOR_DARKGREY); tgi_bar(0, 0, 159, 101); tgi_setcolor(COLOR_YELLOW); tgi_outtextxy(120, 10, textScore); // drawsegment(2, x, y, (80 * scale1) >> 8, x + turn, y2, (80 * scale2) >> 8); draw_tree(x, y, scale2); draw_dude(dx, dy, scale2); } void game() { int x = 160; int dx = 10; int y = 80; int dy = 80; int turn = 0; int jump = 0; int jumpUp = 25; int jumpDown = 25; int score = 0; while (!reset) { // never use while(1). Every loop needs to be halted by the reset event if (!tgi_busy()) { unsigned char joy; // Instead of calling joy_read() directly, use checkInput() defined in resident.c . // It will return the joy state, but will handle pause and reset events too // joy = joy_read(JOY_1); joy = checkInput(); if (JOY_BTN_UP(joy)) { } if (JOY_BTN_DOWN(joy)) { } if (JOY_BTN_RIGHT(joy)) { dx++; if (dx > 150) dx = 150; } if (JOY_BTN_LEFT(joy)) { dx--; if (dx < 10) dx = 10; } if (JOY_BTN_FIRE(joy) && jump == 0) { jump=1; lynx_snd_play(1, musicptr.music3); score++; } if (jump == 1 && jumpUp != 0) { dy = dy - 2; jumpUp--; } if (jump == 1 && jumpUp == 0 && jumpDown != 0) { dy = dy + 2; jumpDown--; } if (jumpDown == 0) { jump = 0; jumpUp = 25; jumpDown = 25; } if (JOY_BTN_FIRE2(joy)) { turn--; } if (x == 0) { x=160; } x--; drawscreen(x, y, dx, dy, turn, score); tgi_updatedisplay(); } } }
  6. That program looks amazing! Old-school and wonderful. I can't wait to try it. Thanks!
  7. Oh, yes, back to the sprite editing issue. My indexed .PCX wouldn't work in Gimp in Linux. But it works in Gimp in Windows 10. Do any Linux users have a suggestion of how to get Linux Gimp to work, or what Linux drawing program to use instead? Thanks.
  8. 🙂 Thanks! It was very exciting indeed! Next, I want to make him jump, and I want to make that tree move on its own horizontally across the screen, back and forth, or just scrolling endlessly. I want to see if the sprite dude can jump over, or on to, the tree. And that would pretty much be a game right there. 🙂
  9. Ok, not my best work. But functional. The dude can walk around. Everything else is stationary. Onwards and upwards. Thanks again, Turbo Laser Lynx!
  10. Ha! Ok, so this works in Windows Gimp, but not in Linux Gimp, for me anyway. Anyway, it's working. Thank you, Turbo Laser Lynx!
  11. Hmmmm, "indexed" is turned on in the image/mode menu... Any other ideas? In the meantime, I'll randomly click buttons. 🙂
  12. My questions never end... I used Gimp to turn the tree into a little guy. I kept the same tree.pcx name. I just opened it in Gimp, edited the image, and then exported as tree.pcx. But "Make" complains now: Error: Error in PCX file `tree.pcx': 770 bytes at end of pixel data Every seen anything like that before?
  13. Thank you! So much to learn. And there are also shortcuts, so that can keep it fun while I'm learning.
  14. I've been bouncing around from thing to thing, playing with the otello, mines, and game.c examples. I've been hacking away at game.c. I wanted to see if I could get the road to be stationary while the tree moves around the screen without resizing. Mission accomplished. A silly little goal, but then if I can figure out how to get either of the two sprite generators (sprpck and sp65) working, I'll be able to change that tree into a car, a robot, or whatever. Little milestones.
×
×
  • Create New...