English Amiga Board


Go Back   English Amiga Board > Other Projects > project.WHDLoad

 
 
Thread Tools
Old 08 May 2024, 16:53   #21
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 2,002
You made something wrong.
Every Amiga library has own LVOs.
Errors 23 showed in your post are LVOs from exec library, not from graphics library.
Don_Adan is offline  
Old 08 May 2024, 21:29   #22
field3d
Registered User
 
Join Date: Feb 2019
Location: USA/Texas
Posts: 36
More information

I have like this the code:

HTML Code:
PROGNAME = ZenerDrive
HDBASE = C:/whdloadde
WHDBASE = $(HDBASE)/WHDLoad
WHDLOADER = $(PROGNAME).slave
SOURCE = $(PROGNAME).s
CONFIG= C:/whdloadde/testswhdload.uae
#CONFIG=whdload-test-jit.uae

all : $(WHDLOADER)

$(WHDLOADER) : $(SOURCE) Makefile
	date > datetime
	"C:/whdloadde/vasmm68k_mot.exe" -pic -x -DDATETIME -I$(HDBASE)/includes/NDK_3.9/Include/include_i -I$(WHDBASE)/Include  -I$(HDBASE)/includes -I$(WHDBASE) -I$(WHDBASE)/Src/sources -nosym -Fhunkexe -o $(WHDLOADER) $(SOURCE)

test: $(WHDLOADER)
	cp $(WHDLOADER) ..
	cmd /c start “C:/Program Files (x86)/Cloanto/Amiga Forever/WinUAE/WinUAE64.exe” -config=$(CONFIG) -G
I have installed the NDK 3.9 but In reality the libraries that are not present in the NDK 3.9 are:

INCLUDE lvo/dos.i
INCLUDE lvo/exec.i
INCLUDE lvo/graphics.i

The dos.i and exec.i I could find find from other places but these are the versions:

exec.i:

HTML Code:
**
**	$VER: exec.i 39.0 (15.10.1991)
**	Includes Release 45.1
**
**	Include all other Exec include files in non-overlapping order.
**
**	(C) Copyright 1985-2001 Amiga, Inc.
**	    All Rights Reserved
**
dos.i:

HTML Code:
**	$VER: dos.i 36.27 (5.4.1992)
**	Includes Release 45.1
**
**	Standard asm header for AmigaDOS
**
**	(C) Copyright 1985-2001 Amiga, Inc.
**	    All Rights Reserved
**
graphics.i I couldn’t find in any place then I renamed the graphics_lib.i to graphics.i but I think that is wrong because it doesn’t seems for that purpose it starts as:

HTML Code:
* Automatically generated header (sfdc 1.11)! Do not edit!
     IFND  LVO_GRAPHICS_LIB_I
LVO_GRAPHICS_LIB_I   SET   1

_LVOBltBitMap     EQU   -30
_LVOBltTemplate     EQU   -36
_LVOClearEOL     EQU   -42
It doesn’t shows header nothing that is why I mention I still miss the graphics.i that is required for that kick13.s.

I don’t think is something apparently as the ‘make’ runs very good in the cygwin. Is there a way to have that 3 lvo libraries to be sure everything is fine?

INCLUDE lvo/dos.i
INCLUDE lvo/exec.i
INCLUDE lvo/graphics.i

As I said graphics.i with such name is impossible find and rename the other one it doesn’t looks normal or with a header.

What can be done here?
field3d is offline  
Old 08 May 2024, 22:27   #23
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,302
graphics.i is missing the "ENDC" directive (unless you truncated the paste). Use my files from the zone!
jotd is offline  
Old 08 May 2024, 22:33   #24
field3d
Registered User
 
Join Date: Feb 2019
Location: USA/Texas
Posts: 36
Quote:
Originally Posted by jotd View Post
graphics.i is missing the "ENDC" directive (unless you truncated the paste). Use my files from the zone!
Thank you jotd. The files worked like a charm the compilation went perfectly without any error. That libraries were the issue.

Just one thing I detected the cygwin previous to the library errors I just changed as you see in the script from the \ to / and worked very good.

