Skip to content

Commit

Permalink
[Maintenance] Fix the function name format of CDG/CD2 functions
Browse files Browse the repository at this point in the history
No leading underscore for functions with Pascal calling convention, but
we do have one for all variables, because it's not worth it to put
keywords in front of everything for no reason.
Seemed to have forgotten this rule in 2017?

Part of P0030, funded by zorg.
  • Loading branch information
nmlgc committed Sep 15, 2019
1 parent ac21170 commit e10502b
Show file tree
Hide file tree
Showing 22 changed files with 342 additions and 342 deletions.
8 changes: 4 additions & 4 deletions th03/formats/cdg_freeall.asm
@@ -1,16 +1,16 @@
; Frees the CDG images in all slots.

; void cdg_freeall(void);
public _cdg_freeall
_cdg_freeall proc near
public cdg_freeall
cdg_freeall proc near
push bp
mov bp, sp
push si
xor si, si
jmp short @@done?

@@loop:
call _cdg_free pascal, si
call cdg_free pascal, si
inc si

@@done?:
Expand All @@ -19,4 +19,4 @@ _cdg_freeall proc near
pop si
pop bp
retn
_cdg_freeall endp
cdg_freeall endp
30 changes: 15 additions & 15 deletions th03/formats/cdg_load.asm
Expand Up @@ -4,7 +4,7 @@
; Loads the [n]th image of the CDG file [fn] into [slot].

; void pascal cdg_load_single_forcealpha(int slot, const char *fn, int n)
_cdg_load_single_forcealpha proc far
cdg_load_single_forcealpha proc far

@@image_size = dword ptr -4
@@n = word ptr 6
Expand All @@ -16,7 +16,7 @@ _cdg_load_single_forcealpha proc far
push di
mov di, [bp+@@slot]
push di
nopcall _cdg_free
nopcall cdg_free
mov ax, di
shl ax, 4
add ax, offset _cdg_slots
Expand Down Expand Up @@ -59,14 +59,14 @@ _cdg_load_single_forcealpha proc far
pop si
leave
retf 8
_cdg_load_single_forcealpha endp
cdg_load_single_forcealpha endp


; Loads the [n]th image of the CDG file [fn] into [slot], skipping the alpha
; plane.

; void pascal cdg_load_single_noalpha(int slot, const char *fn, int n)
_cdg_load_single_noalpha proc far
cdg_load_single_noalpha proc far

@@image_size = dword ptr -4
@@n = word ptr 6
Expand All @@ -78,7 +78,7 @@ _cdg_load_single_noalpha proc far
push di
mov di, [bp+@@slot]
push di
nopcall _cdg_free
nopcall cdg_free
mov ax, di
shl ax, 4
add ax, offset _cdg_slots
Expand Down Expand Up @@ -119,14 +119,14 @@ _cdg_load_single_noalpha proc far
pop si
leave
retf 8
_cdg_load_single_noalpha endp
cdg_load_single_noalpha endp


; Loads all images of the CDG file [fn], starting at [slot_first] and
; incrementing the slot number for every further image.

; void pascal cdg_load_all(int slot_first, const char *fn);
_cdg_load_all proc far
cdg_load_all proc far

@@i = word ptr -2
@@fn = dword ptr 6
Expand All @@ -138,7 +138,7 @@ _cdg_load_all proc far
pushd [bp+@@fn]
call file_ropen
push [bp+@@slot_first]
nopcall _cdg_free
nopcall cdg_free
mov ax, [bp+@@slot_first]
shl ax, 4
add ax, offset _cdg_slots
Expand All @@ -155,7 +155,7 @@ _cdg_load_all proc far
mov ax, [bp+@@slot_first]
add ax, [bp+@@i]
push ax
nopcall _cdg_free
nopcall cdg_free
inc [bp+@@i]

@@free_loop:
Expand Down Expand Up @@ -223,15 +223,15 @@ _cdg_load_all proc far
pop si
leave
retf 6
_cdg_load_all endp
cdg_load_all endp


; Loads all images of the CDG file [fn], disregarding their alpha planes,
; starting at [slot_first] and incrementing the slot number for every further
; image.

; void pascal cdg_load_all_noalpha(int slot_first, const char *fn);
_cdg_load_all_noalpha proc far
cdg_load_all_noalpha proc far

@@fn = dword ptr 6
@@slot_first = word ptr 10
Expand All @@ -241,17 +241,17 @@ _cdg_load_all_noalpha proc far
mov cdg_noalpha, 1
push [bp+@@slot_first]
pushd [bp+@@fn]
call _cdg_load_all
call cdg_load_all
mov cdg_noalpha, 0
pop bp
retf 6
_cdg_load_all_noalpha endp
cdg_load_all_noalpha endp


