flat assembler
Message board for the users of flat assembler.

Index > DOS > How to turn num lock off in FASM?

Author
Thread Post new topic Reply to topic
barneygumble742



Joined: 11 Jul 2004
Posts: 3
barneygumble742 11 Jul 2004, 19:11
hello,

this is a file i'm trying to assemble using fasm153 for dos:

---
;NUMOFF.ASM: Turn NUM-LOCK indicator off.
Code:
   .MODEL SMALL
        .STACK
      .CODE
       .STARTUP
    MOV     AX,40H                         ;set AX to 0040H
     MOV     DS,AX                           ;load data segment with 0040H
       MOV     SI,17H                          ;load SI with 0017H
 AND     BYTE PTR [SI],0DFH        ;clear NUMLOCK bit
        .EXIT
       END
    


---

this is the output i get when i try to assemble:
---
C:\fasm153>fasm numoff.asm numoff.com
flat assembler version 1.53
numoff.asm [3]:
.MODEL SMALL
error: illegal instruction.
---

this is my very first program i'm trying to make for the x86. i haven't changed anything. i took it directly from a floppy disk that came with the book. i think there's something wrong with this statement:
AND BYTE PTR [SI],0DFH ;clear NUMLOCK bit

thank you,
barneygumble742
Post 11 Jul 2004, 19:11
View user's profile Send private message AIM Address Yahoo Messenger Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc 11 Jul 2004, 19:25
Fasm doesn't need all of the red tape included in the code you provided. Here's the FASM version of your code:

Code:
org 100h             ; Start a DOS program
MOV AX,40H           ;set AX to 0040H
MOV DS,AX            ;load data segment with 0040H
MOV SI,17H           ;load SI with 0017H
AND BYTE [SI],0DFH   ;clear NUMLOCK bit
int 20h              ; exit
    
Post 11 Jul 2004, 19:25
View user's profile Send private message Visit poster's website Reply with quote
barneygumble742



Joined: 11 Jul 2004
Posts: 3
barneygumble742 11 Jul 2004, 19:48
wow. amazing. thanks. i'm on a xp machine now and it didn't work. so i got sceptical and booted up my win98se box. i compiled on there and it worked. is there a reason why that is?
Post 11 Jul 2004, 19:48
View user's profile Send private message AIM Address Yahoo Messenger Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc 11 Jul 2004, 19:58
NT/2000/XP lock various memory regions and I/O ports. It's for stability, but is a pain in the neck for those of us who know what we're doing Smile
Post 11 Jul 2004, 19:58
View user's profile Send private message Visit poster's website Reply with quote
barneygumble742



Joined: 11 Jul 2004
Posts: 3
barneygumble742 11 Jul 2004, 20:18
yeah that's what i figured. thank you very much.

barneygumble742
Post 11 Jul 2004, 20:18
View user's profile Send private message AIM Address Yahoo Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.