One thing just to know I saw there these libraries request:

incdir gore:asm/include/
include goredesign.i

Where are included that ones?
field3d is offline  
Old 08 May 2024, 22:53   #25
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,302
Those are specific includes from a now retired whdload coder.

I have source for most released whdload slaves but I don't even have those. They possibly define stuff or macros that can be replaced. Try not including goredesign.i see what happens.

At worst, I have a whdload resourcer tool which can rebuild/partially reverse slaves where source was lost. Starting from binary .slave, the contents of the missing file can be figured out.

This cannot happen with my slaves: https://github.com/jotd666/whdload_slaves
jotd is offline  
Old 09 May 2024, 01:42   #26
field3d
Registered User
 
Join Date: Feb 2019
Location: USA/Texas
Posts: 36
I see. All is working perfect. It’s amazing remember the Assembly in Amiga. I used to do in Action Replay cartridge but now with this vasm and the WHDLoad is a boom!
field3d is offline  
Old 09 May 2024, 03:24   #27
field3d
Registered User
 
Join Date: Feb 2019
Location: USA/Texas
Posts: 36
Another thing. I’m trying to load the boot sector track 0 from DF0: to have a executable file of that boot sector. How is used? I’m using the InstallBB from WHDLoad developer that is located inside the compressed file WHDLoad/C directory.

I tried to read:

InstallBB boot UNIT/0/0

To Write

InstallBB boot UNIT/0/0 WRITE/S

Both cases there is error how you enter the command?

I’m running inside Amiga OS of course.
field3d is offline  
Old 09 May 2024, 22:24   #28
Wepl
Moderator
 
Wepl's Avatar
 
Join Date: Nov 2001
Location: Germany
Posts: 869
Quote:
Originally Posted by paraj View Post
Getting a proper setup is half the challenge YMMV, and you should adjust to fit your own needs, but I use a setup inspired by what JOTD does.
Code:
...
CONFIG=whdload-test.uae
#CONFIG=whdload-test-jit.uae
...
test: $(WHDLOADER)
	cp $(WHDLOADER) ..
	cmd /c start c:\tools\winuae\winuae64.exe -config=$(CONFIG) -G
You colud have two targets (eg test and testj). One with and one without jit. No need to adjust the Makefile to switch.

Quote:
Originally Posted by field3d View Post
I’m testing and I configured all. Appears not a problem. I just have an issue. I see the demo you mention ZenerDrive the WHDLoad asks lvo/dos.i also lvo/graphics.i I have the NDK 3.9 for amiga and it doesn’t comes there the lvo/dos.i and lvo/graphics.i where can I download that libraries or the full NDK complete? I see that dos.i is inside dos directory lvo/graphics.i I can’t find. Where can I download that NDK include libraries?
The NDK never provided include files for the LVOs (library value offsets). The CBM intended way was to use the linker to let resolve them. E.g. to have ' XDEF _LVOOpenLibrary' in your source and then link against amiga.lib. Usual assembler coder on the Amiga don't like to link, instead let the assembler directly create an Amiga load program. This is faster and simpler for small stuff. So all the Assembler packackes included a variant of include files for the LVOs. But they used different naming schemes and different sub directories for them. Therefore a uniform standard is missing. The information for the LVOs is contained in the FD-files in the NDK (directory fd). Using the tool https://aminet.net/package/dev/misc/fd2pragma the include files can be created from the fd-files. Just use the files provided by JOTD
Or use these: https://whdload.de/whdload/lvo.lha

Quote:
Originally Posted by field3d View Post
One thing just to know I saw there these libraries request:

incdir gore:asm/include/
include goredesign.i

Where are included that ones?
As JOTD already wrote this is an include file by DarkAngel. I have the sources from him but not this include file. Anyway, it only contains some macros which are self-explanatory. Just remove the include and replace the macros if there are some.

Quote:
Originally Posted by field3d View Post
Another thing. I’m trying to load the boot sector track 0 from DF0: to have a executable file of that boot sector. How is used? I’m using the InstallBB from WHDLoad developer that is located inside the compressed file WHDLoad/C directory.
to read the bb from df0: to file 'boot':
Code:
installbb boot
to write:
Code:
installbb boot write
Wepl is offline  
Old 10 May 2024, 02:36   #29
field3d
Registered User
 
