Author Topic: A problem that is driving me insane  (Read 7897 times)

Offline TheEXE89

  • New Member
  • Posts: 1
A problem that is driving me insane
« on: May 15, 2011, 10:43:40 PM »
I can't seem to fix lines 355, 356 and 357 in this code


Code: [Select]
;  COMBINED SOUND DATA FILE

;****
; INTRO.MAC
;

INTC1 EQU $A8
INTC2 EQU $A8
falfv   EQU $16
falcv EQU $a3
intle1 EQU 7
intle2 EQU $1b


HOWC1
DB $C9,$C9,$C9,$C9
DB $C9,$C9,$C9,$C9,$C8,$C8,$C8,$C8
HOWC2
DB 0,0,0,0,0
DB $AC,$AB,$AB,$AB,$AB,$AB,$AA
RIVC1
DB 0,0,0,0,0,0,0,0,0,0,0,0,$A9,$A9,$A9

stpf3
db $66,$66,$66,$66,$66,$66,$66,$66
db $66,$66,$66,$66,$66,$66,$66,$66
db $66,$66,$66,$66,$66,$66,$66,$66
STPC3
DB $80,$81,$82,$83,$84,$85,$86,$87
DB $88,$89,$8A,$8B,$8C,$8D,$8E,$8F
DB $8F,$8F,$8F,$8F,$8F,$8F,$8F,$8F

;****************************************************
;*
;*

WLKC1
db $a2,$a3,$a4,$a5,$a6,$a6,$a6,$a5,$a4,$a4

JMPC1
db $a2,$a3,$a3,$a3,$a3,$a3,$a4,$a4
db $a4,$a6,$a6,$a6,$a6,$a6,$a6,$a6
db $a6,$a6,$a6,$a6,$a6,$a6,$a6,$a6
db $a6,$a6,$a6,$a6,$a6,$a6,$a6,$a6
db $a6,$a6,$a6,$a6,$a6,$a6,$a6,$a6
db $a6,$a6,$a6,$a6,$a5,$a5,$a4,$a4

RIVC2
db $a9,$a9,$a9,$a9,$a9,$a9,$a9,$a9
db $a9,$a9,$a9,$a9,$a9,$a9,$a9,$a9
MR2C2
db $a0,$a0,$a1,$a2,$a3,$a4,$a4,$a5,$a5,$a0
db $a0,$a0,$a2,$a3,$a4,$a4,$a5,$a5
db $a0,$a0,$a0,$a2,$a3,$a4,$a4,$a5
db $a5,$a0,$a0,$a0,$a0,$a0,$a0,$a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,$a2,$a3,$a4,$a4,$a4,$a5,$a5

HAMC
db $a3,$a3,$a3,$a0,$a0,$a0,$a4
db $a4,$a4,$a0,$a0,$a0,$a5,$a5,$a5
db $a0,$a0,$a0,$a5,$a5,$a5,$a0,$a0
db $a0,$a6,$a6,$a6,$a0,$a0,$a8,$a8
db $a8,$a0,$a0,$a9,$a9,$a0,$a0,$a8
db $a8,$a0,$a0,$a8,$a8,$a0,$a0,$a7
db $a7,$a0,$a6,$a6,$a0,$a0,$a6,$a6
db $a0,$a0,$a5,$a5,$a0,$a0,$a4,$a4
db $a0,$a3,$a0,$a2,$a0,$a1

SPRC4
db $a3,$a4,$a5,$a6,$a5,$a4,$a3,$a4
db $a5,$a6,$a7,$a6,$a5,$a4,$a3,$a0

GRLC3
GRLC4
PNTC4
db $a7,$a7,$a7,$a7,$a7,$a7
db $a7,$a7,$a7,$a7,$a7,$a7,$a7,$a7
db $a7,$a7,$a7,$a7,$a0,$a0,$a0,$a0
db $a3,$a4,$a5,$a5,$a5,$a5,$a6,$a6
db $a7,$a7,$a7,$a7,$a7,$a7,$a7,$a7
db $a7,$a7,$a7,$a7,$a7,$a7,$a7,$a7


;*
;*
;***************************************************


;SOUND CHANNEL 1
INTF1
db $A2,$AD,$F3,$CC,$D9,$F3
INTL1
db $36,$56,$30,$28,$14,$3d

