What's wrong in the following code?
****************************************
.MODEL SMALL
ROM_BIOS_DATA SEGMENT at 40h
org 1Ah
head dw ?
tail dw ?
buffer dw 16
buffer_end label word
ROM_BIOS_DATA ENDS
code SEGMENT
ORG 100h
_readem proc near
assume ds:ROM_BIOS_DATA
mov bx, ROM_BIOS_DATA ;<---------------Showing error in this line
mov ds, bx
.....
*************************************
Thanks for your help.
****************************************
.MODEL SMALL
ROM_BIOS_DATA SEGMENT at 40h
org 1Ah
head dw ?
tail dw ?
buffer dw 16
buffer_end label word
ROM_BIOS_DATA ENDS
code SEGMENT
ORG 100h
_readem proc near
assume ds:ROM_BIOS_DATA
mov bx, ROM_BIOS_DATA ;<---------------Showing error in this line
mov ds, bx
.....
*************************************
Thanks for your help.
ROM_BIOS_DATA is a structure not a data.
Sorry, I couldn't get you!:confused:
Isn't it declared as a segment?
ROM_BIOS_DATA SEGMENT at 40h
Why this is a structure?
Thanks.
Isn't it declared as a segment?
ROM_BIOS_DATA SEGMENT at 40h
Why this is a structure?
Thanks.
pentagenius
RTFM masmref
RTFM masmref
A4013: instructions and initialized data not supported in AT segments
An instruction or initialized data was found in a segment defined with the AT attribute. The code or data will not be loaded at run time.
Data in AT segments must be declared with the ? initializer.
try changeAn instruction or initialized data was found in a segment defined with the AT attribute. The code or data will not be loaded at run time.
Data in AT segments must be declared with the ? initializer.
buffer dw 16
onbuffer dw 16 dup (?)
The weird thing is that I do not what is the following
There is no ROM_BIOS_DATA struct to declare it as a struct, but it is not data as there is the ROM_BIOS_DATA ends.
head dw ?
tail dw ?
buffer dw 16
buffer_end label word
ROM_BIOS_DATA ENDS
There is no ROM_BIOS_DATA struct to declare it as a struct, but it is not data as there is the ROM_BIOS_DATA ends.
rotivc,
he defined a segment at : ROM_BIOS_DATA SEGMENT at 40h
Segment and struct always end with ENDS keyword.
hm..is that a com file u tryto code?
than use this template:
he defined a segment at : ROM_BIOS_DATA SEGMENT at 40h
Segment and struct always end with ENDS keyword.
hm..is that a com file u tryto code?
than use this template:
.MODEL TINY
.CODE
ORG 100H
START: JMP INIT
INIT:
INT 20H
END START
wizzra, u r correct, it's a beginning snippet from a .COM file.
Thanks for your template, I already know about it.
But as far as I can remember, this code used to work well back at Masm 5 days. And believe me, if I am not missing out something here, this was quite a standard approach to get some ROM data (many used for warm booting).
What I am interested in knowing why this is not working now?
Thanks.
Thanks for your template, I already know about it.
But as far as I can remember, this code used to work well back at Masm 5 days. And believe me, if I am not missing out something here, this was quite a standard approach to get some ROM data (many used for warm booting).
What I am interested in knowing why this is not working now?
Thanks.
pentagenius,
this1 works:
here is my old post:
Don't mix 16bit MASM (DOS) code and 32bit MASM (Windows) code
Here is an example wih 16 bit MASM(DOS) code.
You should use older tools (MASM compiler and linker) too
We will create 16 bit DOS EXE file test.exe with Make16e.bat
It is the contents of the test.asm file
We will create 16 bit DOS COM file test1.com with Make16c.bat
It is the contents of the test1.asm file
Here is the contents of the Make16e.bat file
Here is the contents of the Make16c.bat
Where:
- ml1.exe is MS MASM compiler ver. 6.14
- link16.exe is the old MS Linker ver.5.60
You can download it from:
ftp://ftp.microsoft.com/ softlib/mslfiles/lnk563.exe
start it and next rename the link563.exe to link16.exe
To create 32bit MASM (Windows) code with the newer tools
just take a look in your MASM32 directory and forget about Int 21h.
Regards,
Lingo
this1 works:
ROM_BIOS_DATA equ 40h
Buf_head equ 1Ah ; (0040:001A=0) ;"Head"
Buf_tail equ 1Ch ; (0040:001C=0) ;"Tail"
Kb_bufstart equ 80h ; (0040:0080=0) keyboard buffer offset start address(1Eh)
.286
.model tiny
option segment : use16
.code
org 100h
assume ds:@code, es:nothing, ss:nothing
Start:
jmp Start1
head dw ?
tail dw ?
buffer dw 16
Start1:
assume ds:nothing
mov bx, ROM_BIOS_DATA ;[B]NO[/B] Showing error in this line
mov ds, bx
assume ds:@code
;search for an previously installed copy of bds program
cld
not byte ptr Start ; modify to avoid false match
xor bx, bx ; start search at segment zero
mov ax, cs ; compare to this code segment
mov ds, ax
next_segment:
inc bx ; look at next segment
mov cx, 32 ; 64 bytes must match
cmp ax, bx ; until reaching this code seg
mov es, bx
je loaded
mov si, 100h ; setup to compare strings
mov di, 100h ; 100h -> offset Start
rep cmpsw ; compare ds:si to es:di
test cl, cl ; did the strings match?
jne next_segment ; if no match, try next segment
loaded:
;...
mov ah, 4Ch ; exit to dos
int 21h
End Start
here is my old post:
Don't mix 16bit MASM (DOS) code and 32bit MASM (Windows) code
Here is an example wih 16 bit MASM(DOS) code.
You should use older tools (MASM compiler and linker) too
We will create 16 bit DOS EXE file test.exe with Make16e.bat
It is the contents of the test.asm file
.model small
option segment:use16
;It is EXE file
;dseg segment para public 'data'
.data
str1 db 'Hello world','$'
;dseg ends
;sseg segment para public 'stack'
;sseg ends
.stack
.code
;cseg segment para public 'code'
;assume cs:cseg;, ds:dseg
_start:
mov ax, @data ;$dseg
mov ds, ax
mov es, ax
mov dx, offset str1
mov ah, 9
int 21h
mov ah, 4ch
int 21h
;cseg ends
end _start
We will create 16 bit DOS COM file test1.com with Make16c.bat
It is the contents of the test1.asm file
.model tiny
option segment:use16
; It is COM file
;sseg segment para public 'stack'
;sseg ends
;.stack
.code
;cseg segment para public 'code'
;assume cs:cseg, ds:cseg, es:cseg
ORG 100h
_start:
mov ax, cs
mov ds, ax
mov es, ax
mov dx, offset str1
mov ah, 9
int 21h
mov ah, 4ch
int 21h
str1 db 'Hello world','$'
;cseg ends
end _start
Here is the contents of the Make16e.bat file
@echo off
rem create exe file
\masm32\bin\ml1 /c /Zm /nologo test.asm
\masm32\bin\link16 /nologo test.obj,,,,,
if exist test.obj del test.obj
if exist test.map del test.map
Here is the contents of the Make16c.bat
@echo off
rem create com file
\masm32\bin\ml1 /c /Zm /AT /nologo test1.asm
\masm32\bin\link16 /TINY /nologo test1.obj,test1.com,,,,
if exist test1.obj del test1.obj
if exist test1.map del test1.map
Where:
- ml1.exe is MS MASM compiler ver. 6.14
- link16.exe is the old MS Linker ver.5.60
You can download it from:
ftp://ftp.microsoft.com/ softlib/mslfiles/lnk563.exe
start it and next rename the link563.exe to link16.exe
To create 32bit MASM (Windows) code with the newer tools
just take a look in your MASM32 directory and forget about Int 21h.
Regards,
Lingo
wizzra, u r correct, it's a beginning snippet from a .COM file.
Thanks for your template, I already know about it.
But as far as I can remember, this code used to work well back at Masm 5 days. And believe me, if I am not missing out something here, this was quite a standard approach to get some ROM data (many used for warm booting).
What I am interested in knowing why this is not working now?
Thanks.
Tenkey, Lingo12 thanks a lot to both of you.
That really helped.:grin:
That really helped.:grin: