Jump to content


TASM : Unexpected end of file encountered


  • You cannot reply to this topic
16 replies to this topic

#1 VovaWasabi

    New Member

  • Members
  • PipPip
  • 11 posts

Posted 04 November 2006 - 12:44 AM

i looked it up and found out it happens becasue of macros or labels or ifs. i dont have macros or ifs, and i prety much checked all the labels. i dont know whats wrong. any help would be apreciated. using TASM 5.0 to complie. this is my 1st assembler assignment and my teacher is old school so im not looking for ways to improve it, i jsut want to resolve the error. hers the code

cseg segment 'code'
	assume  cs:cseg,ds:cseg
	org 100h
	.186	

start: jmp real_start

;data

savescreen DW 25*80 DUP (?)

september DB '╔════════════════════════╗                                                      
║┌──────────────────────┐║                                                      
║│                      │║                                                      
║│       September      │║                                                      
║│                      │║                                                      
║└──────────────────────┘║                                                      
║┌──────────────────────┐║                                                      
║│┌──┬──┬──┬──┬──┬──┬──┐│║                                                      
║││Su│Mo│Tu│We│Th│Fr│Sa││║                                                      
║│╞══╪══╪══╪══╪══╪══╪══╡│║                                                      
║││  │  │  │  │  │ 1│ 2││║                                                      
║│├──┼──┼──┼──┼──┼──┼──┤│║                                                      
║││ 3│ 4│ 5│ 6│ 7│ 8│ 9││║                                                      
║│├──┼──┼──┼──┼──┼──┼──┤│║                                                      
║││10│11│12│13│14│15│16││║                                                      
║│├──┼──┼──┼──┼──┼──┼──┤│║                                                      
║││17│18│19│20│21│22│23││║                                                      
║│├──┼──┼──┼──┼──┼──┼──┤│║                                                      
║││24│25│26│27│28│29│30││║                                                      
║│└──┴──┴──┴──┴──┴──┴──┘│║                                                      
║└──────────────────────┘║                                                      
║         N:Next         ║                                                      
║                        ║                                                      
║         Q:Quit         ║                                                      
╚════════════════════════╝'

october DB '╔════════════════════════╗                                                      
║┌──────────────────────┐║                                                      
║│                      │║                                                      
║│       October        │║                                                      
║│                      │║                                                      
║└──────────────────────┘║                                                      
║┌──────────────────────┐║                                                      
║│┌──┬──┬──┬──┬──┬──┬──┐│║                                                      
║││Su│Mo│Tu│We│Th│Fr│Sa││║                                                      
║│╞══╪══╪══╪══╪══╪══╪══╡│║                                                      
║││ 1│ 2│ 3│ 4│ 5│ 6│ 7││║                                                      
║│├──┼──┼──┼──┼──┼──┼──┤│║                                                      
║││ 8│ 9│10│11│12│13│14││║                                                      
║│├──┼──┼──┼──┼──┼──┼──┤│║                                                      
║││15│16│17│18│19│20│21││║                                                      
║│├──┼──┼──┼──┼──┼──┼──┤│║                                                      
║││22│23│24│25│26│27│28││║                                                      
║│├──┼──┼──┼──┼──┼──┼──┤│║                                                      
║││29│30│31│  │  │  │  ││║                                                      
║│└──┴──┴──┴──┴──┴──┴──┘│║                                                      
║└──────────────────────┘║                                                      
║         B:Back         ║                                                      
║         N:Next         ║                                                      
║         Q:Quit         ║                                                      
╚════════════════════════╝'

november DB '╔════════════════════════╗                                                      
║┌──────────────────────┐║                                                      
║│                      │║                                                      
║│       November       │║                                                      
║│                      │║                                                      
║└──────────────────────┘║                                                      
║┌──────────────────────┐║                                                      
║│┌──┬──┬──┬──┬──┬──┬──┐│║                                                      
║││Su│Mo│Tu│We│Th│Fr│Sa││║                                                      
║│╞══╪══╪══╪══╪══╪══╪══╡│║                                                      
║││  │  │  │ 1│ 2│ 3│ 4││║                                                      
║│├──┼──┼──┼──┼──┼──┼──┤│║                                                      
║││ 5│ 6│ 7│ 8│ 9│10│11││║                                                      
║│├──┼──┼──┼──┼──┼──┼──┤│║                                                      
║││12│13│14│15│16│17│18││║                                                      
║│├──┼──┼──┼──┼──┼──┼──┤│║                                                      
║││19│20│21│22│23│24│25││║                                                      
║│├──┼──┼──┼──┼──┼──┼──┤│║                                                      
║││26│27│28│29│30│  │  ││║                                                      
║│└──┴──┴──┴──┴──┴──┴──┘│║                                                      
║└──────────────────────┘║                                                      
║         B:Back         ║                                                      
║                        ║                                                      
║         Q:Quit         ║                                                      
╚════════════════════════╝'