;SOUND CHANNEL 2
INTF2
DB 81,85,81,85,81,85,81
DB 85,81,85,81,85,81,85,81,85,81
DB 85,81,85,81,85,162,136,144,162

INTL2
DB 54,6,3,3,3,3,3,3,3,3,3,3,3
DB 3,3,3,3,3,3,3,3,3,48,40,20,61

;****
; HOWMUCH.ASM
;

; This data came from D:HOWMUCH.SND

;       LOW BASS
HOWLEN equ 12
HOWF1
DB 110,116,131,146
DB 161,173,197,218,197,146,197,146

HOWD1
DB 8,4,4,4,4,4,5,11,22,20,21,20
HOWS1
DB 3,2,2,2,2,2,3,7,8,8,8,7

; This is sound channel 02
HOWF2
DB 0,0,0,0,0,67,53,60,53,45,53,60

HOWD2
DB 4,4,4,4,4,25,10,10,10,21,18,13
HOWS2
DB 0,0,0,0,0,12,4,5,5,11,6,7
;

;****
; WALKING.MAC
;

;
; This data came from D:WALKING.SND
;
;
; This is sound channel 1
WLKLEN equ $000A
WLKF1
DB $23,$24,$25,$26,$28,$2A,$2D,$32,$30,$2E

;****
; JUMP.MAC

; This data came from D:JUMP.SND
;
; This is sound channel 01
JMPLEN EQU $0030
JMPF1
DB $3E,$3D,$3B,$39,$37,$36,$37,$39
DB $3B,$3D,$3E,$3D,$3B,$39,$37,$36
DB $37,$39,$3B,$3D,$3E,$3D,$3B,$39
DB $37,$36,$37,$39,$3B,$3D,$3E,$3D
DB $3B,$39,$37,$36,$37,$39,$3B,$3C
DB $3D,$3E,$40,$47,$53,$63,$72,$72

;****
; RIVET.MAC
;

; This data came from D:RIVET.SND
; This is sound channel 01
;
RIVLEN equ 15
RIVF1
DB 0,0,0,0,0,0,0,0,0,0,0,0,68,68,68
RIVD1
DB 11,11
DB 11,11,11,11,11,11,11,11,11,28,17,6,5

RIVS1
DB 0,0,0,0,0,0,0,0,0,0,0,0,7,1,1


RIVF2
DB 217,182,217,182,217,182
DB 217,182,217,182,217,182,91,91,91

RIVD2
DB 11,11,11,11
DB 11,11,11,11,11,11,11,11,34,6,5

RIVS2
DB 5,5,5,5,5,5,5,5,5,5,5,5,7,1,1

;****
; ROTATE.MAC
;

; This data came from D:ROTATE.SND
;
; This is sound channel 01
ROTLEN equ $0090
ROTC1
db $a9,$a9,$a9,$a9,$a9,$a9,$a9,$a9
db $a9,$a9,$a9,$a9,$a9,$a9,$a9,$a9
db $a9,$a9,$a9,$a9,$a9,$a9,$a9,$a9
db $a9,$a9,$a9,$a9,$a9,$a9,$a9,$a9
db $a9,$a9,$a9,$a9,$a9,$a9,$a9,$a9
db $a9,$a9,$a9,$a9,$a9,$a9,$a9,$a9
db $a9,$a9,$a9,$a9,$a9,$a9,$a9,$a9
db $a9,$a9,$a9,$a9,$a9,$a9,$a9,$a9
db $a9,$a9,$a9,$a9,$a9,$a9,$a9,$a9
db $a9,$a9,$a9,$a9,$a9,$a9,$a9,$a9
db $a9,$a9,$a9,$a9,$a9,$a9,$a9,$a9
db $a9,$a9,$a9,$a9,$a9,$a9,$a9,$a9
db $a9,$a9,$a9,$a9,$a9,$a9,$a9,$a9
db $a9,$a9,$a9,$a9,$a9,$a9,$a9,$a9
db $a9,$a9,$a9,$a9,$a9,$a9,$a9,$a9
db $a9,$a9,$a9,$a9,$a9,$a9,$a9,$a9
db $a9,$a9,$a9,$a9,$a9,$a9,$a9,$a9
db $a9,$a9,$a9,$a9,$a9,$a9,$a9,$a9
ROTF1
DB $88,$88,$88,$88
DB $88,$88,$88,$88,$88,$88,$88,$88
DB $88,$88,$88,$88,$88,$88,$88,$88
DB $88,$88,$88,$88,$B6,$B6,$B6,$B6
DB $B6,$B6,$B6,$B6,$B6,$B6,$B6,$B6
DB $B6,$B6,$B6,$B6,$B6,$B6,$B6,$5B
DB $5B,$5B,$5B,$5B,$5B,$5B,$5B,$5B
DB $5B,$5B,$5B,$5B,$5B,$5B,$5B,$5B
DB $6C,$6C,$6C,$6C,$6C,$6C,$6C,$6C
DB $6C,$6C,$6C,$6C,$6C,$6C,$6C,$48
DB $48,$80,$80,$80,$44,$44,$79,$79
DB $79,$40,$40,$72,$72,$72,$3C,$3C
DB $6C,$6C,$39,$39,$66,$66,$66,$35
DB $35,$5B,$5B,$5B
DB $32,$32,$55,$55,$55,$2F,$2F,$51
DB $51,$51,$2D,$2D,$4C,$4C,$4C,$2A
DB $2A,$48,$48,$48,$28,$28,$44,$44
DB $44,$25,$25,$3F,$3F,$3F,$23,$23
DB $3C,$3C,$3C,$2D,$2D,$3C,$3C,$3C

