Author Topic: HUC - huc_misc.asm file check  (Read 1454 times)

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
HUC - huc_misc.asm file check
« on: August 12, 2013, 08:52:15 AM »
Can you guys check your huc_misc.asm file, under the lib2_farmemget.3: label?

Does it read as this?
Code: [Select]
lib2_farmemget.3:

__stw <_cx
 lda <__fbank
 tam #3

 I downloaded a few packages from huc's site and they all have the same error in the lib file.

TheOldMan

  • Hero Member
  • *****
  • Posts: 958
Re: HUC - huc_misc.asm file check
« Reply #1 on: August 12, 2013, 03:19:27 PM »
That's what I have in my huc_misc.asm file.

touko

  • Hero Member
  • *****
  • Posts: 953
Re: HUC - huc_misc.asm file check
« Reply #2 on: August 12, 2013, 09:50:12 PM »
Me too .

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: HUC - huc_misc.asm file check
« Reply #3 on: August 13, 2013, 04:31:54 AM »
Me three. 

Are you saying this is an error? lol
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
Re: HUC - huc_misc.asm file check
« Reply #4 on: August 14, 2013, 07:09:50 AM »
Yeah, I pretty sure there's supposed to be a stz <_dl and stz <_dh, right after __stw <_cx. I was given a piece of code for huc that required this, that was written by David Michael that's newer than the last HuC official build. Without this, the function would crash on me (i.e. it was called with left over variables in _dl and _dh).

Should be:
Code: [Select]
lib2_farmemget.3:

__stw <_cx
  stz <_dl
  stz <_dh
  lda <__fbank
  tam #3

 Not sure if farmemget() is listed in the doc or not; there were a few functions that somehow didn't get mentioned in the official doc.

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: HUC - huc_misc.asm file check
« Reply #5 on: August 14, 2013, 07:20:33 AM »
I know how they didn't get mentioned.   General carelessness.  I recall reading somewhere, Zeograd ( I think ) flatout said he was too lazy/tired to do documentation, lol.


Maybe it's time HuC finally gets an actual update, like what was supposed to have happened back before I even had 2 lines of Insanity written?
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

touko

  • Hero Member
  • *****
  • Posts: 953
Re: HUC - huc_misc.asm file check
« Reply #6 on: August 14, 2013, 07:24:48 AM »
I just checked the function, and indeed in some cases it may not work correctly.

Code: [Select]
.t1:  lda <__fptr
 add <_cl
 sta <_al
 lda <__fptr+1
 and #$1F
 adc <_ch
 sta <_ah

cmp #$20  ; if this occur _dx is not initialised
 blo .t2

 ; -- calculate second-half size
 and #$1F
 sta <_dh
 lda <_al
 sta <_dl
 subw <_dx,<_cx
 ; -- remap src ptr
.t2:  lda <__fptr+1
 and #$1F
 ora #$60
 sta <__fptr+1

If code jump to .t2 _dx contains random values,and function may not work properly.

TheOldMan

  • Hero Member
  • *****
  • Posts: 958
Re: HUC - huc_misc.asm file check
« Reply #7 on: August 14, 2013, 01:46:58 PM »
so, let's see if I understand this right..

If you call farmemget() to copy <8k, and it's all in one page (so _dx doesn't get set), when the first part of the (split) copy is done, it will try to copy a random number of bytes (since _dx != 0) from the next page anyway?
wow.

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
Re: HUC - huc_misc.asm file check
« Reply #8 on: August 14, 2013, 02:21:17 PM »
Yeah if the copy length is less than 8k, then it doesn't set or clear _dx (_dl / _dh).


 Arguments for farmemget:

; farmemget(void *dst, far void *base, int len)

"fastcall farmemget(word bx, farptr _fbank:_fptr, word acc)"




A:X hold LEN which gets copied to _CX at the start of the routine. _BX is already written by the fastcall handler. And _fbank:_fptr isn't _DX ($20fe/ff). So it's not like it's a missing parameter or such causing the problem (though huc has special labels for dealing with argument overloading). _DX is a temp 'reg' that didn't get initialized by the start of the function.
« Last Edit: August 14, 2013, 02:23:05 PM by Bonknuts »

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
Re: HUC - huc_misc.asm file check
« Reply #9 on: August 16, 2013, 02:09:33 PM »
Maybe it's time HuC finally gets an actual update, like what was supposed to have happened back before I even had 2 lines of Insanity written?

 Why not? No one is EVER going to update that fork on Zeograd's page. Might as well start our own?

TheOldMan

  • Hero Member
  • *****
  • Posts: 958
Re: HUC - huc_misc.asm file check
« Reply #10 on: August 16, 2013, 04:32:36 PM »
Not with the state the HuC code is in. It would take 6 months just to get the current bugs out, and the code in a state where things could be added.

With that said, Arkhan might (or might not) have a version that accepts c++ comments (//) and a command-line arguement to set the file paths. Others have done similar fixes. Might be worth just trying to get those all together.

spenoza

  • Hero Member
  • *****
  • Posts: 2751
Re: HUC - huc_misc.asm file check
« Reply #11 on: August 17, 2013, 04:14:01 AM »
It would take 6 months just to get the current bugs out, and the code in a state where things could be added.

Better to start sooner than later, then. Improving the tools can only improve the quality and number of games made.
<a href="http://www.pcedaisakusen.net/2/34/103/show-collection.htm" class="bbc_link" target="_blank">My meager PC Engine Collection so far.</a><br><a href="https://www.pcenginefx.com/forums/" class="bbc_link" target="_blank">PC Engine Software Bible</a><br><a href="http://www.racketboy.com/forum/" c

touko

  • Hero Member
  • *****
  • Posts: 953
Re: HUC - huc_misc.asm file check
« Reply #12 on: August 17, 2013, 04:53:13 AM »
Better to start sooner than later, then. Improving the tools can only improve the quality and number of games made.
Yes but Better to start later than never ;-)

dshadoff

  • Full Member
  • ***
  • Posts: 175
Re: HUC - huc_misc.asm file check
« Reply #13 on: September 15, 2013, 03:26:08 AM »
A few things that don't get listed in the documentation are actually omitted because they are not really compatible with the rest of the system.

I don't think that farmemget is one of them, but there were some graphics functions which were basically macros... they didn't get mentioned because they were written in a fast and loose way for demonstration purposes; unfortunately, they messed with registers which aren't supposed to get touched in-between instructions, which had soime bizarre side-effects on otherwise working code.

nodtveidt

  • Guest
Re: HUC - huc_misc.asm file check
« Reply #14 on: September 15, 2013, 04:09:28 AM »
I would assume that farmemget function was left out of the documentation because explaining to the layman how it works might not be very easy. cd_fade was also left out of the documentation, and the only reason I can assume for that omission is the possibility that whoever wrote the documentation might not have understood the details of its parameter.