Some pseudo-code I want to convert to an assembleable 16bit ASM file for M/NASM

Started by H126, October 30, 2008, 12:29:12 AM

Previous topic - Next topic

H126

Hello, I am a new guy around here, I am making a freeware / abandonware game patch (for the old dos game ZZT) I am sure that is perfectly legal. Since the source is long-lost in the author's HD crash. The author says that he has no more interest in the DOS game/program. So it is perfectly legal.

The thing is: It is C pseudo-code, but the main purpose for this is to convert it to assembleable ASM file for use in NASM\MASM and make a TSR out of it. Since that ZZT can only be enhanced with any TSR.

The pseudo-code is here:

; Arguments: cx = character-cell X, cy = character-cell Y
; c = character code, f = foreground color, b = background color

videooffset = ((cy * 80) * 14) + cx; base address of the character cell on each plane
videobase = $A000; the start of EGA memory
characterseg = (? >> 4); where ? = the base address of your character set
characterbase = (? & $0F) + (c * 14); as above

for i = 0 to 13
  DEF SEG characterseg; or however this is represented in x86 assembly
  load A, (characterbase + i); the register names are all dummies here, use whatever works
  DEF SEG videobase; set to write to video RAM
  for j = 0 to 3
    out $3C4, 2; a bit of voodoo programming to select the plane to access, since low-level EGA documentation
    out $3C5, (1 << i); seems very hard to find
    if (f & (1 << j) != 0) and (b & (1 << j) != 0) then store $FF, (videooffset + lineoffset)
    else if (f & (1 << j) != 0) then store A, (videooffset + lineoffset)
    else if (b & (1 << j) != 0) then store (A XOR $FF), (videooffset + lineoffset)
    else store $00, (videooffset)
  next
  videooffset += 80
next

BogdanOntanu

Quote from: H126 on October 30, 2008, 12:29:12 AM
Hello, I am a new guy around here, I am making a freeware / abandonware game patch (for the old dos game ZZT) I am sure that is perfectly legal. Since the source is long-lost in the author's HD crash. The author says that he has no more interest in the DOS game/program. So it is perfectly legal.


No it is not perfectly legal. Even if the original author is no longer interested in his own product this does NOT make it legal to patch it. You must ask for his permission and you must obtain this permission in a legal way. This means in writing authenticated if possible.

No  chat, no assumption or "hopes", even email might not be enough.

Here we do not allow game patching or modifications of programs that you have not written yourself and you do not own the source code.

Please before posting again read the rules here: http://www.masm32.com/board/index.php?topic=31.0


It might be legal in some locations or you might be "right"... However we have no way to legally check this and the risk of helping people with bad intentions or to face legal problems are too big and hence the rules state that this is not acceptable.

Quote
The thing is: It is C pseudo-code, but the main purpose for this is to convert it to assembleable ASM file for use in NASM\MASM and make a TSR out of it. Since that ZZT can only be enhanced with any TSR.

The differences between NASM and MASM are too big. And nobody is going to write code for you here ...

I am locking this.. pending deletion ...

Quote
The pseudo-code is here:

; Arguments: cx = character-cell X, cy = character-cell Y
; c = character code, f = foreground color, b = background color

videooffset = ((cy * 80) * 14) + cx; base address of the character cell on each plane
videobase = $A000; the start of EGA memory
characterseg = (? >> 4); where ? = the base address of your character set
characterbase = (? & $0F) + (c * 14); as above

for i = 0 to 13
  DEF SEG characterseg; or however this is represented in x86 assembly
  load A, (characterbase + i); the register names are all dummies here, use whatever works
  DEF SEG videobase; set to write to video RAM
  for j = 0 to 3
    out $3C4, 2; a bit of voodoo programming to select the plane to access, since low-level EGA documentation
    out $3C5, (1 << i); seems very hard to find
    if (f & (1 << j) != 0) and (b & (1 << j) != 0) then store $FF, (videooffset + lineoffset)
    else if (f & (1 << j) != 0) then store A, (videooffset + lineoffset)
    else if (b & (1 << j) != 0) then store (A XOR $FF), (videooffset + lineoffset)
    else store $00, (videooffset)
  next
  videooffset += 80
next


Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro