Johannes
13-11-2010, 01:42
Hello all, let me begin by saying how utterly amazed I am by thinBasic.
Any private programming I did until recently was done on my Acorn RiscPC. That has a very extended BASIC interpreter which has a built-in assembler. And then I needed to bulk-convert half a gigabyte (oh yes) of graphics on my Windows machine.
I looked around and ended up with thinBasic. I wrote several programs in pure BASIC and was already amazed at the execution speed, but converting half a gigabyte of graphics data was impossible in pure BASIC. So I ventured into the assembler. Now, I have been programming assembler for some 25 years, starting on the trusty C64 in 6502 assembler, and the last 20 years were ARM RISC. Programming x86 is... different. ;)
Got that conversion routine working but I will deny having anything to with that code. It's that bad.
A week ago I started on arbitrary-precision math routines and got that working on the ARM. Today I wrote the same routines in x86 assembler and I think I made better use of the x86 instruction set. But I ran into one little problem I can't seem to solve.
At the start of the main routine I perform several jumps based on an incoming parameter. But the assembler will only code short jumps, signed 8-bit displacement, and not 16-bit or 32-bit jumps. Do I need to use other mnemonics or is this impossible with the O2 assembler?
I fixed it by doing a JNE over a CALL to the routine I want. (JMP won't work either because that is also coded as a short jump.)
cmp eax,5
jne not5
call asm_div
ret
.not5
I also noticed that you can enter mnemonics in capitals except for the conditional jumps. Is that intentional or a (very small) bug?
Any private programming I did until recently was done on my Acorn RiscPC. That has a very extended BASIC interpreter which has a built-in assembler. And then I needed to bulk-convert half a gigabyte (oh yes) of graphics on my Windows machine.
I looked around and ended up with thinBasic. I wrote several programs in pure BASIC and was already amazed at the execution speed, but converting half a gigabyte of graphics data was impossible in pure BASIC. So I ventured into the assembler. Now, I have been programming assembler for some 25 years, starting on the trusty C64 in 6502 assembler, and the last 20 years were ARM RISC. Programming x86 is... different. ;)
Got that conversion routine working but I will deny having anything to with that code. It's that bad.
A week ago I started on arbitrary-precision math routines and got that working on the ARM. Today I wrote the same routines in x86 assembler and I think I made better use of the x86 instruction set. But I ran into one little problem I can't seem to solve.
At the start of the main routine I perform several jumps based on an incoming parameter. But the assembler will only code short jumps, signed 8-bit displacement, and not 16-bit or 32-bit jumps. Do I need to use other mnemonics or is this impossible with the O2 assembler?
I fixed it by doing a JNE over a CALL to the routine I want. (JMP won't work either because that is also coded as a short jump.)
cmp eax,5
jne not5
call asm_div
ret
.not5
I also noticed that you can enter mnemonics in capitals except for the conditional jumps. Is that intentional or a (very small) bug?