Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Bloodwych source details  (Read 1559 times)

Bit

  • A600
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 69
Bloodwych source details
« on: January 07, 2016, 03:25:48 PM »

Trying to bring a little light into the maze of disassembly

Labellist and some explanations, beginning with the end of the code, going up.

Latest values:
0D586 data_cblitmask0 byte
0D587 data_cblitmask1 byte
0D588 data_cblitmask2 byte
0D589 data_cblitmask3 byte
0D58A BW_draw_woundflash_digit   <- edited!
0D51C BW_draw_char
« Last Edit: January 07, 2016, 11:40:47 PM by Bit »
Logged

Bit

  • A600
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 69
Re: Bloodwych source details
« Reply #1 on: January 07, 2016, 03:28:07 PM »

Note:
 Amiga label: bruceuncles' 439-disassembly
 Atari: basic offset of program start (version?): 0x14000

Memory map:

...
08992 long r/w data data_framebufferptr
...
0D51C BW_draw_char
0D586 data_cblitmask0 byte
0D587 data_cblitmask1 byte
0D588 data_cblitmask2 byte
0D589 data_cblitmask3 byte
0D58A BW_draw_woundflash
0D60C BW_blitchar
0D674 data_blitchar readonly 32 words (belongs to BW_blitchar)
0D6B4 unused code
0D6C4 BW_draw_bar
0D6E0 BW_cs_draw_frame
0D720 unused code
0D730 BW_draw_frame
0D760 BW_blit_vertical line
0D7D8 data_hline readonly 4 words (belongs to BW_blit_horizontal_line)
0D7E0 BW_blit_horizontal_line
0D8B0 BW_xy_to_offset
0D8C0-end datas only

high area:
...
188DA data_fonttable TODO: size
...
...?-05FFFF preserved for stack
60000  mainscreen (size 7D00)
67D00  framebuffer (size 7D00)
« Last Edit: January 07, 2016, 10:20:13 PM by Bit »
Logged

Bit

  • A600
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 69
Re: Bloodwych source details
« Reply #2 on: January 07, 2016, 03:29:28 PM »

---

 0D8B0  (Atari:: 216F6)

BW_xy_to_offset
  calculates an offset by given x and y to the next pixelblockdata-border to the left
  used by drawing routines to determine the location to begin with

input: D4.w = x, D5.w = y
output: D0.w

result gives an (screen)offset in bytes

for the Amiga the result is aligned to the next byteborder to the left:
  D0.w = (320 * y + x) / 8

for the Atari the result is aligned to the next pixelblock to the left:
  D0.w = V_SCREEN_BYTES_PER_LINE(160) * y + ((x / 2) & 0xf8)

---

  0D7E0  (2180A)

BW_blit_horizontal_line
  draws a horizontal line into the framebuffer

input: D4.w = x, D5.w = y, D3.hiw = width, D3.b = color

Note: substract 1 from your wanted width...

uses (exclusive) readonly data_hline (0D7D8) 4 words, Amiga only

---

  0D760 (217B6)

BW_blit_vertical line
  draws a vertical line into the framebuffer

input: D4.w = x, D5.w = y, D3.hiw = height, D3.b = color

Note: substract 1 from your wanted height...

---

  0D730 (21786)

BW_draw_frame
  draws a frame into the framebuffer

input: D4.w = x, D5.w = y, D4.hiw = width, D5.hiw = height, D3.w = color

Note: substract each 1 from your wanted width and height..

---

  0D6E0 (21736)

BW_cs_draw_frame
  draws a frame into the framebuffer - this one used during champion selection only

input: D4.w = x, D5.w = y, D4.hiw = width, D5.w = height, D3.w = color, D3hi.w length2

Note: weird parameters, it does:
  BW_blit_horizontal_line(x + 1, y, width - 2, color);
  BW_blit_horizontal_line(x + 1, y + height, length2, color);
  BW_blit_vertical_line(x, y + 1, height - 2, (i8)color);
  BW_blit_vertical_line(x + width, y + 1, length2, (i8)color);

---

  0D6C4 (2171A)

BW_draw_bar
  draws a filled bar into the framebuffer

input: D4.w = x, D5.w = y, D4.hiw = width, D5.hiw = height, D3.w = color

Note: substract each 1 from your wanted width and height..

---

  0D60C (21596, then 215A2)

BW_blitchar

input: D0.w = ascii-digit, A0.l = destination
parameter bytes: data_cblitmask0/1/2/3

Note: Amiga uses two different routines to blit a character.
This one blits the damage value into the bitmap for BW_draw_woundflash_digit, excl. subroutine for that.

---

  0D58A (21676)

BW_draw_woundflash_digit

input: D4.w = x, D5.w = y, D0.b = ascii-digit '0'-'9'