; Frees the CDG image in the given [slot].

; void cdg_free(int slot);
_cdg_free proc far
cdg_free proc far

@@slot = word ptr 6

Expand Down Expand Up @@ -289,4 +289,4 @@ _cdg_free proc far
pop si
pop bp
retf 2
_cdg_free endp
cdg_free endp
6 changes: 3 additions & 3 deletions th03/formats/cdg_put.asm
@@ -1,8 +1,8 @@
; Displays the CDG image in the given [slot] at (⌊x/8⌋*8, y).

; void pascal cdg_put(int x, int y, int slot);
public _cdg_put
_cdg_put proc far
public cdg_put
cdg_put proc far

@@slot = word ptr 6
@@y = word ptr 8
Expand Down Expand Up @@ -95,5 +95,5 @@ _cdg_put proc far
pop si
pop bp
retf 6
_cdg_put endp
cdg_put endp
align 2
10 changes: 5 additions & 5 deletions th03/formats/cdg_put_dissolve.asm
Expand Up @@ -3,8 +3,8 @@
; (mod 8, 0 = none, 7 = full) on the E bitplane.

; void pascal cdg_put_dissolve_e(int x_center, int y_center, int slot, int strength);
public _cdg_put_dissolve_e
_cdg_put_dissolve_e proc near
public cdg_put_dissolve_e
cdg_put_dissolve_e proc near

@@h = word ptr -6
@@w = word ptr -4
Expand Down Expand Up @@ -41,11 +41,11 @@ _cdg_put_dissolve_e proc near
jnz short @@put_alpha

@@put_noalpha:
call _cdg_put_noalpha pascal, [bp+@@x_center], [bp+@@y_center], [bp+@@slot]
call cdg_put_noalpha pascal, [bp+@@x_center], [bp+@@y_center], [bp+@@slot]
jmp short @@dissolve_prepare

@@put_alpha:
call _cdg_put pascal, [bp+@@x_center], [bp+@@y_center], [bp+@@slot]
call cdg_put pascal, [bp+@@x_center], [bp+@@y_center], [bp+@@slot]

@@dissolve_prepare:
and [bp+@@strength], 7
Expand Down Expand Up @@ -102,4 +102,4 @@ _cdg_put_dissolve_e proc near
pop si
leave
retn 8
_cdg_put_dissolve_e endp
cdg_put_dissolve_e endp
2 changes: 1 addition & 1 deletion th03/formats/cdg_put_hflip.asm
Expand Up @@ -2,7 +2,7 @@
; horizontally.

; void DEFCONV cdg_put_hflip(int x, int y, int slot);
proc_defconv _cdg_put_hflip
proc_defconv cdg_put_hflip

@@slot = word ptr 6
@@y = word ptr 8
Expand Down
6 changes: 3 additions & 3 deletions th03/formats/cdg_put_noalpha.asm
Expand Up @@ -2,8 +2,8 @@
; alpha plane.

; void pascal cdg_put_noalpha(int x, int y, int slot);
public _cdg_put_noalpha
_cdg_put_noalpha proc far
public cdg_put_noalpha
cdg_put_noalpha proc far

@@slot = word ptr 6
@@y = word ptr 8
Expand Down Expand Up @@ -65,5 +65,5 @@ _cdg_put_noalpha proc far
pop si
pop bp
retf 6
_cdg_put_noalpha endp
cdg_put_noalpha endp
align 2
8 changes: 4 additions & 4 deletions th03/formats/cdg_unput_upwards.asm
Expand Up @@ -3,9 +3,9 @@
; at the bottom of that image, as well as the one line immediately below, from
; the VRAM's E plane.

; void cdg_unput_for_upwards_motion_e(int x, int y, int slot);
public _cdg_unput_for_upwards_motion_e
_cdg_unput_for_upwards_motion_e proc near
; void cdg_unput_for_upwards_motion_e(int x_center, int y_center, int slot);
public cdg_unput_for_upwards_motion_e
cdg_unput_for_upwards_motion_e proc near

@@h = word ptr -4
@@w = word ptr -2
Expand Down Expand Up @@ -65,4 +65,4 @@ _cdg_unput_for_upwards_motion_e proc near
pop si
leave
retn 6
_cdg_unput_for_upwards_motion_e endp
cdg_unput_for_upwards_motion_e endp

0 comments on commit e10502b

Please sign in to comment.