Posts: 3,522
Threads: 189
Joined: Dec 2003
I ripped the op codes from Dav's BMP loader...
Then as it didn't work I used debug...
And when that didn't work either I tried objripper
THEN, after I did all that I noticed the output was the same in all 3 cases...
Yu can see for yourself, the asm code is in my first post.
Posts: 3,288
Threads: 167
Joined: Nov 2001
I don't think the ASM code had any probs with it. QB bug?
Posts: 3,522
Threads: 189
Joined: Dec 2003
It's not call absolute, if i try it with the VESA init code, or the res changing code it works fine, 1'000'000 calls and going strong...
Also, the bank switch works fine, unless you use it a lot, like I said, it's only when switcing banks a lot that it crashes.
Posts: 1,272
Threads: 36
Joined: Feb 2003
Can you upload it somewhere or post it so we can see if the same thing happens on our computers?
Posts: 3,522
Threads: 189
Joined: Dec 2003
Ok, now it works, with this code.
Code: DEFINT A-Z
'$DYNAMIC
CLS
RANDOMIZE TIMER
ASMInit$ = "5589E5B8034FCD108B5E0689075DCA0200"
'push bp
'mov bp, sp
'mov ax, 04f03h
'int 10h
'mov bx, (bp + 6)
'mov (bx), ax
'pop bp
'retf 2
ASMBank$ = "5589E5B8054FBB00008B5606CD105DCA0200"
'push bp
'mov bp, sp
'mov ax, 4f05h
'mov bx, 0
'mov dx, (bp + 6)
'int 10h
'pop bp
'retf 2
ASM640$ = "5589E5B8024FBB0101CD108B5E0689075DCA0200"
'push bp
'mov bp, sp
'mov ax, 04f02h
'mov bx, 0101h
'int 10h
'mov bx, (bp + 6)
'mov (bx), ax
'pop bp
'retf 2
ASMText$ = "5589E5B8024FBB0300CD108B5E0689075DCA0200"
'push bp
'mov bp, sp
'mov ax, 04f02h
'mov bx, 03h
'int 10h
'mov bx, (bp + 6)
'mov (bx), ax
'pop bp
'retf 2
FOR a = 1 TO LEN(ASMInit$) STEP 2 'EDIT: I forgot this, lol, sry.
g$ = g$ + CHR$(VAL("&H" + MID$(ASMInit$, a, 2)))
NEXT
ASMInit$ = g$: g$ = ""
FOR a = 1 TO LEN(ASMBank$) STEP 2
g$ = g$ + CHR$(VAL("&H" + MID$(ASMBank$, a, 2)))
NEXT
ASMBank$ = g$: g$ = ""
FOR a = 1 TO LEN(ASM640$) STEP 2
g$ = g$ + CHR$(VAL("&H" + MID$(ASM640$, a, 2)))
NEXT
ASM640$ = g$: g$ = ""
FOR a = 1 TO LEN(ASMText$) STEP 2
g$ = g$ + CHR$(VAL("&H" + MID$(ASMText$, a, 2)))
NEXT
ASMText$ = g$: g$ = ""
DEF SEG = SSEG(ASMInit$)
CALL ABSOLUTE(IsVESAInstalled%, SADD(ASMInit$))
DEF SEG
IF IsVESAInstalled <> 79 THEN PRINT "No VESA!.": END
PRINT "This should be 79:"; IsVESAInstalled
t$ = INPUT$(1)
DEF SEG = SSEG(ASM640$)
CALL ABSOLUTE(ok%, SADD(ASM640$))
DEF SEG
IF ok <> &H4F THEN PRINT "ERROR SETTING RES!": END
scrXr& = 640
scrYr& = 480
'OPEN "Dummy.txt" FOR OUTPUT AS #1
'PRINT #1, "A", "X", "Y", "Offset", "NewBank", "Bank"
x = 0
y = 0
DEF SEG = &HA000
FOR y = 0 TO 100
FOR x = 0 TO 100
Offset& = y% * scrXr& + x%
NewBank& = Offset& AND -65536
IF NewBank& <> Bank& THEN
DEF SEG = SSEG(ASMBank$)
CALL ABSOLUTE(BYVAL NewBank& \ 65536, SADD(ASMBank$))
DEF SEG = &HA000
Bank& = NewBank&
END IF
'PRINT #1, a&, x, y, Offset&, NewBank&, Bank&
POKE Offset& AND 65535, 7
NEXT
NEXT
DEF SEG
t$ = INPUT$(1)
DEF SEG = SSEG(ASMText$)
CALL ABSOLUTE(retval%, SADD(ASMText$))
DEF SEG
SCREEN 0: WIDTH 80, 25: CLS
This code is for PDS 7.1, you have to change the SADD and SSEG to VARPTR and VARSEG for it to work in QB 4.5. But you already knew that, didn't you?
Posts: 788
Threads: 53
Joined: Nov 2002
Erm, You're not suposed to the hex code directly into the string. You're supposed to convert them to ascii chars.
oship me and i will give you lots of guurrls and beeea
Posts: 3,522
Threads: 189
Joined: Dec 2003
Yes, but look below, it changes it to op codes, chr$()
I found a bug though, (I just threw this togheter to post here, this is not my actuall code, but it does the same thing)
Edited my previous post to fix the bug.
Posts: 788
Threads: 53
Joined: Nov 2002
Yeah, saw that now, was going to saw do this.
Code: binstr = ""
for i = 1 to len( hexstr ) step 2
binstr = binstr + chr$( hex$( "&h" + mid$( hexstr, i, 2 ) ) )
next i
oship me and i will give you lots of guurrls and beeea
Posts: 3,522
Threads: 189
Joined: Dec 2003
Here's the exact code that crashes on my computer:
Code: DEFINT A-Z
'$DYNAMIC
CLS
RANDOMIZE TIMER
ASMInit$ = "5589E5B8034FCD108B5E0689075DCA0200"
'push bp
'mov bp, sp
'mov ax, 04f03h
'int 10h
'mov bx, (bp + 6)
'mov (bx), ax
'pop bp
'retf 2
ASMBank$ = "5589E5B8054FBB00008B5606CD105DCA0200"
'push bp
'mov bp, sp
'mov ax, 4f05h
'mov bx, 0
'mov dx, (bp + 6)
'int 10h
'pop bp
'retf 2
ASM640$ = "5589E5B8024FBB0101CD108B5E0689075DCA0200"
'push bp
'mov bp, sp
'mov ax, 04f02h
'mov bx, 0101h
'int 10h
'mov bx, (bp + 6)
'mov (bx), ax
'pop bp
'retf 2
ASMText$ = "5589E5B8024FBB0300CD108B5E0689075DCA0200"
'push bp
'mov bp, sp
'mov ax, 04f02h
'mov bx, 03h
'int 10h
'mov bx, (bp + 6)
'mov (bx), ax
'pop bp
'retf 2
FOR a = 1 TO LEN(ASMInit$) STEP 2 'EDIT: I forgot this, lol, sry.
g$ = g$ + CHR$(VAL("&H" + MID$(ASMInit$, a, 2)))
NEXT
ASMInit$ = g$: g$ = ""
FOR a = 1 TO LEN(ASMBank$) STEP 2
g$ = g$ + CHR$(VAL("&H" + MID$(ASMBank$, a, 2)))
NEXT
ASMBank$ = g$: g$ = ""
FOR a = 1 TO LEN(ASM640$) STEP 2
g$ = g$ + CHR$(VAL("&H" + MID$(ASM640$, a, 2)))
NEXT
ASM640$ = g$: g$ = ""
FOR a = 1 TO LEN(ASMText$) STEP 2
g$ = g$ + CHR$(VAL("&H" + MID$(ASMText$, a, 2)))
NEXT
ASMText$ = g$: g$ = ""
DEF SEG = SSEG(ASMInit$)
CALL ABSOLUTE(IsVESAInstalled%, SADD(ASMInit$))
DEF SEG
IF IsVESAInstalled <> 79 THEN PRINT "No VESA!.": END
PRINT "This should be 79:"; IsVESAInstalled
t$ = INPUT$(1)
DEF SEG = SSEG(ASM640$)
CALL ABSOLUTE(ok%, SADD(ASM640$))
DEF SEG
IF ok <> &H4F THEN PRINT "ERROR SETTING RES!": END
scrXr& = 640
scrYr& = 480
'OPEN "Dummy.txt" FOR OUTPUT AS #1
'PRINT #1, "A", "X", "Y", "Offset", "NewBank", "Bank"
DEF SEG = &HA000
'FOR y = 0 TO 100
' FOR x = 0 TO 100
FOR a& = 0 TO 1000000
x = 640 * RND
y = 480 * RND
Offset& = y% * scrXr& + x%
NewBank& = Offset& AND -65536
IF NewBank& <> Bank& THEN
DEF SEG = SSEG(ASMBank$)
CALL ABSOLUTE(BYVAL NewBank& \ 65536, SADD(ASMBank$))
DEF SEG = &HA000
Bank& = NewBank&
END IF
'PRINT #1, a&, x, y, Offset&, NewBank&, Bank&
POKE Offset& AND 65535, 7
'NEXT
NEXT
DEF SEG
t$ = INPUT$(1)
DEF SEG = SSEG(ASMText$)
CALL ABSOLUTE(retval%, SADD(ASMText$))
DEF SEG
SCREEN 0: WIDTH 80, 25: CLS
Posts: 788
Threads: 53
Joined: Nov 2002
Here
Code: Segment: BNK_TEXT WORD USE16 00000012 bytes
0000 DRVSWTCHBNK:
0000 55 push bp
0001 8B EC mov bp,sp
0003 B8 05 4F mov ax,0x4f05
0006 BB 00 00 mov bx,0x0000
0009 8B 56 06 mov dx,0x6[bp]
000C CD 10 int 0x00000010
000E 5D pop bp
000F CA 02 00 retf 0x00000002
Routine Size: 18 bytes, Routine Base: BNK_TEXT + 0000
Stop using call absolute dude, it's just stupid. Write the asm code, assemble it, make a qlb and load it in the ide.
oship me and i will give you lots of guurrls and beeea
|