![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jan 2006
Posts: 1
Rep Power: 0
![]() |
Making a temperature converter in assembly
Hello everyone,
I'm new to assembly, but I've got most of the basics so I'm trying to make a temperature converter. However, TLINK tells me there's no program entry point when I try to link it. No problems with TASM, it's just TLINK that gives the error. Any help would be appreciated. Thanks! Here's my code: ---------------------------- .model small .stack .data lf equ 0ah cr equ 0dh prompt1 db cr,lf,"Enter task: ","$" prompt1a db cr,lf,"[1] Convert centigrade to farenheit","$" prompt1b db cr,lf,"[2] Convert farenheit to centigrade","$" prompt2 db cr,lf,"Enter temp: ","$" .code main proc far mov ax,@data mov ds,ax call firstprompt cmp al,'1' je centigrade cmp al,'2' je farenheit jmp firstprompt main endp firstprompt: mov ax,offset prompt1 call write mov ax,offset prompt1a call write mov ax,offset prompt1b call read ret write: mov ah,09h int 21h ret read: mov ah,01h int 21h ret centigrade: jmp entertemp sub ax,32d mov bx,5d mul bx mov bx,9d div bx call write farenheit: jmp entertemp mov bx,9d mul bx mov bx,5d div bx mov bx,32d add ax,bx call write entertemp: mov ax,offset prompt2 call write call read ret endprog: mov ax,4c00h int 21h end Last edited by GothicSheep; Jan 29th, 2006 at 1:02 AM. Reason: Syntax error |
|
|
|
|
|
#2 |
|
Game engine designer
Join Date: May 2005
Location: Sweden
Posts: 288
Rep Power: 4
![]() |
I tried to link your program and got the error that there were no entry point in the program. I added two rows, and then it worked. Try this code.
.model small .stack .data lf equ 0ah cr equ 0dh prompt1 db cr,lf,"Enter task: ","$" prompt1a db cr,lf,"[1] Convert centigrade to farenheit","$" prompt1b db cr,lf,"[2] Convert farenheit to centigrade","$" prompt2 db cr,lf,"Enter temp: ","$" .code start: ; ADDED main proc far mov ax,@data mov ds,ax call firstprompt cmp al,'1' je centigrade cmp al,'2' je farenheit jmp firstprompt main endp firstprompt: mov ax,offset prompt1 call write mov ax,offset prompt1a call write mov ax,offset prompt1b call read ret write: mov ah,09h int 21h ret read: mov ah,01h int 21h ret centigrade: jmp entertemp sub ax,32d mov bx,5d mul bx mov bx,9d div bx call write farenheit: jmp entertemp mov bx,9d mul bx mov bx,5d div bx mov bx,32d add ax,bx call write entertemp: mov ax,offset prompt2 call write call read ret endprog: mov ax,4c00h int 21h end start ; MODIFIED It outputs some crap though, so you got some time with debugging now. ![]() |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|