Page 1 of 1
Help with my asm code
Posted: Fri Nov 14, 2003 6:48 am
by KieranFoot
I understand asm a little but i dont understand how to do if statements, so i want to know how to convert the following qb code into asm ???
Code: Select all
IF (B AND &HE0) = &H0 THEN
IF (C AND &HE0) = &HC0 THEN
Success = -1
END IF
END IF
Thanx ;D
Re:Help with my asm code
Posted: Fri Nov 14, 2003 7:27 am
by Tim
Here's my first stab at it:
Code: Select all
mov bl, [b]
mov cl, [c]
; BL & 0E0h...
test bl, 0E0h
; ... = 0, then continue
jnz rest_of_the_program
; CL & 0E0h...
and cl, 0E0h
; ... = 0C0h...
cmp cl, 0C0h
; ...then continue
jne rest_of_the_program
; success: assign -1 to variable Success
mov dword [Success], -1
rest_of_the_program:
; do whatever was underneath the IF statement
Imagine you're coding BASIC, but the only control statement you have is GOTO (equivalent to JMP, etc. in assembly).
Erm, do you know any languages besides BASIC? Any C, perhaps, or Pascal?
Re:Help with my asm code
Posted: Fri Nov 14, 2003 7:37 am
by KieranFoot
I know a bit of c++ but thats about it.
I wanted that code converting because I'm adding interrupt functions to handle SBlaster cards such as SBDetect and SBWriteReg. I think its a good idea to have sound routines built into the very foundations of the system...
Thanx ;D