;procedures

savescreen proc near
savescreen:
	push 0B800h
	pop es	
	mov cx,25*80 
	sub bx,bx
     sc:mov ax,es:[bx]
	mov savescreen[bx],ax
	inc bx
	inc bx
	loop sc
	ret

savescreen endp
		

real_start:

	int 10h
	call savescreen
        jmp print_s


print_s: push 0B800h
	pop es
	mov cx,25*80
	sub bx,bx 
      s:mov es:[bx],september[bx]
	inc bx
	inc bx
	loop s
     si:int 16h
	cmp al,'N'
	je print_o
	cmp al,'n'
	je print_o
	cmp al,'Q'
	je quit_p
	cmp al,'q'
	je quit_p
	jmp si

print_o: push 0B800h
	pop es
	mov cx,25*80 
	sub bx,bx
      o:mov es:[bx],october[bx]
	inc bx
	inc bx
	loop o
     oi:int 16h
	cmp al,'N'
	je print_n
	cmp al,'n'
	je print_n
	cmp al,'B'
	je print_s
	cmp al,'b'
	je print_s
	cmp al,'Q'
	je quit_p
	cmp al,'q'
	je quit_p
	jmp oi

print_n: push 0B800h
	pop es
	mov cx,25*80
	sub bx,bx 
      n:mov es:[bx],november[bx]
	inc bx
	inc bx
	loop n
      ni:int 16h
	cmp al,'B'
	je print_o
	cmp al,'b'
	je print_o
	cmp al,'Q'
	je quit_p
	cmp al,'q'
	je quit_p
	jmp ni

quit_p:	push 0B800h
	pop es
	mov cx,25*80
 	sub bx,bx 
    lsc:mov es:[bx],savescreen[bx]
	inc bx
	inc bx
	loop lsc
	int 20h

cseg ends
	end start


i noticed the stuff doesnt allign because of spaces, in the text file it looked much neater =D

#2 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 04 November 2006 - 01:22 AM

You can use the code tag rather than the quote tag for posting code, it makes the alignment much nicer. I've edited it for you.

As for your actual question, afraid I can't help - I've never used TASM. I am curious though about the 'end start'. What does that do? The first line in the file declares the code segment, so I'd expect the last line to end it. And 'start' isn't a procedure but just a label, so it doesn't seem like its 'end' should need to be declared.
reedbeta.com - developer blog, OpenGL demos, and other projects

#3 VovaWasabi

    New Member

  • Members
  • PipPip
  • 11 posts

Posted 04 November 2006 - 01:43 AM

oo code tag i see, didnt see it before, sorry.

cseg ends ends the segment. but i used end start in another program cuz the teacher said thats what we have to do and it worked fine. ill try it tho.

jsut tried, same error

Assembling file: cal.ASM
**Fatal** cal.ASM(189) Unexpected end of file encountered
Error messages: 1
Warning messages: None
Passes: 1

#4 VovaWasabi

    New Member

  • Members
  • PipPip
  • 11 posts

Posted 04 November 2006 - 01:53 AM

id try masm but installation freezes up and doesnt finish

#5 VovaWasabi

    New Member

  • Members
  • PipPip
  • 11 posts

Posted 04 November 2006 - 02:31 AM

ok i figured out what hte problem is. its not working becasue i use unicode in the file and when i save it as unicode formar not ansi it gives that error. if i copy a working op code into that file it gives the same error.
any1 know how to fix it?

#6 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 04 November 2006 - 02:40 AM

What text editor are you using? If it's Notepad, you can choose the text encoding when you Save As.
reedbeta.com - developer blog, OpenGL demos, and other projects

