7 ms·
In a string literal?!?! We did better almost 40 years ago..., this is assembly in turbo pascal: procedure init; assembler; asm mov ax,13h int 10h
by siempreme 7y ago
In a string literal?!?! We did better almost 40 years ago..., this is assembly in turbo pascal:
procedure init; assembler;
asm
mov ax,13h
int 10h
end;
You can even have only the asm block in a regular pascal function and make use of regular arguments in the asm block.
- snarfy 7y agoIt gives me nostalgia seeing mode 13 graphics. What's next, mode x? Triangle drawing routines? :)
- nurettin 7y agonext, we implement bresenham's algorithms, then we embed antialiasing.
- pan69 7y agoI've actually picked this up as a hobby since a year ago or so. I grew up in the late 80's early 90's doing exactly this type of thing as a kid. Having worked as a professional dev for the past few decades I started to notice that I've been taking my work home for all that time, and even though I like my work, I felt I needed a hobby as I'm getting older. So, I'm currently making a shooting game for the 286/16 in modex VGA with SoundBlaster digitised sound and Adlib for music. All programmed from scratch...
- jsd1982 7y agoCool! Got a public repo of code? What toolchain are you using?
- pan69 7y agoSorry, no public repo, yet. Once I have something coherent working I will definitely publish it. I'm using Watcom C v11. I actually bought this somewhere in the 90's. However, the Watcom tool chain is still being developed as Open Watcom. So, great for 32bit DOS: https://github.com/open-watcom https://github.com/open-watcom
- pjmlp 7y agoFor some cultural reason C and C++ compilers for UNIX do it the hard way. PC compilers always followed that path. The same in Turbo C would be: void init() { asm { mov ax, 0x13 int 0x10 } }
- Tinfoilhat666 7y agoAlso Rust uses strings for asm. It can't be bad.
- jashmatthews 7y agoRust stdlib uses strings because it's just piping through to LLVM and that's what LLVM expects: http://llvm.org/docs/LangRef.html#inline-assembler-expressions http://llvm.org/docs/LangRef.html#inline-assembler-expressio... There's also a Rust version of Dynasm.
- steveklabnik 7y agoIt’s a fairly major point of contention, and we may not keep it. Note that it’s not a stable feature yet. As pointed out below, it’s this way because it’s basically a convenience into LLVM.
- tropo 7y agoKeep it. Porting to rust is easier if it doesn't require a person to be an expert at two different kinds of inline assembly syntax. Being able to grab a chunk of inline assembly from a C project is very useful. Whatever you do, don't embed knowledge of the assembly language into the compiler. That way lies madness. Assembly is often used for new CPU features that are not yet supported by the compilers that people are using. Constantly putting out minor compiler updates for every CPU revision would be miserable, and the users won't want to force those upgrades anyway. There is also the issue, I'm sorry, of the rust preprocessor. It will be written and it will be used. It may even be popular and ultimately written into an ISO standard. The irregularity of switching suddenly to a radically different CPU-specific syntax for assembly code would make the preprocessor situation much more nasty and gross.
- dfeojm-zlib 7y agoAh yes. And Borland Pascal. Mode X VGA hackery in unreal mode. Later, when I worked for a software store in high school, I acquired Borland C++ 3.1, the physically-largest and heaviest (27 lbs / 12.2 kg) retail software package that I know of. It was a small software shop, they gave us crazy discounts, vendors gave us NFRs and they let us borrow anything on the shelf (trusty-dusty shrinkwrap machine). The profiler, debugger, and assembler were also good as there were protected-mode variants that could sometimes keep the machine from crashing.
- childintime 7y agoAssembler? Inline LLVM intermediate representation might be extremely useful instead, for many applications, see: https://idea.popcount.org/2013-07-24-ir-is-better-than-assembly/ https://idea.popcount.org/2013-07-24-ir-is-better-than-assem...
- gumby 7y ago> In a string literal?!?! It's a thing literal as it is literally dumped straight into the generated .s file by the compiler, as most C compilers don't do the actual assembly or generation of object file. Of course these days it's not literally dumped in unmodified -- various compilers do substitutions for you. But that's the legacy.