Enterprise Forever

:UK => Enterprise DevCompo => Enterprise DevCompo #2 => Topic started by: geco on 2017.April.02. 17:33:56

Title: Snake 256byte
Post by: geco 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)
[attach=2]
Title: Re: Snake 256byte
Post by: SlashNet on 2017.April.04. 21:09:22
https://youtu.be/qiKTkpAX4Xc
Title: Re: Snake 256byte
Post by: geco on 2017.April.05. 08:35:38
https://youtu.be/qiKTkpAX4Xc
Thank you very much :)
Title: Re: Snake 256byte
Post by: g0blinish on 2017.April.23. 15:56:33
if LPT adress is known ho to determine adresses of font and video memory?
Title: Re: Snake 256byte
Post by: geco 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

Title: Re: Snake 256byte
Post by: Zozosoft 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.
Title: Re: Snake 256byte
Post by: geco 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
Title: Re: Snake 256byte
Post by: g0blinish 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?
Title: Re: Snake 256byte
Post by: Zozosoft 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.
Title: Re: Snake 256byte
Post by: g0blinish on 2017.April.24. 03:32:36
exactly.
Title: Re: Snake 256byte
Post by: g0blinish 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
Title: Re: Snake 256byte
Post by: geco 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.
Title: Re: Snake 256byte
Post by: g0blinish 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

Title: Re: Snake 256byte
Post by: geco 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.
Title: Re: Snake 256byte
Post by: g0blinish 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.
Title: Re: Snake 256byte
Post by: geco on 2017.April.24. 13:18:29
but here is some issues with color.
Probably because character codes from 0-127 are displayed of palette color 0,1, and from 128-255 are displayed with 2,3
Title: Re: Snake 256byte
Post by: Zozosoft on 2017.April.24. 13:25:36
And can be a problem: EXOS character codes 128-159 are converted to 0-31 in video memory. If you directly copy text which including these character will be displayed with wrong color pair.
Title: Re: Snake 256byte
Post by: g0blinish on 2017.April.24. 13:26:48
Now I see only one line of characters.

should I use VRES?
Title: Re: Snake 256byte
Post by: geco on 2017.April.24. 13:46:49
Now I see only one line of characters.

should I use VRES?
No, you used the charmap address of STATUS line, you should use the next LPB (LPT line) (if it has a right address, or you can set up your own character map address), and you should set the same charmap address of the following LPB's in this case you can see the same result in each line.
Title: Re: Snake 256byte
Post by: g0blinish on 2017.April.24. 14:19:11
same picture:
Code: [Select]
ld      hl,($bff4)


ld de,16+4
add hl,de
;

ld e,(hl)
inc hl
ld d,(hl)

;
ld b,0

ld a,$FF
out ($B3),a
mm:
ld a,b
ld (de),a
inc de
inc b
jr nz,mm
Title: Re: Snake 256byte
Post by: geco on 2017.April.24. 14:35:14
same picture:
Not the same :) now your characters were displayed in the 2nd line by green colour, if you set next LPT rows with the same charmap address, then each row will show the same characters, if your plan is to display all defined characters then probably the charmap address of 3rd LPT row is not continuation of 2nd LPT row, you can setup your addresses into LPT, or check address of next LPT line if the 1st row is flled with characters, and continue printing to that address.