#7 VovaWasabi

    New Member

  • Members
  • PipPip
  • 11 posts

Posted 04 November 2006 - 03:23 AM

yea. im using notepad and i save it as unicode but get the end of file error. if i dont save it as unicode tasm doesnt recognize the characters. i could write out all the unicode in hex but that will take a while. im jsut wondering if thers a way around this

#8 VovaWasabi

    New Member

  • Members
  • PipPip
  • 11 posts

Posted 04 November 2006 - 03:33 AM

maybe therse like a command u need to put in if u use unicode in your file, i dunno. ill try to google that

#9 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 04 November 2006 - 04:52 AM

Does the file end in a blank line? Some text processing programs need the last character to be a newline.
reedbeta.com - developer blog, OpenGL demos, and other projects

#10 VovaWasabi

    New Member

  • Members
  • PipPip
  • 11 posts

Posted 04 November 2006 - 05:21 AM

tried, nothing. it seems to be the actaul format of the text file. content is irrelevant. ansi format: no error. unicode format: end of file error

#11 VovaWasabi

    New Member

  • Members
  • PipPip
  • 11 posts

Posted 04 November 2006 - 03:52 PM

p retty much corrected my whole program from errors by ommiting the unicode symbols and testing the code. but i need to put the actual picture on the screen. i tried getting unicode editors but that didnt help

i drew my table using ascii tho, not unicode!! why am i even looking that up! this is so frustrating

i guess this is a general text editing question though. the way i drew the calendar table is by having an ascii chart infront of me and holding out ALT and pressign the binary code for the symbol i wanted. but i guess when i do that it adds on extra bits or whatever, im not really sure, and thats why it sees it as unicode. any ideas?

or maybe becasue i used the extended ascii table

#12 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 04 November 2006 - 05:33 PM

Does the assembler support escape sequences, like '\123' or something like that to make non-typeable characters? If so, try using those instead of typing the characters directly into the text file. Then save it using ANSI encoding.
reedbeta.com - developer blog, OpenGL demos, and other projects

#13 VovaWasabi

    New Member

  • Members
  • PipPip
  • 11 posts

Posted 04 November 2006 - 06:39 PM

yea thats what im going to have to do if i dont resolve this issue. im going to have to type all the extended ascii in hex and print em 1 by 1 that s gonna be alot of typing. extended ascii is 16 bit. is unicode 16 or 32 bit? i think if i save my file in a 16 bit mode using extended ascii ill be alright but i dont know how to do that. id porlly have to go into dos and edit it there but i dont even think i have a dos text editor ><

#14 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 05 November 2006 - 12:23 AM

The extended ASCII set is still just 8-bits. Standard ASCII uses only 7 bits (characters 0-127), so that the high bit is always zero - this was useful in the old modem days because you could put parity in the high bit. The line and corner characters you've used are all in the 128-255 zone. You shouldn't need to use any kind of multi-byte encoding.

Also keep in mind that Notepad doesn't speak ASCII. It only speaks ANSI (aka ISO-8859-1), so if you want to get it to encode extended ASCII characters you'll have to paste in the corresponding ANSI characters, which will make it look like gibberish in Notepad, since the ANSI set has different characters in the 128-255 range than ASCII. It should still come out right when printed on the terminal. However, I'd say that using escape sequences is probably your best bet for success. Use copy/paste to save typing time, obviously.

As for Unicode, it comes in multiple flavors - UTF-8, UTF-16, and UTF-32. The first two use multi-character encoding schemes for characters falling outside of their range.
reedbeta.com - developer blog, OpenGL demos, and other projects

#15 VovaWasabi

    New Member

  • Members
  • PipPip
  • 11 posts

Posted 05 November 2006 - 01:06 AM

ooo i see! imma do what you said and use the corresponding ansi characters. i think i know what you mean by escape sequence, but im not sure if i can do it in assembler. i know 2 ways of printing on the screen. passing a value to a register and then have it moved to video memory, or move an item from an array in RAM into video memory. my program uses the 2nd way, i have an array for each month, and each array has 25*80 characters, exactly the size of the display window. so all i ahve to do is print each character 1 by 1. if i use the first way im going to have to take each value and put it in the register then print it. thats 2 instructions for every character. id be able to you loops but its much easier to lose track when you do that.

