Welcome, Guest. Please login or register.


Author Topic: Snake 256byte (Read 8753 times)

Offline geco

  • EP addict
  • *
  • Posts: 7218
  • Country: hu
    • Támogató Támogató
Snake 256byte
« on: 2017.April.02. 17:33:56 »
256 byte version of well known Snake game. It runs on all EXOS versions, but there is no soft reset. There are 99 levels, when it is completed the border changes it's color.
Controls:
Internal joystick: move snake
Stop: restart game
Hold: set speed (default is 4)
[ Guests cannot view attachments ]

Offline SlashNet

  • EP addict
  • *
  • Posts: 1330
  • Country: ua
  • Enterprise 128K | Cubietruck
    • My old site about Enterprise
Re: Snake 256byte
« Reply #1 on: 2017.April.04. 21:09:22 »

Offline geco

  • EP addict
  • *
  • Posts: 7218
  • Country: hu
    • Támogató Támogató
Re: Snake 256byte
« Reply #2 on: 2017.April.05. 08:35:38 »

Offline g0blinish

  • EP fan
  • *
  • Posts: 110
Re: Snake 256byte
« Reply #3 on: 2017.April.23. 15:56:33 »
if LPT adress is known ho to determine adresses of font and video memory?

Offline geco

  • EP addict
  • *
  • Posts: 7218
  • Country: hu
    • Támogató Támogató
Re: Snake 256byte
« Reply #4 on: 2017.April.23. 16:42:10 »
if LPT adress is known ho to determine adresses of font and video memory?
Then LPT address + 4,5 gives the video memory (character map address) and LPT address + 6,7 gives the font memory/char mode.
Snake uses CHAR128 mode therefor LPT address +6,7 should be multiplied by 128, it will give the font memory, I use the normal EXOS font memory.

LPT 1 st char row used by the game:
F7 08 0B 73 28 C0 E9 01 00 92 00 49 FF 24 2D 36
Character map address: c028h
font address: 01e9h*80h= f480h


Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14775
  • Country: hu
    • http://enterprise.iko.hu/
Re: Snake 256byte
« Reply #5 on: 2017.April.23. 16:47:39 »
But font address are different in EXOS 2.0 (EP64) and EXOS 2.1 (EP128): B680/B480h
In my programs copy it from Status Line LPB.

Offline geco

  • EP addict
  • *
  • Posts: 7218
  • Country: hu
    • Támogató Támogató
Re: Snake 256byte
« Reply #6 on: 2017.April.23. 17:13:25 »
But font address are different in EXOS 2.0 (EP64) and EXOS 2.1 (EP128): B680/B480h
In my programs copy it from Status Line LPB.
Sorry, Snake does the same :) Just I took the example from the game started under EXOS 2.1

Offline g0blinish

  • EP fan
  • *
  • Posts: 110
Re: Snake 256byte
« Reply #7 on: 2017.April.23. 20:21:00 »
Then LPT address + 4,5 gives the video memory (character map address) and LPT address + 6,7 gives the font memory/char mode.
Snake uses CHAR128 mode therefor LPT address +6,7 should be multiplied by 128, it will give the font memory, I use the normal EXOS font memory.

LPT 1 st char row used by the game:
F7 08 0B 73 28 C0 E9 01 00 92 00 49 FF 24 2D 36
Character map address: c028h
font address: 01e9h*80h= f480h

As I understand char data defines as +128 for each line?

Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14775
  • Country: hu
    • http://enterprise.iko.hu/
Re: Snake 256byte
« Reply #8 on: 2017.April.23. 20:31:46 »
As I understand char data defines as +128 for each line?
Yes, if you use the default 128 characters mode.

Offline g0blinish

  • EP fan
  • *
  • Posts: 110
Re: Snake 256byte
« Reply #9 on: 2017.April.24. 03:32:36 »
exactly.

Offline g0blinish

  • EP fan
  • *
  • Posts: 110
Re: Snake 256byte
« Reply #10 on: 2017.April.24. 08:07:09 »
well. I don't see characters( but address difers from C028
   ld      hl,($bff4)
   push hl
   
   inc hl,hl,hl,hl
   ld e,(hl)
   inc hl
   ld d,(hl)
   
   ld b,0
   push de
   
mm:
   ld a,b
   ld (de),a
   inc de
   inc b
   jr nz,mm
   pop de
   pop hl

Offline geco

  • EP addict
  • *
  • Posts: 7218
  • Country: hu
    • Támogató Támogató
Re: Snake 256byte
« Reply #11 on: 2017.April.24. 08:32:47 »
well. I don't see characters( but address difers from C028
Your code seems to be good, please check the margin settings in LPT, I think it was set off.

Offline g0blinish

  • EP fan
  • *
  • Posts: 110
Re: Snake 256byte
« Reply #12 on: 2017.April.24. 09:17:30 »
ep128emu 2.0.10, EXDOS 2.1:

  B900  F7 08 3F 74 B8 FE E9 01 :w.?t8~i.
  B908  00 36 00 49 FF 24 2D 36 :.6.I.$-6


Offline geco

  • EP addict
  • *
  • Posts: 7218
  • Country: hu
    • Támogató Támogató
Re: Snake 256byte
« Reply #13 on: 2017.April.24. 10:24:01 »
I think i know what is the problem, you use the NICK address for printing the characters, and in this case the address of status line, and 0ffh segment is not paged in into page 3.

Offline g0blinish

  • EP fan
  • *
  • Posts: 110
Re: Snake 256byte
« Reply #14 on: 2017.April.24. 11:21:31 »
yes, t works:
Code: [Select]
ld a,$FF
out ($B3),a
mm:
ld a,b
ld (de),a
inc de
inc b
jr nz,mm

but here is some issues with color.