A computer components & hardware forum. HardwareBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » HardwareBanter forum » Video Cards » Nvidia Videocards
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Skybuck's Open Source Project: Mario for TP7 and Delphi (10.2)



 
 
Thread Tools Display Modes
  #1  
Old February 4th 20, 07:46 PM posted to alt.comp.periphs.videocards.nvidia
[email protected]
external usenet poster
 
Posts: 533
Default Skybuck's Open Source Project: Mario for TP7 and Delphi (10.2)

I have decided not to use github/git for now, it's too complex for such a simple project and I want to use my own manual versioning system and I want everybody that knows how to use a webbrowser and zip/winrar to be able to participate and keep things efficient. I consider git very bug prone and inefficient for now.

So I have decided to upload the sources I have so far, not all of them and not all information yet, but the most important parts that allow you to get started.

To my webdrive to keep it simple for now.

http://www.skybuck.org/Source/Pascal/Games/Mario/

There are two files

MarioTP7.zip
MarioDelphi.zip

The first one is newer and it's source code was created/modified yesterday by using turbo pascal 7 and it compiles with turbo pascal 7.01 and error 200 fixes applied to crt units, using ultra bp7 distro found on internet, search this thread for that link.

MarioTP7 v0003 is capable of running inside TP7 and can be debugged.
Comments have be added be me during reverse engineering attempt to discover functionality and usage of vga/asm functions and such. This is usefull information in this source.

MarioDelphi.zip contains a little bit older source, was not based on MarioTP7.
And this source version compiles in Delphi latest versions like 10.2 and such.

Units have been renamed to avoid conflicts, data files have be moved to other location to keep source tree clean.

Modified Source
Modified Data (this folder contains a bit misleading description, decided not to rename files to .inc but just keep it as it is for now).

Both projects/zips are usefull for examing mario in it's original form and to see how Delphi handles it.

The delphi version contains different "branches".

NON-VCL
VCL
OpenGL


For now I consider the NON-VCL branch best, it can display some graphics.
VCL branch is little bit less good and too complex with windows form and such.
OpenGL I consider a failed branch cause I forgot how to use opengl rendering contexes properly and it creates a opengl thread and that creates issues with mario... mario should run in a thread, but if opengl and mario run in different threads running gets difficult.

So for now OpenGL branch is considered a fail, might be solved/fixed later.

The main branch is the version 0.01 to version 0.10.

It simply contains the original source code/units/renamed units and has as little changes as possible to compile it in Delphi. All ASM is disabled, except the db stuff, and some of that was changed to dw or dq to match bigger pointer sizes.

For now I do consider version 0.10 and v0003 and non-vcl versions usefull for those that want to give it a try and experiment with it.

You may have to set the modified data path in search path or re-add it to project file so that delphi can find the data/includes and such.

Good luck, let me know if you tried it and what issues you may have run into !

This might be my first true open source project where I will expect some contributions from others if necessary.

Bye for now,
Skybuck.
  #2  
Old February 6th 20, 03:32 AM posted to alt.comp.periphs.videocards.nvidia
[email protected]
external usenet poster
 
Posts: 533
Default Skybuck's Open Source Project: Mario for TP7 and Delphi (10.2)

Thu, 06 Feb 2020 02:14:57 +0000

New Turbo Pascal 7 mario source code (and exe) distribution available:

http://www.skybuck.org/Source/Pascal/Games/Mario/

MarioTP7v2.zip

Direct link:

http://www.skybuck.org/Source/Pascal...MarioTP7v2.zip

Today I worked some more in Turbo Pascal 7 version to reduce it's complexity. I also wrote some test programs to text vga256.pas and x-mode. I did discover something amazing about my monitor with test4.pas. It has slow response time when red, green and blue pixels are scrolled. I will try later on laptop and crt monitor to see if these monitors have same issue.

I branched into 3 different branches:

vXXXX is original source with some modifications to make it debuggable in
TP7, basically levels 2 to 6 disabled so it will fit into memory.

rXXXX is reduced source where menu/macros/txt/intro/config/command line/joystick/status/score counter/multi player and such has been removed to reduce complexity.

pXXXX is pascal source where ASM is to be replaced with Pascal code to make
it easier to port later to for example Delphi. (Currently DrawImage is not decoding the bitmaps correctly in pascal code so some help with this would be great, alternatively data bitmaps could be loaded instead of ASM bitmaps, but I am kinda keen on trying to understand the ASM format of these bitmap includes...).