anyways, thanx alot, i think we finaly solved it =D


ill so that 1st thing in the morning and let you know


ok i got it ALT+205 is ascii and ALT+0205 is ansi. imma do it tomrrow


i jsut tried to do one character tonight and the question is how to put the 128-255 ansi characters, becasue the only way i know to do it is hold ALT and type the number in decimal and the corresponding extended ACSII character pops up, not ANSI.

thanx

#16 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 05 November 2006 - 04:16 AM

By 'escape sequence' I meant that you should use them in the strings you declare in the assembly file rather than pasting extended characters directly into the assembly file. The assembler will then translate the escape sequences into the bona fide characters that they represent, and will store those in the compiled binary.

For instance, if this was C/C++, instead of writing
char *mystring = "╔════════╗";
which is likely to make the compiler choke since it doesn't expect to see extended characters, I would write
char *mystring = "\xC9\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xBB";
Those are the ASCII codes in hex for the appropriate symbols. The "\x" is interpreted by the compiler when it's lexing the string as a signal to read the hex digits that follow and insert the character with that code. You might've seen "\n" used for newlines or "\t" for tabs. That's another example of an escape sequence in C. I don't know what the escape sequences are for your assembler, though it's likely that they are similiar. Anyway, once you've declared this string, you output it to the console the same way as you would any other string. The escape sequences go away when you run the assembler.
reedbeta.com - developer blog, OpenGL demos, and other projects

#17 VovaWasabi

    New Member

  • Members
  • PipPip
  • 11 posts

Posted 05 November 2006 - 10:54 PM

i tried what u said and i got a value out of range error. its ok cuz i post below of what i did this morning. i kind of like the single character over the escape sequence (if it ever works for me) becasue in this case it makes allignment very easy. looks funny buy it works. i put colors in it and stuff, looks as hit as a dos calendar could look lol. thanx alot for all your help



sep1  DB ('ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»                                                      

sep#	 ('ºÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿º                                                      ')

sep2  DB ('ºÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿º                                                      ')

sep3  DB ('º³                      ³º                                                      ')

sep4  DB ('º³       September      ³º                                                      ')

sep5  DB ('º³                      ³º                                                      ')

sep6  DB ('ºÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙº                                                      ')

sep7  DB ('ºÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿º                                                      ')

sep8  DB ('º³ÚÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄ¿³º                                                      ')

sep9  DB ('º³³Su³Mo³Tu³We³Th³Fr³Sa³³º                                                      ')

sep10 DB ('º³ÆÍÍØÍÍØÍÍØÍÍØÍÍØÍÍØÍ͵³º                                                      ')

sep11 DB ('º³³  ³  ³  ³  ³  ³ 1³ 2³³º                                                      ')

sep12 DB ('º³ÃÄÄÅÄÄÅÄÄÅÄÄÅÄÄÅÄÄÅÄÄ´³º                                                      ')

sep13 DB ('º³³ 3³ 4³ 5³ 6³ 7³ 8³ 9³³º                                                      ')

sep14 DB ('º³ÃÄÄÅÄÄÅÄÄÅÄÄÅÄÄÅÄÄÅÄÄ´³º                                                      ')

sep15 DB ('º³³10³11³12³13³14³15³16³³º                                                      ')

sep16 DB ('º³ÃÄÄÅÄÄÅÄÄÅÄÄÅÄÄÅÄÄÅÄÄ´³º                                                      ')

sep17 DB ('º³³17³18³19³20³21³22³23³³º                                                      ')

sep18 DB ('º³ÃÄÄÅÄÄÅÄÄÅÄÄÅÄÄÅÄÄÅÄÄ´³º                                                      ')

sep19 DB ('º³³24³25³26³27³28³29³30³³º                                                      ')

sep20 DB ('º³ÀÄÄÁÄÄÁÄÄÁÄÄÁÄÄÁÄÄÁÄÄÙ³º                                                      ')

sep21 DB ('ºÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙº                                                      ')

sep22 DB ('º         N:Next         º                                                      ')

sep23 DB ('º                        º                                                      ')

sep24 DB ('º         Q:Quit         º                                                      ')

sep25 DB ('ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ')









1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users