;****
; MARCHTWO.MAC
;

; This data came from D:MARCHTWO.SND
;
;
; This is sound channel 01
MR2LEN equ $004A
MR2F2
DB $5B,$5B
DB $5B,$5B,$5B,$5B,$5B,$5B,$5B,$51
DB $51,$51,$51,$51,$51,$51,$51,$51
DB $5B,$5B,$5B,$5B,$5B,$5B,$5B,$5B
DB $5B,$6C,$6C,$6C,$6C,$6C,$6C,$6C
DB $6C,$6C,$6C,$6C,$6C,$6C,$6C,$6C
DB $6C,$6C,$6C,$6C,$6C,$6C,$88,$88
DB $88,$88,$88,$88,$88,$88,$88,$88
DB $88,$88,$88,$88,$88,$88,$88,$88
DB $88,$88,$88,$88,$88,$88,$88,$88

;****
; MARCHONE.MAC
;

; This data came from D:MARCHONE.SND
;
; This is sound channel 01
MR1LEN equ $001D
MR1F2
DB $6C,$6C,$6C,$6C,$6C
DB $6C,$6C,$6C,$6C,$6C,$6C,$6D,$6E
DB $70,$88,$88,$88,$88,$88,$88,$88
DB $88,$88,$88,$88,$88,$88,$88,$88

;****
; ATTACK.MAC
;

; This data came from D:ATTACK.SND
;
; This is sound channel 01
ATKLEN EQU $00B6
ATKF2
DB $6C,$6C,$6C,$6C,$6C,$6C
DB $6C,$6C,$6C,$6C,$6C,$6C,$5B,$5B
DB $5B,$5B,$5B,$5B,$5B,$5B,$5B,$5B
DB $5B,$5B,$6C,$6C,$6C,$6C,$6C,$6C
DB $6C,$6C,$6C,$6C,$6C,$6C,$5B,$5B
DB $5B,$5B,$5B,$5B,$5B,$5B,$5B,$5B
DB $5B,$6C,$6C,$6C,$6C,$6C,$6C,$6C
DB $6C,$6C,$6C,$6C,$6C,$6C,$6C,$6C
DB $6C,$6C,$6C,$6C,$6C,$6C,$6C,$6C
DB $6C,$6C,$6C,$6C,$6C,$6C,$6C,$6C
DB $6C,$6C,$6C,$6C,$6C,$6C,$6C,$6C
DB $6C,$6C,$6C,$6C,$6C,$88,$88,$88
DB $88,$88,$88,$88,$88,$88,$88,$88
DB $88,$6C,$6C,$6C,$6C,$6C,$6C,$6C
DB $6C,$6C,$6C,$6C,$6C,$88,$88,$88
DB $88,$88,$88,$88,$88,$88,$88,$88
DB $88,$6C,$6C,$6C,$6C,$6C,$6C,$6C
DB $6C,$6C,$6C,$6C,$88,$88,$88,$88
DB $88,$88,$88,$88,$88,$88,$88,$88
DB $88,$88,$88,$88,$88,$88,$88,$88
DB $88,$88,$88,$88,$88,$88,$88,$88
DB $88,$88,$88,$88,$88,$88,$88,$88
DB $88,$88,$88,$88,$88,$88,$88,$88



