The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: zak100 on December 13, 2009, 03:23:50 PM

Title: Not printing proper message
Post by: zak100 on December 13, 2009, 03:23:50 PM
Hi,
I am tying to print a mesg using my kernel. I got this from this forum but I have modified the code. I am not using bios but
I am trying to print directly on screen. The code is given below:


.MODEL  TINY
        .CODE

;----------------------------------------------------------------------------------

LoadOfs EQU     0               ;must match the value in the bootloader source file

;----------------------------------------------------------------------------------

;---------------------- initialize ES segment register

        ORG     0

Start:  push    cs
        pop     ds
       
;-----------clear screen
mov ax, 3
int 10h

   
;---------------------- writing a message on screen at startup, character by character- we can't use int 21h
overdata:
        xor di, di
        mov ax, 0B800h
        mov es, ax
        mov si, offset msg0
       
msgloop:
        lodsb; loads al with a byte of data pted by ds:si
        or al, al
        jz Halt0
        stosw; transfers the contents of al to mem location ptd by es:di
        jmp msgloop
       

;---------------------- done - halt

Halt0: hlt
jmp     Halt0

;---------------------- data area in code segment

Msg0    db      "We be bootin234!"

;----------------------------------------------------------------------------------

        END     Start



The boot sector code is also given below which I again got from this forum:



.MODEL  TINY
        .CODE

;----------------------------------------------------------------------------------

LoadOfs EQU     0
LoadSeg EQU     1000h

;----------------------------------------------------------------------------------

;---------------------- branch to executable code

        ORG     0

Boot0:  jmp short Boot1
nop
;---------------------- OEM identifier

        ORG     3

        DB      "Zulfi OS"

;---------------------- BIOS parameter block for 1.44 Mb floppy disk

        ORG     0Bh

bpbBytesPerSector    DW 512
bpbSectorsPerCluster DB 2; 1
bpbReservedSectors   DW 1
bpbNumberOfFATs      DB 2
bpbRootEntries       DW 112; 224
bpbTotalSectors      DW 1440; 2880
bpbMedia             DB 0F9H; 0F0h
bpbSectorsPerFAT     DW 3; 9
bpbSectorsPerTrack   DW 9; 18; different (18)
bpbHeadsPerCylinder  DW 2
bpbHiddenSectors     DD 0
bpbTotalSectorsBig   DD 0
bsDriveNumber        DB 0
bsUnused             DB 0
bsExtBootSignature   DB 29h
bsSerialNumber       DD 0a0a1a2a3h
bsVolumeLabel        DB "MOS FLOPPY "
bsFileSystem         DB "FAT12   "

;---------------------- initialize SS:SP

Boot1:  cli                     ;disable maskable interrupts
        xor     di,di
        mov     ss,di
        mov     sp,7C00h        ;SS:SP = 0000:7C00
        sti                     ;enable maskable interrupts

;---------------------- display 'A' character

        cld
        mov     ax,0B800h
        mov     es,ax
        mov     ax,1F41h
        stosw

;---------------------- wait for a keypress

        mov     ah,0
        int     16h

;---------------------- read the bootloader code

        mov     cx,5            ;retry count

Reset0: push    cx
        mov     ah,0            ;reset floppy disk function
        mov     dl,0            ;drive A:
        int     13h

        mov     ax,LoadSeg      ;read sector into address LoadSeg:LoadOfs
        mov     es,ax
        mov     bx,LoadOfs

        mov     cx,2            ;cylinder 0, sector 2
        xor     dx,dx           ;head 0, drive 0
        mov     ax,201h         ;read 1 sector
        int     13h
        pop     cx
        jnc     Exec0

        loop    Reset0

;---------------------- failed 5 times - halt
;---display 'F' character  to show the failure occured
mov ax, 0B800h
mov es, ax
mov Di,4
mov ax, 9c46h
stosw


Halt0:  hlt
      jmp     Halt0

;---------------------- execute the bootloader code