There was also a little problem with the delphi project. Some TWindow unit was missing, but this unit can be safely removed from the project, it's not necessary.

For now no new Delphi distribution.

Some tips for people wanting to participate or want to understand how this versioning and branching and uploading is done:

1. v0001 to v0004 was the first versions/branch.

2. R0004 to R0007 was based on v0004.

3. P0007 was based on R0007.

Versioning and Branching works as follows in ms-dos:

xcopy source dest

Where source is the folder to use as "base".

Where dest is new folder to copy too.

When xcopy asks file or folder choose "d" for directory, this will create a new folder.

There is one little problem with this versioning maybe. If I would continue v0004 to v0007 or so tracking might be lost which was based on which but I don't mind that much. This is documented inside the RMario and PMario.pas for their branch. RMARIO.pas in rXXXX branch. PMario in pXXXX branch.

It's unlikely that r branch will be re-integrated with v or p branch.
It's also unlikely that p branch will be re-integrated with v branch.

If it does happen then it might not be an issue if there is no versioning conflict or overlap for example, though since P is based on reduced branch it's unlikely.

However I might copy some code from the other branches back into the v branch, for example if asm is turned into pascal code. That would be nice.

Later also some Delphi code might be integrated into it, not sure yet though.
Perhaps in future there will be a dBranch or so.

Uploading is done as follows:

1. Create upload folder on your main drive.

2. Mount virtual disk with vmware or virtual box.

3. Create a zip/rar in upload file.

4. Add source code files from mario to this new zip/rar.

Upload zip/rar file to a drive somewhere or send it to me:

skybuck
2000
@
hotmail
..
com

^ Attached it together.

What I am looking for from you:

1. Pseudo code of what the assembler does.
and/or
2. A description of what the assembler does.
and/or
3. How the bitmaps are stored in ASM routines, it's format ?
and/or
4. A description of how the scrolling is done in combination with x-mode and drawing.
and/or
5. Anything else that is off interest. Perhaps push/pop graphics though I think I have an idea what it does. Also how the music is played is also kinda interesting, not yet sure how that is done without freezing the game.

Bye for now,
Skybuck.
  #3  
Old February 6th 20, 03:33 AM posted to alt.comp.periphs.videocards.nvidia
[email protected]
external usenet poster
 
Posts: 533
Default Skybuck's Open Source Project: Mario for TP7 and Delphi (10.2)

Would be nice if somebody could convert this ASM into some C or Pascal source code, or some pseudo code to explain/describe it's functionality/behaviour:

(This code may be x-mode related and somehow decodes the ASM bitmap below):

Here is a somewhat reduced example and also an example of the ASM bitmap:

Here is the code I need help with understanding:

const
VGA_SEGMENT = $A000;

VIR_SCREEN_WIDTH = SCREEN_WIDTH + 2 * 20;
VIR_SCREEN_HEIGHT = 182;

BYTES_PER_LINE = VIR_SCREEN_WIDTH div 4;

MAP_MASK = 2;

SC_INDEX = $03C4;

var
PageOffset: Word = 0;

procedure DrawImage (XPos, YPos, Width, Height: Integer; var BitMap);
{ Draw an image on the screen (NULL-bytes are ignored) }
begin
asm
push ds

mov ax, VGA_SEGMENT
mov es, ax

mov ax, YPos
cmp ax, VIR_SCREEN_HEIGHT
jb @NotNeg
jg @End
mov bx, ax
add bx, Height
jnc @End
@NotNeg:
mov bx, BYTES_PER_LINE
mul bx
mov di, XPos
mov bx, di
shr di, 1
shr di, 1
add di, ax { DI = (YPos * 80) + XPos / 4 }
add di, PageOffset

lds si, BitMap { Point to bitmap }

and bl, 3
mov cl, bl
mov ah, 1
shl ah, cl
sub bl, 4
mov cx, 4 { 4 planes }

@Plane:
push bx
push cx { Planes to go }
push ax { Mask in AH }

mov al, MAP_MASK
mov dx, SC_INDEX
out dx, ax

cld
push di
mov bx, Width
shr bx, 1
shr bx, 1
mov ax, BYTES_PER_LINE
sub ax, bx { Space before next line }
mov dx, Height
@Line:
mov cx, bx
shr cx, 1

push ax
pushf

@Pixel:
lodsw
or al, al
jz @Skip1
seges
mov [di], al
@Skip1:
inc di
or ah, ah
jz @Skip2
seges
mov [di], ah
@Skip2:
inc di
loop @Pixel