;****
; HAMMER.MAC
;

; This data came from D:HAMMER.SND
;


CH1OFF EQU 0 ;channel offsets
CH2OFF EQU 2
CH3OFF EQU 4
CH4OFF EQU 6
;
HAMLEN equ $0045           ;sound table length
hamle2  equ low [-1]
hamle3  equ low [-12]
hamle4  equ low [-17]
HAMF
db $cc,$cc,$cc,$cc,$cc,$cc,$b6,$b6
db $b6,$cc,$cc,$cc,$a2,$a2,$a2,$cc
db $cc,$cc,$99,$99,$99,$99,$cc,$cc
db $88,$88,$88,$cc,$cc,$80,$80,$80
db $cc,$cc,$79,$79,$cc,$cc,$72,$72
db $cc,$cc,$6c,$6c,$cc,$cc,$66,$66
db $cc,$60,$60,$cc,$cc,$5b,$5b,$5b
db $51,$55,$55,$51,$51,$51,$51,$51
db $4c,$51,$48,$51,$44

;****
; STAMP.MAC
;

; This data came from D:STAMP.SND
;
; This is sound channel 04
STPLEN equ $0018

STPF4 EQU $66

;****
; FALL.MAC
;

; This data came from D:FALL.SND
;

;****
; GRIN.MAC
;

; This data came from D:GRIN.SND
;
; This is sound channel 03
;
GRNLEN EQU $0011
GRNF3
db $08,$08,$08,$08,$08,$08,$08,$08
db $08,$08,$08,$08,$08,$08,$08,$08
db $08
GRNC3
db $48,$48,$48,$48,$48,$48,$48,$48
db $48,$48,$48,$48,$48,$48,$48,$48
db $48

;****
; GIRL1.MAC
;

; This data came from D:GIRL1.SND
;
; This is sound channel 03
GRLLEN equ 4
; This is sound channel 04

GRLF3
DB 45,35,40,45

GRLF4
DB 52,45,47,53
GRLD3
GRLD4
DB 16,12,4,5
GRLS3
GRLS4
DB 10,5,1,2

;****
; SPRING.MAC
;

; This data came from D:SPRING.SND
;
; This is sound channel 02
SPRLEN equ $000F
SPRF4
DB $16,$1B,$23,$2D,$3B,$4B,$64
DB $1D,$20,$28,$2F,$39,$48,$56,$6D

;****
; POINTS.MAC
;

; This data came from D:POINTS.SND
;
; This is sound channel 01
PNTLEN equ $002D
PNTF4
DB $32,$33,$32,$31,$32
DB $33,$32,$31,$32,$33,$32,$31,$32
DB $33,$32,$31,$32,$32,$28,$28,$28
DB $28,$28,$29,$28,$27,$28,$28,$27
DB $28,$29,$27,$28,$34,$35,$34,$34
DB $35,$3C,$3D,$3C,$44,$43,$44,$44

;*******************************************************
;*  pointer table for muspr
;*

howa1
dw howf1
dw howc1
dw howd1
dw hows1
howa2
dw howf2
dw howc2
dw howd2
dw hows2


riva1
dw rivf1
dw rivc1
dw rivd1
dw rivs1
riva2
dw rivf2
dw rivc2
dw rivd2
dw rivs2


grla3
dw grlf3
dw grlc3
dw grld3
dw grls3
grla4
dw grlf4
dw grlc4
dw grld4
dw grls4

;********************************
;* jump table for sounds routine*
;********************************

sjtab
db voice - intro
db voice - intro
db girl1 - intro
db voice - intro
db fall - intro
db voice - intro
db hammer - intro
db voice - intro
db voice - intro
db voice - intro
db voice - intro
db rivet - intro
db voice - intro
db voice - intro
db howmuch - intro
db intro - intro

fh
db high, pntf4
db high, sprf4
db 0 ;girl
db high, grnf3
db 0 ;fall
db high, stpf3
db high, 0 ;hammer
db high, atkf2
db high, mr1f2
db high, mr2f2
db high, rotf1
db 0 ;rivet
db high, jmpf1
db high, wlkf1
db 0 ;howmuch
db 0 ;intro

fl
db low, pntf4
db low, sprf4
db 0 ;girl
db low, grnf3
db 0 ;fall
db low, stpf3
db 0 ;hammer
db low, atkf2
db low, mr1f2
db low, mr2f2
db low, rotf1
db 0 ;rivet
db low, jmpf1
db low, wlkf1
db 0 ;howmuch
db 0 ;intro