Exec0:
        db      0EAh            ;JMP FAR instruction
        dw      LoadOfs         ;offset
        dw      LoadSeg         ;segment

;---------------------- boot sector signature

        ORG     1FEh

        dw      0AA55h

;----------------------------------------------------------------------------------

        END     Boot0


I am getting foloowing text printed in white color with light blue background (bg) and its blinking.

We be bootin234!OS FLOPPY FAT12 (& ... garbage)

It should print only:

We be bootin234!

without blinking and not in light blue bg.

Can somebody plz help me with this.

Zulfi.

Title: Re: Not printing proper message
Post by: dedndave on December 13, 2009, 03:34:46 PM
hiya Zulfi
1) you should use CLD before the loop - the DF is probably clear, but no guarantee
2) mov si,offset msg0+LoadOfs - that way, it gets corrected if LoadOfs is changed
3) you are getting the blinking grey on ugly blue (cyan i think it is) because that is the color for attribute 0B8h - lol
     put the attribute you want in AH (7) before the loop
4) the loop displays a null-terminated string, but your string has no terminator - ...bootin234!",0

EDIT - oh - you can test that code by writing it in a .COM or .EXE program - that way, you don't have to boot a floppy every time   :bg

a handy animated GIF...

(http://www.cs.uregina.ca/Links/class-info/250/f06/lab9/TextModeColors.gif)
Title: Re: Not printing proper message
Post by: FORTRANS on December 13, 2009, 04:15:54 PM
Hi,

   The code you show is testing for a zero termination byte.
change your code like the following.


Msg0    db      "We be bootin234!", 0


Regards,

Steve N.
Title: Re: Not printing proper message
Post by: zak100 on December 13, 2009, 06:42:31 PM
Thanks. Its working now. Whats the purpose of this gif? Is it the binary of my prog.?

Zulfi.
Title: Re: Not printing proper message
Post by: dedndave on December 14, 2009, 12:22:21 AM
no lol
it is an animated GIF for picking text-mode screen attributes
save it as reference material
if you want to know what attribute byte you need to make a certain color/blink combintation, refer to the pic
see what the char looks like to the left of 0B8h ? - lol
Title: Re: Not printing proper message
Post by: rags on December 14, 2009, 02:11:57 AM
that's pretty cool Dave, even though I don't work in 16-bit.
Did you make that gif?
Title: Re: Not printing proper message
Post by: dedndave on December 14, 2009, 02:34:38 AM
lol - no - i cobbed it off some university site (Univ of Regina Canada)
i was thinking of making a similar one that has the characters, as well   :P
they wasted some space with 0's
Title: Re: Not printing proper message
Post by: MichaelW on December 14, 2009, 03:19:38 AM
The table does not show the high-intensity background colors available when the blink/intensity bit in the mode control register is set to zero. IMO high-intensity background colors are more useful than blinking characters.
Title: Re: Not printing proper message
Post by: dedndave on December 14, 2009, 10:52:29 AM
oh - i thought they were underlined
but, now that you mention it, i do recall the intensity thing
that may be adapter specific

by re-mapping the upper 128 characters, you can do some interesting things with text mode graphics - lol
but - the normal graphics modes are much easier to use nowdays due to the vesa interface
this is something i haven't spent much time with, as yet   :bg

Zulfi's bug was just interesting because he had the remnant in AH from loading the ES register with 0B800h from AX - lol
Title: Re: Not printing proper message
Post by: FORTRANS on December 14, 2009, 02:32:55 PM
Hi,

   A quick cut-and-paste...


; - Attribute Byte defines colors (and blink) -
; - bit7 - bit6 - bit5 - bit4 + bit3 - bit2 - bit1 - bit0 -
; - Blink   red  green   blue  intense  red  green   blue -
; - fore -  background color  +      foreground color     -


   I have not seen high intensity backgrounds in "normal" use.

Steve

Edit:

   Ah, reread MichaelW's comment.  Right...  Oops.  It does
need a tweak though.

SRN
Title: Re: Not printing proper message
Post by: MichaelW on December 14, 2009, 09:51:58 PM
Quotethat may be adapter specific

It is standard for the EGA/VGA.

Title: Re: Not printing proper message
Post by: dedndave on December 14, 2009, 09:53:54 PM
gawd - i must be thinking of MDA cards - talk about showing my age - lol
Title: Re: Not printing proper message
Post by: FORTRANS on December 14, 2009, 10:22:01 PM
Hi,

   Dave, there is a monochrome EGA/VGA video mode that
emulates an MDA.  Here on a Windows 2000 machine, I
cannot set video modes in any reasonable sense.  But it
works on other systems.  Maybe it would work on yours?

   Since MichaelW mentioned the intense background, and I
have been seting colors using escape sequences with the
ANSI.SYS device, I didn't see the intense background.  So
I coded one up to set things using the BIOS.  And I figured
I should share it.  Shows blinking characters, then goes on
to show the intense background.

Regards,

Steve N.
Title: Re: Not printing proper message
Post by: dedndave on December 15, 2009, 11:26:14 AM
great Steve - lol
when i run that on mine, it is high-intensity BG and stays that way - no change between keypresses
seeing as how there is no source....................   :(

but - here's a little goodie for you
many years ago, i wrote a vga ansi.sys driver (config.sys type)

it has a dos screen-saver built in   :bg
i tried to keep it small and fast
you can also control the character re-map buffer size
let me see if i can find the doc file for it, as well

assemble it as though it were a .COM program, then rename to .SYS
i used masm v 5.10 back then
i don't know how well it would work under win 2k or XP - never tried it
but, i used to use it with win 98 and earlier OS's

EDIT - i was looking for the doc - it is on one of my (many) older/smaller drives

looking at this one, you can define:
the size of the sequence buffer
the size of the re-assignment buffer
the time-out for the screen-saver
and which interrupts bring you out of screen-save

i seem to recall a more recent version that also allowed int 33h to bring it out of screen-save
but, this is from memory

DEVICE=VGAANSI.SYS t300 s80 r128 i16 i10

screen saver time = 5 minutes (300 seconds - 3600 max - t0 disables screen-saver)
sequence buffer = 80 bytes
re-assignment buffer = 128 bytes
INT 16 or INT 10h bring you out of screen-save

i don't recall all the default values, but i know if you specify nothing, it works like the standard ANSI.SYS plus a 5 minute screen-saver

as i remember, the whole thing is like 384 bytes installed - lol
Title: Re: Not printing proper message
Post by: FORTRANS on December 15, 2009, 03:00:48 PM
Quote from: dedndave on December 15, 2009, 11:26:14 AM
great Steve - lol
when i run that on mine, it is high-intensity BG and stays that way - no change between keypresses
seeing as how there is no source....................   :(

Hi Dave,

   Bizarre.  I probavly shouldn't post one off code, but...
Uncomment lines to change operating behaviour.  (Bad.)
You can then play with the Monochrome display mode.
As far as no blinking, copy/paste the set attribute stuff
at the end up front and reverse the setting.  How the
cusom colors did not work is beyond me.  It has worked
on all machines I've tried it on.  Unless you do it in a
window?  It should/must be run full screen.

   Yep, it misperforms nicely in a window.  Sigh.  Go full
screen.  Do a "Mode 80,25".  And then run the silly thing.
Amazing what people come up with!

   Anyway, hold on to your breakfast, here's the code.
The stuff keyboard stuff works in DOS, but not in Windows
2000.  Masm 5.0 was used if that matters.


        PAGE ,132
        TITLE Check 16 Color Text
        NAME  ColorT16

        COMMENT *
6 December 2005
   Following a thread on comp.asm.x86, I looked into the 16 color video
modes of the EGA/VGA.  Main source was "Programmer's Guide to PC Video
Systems" by Richard Wilton.

   Also, one of the "bright" ideas was inspired by the ANSI color
changes observed in COLORS.TXT.  However, that is 16 color text mode.
*

        COMMENT *
14 December 2009, thread on MASM Forum, set Blink/Intensity.  Tried
keyboard stuffing "mode co80", but Win2k barfs.
        *

        .XCREF
        .XLIST
INCLUDE DEFMS.ASM   ; MACRO and MS-DOS definitions from Heath/Zenith software
        DOSF_GETPSP     EQU 62H         ; Get Program Segment Prefix
        .LIST
        .CREF

                ; DEBUG equates
DEBUG   EQU     0       ; Debug

; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Set up the code definitions the operating system wants.  Stack segment:
STCKSG  SEGMENT STACK
        ASSUME  SS:STCKSG, CS:CODE
        DB      32 DUP('STACK   ')      ; Stack area, and filler (512 Bytes)
STCKSG  ENDS

; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Set up the code definitions the operating system wants.  Data segment:
DATASG  SEGMENT PUBLIC
        ASSUME  DS:DATASG, SS:STCKSG, CS:CODE

MSG1    DB      ' Hit a key to continue. $'
MSG2    DB      ' Custom colors. $'
MSG3    DB      ' Altered lbink register. $'
Cmd     DB      'mode co80'
   
; - - - Display routines related data area - - -

RESET_DAT DB   0, 1, 2, 3, 4, 5, 38, 7, 56, 9, 18, 27, 36, 45, 54, 63

; - - - End display routines related data area - - -

DATASG  ENDS

; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Set up the code definitions the operating system wants.  Code segment:
CODE    SEGMENT PUBLIC
        ASSUME  CS:CODE,DS:DATASG,ES:NOTHING,SS:STCKSG

START   PROC
        MOV     AX,SEG DATASG   ; Set DS for rest of code ...
        MOV     DS,AX
        MOV     AX,0B800H       ; Set ES to color text video page
;        MOV     AX,0B000H       ; Set ES to mono text video page
        MOV     ES,AX

        MOV    AX,3     ; Fn 0, set video mode
        INT    10H      ; Video BIOS

; - Attribute Byte defines colors (and blink) -
; - bit7 - bit6 - bit5 - bit4 + bit3 - bit2 - bit1 - bit0 -
; - Blink   red  green   blue  intense  red  green   blue -
; - fore -  background color  +      foreground color     -

; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Draw a 16x16 block of all possible attributes

        MOV     DX,0    ; Line Counter
        MOV     DI,320  ; Point to second line of Video Page
CT_1:
        MOV     CX,16   ; 16 blocks
CT_2:
        XOR     AX,AX
        MOV     AL,DL
        SHL     AL,1
        SHL     AL,1
        SHL     AL,1
        SHL     AL,1
        ADD     AL,16
        SUB     AL,CL
        PUSH    AX
        CALL TOASCII

        POP     AX
        PUSH    AX
        XCHG    AL,AH
        MOV     AL,BH
        STOSW

        POP     AX
        XCHG    AL,AH
        MOV     AL,BL
        STOSW
        XOR     AX,AX
        STOSW

        LOOP    CT_2

        INC     DX      ; Line Counter
        ADD     DI,160-96 ; Point to Start of Next Line
        CMP     DX,16
        JB      CT_1

        MOV     DX,OFFSET Msg1
        SCALL OUTSTR

        XOR     AX,AX
        INT     16H

        XOR     SI,SI
RESET_V2:
        MOV     BX,SI   ; Palette register (0-15)
        MOV     BH,RESET_DAT[SI] ; rgbRGB
        MOV     AH,10H  ; Set EGA Palette BIOS function
        MOV     AL,0    ; Set EGA Palette
        INT     10H
        INC     SI
        CMP     SI,16
        JL      RESET_V2

        MOV     DX,OFFSET Msg2
        SCALL OUTSTR

        XOR     AX,AX
        INT     16H

        MOV     AH,10H  ; Set EGA Palette BIOS function
        MOV     AL,3H   ; Set Background Intensity/Blink state
        MOV     BL,0    ; 1 = blink, 0 intensity
        INT     10H

        MOV     DX,OFFSET Msg3
        SCALL OUTSTR

        XOR     AX,AX
        INT     16H

;        MOV     AX,SEG DATASG   ; Set ES for string instruction.
;        MOV     ES,AX
;        MOV     CX,9
;        MOV     SI,OFFSET CMD

;CT_3:
;        PUSH    CX
;        LODSB
;        PUSH    SI

;        MOV     CL,AL           ; ASCII value
;        MOV     CH,71           ; fake Scan Code
;        MOV     AH,5            ; Stuff keyboard buffer
;        INT     16H             ; Keyboard BIOS

;        POP     SI
;        POP     CX
;        LOOP    CT_3

;        MOV     CL,0            ; Non-ASCII
;        MOV     CH,71           ; Scan Code Home
;        MOV     AH,5            ; Stuff keyboard buffer
;        INT     16H             ; Keyboard BIOS

; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

;       Close down
;       **********
        SCALL   EXIT    ; Enter dos

START   ENDP

; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; THIS ROUTINE CONVERTS THE ONE BYTE BINARY NUMBER IN THE AL-REGISTER INTO
; ITS HEXADECIMAL ASCII REPRESENTATION AND places THESE TWO BYTES iNTO THE
; BX register.

TOASCII:
        PUSH   AX
        AND    AX,0F0H
        SHR    AX,1
        SHR    AX,1
        SHR    AX,1
        SHR    AX,1
        CALL   CONVERT
        MOV    BH,AL

        POP    AX
        AND    AX,0FH
        CALL   CONVERT
        MOV    BL,AL

        RET

; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; THIS ROUTINE CONVERTS A SINGLE DIGIT HEX CODE IN THE RANGE 0 TO 15
; TO ITS ASCII 8 BIT BYTE EQUIVALENT.
; ENTER AND RETURN WITH THE ARGUEMENT IN THE AL-REG.

CONVERT:
        CMP AL,0AH      ; SEE IF NOT NUMERIC
        JC CON1         ; JUMP IF IN  RANGE 0 TO 9
        ADD AL,07H      ; LETTER "A" IS 7 AFTER NUMBER "9"
CON1:   ADD AL,30H      ; NUMBER "0" IS ASCII CODE 30H
        RET

; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CODE    ENDS
        END     START


Quote
but - here's a little goodie for you
many years ago, i wrote a vga ansi.sys driver (config.sys type)

it has a dos screen-saver built in   :bg
i tried to keep it small and fast
you can also control the character re-map buffer size

   I will take a look.

Thanks,

Steve N.
Title: Re: Not printing proper message
Post by: dedndave on December 15, 2009, 07:06:34 PM
man, Steve, you are a blast from the past - lol

QuoteINCLUDE DEFMS.ASM   ; MACRO and MS-DOS definitions from Heath/Zenith software

what really hurts is, if i dig through my shed, i probably have that file   :lol

EDIT - a little googling - you must have a "bogus" nic on another site - lol

i found the defms.asm file
this index has a lot of z-100 stuff you may find interesting
http://people.cis.ksu.edu/~mcalhoun/Z-100/
Title: Re: Not printing proper message
Post by: FORTRANS on December 15, 2009, 07:21:13 PM
Hi,

   Oh, indeed.  ;-)

Regards,

Steve N.

Edit:

   Hmm, trying to get me to get a Z-100 up and running?
They were fun to tinker with.  But they really scare you
when the smoke comes out...

SRN
Title: Re: Not printing proper message
Post by: dedndave on December 16, 2009, 01:39:12 PM
as a young ham radio operator (living in Michigan, no less), i have built a few heathkits in my time
in fact, the old HF station was a heath sb-101 and sb-220 that i built as a teen
you can imagine my temptation to lean toward the heath-zenith z-100 stuff
fact is - i thought their prices were too high - lol

(http://szoncso.com/fritz6x6/Heathkit_SB-101.jpg)
(http://www.rigpix.com/linears/heathkit_sb220.jpg)
Title: Re: Not printing proper message
Post by: zak100 on December 16, 2009, 01:45:48 PM
Great! I like your interest.

Zulfi.
Title: Re: Not printing proper message
Post by: FORTRANS on December 16, 2009, 02:54:52 PM
Hi again,

Quotethis index has a lot of z-100 stuff you may find interesting

   Nice, thanks.

QuoteI will take a look.

   Rather nice code.  It is going to take a while to digest.
You had a dislike of long labels?  I think I will have to try it
out sometime.

Quoteyou can imagine my temptation to lean toward the heath-zenith z-100 stuff
fact is - i thought their prices were too high - lol

   Well, the Z-100's were used at Eglin, so some showed up
somewhere along the line, and we formed a club.  And for
what you got, they were not more expensive than IBM PC's
or DEC Rainbows.  And you got all sorts of strange documentation
in the Heath tradition.  You could use up a massive amount of
time either with the software or the hardware.  (Or both!  I got
a TV capture board and translated its software from Z-80 land.)

   I wanted to build some of the Heathkit stuff, but chickened
out on the radios.  Nice looking units.

   Did you get things a blinking?

Regards,

Steve N.
Title: Re: Not printing proper message
Post by: zak100 on December 16, 2009, 06:08:09 PM
Thanks for mentioning this Z-100 page. It has a large number of zipped programs. I hope they can be useful.


Zulfi.
Title: Re: Not printing proper message
Post by: dedndave on December 16, 2009, 07:11:20 PM
well, Zulfi
Steve and I got a little off-topic and hi-jacked your thread - lol
we didn't think you'd mind    :P
Title: Re: Not printing proper message
Post by: zak100 on December 27, 2009, 06:36:41 PM
Hi,
I have modified the boot loader by putting the message (mesg) in data segment. Again I am not getting the mesg displayed. I have checked the debug. SI is pointing to DS but when I do lodsb, AL is not getting correct value from the string.



The code is given below:



.MODEL  SMALL
.data
Msg0    db      "We be bootin234!",0

        .CODE

;----------------------------------------------------------------------------------

LoadOfs EQU     0               ;must match the value in the bootloader source file

;----------------------------------------------------------------------------------

;---------------------- initialize ES segment register

        ORG     0

Start:  ;push    cs
        ;pop     ds
       
;-----------clear screen
mov ax, 3
int 10h

   
;---------------------- writing a message on screen at startup, character by character- we can't use int 21h
overdata:
        mov ax, @data
        mov ds, ax
        xor di, di
        mov ax, 0B800h
        mov es, ax
        mov si, offset msg0
       mov ah, 41h; attribute byte
       cld;
msgloop:
        lodsb; loads al with a byte of data pted by ds:si
        or al, al
        jz Halt0
        stosw; transfers the contents of al to mem location ptd by es:di
        jmp msgloop
       

;---------------------- done - halt

Halt0: hlt
jmp     Halt0

END     Start





Kindly help me with this.

Zulfi.
Title: Re: Not printing proper message
Post by: dedndave on December 27, 2009, 07:00:28 PM
hi Zulfi
well - for testing under DOS, you want to be ORG'ed at 100h - model tiny - that makes a .COM program
(no .data segment)

to make an IO.SYS file - ORG at 0 - again - no .data segment
the data is in the same segment as the code
it needs to appear at the end, after the code (easiest way)
to load a multi-segment program the EXEC loader is required
you don't have an EXEC loader because you have no DOS or other OS installed
so - push cs/pop ds will get the code segment into the DS register for you

for IO.SYS...
        mov si, offset msg0+LoadOfs
Title: Re: Not printing proper message
Post by: zak100 on December 28, 2009, 06:57:51 PM
Thanks. But this I had already done with the support of you people on this forum. Now I was trying to prepare myself for protected. I saw in the book that we need data segment for pmode. So waht I conclude from your statement that if want to switch to pmode we cant print any mesg until we are in pmode??

Now I have added another mesg in the above code but its again not printing! I am providing the code below:


.MODEL  TINY



        .CODE

;----------------------------------------------------------------------------------

LoadOfs EQU     0               ;must match the value in the bootloader source file

;----------------------------------------------------------------------------------

;---------------------- initialize ES segment register

        ORG     0

Start:  push    cs
        pop     ds
       
;-----------clear screen
mov ax, 3
int 10h

   
;---------------------- writing a message on screen at startup, character by character- we can't use int 21h
overdata:
       
        xor di, di
        mov ax, 0B800h
        mov es, ax
        mov si, offset msg0+LoadOfs
       mov ah, 41h; attribute byte
       cld;
msgloop:
        lodsb; loads al with a byte of data pted by ds:si
        or al, al
        jz nextmesg
        stosw; transfers the contents of al to mem location ptd by es:di
        jmp msgloop
       
nextmesg:xor di, di
        mov ax, 0B820h
        mov es, ax
        mov si, offset msg2+LoadOfs
       mov ah, 41h; attribute byte
       cld;
msg2loop:
        lodsb; loads al with a byte of data pted by ds:si
        or al, al
        jz Halt0
        stosw; transfers the contents of al to mem location ptd by es:di
        jmp msg2loop
;---------------------- done - halt

Halt0: hlt
jmp     Halt0

;---------------------- data area in code segment


Msg0    db      "We be bootin234!",0
Msg2    db      "Moving to protected mode!",0
;----------------------------------------------------------------------------------

        END     Start




Its showing the first screen prints 'A' using the bootloader code, which I again developed through this forum. After printing 'A' it hangs up. Its not even doing clrscr. I have checked this through debug and I found that AL becomes 0, so the zero flag is enabled.

Kindly help me in this rergard.

Zulfi.
Title: Re: Not printing proper message
Post by: dedndave on December 28, 2009, 07:39:47 PM
hi Zulfi
that code looks like it ought to work
maybe it is not being placed on the floppy at the right location
or, it is not the first entry in the root directory

as for setting up a data segment for protected mode
you have a long way to go to get there
i mean, you can get to protected mode and perhaps do a couple trivials
but, a lot of OS needs to be in place to make it useful
and - yes - once that is loaded, then you can be segmented
but at the time this preliminary code is running, there is no EXEC loader present
that is one of the things you will have to provide

before you worry about getting into protected mode,
you should worry about getting the basics up and running

error handlers - in case there is a disk or other error
disk I/O - in order to load the rest of the OS
EXEC loader so you can load rudimentary programs
keyboard and screen interface so you can use EXEC to run tests without writing a new boot disk 20 times a day

writing an OS is a major undertaking
it is best approached by experienced programmers who have a firm grasp of the hardware
Title: Re: Not printing proper message
Post by: zak100 on December 29, 2009, 05:41:22 AM
Thanks for your guidance. What should I be doing to get rid of this error?

Zulfi.
Title: Re: Not printing proper message
Post by: sinsi on December 29, 2009, 06:01:13 AM
Give us all of your code in a zip attachment and your commands to write to a floppy, and we'll see what's going on.
Title: Re: Not printing proper message
Post by: FORTRANS on December 29, 2009, 01:52:27 PM
Hi,

   Just tried the posted code.  Once I remembered to hit
a key to go on, it worked.  Showed both messages.

Regards,

Steve
Title: Re: Not printing proper message
Post by: zak100 on December 29, 2009, 02:30:35 PM
Hi,
I have tried again and its working now. Sorry for taking your time but thanks for your attention in this regard. Maybe I was using some wrong file last time.

Zulfi.