popf
rcl cx, 1
jcxz @Skip3

lodsb
or al, al
jz @Odd
stosb
jmp @Skip3
@Odd: inc di
@Skip3:
pop ax
add di, ax
dec dx
jnz @Line

pop di

pop ax
mov al, ah
mov cl, 4
shl al, cl
or ah, al { Mask for next byte }
rol ah, 1 { Bit mask for next plane }
pop cx { Planes }
pop bx
inc bl { Still in the same byte? }
adc di, 0
loop @Plane

@End:
pop ds
end;
end;

{ Example of ASM bitmap enemy }

procedure GRKOOPA000; assembler;
asm
db 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 31, 0, 0, 0
db 0, 31, 16, 0, 0, 0, 31, 81, 0, 0, 0, 31, 77, 0, 0
db 0, 31, 78, 0, 0, 0, 31, 78, 0, 0, 16,127, 53, 0, 0
db 16, 78, 83, 17, 17, 16, 53, 74,113,112, 16, 73,104,116,115
db 16, 16,104,115,114, 0, 16, 28,129,129, 0, 83, 30,115,114
db 0, 76, 30,128,112, 0, 16, 30,114,113, 0, 16,111,114,113
db 0, 0,135, 18, 96, 0, 0,130, 26, 26, 0, 0, 16,134,134
db 0, 16, 76,120,120, 0, 29, 83, 0, 76, 0, 16, 16, 0, 16
db 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 31, 0, 0, 0
db 0, 31, 0, 0, 0, 16, 31, 16, 0, 0, 16, 31, 76, 0, 0
db 16, 31, 77, 0, 0, 18,127, 77, 0, 0, 84, 78, 75, 0, 0
db 84, 78, 16,128, 0, 83, 74, 25,114,112, 76, 16, 31,116,113
db 76, 81, 31,129,115, 18, 83, 20,118,112, 0, 77, 16,117,113
db 0, 77, 16,115,112, 0, 83, 16,112,114, 0, 74, 23,114,114
db 0, 0, 31, 16, 18, 0, 0,134, 26, 26, 0, 16,128,134,134
db 0, 76, 76,120,120, 0, 77, 83, 17,132, 0, 16, 16, 0, 16
db 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 16, 20, 0, 0, 0
db 23, 20, 0, 0, 0, 18, 20, 0, 0, 0, 17, 20, 17, 0, 0
db 17,125, 17, 0, 0, 25,133, 17, 0, 0, 78, 78, 17, 0, 0
db 77, 78, 0,128, 0, 78, 76,104,118, 0, 78, 81,104,129, 16
db 78, 76,104,117,113, 74, 74,113,119,114, 0, 73, 96,119, 96
db 0, 73,114,116,114, 0, 73,114,113,114, 0, 18,113,112,112
db 0, 16,104,112, 16, 0, 16, 27, 26, 26, 0, 74,134,134, 55
db 0, 77,120,120, 19, 0, 77, 17, 76, 28, 0, 16, 0, 16, 16
db 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 22, 19, 0, 0, 0
db 28, 16, 0, 0, 0, 25,120, 0, 0, 0, 22, 73, 0, 0, 0
db 23, 77, 0, 0, 0,135, 53, 0, 0, 0, 76, 78, 0, 0, 0
db 74, 53, 0,112, 0, 78, 76,128,113, 0, 77, 81,114,130, 0
db 83, 81,114,129, 16, 83, 23,112,118, 16, 17, 23,113,117, 16
db 17, 23,128,114, 16, 0, 23,115,112, 16, 0, 23,113,112, 16
db 0,122, 96, 16, 0, 0, 18, 26, 26, 16, 0, 74,134,134, 16
db 0, 77,120,120, 0,104, 83, 0, 76, 16, 16, 16, 0, 16, 16
end;

Bye,
Skybuck.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Skybuck's Universal Code 4,Delphi Demonstration Program Skybuck Flying Asus Motherboards 8 May 28th 07 11:30 PM
Skybuck's Universal Code 4,Delphi Demonstration Program Skybuck Flying Nvidia Videocards 8 May 28th 07 11:30 PM
[OT] Open source wars Robert Myers General 4 June 16th 05 03:07 PM
Open source BIOS project Yousuf Khan General 22 January 5th 04 10:16 PM
Open source BIOS project Yousuf Khan Intel 20 January 5th 04 10:16 PM


All times are GMT +1. The time now is 12:03 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 HardwareBanter.
The comments are property of their posters.