Join Date: Feb 2019
Location: USA/Texas
Posts: 36
Oh @Wepl wonderful about the pragma. I will try in a free time. Now I see is very interesting the deep it is to program assembly language from PC just like that and that runs in Amiga amazing. If we had that tools in that times we would be something as extraterrestrials.

The issue of the boot sector. That boot sector really is executable in AMIGA OS? I mention because I have some of my releases that I protected in the old times on some of my releases, for example in the boot sector I entered routines that are needed to preserve and if are removed some detection of characters in screen, instructions, checksums, etc. it will not properly continue executing in the workbench other things, if they are not present there is a crash. Then it has several years I developed that and I’m trying to remember what I did but in my figuration would be good have the boot sector running as an executable in the first place to run then continue with other routines in the Workbench from the other executables, I just need that boot sector files execute before the other files and like I have instructions there in the boot sector to continue with the mouse, etc. there is not a problem to put before the other executables but it’s important I run the boot block because of that.
field3d is offline  
Old 10 May 2024, 10:40   #30
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,302
no, amigados bootblock is not executable. IIRC the boot checksum must be correct for it to make bootable (install does that). Just emulate that with kickemu and DISKSONBOOT, and use the _bootblock callback, make sure it returns 0 (not sure of that) so it keeps on booting.

in the _bootblock call you can set the variables you want then give back control to the virtual OS to boot your disk.
jotd is offline  
Old 11 May 2024, 05:30   #31
field3d
Registered User
 
Join Date: Feb 2019
Location: USA/Texas
Posts: 36
Quote:
Originally Posted by jotd View Post
no, amigados bootblock is not executable. IIRC the boot checksum must be correct for it to make bootable (install does that). Just emulate that with kickemu and DISKSONBOOT, and use the _bootblock callback, make sure it returns 0 (not sure of that) so it keeps on booting.

in the _bootblock call you can set the variables you want then give back control to the virtual OS to boot your disk.
Very interesting. Is there a manual or page with examples of the use of this? I will take a look on this. Thank you for the tip
field3d is offline  
Old 12 May 2024, 01:30   #32
paraj
Registered User
 
paraj's Avatar
 
