--------------- FIDO MESSAGE AREA==> TOPIC: 145 ASSEMBLY LANG. Ref: EAS00015Date: 06/22/97 From: JERRY COFFIN Time: 12:11pm \/To: KURT WISMER (Read 2 times) Subj: problem with my code... On (17 Jun 97) Kurt Wismer wrote to Jerry Coffin... JC> I see a couple of problems, though I'm not sure if they're JC> related to the symptoms you're seeing or not. KW> well the litmus test will be if the symptoms go away... Well, I did some more looking at it, and actually did some testing on the result this time. It seems to produce a reasonable backup of a full disk, though I haven't done extensive testing. I've changed it over to using simplified segment directives, though I don't think that made any real difference; mostly it let me move the data declarations to the top where I prefer them, and still have them at the end of the program where they belong in the final image. .model tiny, c ; DiskBack - generates an image of a floppy disk in a file (and parses ; out the empty space). .stack .data file db 'diskback.img',0 .data? buff db 202h dup(?) .code .startup main proc mov dx, offset file ;create file with filename in [dx] xor cx, cx ;set file attributes = 00000000 mov ah, 3ch ;create function => int 21h, ah = 3ch int 21h ;returns handle of created file in ax mov di, ax ;save handle mov dx, 0ffffh arge: inc dx xor ax, ax mov bx, offset buff mov cx, 1 int 25h pop si jc close ;close and exit on error mov si, bx mov cx, 100h loop1: lodsw cmp ax, 0f6f6h loopz loop1 jz arge writ: push dx ;save sector index mov bx, offset buff + 200h mov [bx], dl mov [bx+1], dh mov bx, di ;restore file handle mov dx, offset buff mov ah, 40h ;write function => int 21h, ah = 40h mov cx, size buff ; **** write 200h (512) bytes int 21h ;writes 1 sector to the file with handle bx pop dx ;restore sector index jmp arge close: mov bx, di ;restore file handle mov ah, 3eh ;close file => int 21h, ah = 3eh int 21h ;bx = file handle mov ax, 4c00h ;exit program int 21h main endp end This should assemble to 89 bytes. If you want to make it shorter, it's safe to eliminate explicitly closing the file before exit, since DOS wil do that automatically. There ar probably other places bits can be shaved off as well. Then again, if you really want to use this, you'll probably want to add some feedback to the user during operation, which is likely to occupy almost as much space as the real guts of the program... Later, Jerry. ... The Universe is a figment of its own imagination. --- PPoint 1.90 * Origin: Point Pointedly Pointless (1:128/166.5) --------------- FIDO MESSAGE AREA==> TOPIC: 145 ASSEMBLY LANG. Ref: EAS00016Date: 06/21/97 From: EDDY THILLEMAN Time: 05:01pm \/To: DAVID KIRSCHBAUM (Read 2 times) Subj: PCMAG's CALC.COM Hi David, 18 Jun 97, David Kirschbaum of 1:3634/2.4 wrote to Eddy Thilleman: DK> However PCMag has a policy that people (theoretically DK> subscribers, but they don't push the issue) can freely use DK> their programs as they will. And the source code for DK> private, noncommercial purposes. A fair policy. DK> Just so it's private and noncommercial. It's for my own use, private and noncommercial. DK> Or if you use some of their stuff (significant snippets, DK> unique algorithms, etc.) in noncommercial or public domain DK> stuff, that you give them credit. Which is a nice way to go DK> about doing things, I'd say. Certainly. DK> who used to make a few trivial changes in public domain source DK> code (or even the PCMag stuff) and then try to copyright it as DK> their own stuff. Ugh! DK> They were, of course, ostracized, burned in effigy, etc. etc. Of course! DK> But I'd suggest you don't treat PCMag programs or source code DK> as public domain. Treat it as copyrighted code, owned by DK> someone else, that they're nice enough to let you use. Fair enough. Cheers, Eddy ... "A bomb!" Tom expoloded. --- MBM v4.12 * Origin: Speedy Gonsalez (2:500/143.7) --------------- FIDO MESSAGE AREA==> TOPIC: 145 ASSEMBLY LANG. Ref: EAS00017Date: 06/21/97 From: EDDY THILLEMAN Time: 06:47pm \/To: DAVID KIRSCHBAUM (Read 2 times) Subj: Redirection Hi David, 18 Jun 97, David Kirschbaum of 1:3634/2.4 wrote to Eddy Thilleman: DK> Couldn't resist tweaking it a little, of course (the infamous DK> "Toad Hall Tweak"), :)) DK> and tried to do something about detecting redirection. This was not in the original source? DK> ;When he's using redirection DK> ;StdIn alone ("<") produces a command line length of 1 You mean the byte at 80h in the PSP? DK> (space, CR) DK> ;StdOut alone (">" : same result. So you can't distinguish between '<' and '>' DK> ;StdIn and StdOut ("wherever") produces a command DK> line ;length of 2 (space, space, CR). DK> ;A question mark alone would produce a command line length of DK> 2 ;(space, "?", CR). Seems that the operating system copies the space to 81h, seems that is the reason why any command line starts at 82h in the PSP. Never knew why, and it always seemed pointless to me, but this could be the reason. The same for the space before any redirection symbol. But what if the user didn't include a space immediately preceding the redirection symbol, like in "echo text>file1" or in "some_commandfile2" ? DK> But this has always worked pretty well for me, so you might DK> want to see if they work for you. Well, if I had the source, I could try it out. DK> Yell if "you" want ARGS.ASM, of course .. or I could post DK> the source here .. only 5K. Yell!!! :) If more people are interested, please post it here. Otherwise, please send it to my fido adres at 2:500/143.7 or to my internet adres eddy.thilleman@net.hcc.nl Cheers, Eddy ... * <- Tribble Yn <- Japanese Tribble --- MBM v4.12 * Origin: Speedy Gonsalez (2:500/143.7) --------------- FIDO MESSAGE AREA==> TOPIC: 145 ASSEMBLY LANG. Ref: EAS00018Date: 06/21/97 From: EDDY THILLEMAN Time: 06:49pm \/To: STEVEN READ (Read 2 times) Subj: Pcmag's calc.com Hi Steven, 19 Jun 97, Steven Read of 1:157/200 wrote to Eddy Thilleman: SR> From the SimTel CDROM volume 2 I don't have the SimTel CDROM volume 2, but I've found it on the Internet. Some site wouldn't let me get the file, but another did allow me to get it. SR> There are also sites on the Internet that carry the SimTel SR> files, but I don't have/use Internet, hence I don't have the SR> address. I did a search on the internet for "Simtel"... Thanks for your reply. Cheers, Eddy ... "A crowd of people stood and stared." - Beatles --- MBM v4.12 * Origin: Speedy Gonsalez (2:500/143.7) --------------- FIDO MESSAGE AREA==> TOPIC: 145 ASSEMBLY LANG. Ref: EAT00000Date: 06/22/97 From: DORAN MOPPERT Time: 11:44am \/To: JOHN GARDENIERS (Read 2 times) Subj: 3d Math JG> After I'd posted the message it occurred to me that you must be doing JG> that. Brain lock on my part was to blame there. I've only ever JG> worked with degrees, not radians, and have always used a 90 byte JG> table. I've never been given a good reason to use radians for JG> anything. Do you have one? To my mind a square has 90 degree angles. JG> It doesn't sound right expressed in any other terms and I see no JG> advantage to using another system in calculations. :-/ Radians (1 cycle = 2*pi) are useful for some trig stuff - the basis of the system being that the arc length of diameter 1 is equal to the angle in radians. I preferred to use 256 degrees/cycle when I was doing graphics stuff just because it's a number that's easy to handle on a computer ... one lookup fits into an 8-bit register, and removing the bits after 7 is a lot easier than calculating modulo-36 on the number. .. Aspect .. --- FMail/386 1.20+ * Origin: Comms Barrier BBS +61.3.9585.1112, +61.3.9583.6119 (3:632/533) --------------- FIDO MESSAGE AREA==> TOPIC: 145 ASSEMBLY LANG. Ref: EAT00001Date: 06/19/97 From: DORAN MOPPERT Time: 12:30pm \/To: JERRY COFFIN (Read 2 times) Subj: HELP! JC> While you're at it, save even a bit more: JC> mov dx, (offset theendofprog + 15) SHR 4 JC> you're working entirely with constants, so there's no need to do the JC> calculation at run time; the assembler can do all the calculations at JC> assembly time. Unless you're writing something _really_ dodgy, where the size might change at runtime =) ... || (\/) ___________ ______ ~~\/~~ |_\/ \ ______ --- FMail/386 1.20+ * Origin: Comms Barrier BBS +61.3.9585.1112, +61.3.9583.6119 (3:632/533) --------------- FIDO MESSAGE AREA==> TOPIC: 145 ASSEMBLY LANG. Ref: EAT00002Date: 06/23/97 From: PAUL WANKADIA Time: 12:14pm \/To: ALL (Read 2 times) Subj: protected mode The code seems to work until I try to LIDT (i.e. LGDT works, but LIDT doesn't). Can anyone tell me why? TIA. ===== /* boot/boot.h ~~~~~~~~~~~ Contains macros for values used during booting. */ #define BOOT_SEG 0x9000 #define KERNEL_SEG 0x0100 #define SYSTEM_SIZE 0x10 ===== /* boot/head.S ~~~~~~~~~~~ PUNIX starts here. */ #include "boot.h" .file "boot/head.S" .code16 .text .global start start : movw %cs, %ax movw %ax, %ds movw %ax, %ss movw $0xFFFF, %sp movb $0x03, %ah movb $0x00, %bh int $0x10 movw $0x1301, %ax movw $0x07, %bx movw $msg_yo2, %bp movw msg_yo2_length, %cx int $0x10 /* * Disable all interrupts ... */ cli movb $0x80, %al outb %al, $0x70 /* * ... load GDT and IDT ... */ lgdt gdt_descriptor lidt idt_descriptor /* * ... and enter protected mode. */ movl %cr0, %eax orb $0x01, %al movl %eax, %cr0 jmp 1f /* * Setup segment registers and stack. */ 1 : .code32 movw $0x10, %ax movw %ax, %ds movw %ax, %es movw %ax, %fs movw %ax, %gs movw %ax, %ss movw $0xFFFF, %sp /* * Start the kernel! */ movw msg_yo_length, %cx movl $msg_yo, %esi movl $0xB8000, %edi cld rep movsb call _start_kernel /* * start_kernel() shouldn't return, but if it does... */ 2 : jmp 2b idt_descriptor : .word 0x00 .long 0x00 gdt_descriptor : .word 0x7FF .word gdt, (KERNEL_SEG) gdt : .quad 0x00 .word 0xFFFF .word 0x0000 .word 0x9A00 .word 0x00CF .word 0xFFFF .word 0x0000 .word 0x9200 .word 0x00CF msg_yo : .ascii "Y.o.!." msg_yo_length : .word . - msg_yo msg_yo2 : .ascii "We are in the kernel!\r\n" msg_yo2_length : .word . - msg_yo2 ===== --- PPoint 2.00 * Origin: Junyer's Workshop (3:640/772.3) --------------- FIDO MESSAGE AREA==> TOPIC: 145 ASSEMBLY LANG. Ref: EAT00003Date: 06/23/97 From: PAUL WANKADIA Time: 02:07pm \/To: BARTON PAUL LEVENSON (Read 2 times) Subj: ArrowSoft Assembler On 21 Jun 97, Barton Paul Levenson wrote to Jon Gentil -- [re "ArrowSoft Assembler"] BP> No advantages that I can see. The company went bankrupt. It comes with BP> no documentation and crashes if you make the slightest syntax error. I've got some docs for it ... where'd you get your copy from? --- PPoint 2.00 * Origin: Junyer's Workshop (3:640/772.3) --------------- FIDO MESSAGE AREA==> TOPIC: 145 ASSEMBLY LANG. Ref: EAT00004Date: 06/22/97 From: DAVID SIMAL Time: 08:35am \/To: PHIL QUINTON (Read 2 times) Subj: Re: SBPro v2, Sound Sampling Bonjour Phil ! Phil Quinton crivait le Jeudi 19 Juin 1997 All : PQ> @CODEPAGE: 437 PQ> I have a Sblaster Pro v2 compatable sound card and I PQ> want to sample from the line-in. Can someone show me PQ> how do it, with assembler? It depends if you want to use DMA or not... without DMA, it's relatively simple : Reading from DSP : ================== mov dx, ; Example : 220h add dl,0Eh BUSY: ; in al,dx ; Wait for DSP ready to read or al,al ; jns BUSY ; sub dl,4 in al,dx ; The value read from the DSP is in AL Writing to the DSP : ==================== mov dx, add dl,0Ch BUSY: ; in al,dx ; Wait for DSP ready to write to or al,al ; js BUSY ; mov al, out dx,al Now, to sample , you write 20h to the DSP, and then, you read the value from the DSP. To replay a sample, you write 10h to the DSP, and then, you write the sample (8bits) !!! You have to do this at a constant rate (the DSP doesn't do it for you), if you want to sample at 20 Khz, you'll have to do the sampling procedure 20000 times a second... (The maximum sampling rate in direct mode is about 22050 Hz, according to creative labs, personnaly, I can achieve about 35Khz in direct mode...) 16bits and 8/16bits/Stereo modes are only availible in DMA modes... which are a lot more complex, if I can suggest you a book (electronic), go to www.creativelabs.com, and take the Software Handbook Developper's Guide... (in .PDF format), it well explains all the concepts, and you'll have plenty of examples in the bundles (.C & .EXE) Amitis, David. --- GoldED/386 2.50+ * Origin: OVER-BBS, +32-81-732.763, 21h30-6h00 (2:293/3407) --------------- FIDO MESSAGE AREA==> TOPIC: 145 ASSEMBLY LANG. Ref: EAT00005Date: 06/23/97 From: JERRY COFFIN Time: 09:21am \/To: MODERATOR (Read 2 times) Subj: Protected Mode Compiler On (22 Jun 97) Moderator wrote to Patrick Sung... M > This is the 80XXX echo, for assembly language programming. Your M > request is off-topic here, please repost it in C_PLUS_PLUS and M > I'm sure you'll get a better response than this.. My apologies for a reply bordering on topical at best, but it's spelled C_PLUSPLUS (only one underscore) - trying to areafix it with the wrong spelling generally won't work. Later, Jerry. ... The Universe is a figment of its own imagination. --- PPoint 1.90 * Origin: Point Pointedly Pointless (1:128/166.5)