cnh
db high, pntc4
db high, sprc4
db 0 ;girl
db high, grnc3
db 0 ;fall
db high, stpc3
db 0 ;hammer
db high, atkc2
db high, mr1c2
db high, mr2c2
db high, rotc1
db 0 ;rivet
db high, jmpc1
db high, wlkc1
db 0 ;howmuch
db 0 ;intro

cnl
db low, pntc4
db low, sprc4
db 0 ;girl
db low, grnc3
db 0 ;fall
db low, stpc3
db 0 ;hammer
db low, atkc2
db low, mr1c2
db low, mr2c2
db low, rotc1
db 0 ;rivet
db low, jmpc1
db low, wlkc1
db 0 ;howmuch
db 0 ;intro

chnum ;biases chan #4=6; #3=4; #2=2, #1=0
db 6
db 6
db 0 ;girl
db 4
db 0 ;fall
db 4
db 0 ;hammer
db 2
db 2
db 2
db 0
db 0 ;rivet
db 0
db 0
db 0 ;howmuch
db 0 ;intro



;*******************************************************
;*
;*  RAM VARIABLES
;*
INTRX1 DB 0
INTRX2 DB 0
vtime DB 0
MUSIC2 DB $1B
FALF3 DB $16
falc3 db 0
GRNCNT DB $11


it keeps telling me "comma, colon or end of line expected." What am i doing wrong?

Offline Keith Kanios

  • Full Member
  • **
  • Posts: 383
  • Country: us
    • Personal Homepage
Re: A problem that is driving me insane
« Reply #1 on: May 16, 2011, 12:17:37 AM »
What am i doing wrong?

Presumably, since you are here, you are trying to assemble some code with NASM that was developed for a different assembler/syntax.

If this code was intended to be assembled by NASM, the author has missed their mark and I would suggest a RTFM session or two.

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: A problem that is driving me insane
« Reply #2 on: May 16, 2011, 09:10:22 AM »
Yow! This would drive me insane, too. Fortunately, I'm already insane, so it doesn't do much harm. :)

What jumped out at me, at first, was this little Nasm subtlety:

http://www.nasm.us/xdoc/2.09.08/html/nasmdoc3.html#section-3.4.1

Quote
Note, though, that the $ prefix does double duty as a prefix on identifiers (see section 3.1), so a hex number prefixed with a $ sign must have a digit after the $ rather than a letter.

Therefore, some of your "$??" constructs are interpreted as numbers, and some of 'em are interpreted as symbols... which are undefined. I attempted to "fix" this with a simple search-and-replace: "$"->"0x". This probably gives the intended results(?).

But that doesn't address the first set of errors Nasm notices, lines 355, 356, and 357:

Code: [Select]
hamle2  equ low [-1]
hamle3  equ low [-12]
hamle4  equ low [-17]

I don't know what that means. "low byte of -1"? I interpreted it as that, and changed it to "-1 & 0xFF" (etc.). Since "low" is used as an identifier elsewhere, that probably isn't right.

A pantload of warnings about "label alone on a line with no colon". We can probably ignore that - I just turned the warning off. Another bunch of warnings about "byte value exceeds bounds". This is probably not safe to ignore! I changed a bunch of your "db"s to "dd". Possibly should be "dw", in the unlikely(?) event that this is supposed to be 16-bit code. Or perhaps that isn't what's intended at all...

A bunch of errors about "undefined symbols" which appear to differ only in case from symbols which exist. Nasm is case-sensitive: "MYVAR" is a different symbol from "myvar"! I forced the whole thing to lowercase, to get around that problem. That may not be right (or not ideal), but I suspect it's okay...

Still a bunch of undefined symbols. I arbitrarily made labels with these names. This is almost certainly not right! Maybe supposed to be external variables? I dunno...

The attached file assembles, but I doubt if it's "even close" to what you want! Your best bet is probably to use the tool it was written for to assemble (compile?) it. If you wish to "translate" it to Nasm syntax, we may be able to help, but may need more information. What tool was this written for (if you know)? What OS is it intended for? What command line are you giving Nasm? Since this contains only data, no actual "code", it is presumably intended to be used with some other program. What? ... and anything else you can think of to tell us that may clarify what you're trying to do...

Best,
Frank