Join Date: Feb 2017
Location: Denmark
Posts: 1,145
Quote:
Originally Posted by Wepl View Post
You colud have two targets (eg test and testj). One with and one without jit. No need to adjust the Makefile to switch.
Ah yeah, you're right of course. Don't know why I haven't done that, but then again I don't usually switch that much between jit and non-jit (usually I'm changing other stuff like custom flags/stuff in code as well).

Quote:
Originally Posted by field3d View Post
Very interesting. Is there a manual or page with examples of the use of this? I will take a look on this. Thank you for the tip
Check out JOTD's archive of whdload slaves at https://github.com/jotd666/whdload_slaves and I'm sure there are plenty of examples, but that's probably not the way you want to approach it.

IMO you want to be mostly thinking about what *needs* to be patched, and go from there, and only later think about improvements.

If you have a disk with a custom boot block that does stuff, later loads startup-sequence and continues normally, just try to use the generic kick13 slave and see where it falls over (i.e. first let everything play out). Then analyze and think about what steps need to be take to make it work. If the boot block does something that's incompatible with whdload (like directly reading from the disk or modifying interrupts via VBR) it needs to be patched, but if it's doing more benign stuff, you may be able to leave it alone.

All of the conditional assembly in the generic kick slaves are just there to give you hooks into the loading process so you can patch problematic parts (or insert later hooks). You want to (initially) strive to patch as little as possible.
paraj is offline  
Old 13 May 2024, 06:44   #33
field3d
Registered User
 
Join Date: Feb 2019
Location: USA/Texas
Posts: 36
@paraj and @jotd Very good information. Yes I think I have an idea now how it works. It’s a passion the Amiga OS. It Amazes me that the assembly language despite the years still strong. I use a little Assembly Language in PC and yes there are things but the Amiga OS it was really strong. I never understood the bankruptcy but thing happen. I will study more other codes and to apply the boot clocks as I see also WHDLoad is such strong that has some strong features that by itself can fix a lot of things.

Now I have some simple maybe fool questions. I’m crafting some routines to test and they are running fine and is just wan to know if in WHDLoad exists:

1.-For example. Put a breakpoint or make a stop where I mark ‘I want break point here’. The code is fictitious but is just to illustrate, is not specific of a Game or something is just to understand how to enter this and track values.

PLINTRO
PL_START
PL_PS $ffff,SetStack
PL_PSS $fffff,xxxx,1

I want break point here

PL_B $ffff,$ff
PL_SA $ffff,$ffff

PL_PSS $ffff,
PL_END

I tried to do enter in that line loop: jmp loop or:

loop:
jmp loop

And the errors to compile are undefined.

2.-Is there a way to print D0 or any register in the screen in the AMIGA OS? I just want to know. I don’t;t have any troubles with this because I can use a cartridge and see the registers at that moment or memory. But if there is something to send the variable, sometimes you see the CLI loading and other windows and maybe print there.

3.-I heard there is a debug option in the slaves codes, how you activate it? And is there a list of features you can make, as for example, breakpoints, see registers, etc.?
field3d is offline  
Old 13 May 2024, 08:33   #34
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,302
1. I never used breakpoints, I usually used "blitz" macro, then I break with debugger. With WinUAE you can call some code to call winuae debugger (some fake address in $FF0062)

"And the errors to compile are undefined.": huh? can you be maybe clearer?

2. No. What I usually do is to put a memory watchpoint on, say $100 (rarely used) and write the value of D0 there. WinUAE can print things in the WinUAE debugger console, but I never got that to work.

3. you mean "DEBUG" macro in kickemu. It enables more checks on kickstart, specially amigaDOS part. For instance if an assign can't be performed, the slave breaks. Kind of "assert".
jotd is offline  
Old 13 May 2024, 17:47   #35
field3d
Registered User
 
Join Date: Feb 2019
Location: USA/Texas
Posts: 36
Quote:
Originally Posted by jotd View Post
1. I never used breakpoints, I usually used "blitz" macro, then I break with debugger. With WinUAE you can call some code to call winuae debugger (some fake address in $FF0062)

"And the errors to compile are undefined.": huh? can you be maybe clearer?

2. No. What I usually do is to put a memory watchpoint on, say $100 (rarely used) and write the value of D0 there. WinUAE can print things in the WinUAE debugger console, but I never got that to work.

3. you mean "DEBUG" macro in kickemu. It enables more checks on kickstart, specially amigaDOS part. For instance if an assign can't be performed, the slave breaks. Kind of "assert".
Oh I see whats happen that loop can’t be inside some elements I think is now ok. I will try Blitz. Sometimes I use the Action Replay or Similar Cartridge as the hrtmon to solve the problem.

Now for example I think my last question. I see in patches some examples this for example:

lea (_pl,pc),a0 ;patch list
lea ($10000),a1 ;destination
move.l (_resload,pc),a2
jsr (resload_Patch,a2)

Using the previous destination and guessing this fictional patches:

PL_B $3500,$44
PL_S $696,8
PL_SA $696,$705

Exactly:

1.-PL_B - In what exact memory position writes the value of $44?
2.-PL_S - Skip 8 bytes from what exact memory position?
3.-PL_SA - What it does exactly this? It stores the skipped position from pot 2 ‘PL_S’ or what it does and if writes something in what exact memory position.
field3d is offline  
Old 13 May 2024, 18:28   #36
paraj
Registered User
 
paraj's Avatar
 
Join Date: Feb 2017
Location: Denmark
Posts: 1,145
In addition to what jotd mentioned, I will often also add a "tst.b $100.w" and then break in WinUAE when address $100 is read, but that's really only necessary inside slave, as you can just break on the real address inside the game. Now for the latter part it can be an issue for games that use EXPMEM - i.e. it will be different between configurations, and you can't correlate it with classic 512k+512k setup. That's why it's often useful to have a "CHIPONLY" configuration that uses only chipmem, that way you can be sure the addresses in the game are fixed, and with a little bit of tweaking match it with a true 1MB chip setup.

Sometimes I also find it useful to log stuff to a file with resload_Log (add FILELOG LogBuffer=100000 on the command line). Especially when I need to check it on real HW. http://www.whdload.de/demos/TBL_Eon.lha has an example of doing that (PRINTF macro) as well as the WinUAE control stuff JOTD mentioned.

For your questions: The address are relative to the start of the destination when using resload_Patch, so PL_B $3500,$44 changes the byte at $13500 to $44.
PL_S $696,8 skips to $1069e
PL_SA isn't standard, but a common macro, it's "skip absolute" so would skip to $10705 here.

Note that when you use resload_PatchSeg the destination address are in "IRA" (the disassembler) format, which is very convenient.
paraj is offline  
Old 13 May 2024, 22:26   #37
Wepl
Moderator
 
Wepl's Avatar
 
Join Date: Nov 2001
Location: Germany
Posts: 869
If you want to enter a monitor at a specific address of the code you patch via resload_Patch/Seg you also have these two commands:

PL_BKPT off
lets WHDload write an ILLEGAL ($4afc) to destination+offset and saving the original contents, when the ILLEGAL is executed the original contents is restored, a NMI stackframe is created and the detected freezer called, if there is no freezer nothing will be done, the VBR should be moved by WHDLoad to allow catching the illegal instruction exception (breakpoint)

PL_BELL off,tim
similar to PL_BKPT but instead of entering a freezer a color cycle will be shown for the given time or LMB pressed, time is given in 1/10s (ring the bell)

(https://whdload.de/docs/autodoc.html#resload_Patch)

PL_BKPT will enter the monitor when PC reaches the address you specified. This requires a monitor detected by WHDLoad (eg. hrtmon).

With PL_BELL you a get a color cycle and can for example enter the WinUAE debugger at this point.

Logging can be done via resload_Log or winuaelog. You need to inject the code for this somehow. E.g. by patching the program.
For resload_Log there is also a LOG macro in whdmacros.i which can be used to log from your slave code.

It all depends a bit on if you are working with WinUAE or real hw.
Wepl is offline  
Old 14 May 2024, 00:28   #38
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,302
When i debug kickemu games, I often use CHIPONLY with a properly calibrated AllocMem before loading the segments, so the first segment (if we're lucky there aren't a lot of different segments) is loaded in $20000 and it matches IRA offsets. Much easier to follow the code.

Without calibrated AllocMem, exe usually loads around $1Dxxx something, so not as convenient.
jotd is offline  
Old 14 May 2024, 12:01   #39
Wepl
Moderator
 
Wepl's Avatar
 
Join Date: Nov 2001
Location: Germany
Posts: 869
For kickemu stuff I like to recommend setting SEGTRACKER in the Slave source.
WHDLoad will then report on all exceptions the name of the binary together with the (relocated) offset. The offset is then the same as when loaded into ReSource or disassembled with IRA.
Using resload_PatchSeg you can set breakpoints (PLBKPT) or asserts (PL_I).
Wepl is offline  
Old 15 May 2024, 00:02   #40
copse
Registered User
 
Join Date: Jul 2009
Location: Lala Land
Posts: 537
Is there a resource that will let one get set up in using whdload for patches avoiding the problems above? There was some thought expressed to creating an hdf for instance to streamline the process, but that was dismissed due to it requiring on device assembly using barfly.
copse is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASM: Asm-ONE or AsmPro - how to set a Hello amiga coders, I hope it is ok to hijack ? Fireball Coders. Asm / Hardware 3 08 May 2024 13:35
Tool to convert asm to gnu asm (gas) Asman Coders. Asm / Hardware 13 30 December 2020 11:57
Help with compile JimDrew Coders. Language 23 30 October 2014 22:42
Trying to compile some ASM in StormC V4 NovaCoder Coders. General 2 29 September 2009 01:44
WHDload ASM Slave Retro1234 Coders. General 21 27 October 2008 13:20

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:19.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.11640 seconds with 15 queries