TODO: calls unexplored routine 0A9EC in the end. Some more databytes used

---

  0D51C (2159C, then 215A2)

BW_draw_char

input: D0.w = character, A0.l = destination
parameter bytes: data_cblitmask0/1/2/3

Note: Amiga uses two different routines to blit a character.
This one draws the character to the screen
« Last Edit: January 07, 2016, 11:43:07 PM by Bit »
Logged

Bit

  • A600
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 69
Re: Bloodwych source details
« Reply #3 on: January 07, 2016, 03:30:11 PM »

Datas:

data_framebufferptr long   Amiga: 08992  Atari: 22AFA
   memoryoffset of the screen you want to draw in

data_cblitmask0: byte Amiga: 0D586 Atari: 22B06
data_cblitmask1: byte Amiga: 0D587 Atari: 22B07
data_cblitmask2: byte Amiga: 0D588 Atari: 22B08
data_cblitmask3: byte Amiga: 0D589 Atari: 22B09
  four bytes to mask the character blit - this afftects the color ofc

data_blitchar 32 words Amiga: 0D674 Atari: no
  needed for BW_blitchar

data_hline 4 words Amiga: 0D7D8 Atari: no
  needed for BW_blit_horizontal_line

data_fonttable Amiga: 188DA Atari: 2CB5E TODO: size
« Last Edit: January 07, 2016, 10:23:52 PM by Bit »
Logged

Hungry Horace

  • Amorphous Blue-Blob Man
  • Site Admin
  • A4000T
  • ******
  • Karma: 305
  • Online Online
  • Posts: 3,283
  • Don't forget... Ameboid's need love too!
    • Amiga Online
Re: Bloodwych source details
« Reply #4 on: January 07, 2016, 05:10:45 PM »


...?-05FFFF preserved for stack
60000  mainscreen (size 7D00)
67D00  framebuffer (size 7D00)


edit:

Just started adding in the labels to the re-source code.

Going by your notes above.... persumably i could patch the addresses at $8992 and $8996 to $70000 and $7F000 and as a result i should be 'free' to use $60000-$6FFFF anyway?



This is interesting...  My code occurs at $593EA  .... it is added on 'directly' to the end of the exceutable.... i've also played through a lot of the game like this without any problems

are the stack / screen items relocatable, or have i just got lucky??
« Last Edit: January 07, 2016, 05:29:25 PM by Hungry Horace »
Logged
Quote from: KillerGorilla
because winuae is made of code and your amiga is made of stuff

Hungry Horace's Artwork Available
Buy my work

http://twitter.com/horaceandspider

Bit

  • A600
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 69
Re: Bloodwych source details
« Reply #5 on: January 07, 2016, 05:36:50 PM »

Leaving it unchanged, you got a distance of about 27k to the screenstart.
What will be on the stack? Let it have a depth of 50 routines (=200 byte returnadress - whereby that source saves a lot of bsr by using bra), then add two dozen packs of all long registers, pushed by movem (24 * 15 * 4 = 1440). Now perhaps such a 32 bit 3D data-structure and the link/unlk that needs it. However - you hardly will get more than 2k. That's still plenty of space for assembler routines left - especially when you call existing stuff.

edit: changing screen adresses is surely a solution (if you can manage to tell the os where those locations are)
Those two long variables are used dynamically, because they got swapped all the time - and that happens on different locations! We just have to change all of them.

You could search the disassembly for all 60000 and 67D00
I'm sure they are all hardcoded and never placed in a datatable.
 - happens i.e. some lines before 0016A, at 0041C, shortly after 03F86, some lines after 07A08, 08926, 08948, there's one 60000 after C728 - that's not a screenadress, even though it's about graphic. I think that's it - maybe give it a try in a sidebranch.
« Last Edit: January 07, 2016, 05:53:43 PM by Bit »
Logged

Bit

  • A600
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 69
Re: Bloodwych source details
« Reply #6 on: March 03, 2016, 11:19:37 PM »

Having the disassembly of the extended levels now, I better reorganize this thread. The list of functions and data-blocks will simply be too huge in the end, so an attached listing would make more sense.
There is surely no need that an informative file needs to be translatable in any language, so I took bruceuncle's disassembly and 'framed' the routines a bit in C-style. If you take this file, read it into notepad++ and then invoke the function to close all text blocks (Alt + 0), you will get the idea. The original listing is somehow kept, especially the sequence, all that got changed is commented. Just the last 3000 of 19000 lines are done now, and I did not add much comments, nor arguments. This is made now on the base of my latest Atari-version, and you will see that almost anything is kept in the same order.
Just tell me if it can be useful in the end - (which is still a lot of work).
Logged
Pages: [1]   Go Up