Qbasicnews.com
July 08, 2020, 07:42:50 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: The things I'd do for my daughter.  (Read 5043 times)
relsoft
*/-\*
*****
Posts: 3927



WWW
« on: March 27, 2006, 11:54:09 PM »

I went to the boondocks for 2 days and I find this message plastered in front of my monitor.....

[translated in english]

Quote
Sir,
     Would you kindly debug these programs? This is a project of of ours and we need this by thursday or we fail.  Our teacher won't let us in the lab. I was referred here by "name withheld" who you made that nice polygon calculator.  She says you're only the one person who can do this and finish it in time.

                                                              Regards Kessa,
                                                              BS, IT  **** State University



Now I wouldn't do this if I didn't know ther teacher taught them well, but I knew she didn't. I knew some of her former students.  And the fact that they don't have their own computer plus they also are not allowed to use the lab these days.  There are about 6 programs here that I need to debug.  I get paid for this also.  Preparing for my daughter's birthday was another motivation to get paid for this. :*)  But I probably woul'd never try to debug but write their proggies from scratch.   I would explain what the code does to them to so I'd better rewrite these from scratch.

Why rewrite from scratch?  Well, would you rather debug this?
Spaghetti City!!!!


Code:
.model small
.stack 100
.data



    game db 13,10,  "                                WELCOME!$"
    game1 db 13,10,"Instruction:answer 3 questions given by choosing to the given selections.Type    the letter of the chosen answer and press enter(press enter)$"
   

    game2  db 13,10, "1.What is the name of the path that energy takes as one living thing eats         another living thing?"
              db 13,10, "              a.Consumers"
              db 13,10, "              b.producers"
              db 13,10, "              c.foodchain$"

    msg3 db 13,10, "enter your choice:$"

    game4 db 13,10, "2.All of the population living together in a region forms a ______?"
              db 13,10, "              a.Habitat"
              db 13,10, "              b.Population"
              db 13,10, "              c.Community$"

    msg5 db 13,10, "enter your choice:$"

    game6 db 13,10, "3.How many planets are in the solar system?"
              db 13,10, "              a.7"
              db 13,10, "              b.9"
              db 13,10, "              c.12$"


    msg7 db 13,10, "enter your choice:$"

    ask1 db 13,10, "your correct!$"
    ask2 db 13,10, "your wrong!$"
    ask3 db 13,10, "your correct!$"
    ask4 db 13,10, "your wrong!$"
    ask5 db 13,10, "your correct!$"
    asK6 db 13,10, "your wrong!$"
   
   



   nameinput label byte
   maxnamelen db 50
   curnamelen db 50
   namefield db 50 dup(?)

   nameinput1 label byte
   maxnamelen1 db 50
   curnamelen1 db 50
   namefield1 db 50 dup(?)

   nameinput2 label byte
   maxnamelen2 db 50
   curnamelen2 db 50
   namefield2 db 50 dup(?)


   nameinput3 label byte
   maxnamelen3 db 50
   curnamelen3 db 50
   namefield3 db 50 dup(?)

   nameinput4 label byte
   maxnamelen4 db 50
   curnamelen4 db 50
   namefield4 db 50 dup(?)


   nameinput5 label byte
   maxnamelen5 db 50
   curnamelen5 db 50
   namefield5 db 50 dup(?)


   nameinput6 label byte
   maxnamelen6 db 50
   curnamelen6 db 50
   namefield6 db 50 dup(?)


   nameinput7 label byte
   maxnamelen7 db 50
   curnamelen7 db 50
   namefield7 db 50 dup(?)

   newline db 13,10,"$"

.code
  begin proc

   mov ax,@data
   mov ds,ax

   mov ah,09h
   mov dx,offset game
   int 21h

   mov ah,0ah
   mov dx,offset nameinput
   int 21h

   mov bx,0
   mov bl,curnamelen
   mov namefield[bx],"$"

   mov ah,09h
   mov dx,offset newline
   int 21h


 


 mov ah,09h
 


 mov dx,offset game1
   int 21h

   mov ah,0ah
   mov dx,offset nameinput1
   int 21h

   mov bx,0
   mov bl,curnamelen1
   mov namefield1[bx],"$"

   mov ah,09h
   mov dx,offset newline
   int 21h


 

   mov ah,09h
   mov dx,offset game2
   int 21h

   mov ah,0ah
   mov dx,offset nameinput2
   int 21h

   mov bx,0
   mov bl,curnamelen2
   mov namefield2[bx],"$"

   mov ah,09h
   mov dx,offset newline
   int 21h



   mov ah,09h
   mov dx,offset msg3
   int 21h

   mov ah,0ah
   mov dx,offset nameinput3
   int 21h

   mov bx,0
   mov bl,curnamelen3
   mov namefield3[bx],"$"

   mov ah,09h
   mov dx,offset newline
   int 21h


   
   cmp al,'a'
   je labelwrong

   labelwrong:

   mov ah,09h
   mov dx,offset ask2
   int 21h

   mov ah,0ah
   mov dx,offset nameinput
   int 21h

   mov bx,0
   mov bl,curnamelen
   mov namefield[bx],"$"

   mov ah,09h
   mov dx,offset newline
   int 21h

   

   cmp al,'b'
   je labelwrong

   

   mov ah,09h
   mov dx,offset ask2
   int 21h

   mov ah,0ah
   mov dx,offset nameinput
   int 21h

   mov bx,0
   mov bl,curnamelen
   mov namefield[bx],"$"

   mov ah,09h
   mov dx,offset newline
   int 21h




   cmp al,'c'
   je labelcorrect

 

   mov ah,09h
   mov dx,offset ask1
   int 21h

   mov ah,0ah
   mov dx,offset nameinput
   int 21h

   mov bx,0
   mov bl,curnamelen
   mov namefield[bx],"$"

   mov ah,09h
   mov dx,offset newline
   int 21h










   mov ah,09h
   mov dx,offset game4
   int 21h

   mov ah,0ah
   mov dx,offset nameinput4
   int 21h

   mov bx,0
   mov bl,curnamelen4
   mov namefield4[bx],"$"

   mov ah,09h
   mov dx,offset newline
   int 21h



   mov ah,09h
   mov dx,offset msg5
   int 21h

   mov ah,0ah
   mov dx,offset nameinput5
   int 21h

   mov bx,0
   mov bl,curnamelen5
   mov namefield5[bx],"$"

   mov ah,09h
   mov dx,offset newline
   int 21h



   cmp al,'a'
   je labelwrong3

 

   mov ah,09h
   mov dx,offset ask4
   int 21h

   mov ah,0ah
   mov dx,offset nameinput
   int 21h

   mov bx,0
   mov bl,curnamelen
   mov namefield[bx],"$"

   mov ah,09h
   mov dx,offset newline
   int 21h

   
   cmp al,'b'
   je labelwrong4

 

   mov ah,09h
   mov dx,offset ask4
   int 21h

   mov ah,0ah
   mov dx,offset nameinput
   int 21h

   mov bx,0
   mov bl,curnamelen
   mov namefield[bx],"$"

   mov ah,09h
   mov dx,offset newline
   int 21h




   cmp al,'c'
   je labelcorrect2

   

   mov ah,09h
   mov dx,offset ask3
   int 21h

   mov ah,0ah
   mov dx,offset nameinput
   int 21h

   mov bx,0
   mov bl,curnamelen
   mov namefield[bx],"$"

   mov ah,09h
   mov dx,offset newline
   int 21h



   







   mov ah,09h
   mov dx,offset game6
   int 21h

   mov ah,0ah
   mov dx,offset nameinput6
   int 21h

   mov bx,0
   mov bl,curnamelen6
   mov namefield6[bx],"$"

   mov ah,09h
   mov dx,offset newline
   int 21h


   mov ah,09h
   mov dx,offset msg7
   int 21h

   mov ah,0ah
   mov dx,offset nameinput7
   int 21h

   mov bx,0
   mov bl,curnamelen7
   mov namefield7[bx],"$"

   mov ah,09h
   mov dx,offset newline
   int 21h



 


   cmp al,'a'
   je labelwrong5

 

   mov ah,09h
   mov dx,offset ask6
   int 21h

   mov ah,0ah
   mov dx,offset nameinput
   int 21h

   mov bx,0
   mov bl,curnamelen
   mov namefield[bx],"$"

   mov ah,09h
   mov dx,offset newline
   int 21h

   
   cmp al,'b'
   je labelcorrect3

 

   mov ah,09h
   mov dx,offset ask5
   int 21h

   mov ah,0ah
   mov dx,offset nameinput
   int 21h

   mov bx,0
   mov bl,curnamelen
   mov namefield[bx],"$"

   mov ah,09h
   mov dx,offset newline
   int 21h




   cmp al,'c'
   je labelwrong6

 

   mov ah,09h
   mov dx,offset ask6
   int 21h

   mov ah,0ah
   mov dx,offset nameinput
   int 21h

   mov bx,0
   mov bl,curnamelen
   mov namefield[bx],"$"

   mov ah,09h
   mov dx,offset newline
   int 21h





   
 
   mov ah,4ch
   int 21h

begin endp
   end begin
     



Looking at the code makes smile a little. :*)
Logged

y smiley is 24 bit.


Genso's Junkyard:
http://rel.betterwebber.com/
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #1 on: March 28, 2006, 09:32:41 PM »

I agree with your actions. I often feel the same way when I am doing a "team" project.


One thing you can do is charge them different prices for debugging (higher) versus for writing the whole thing (lower) again, or maybe even both (highest price).
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
relsoft
*/-\*
*****
Posts: 3927



WWW
« Reply #2 on: March 28, 2006, 11:02:20 PM »

Yeah, I charged 500 pesos (about 10 usd) for rewriting the above code:

Code:
.model small
.386
.stack 200
.data




game          db 13,10,"                                WELCOME!$"
instruction   db 13,10,"  Instruction: Answer 3 questions given by choosing to the given selections. "
              db 13,10,"   Type the letter of the chosen answer and press enter(press enter)$"


newline       db 13,10,"$"
msg           db 13,10, "enter your choice:$"


game1         db 13,10, "1.What is the name of the path that energy takes as one living thing eats"
              db 13,10, "                            another living thing?"
              db 13,10, "              a.Consumers"
              db 13,10, "              b.producers"
              db 13,10, "              c.foodchain$"




game2         db 13,10, "2.All of the population living together in a region forms a ______?"
              db 13,10, "              a.Habitat"
              db 13,10, "              b.Population"
              db 13,10, "              c.Community$"


game3         db 13,10, "3.How many planets are in the solar system?"
              db 13,10, "              a.7"
              db 13,10, "              b.9"
              db 13,10, "              c.12$"



ask1          db 13,10, "You're correct!$"
ask2          db 13,10, "You're wrong!$"
ask3          db 13,10, "invalid input!$"
ask4          db "Your score is  /3$"


names         db 13,10, "                               Submitted by: "
              db 13,10, ""
              db 13,10, "                               Ryan Guadalupe"
              db 13,10, "                               Mary Jane San Felix"
              db 13,10, "                               Mary Jezza Saballa$"

;for choice input
nameinput      label byte
maxnamelen     db 2
curnamelen     db 2
namefield      db 2 dup(?)


score          db 0

.code

;*****************************************************************
PrintChar Macro aschar
    pusha
        mov al, aschar
        mov ah, 0ah
        mov bh, 00
        mov cx, 1
        int 10h
    popa
EndM PrintChar

;*****************************************************************
;Prints a string on the screen
;string needs to be ended by $"
Print Macro  Message
pusha
xor ax,ax                             ;zero out ax
mov ah, 09h      ;print interrupt 21, 9
lea dx, message      ;Load Effective Address(offset)
int 21h      ;print it
popa
EndM Print
;*****************************************************************
;sets the cursor at row col
Locate Macro row, col
    pusha
    mov ah, 02h ;int 10, 2
    xor bx, bx                          ;bx should be zero
    mov dh, row ;dh=row, dl = column
    mov dl, col
    int 10h ;do it
    popa
EndM Locate

;*****************************************************************
;reads the keyboad buffer
Input Macro
;needs ax to be unused
;returns in AH the scancode
;returns in AL the asciicode
mov   ah, 10h                   ; check for input
    int   16h
EndM Input


;*****************************************************************
;destroys ax, dx
Getinput proc
   pusha
   mov ah, 0ah ;int 20, a (buffered input)
   lea dx, nameinput ;load parlist
   int 21h ;do it
   popa
   ret
Getinput Endp


;*****************************************************************
;sets screen to texmode
textmode         proc
   mov   ah, 00h                        ;set video mode
   mov   al, 03h                        ;mode 03h
   int   10h                            ;enter 80x25x16 mode
   ret
textmode         endp

;*****************************************************************
;clears the screen
ClearScreen Proc
pusha ;preserve general regs
mov ax, 0600h        ;int 10, 6(scroll screen)
mov bh, 01011010b ;color white on Black
mov cx, 0000 ;row0,col0
mov dx, 184fh ;25,80
int 10h                         ;scroll(clear it)
popa ;restore regs
ret
ClearScreen Endp
;*****************************************************************
;*****************************************************************
;Main program

start:

      mov ax, @data                     ;set segments to data
      mov es, ax
      mov ds, ax

      call  textmode ;set to textmode
      call  ClearScreen ;clear the screen
      print game
      print instruction
      input
      xor ax, ax

q1:
      input
      call clearscreen                  ;clear the screen
      locate 0,0                        ;row 0, col0
      print game1                       ;question 1
      print newline                     ;next row (CRLF)
      locate 7, 1                       ;row7, col 1
      print msg                         ;"enter your choice"
      call getinput                     ;nemefield = choice + enter
      lea di, namefield                 ;set offset to first char
      mov al, es:[di]                   ;mov cahracter to al
      cmp al, "a"                       ; is it "a"?
      jne check1_1                      ;!= "a" check fr another choice
      print newline                     ;= "a" wrong!
      print ask2                        ;print you are wrong
      jmp q2                            ;return to question 1
check1_1:
      cmp al, "b"                       ;"b"?
      jne check1_2                      ;check for another choice
      print newline                     ;crlf
      print ask2                        ;print wrong
      jmp q2                            ;jump to q 1
check1_2:
      cmp al, "c"                       ;"c" is the correct ans
      jne invalid_1                     ;if != a b or c then invalid
      print newline                     ;crlf
      print ask1                        ;print corect
      add score, 1                      ;add 1 to score
      jmp Q2                            ;since correct, next question
invalid_1:                              ;handle invalid input
      print newline                     ;cr lf
      print ask3                        ;print "invalid input"
      jmp q1                            ;return to Q 1
Q2:
      input
      call clearscreen                  ;clear the screen
      locate 0, 0
      print game2                       ;question 2
      print newline

      locate 7, 1
      print msg
      call getinput
      lea di, namefield
      mov al, es:[di]
      cmp al , "a"
      jne check2_1
      print newline
      print ask2
      jmp q3
check2_1:
      cmp al, "b"
      jne check2_2
      print newline
      print ask2
      jmp q3
check2_2:
      cmp al, "c"                       ;this is the correct answer
      jne invalid_2
      print newline
      print ask1
      add score, 1                      ;add 1 to score
      jmp Q3
invalid_2:
      print newline
      print ask3
      jmp q2

Q3:
      input
      call clearscreen                  ;clear the screen
      locate 0, 0
      print game3                       ;question 2
      print newline

      locate 7, 1
      print msg
      call getinput
      lea di, namefield
      mov al, es:[di]
      cmp al, "a"
      jne check3_1
      print newline
      print ask2
      ;jmp q3
      jmp end_test
check3_1:
      cmp al, "c"
      jne check3_2
      print newline
      print ask2
      ;jmp q3
      jmp end_test
check3_2:
      cmp al, "b"                       ;correct answer
      jne invalid_3
      print newline
      print ask1
      add score, 1                      ;add 1 to score
      jmp end_test
invalid_3:
      print newline
      print ask3
      jmp q3


end_test:

      input
      call clearscreen                  ;clear the screen
      locate 10, 25
      print ask4
      locate 10, 39
      mov al, scor
      e
      or al, 30h
      printchar al
      input
      call clearscreen                  ;clear the screen
      locate 10, 10                     ;set cursor at 10 ,10
      print names                       ;print our names
      input                             ;wait for keypress

      mov   ah, 4ch
      mov   al, 00h
      int   21h                            ;return to dos

end start
Logged

y smiley is 24 bit.


Genso's Junkyard:
http://rel.betterwebber.com/
Jofers
Been there, done that
*****
Posts: 1040



WWW
« Reply #3 on: March 29, 2006, 12:15:21 AM »

You're a nobler man than me Smiley  I knew my roomate was taught well, but I did his java homework for the exact same price, and then spent it on Applebees.  But hey, I would never do such a thing if I cared.
Logged
relsoft
*/-\*
*****
Posts: 3927



WWW
« Reply #4 on: March 29, 2006, 02:06:20 AM »

Quote from: "Jofers"
You're a nobler man than me Smiley  I knew my roomate was taught well, but I did his java homework for the exact same price, and then spent it on Applebees.  But hey, I would never do such a thing if I cared.


I wouldn't say what I did was noble. But I needed some fast cash. :*)

BTW, what are applebees?

Bees that look like an apple or apples that look like bees?


 Cheesy
Logged

y smiley is 24 bit.


Genso's Junkyard:
http://rel.betterwebber.com/
DrV
Na_th_an
*****
Posts: 1553



WWW
« Reply #5 on: March 29, 2006, 03:30:27 AM »

Applebee's is a restaraunt chain in the U.S. (one of those silly ones that think that since they take longer to give you food, they can charge you more money Wink ).
Logged
Jofers
Been there, done that
*****
Posts: 1040



WWW
« Reply #6 on: March 29, 2006, 04:26:22 AM »

Yes, but their burgers... soo good...
Logged
Anonymous
Guest
« Reply #7 on: March 29, 2006, 12:54:29 PM »

yeah the applebee burger is th shiznat. *drools*


dude if i could program for applebee burgers i would end up looking like comic book guy from the simpsons :|
Logged
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #8 on: March 30, 2006, 01:26:39 AM »

A few comments:

Rel, did you move to Mexico? Pesos?  :Huh:


Applebee's has nice burgers, but often lousy service. Besides that, their burgers make my face red and my nose runny. I think it's something in the sauce that I tell them not to put...

These are the defects with the burger+fries I used to order for takeout (my mom still buys the salad there sometimes, I guess it's harder to frag up salad):

*The meat is too big for the bun. I need to cut out a huge chunk of it manually, and then I cut the thing in 2's or 4's so it doesn't become a huge mess.

*Often, at my Applebee's, they don't give me what I want: NO "BBQ" sauce, and WITH pickles. I once told them about them not giving me "cucumbers", and they said "Well, we don't have cucumbers, we have pickles".... omfg they don't understand that pickled cucumbers = pickles.

*Half the time they give me half the fries that they usually give.


It's not surprising though, given that their employees are often basically teenagers who are going to make lots of mistakes. Some my age actually...: I saw a few high school acquaintances (girls) working in there. (They should be in college...)

Edit: It's actually 51.15 PHP (Philipoine Pesos) to 1 USD. One of my professors is from the Philippines actually. I think.

Edit2: Considering that, according to the CIA, the average GDP (adjusted from PPP GDP of $5100) is approximately $1020, $10 looks to be 3.5 days of work, no?
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Pritchard
Wandering Guru
***
Posts: 328


« Reply #9 on: March 30, 2006, 01:37:36 AM »

Quote from: "Jofers"
Yes, but their burgers... soo good...
Umm...No their Quesaduillas are better...
Logged

 will Live Forever, or Die Trying >_<;;
relsoft
*/-\*
*****
Posts: 3927



WWW
« Reply #10 on: March 30, 2006, 08:48:34 AM »

Quote from: "Agamemnus"
A few comments:

Rel, did you move to Mexico? Pesos?  :Huh:


Edit: It's actually 51.15 PHP (Philipoine Pesos) to 1 USD. One of my professors is from the Philippines actually. I think.

Edit2: Considering that, according to the CIA, the average GDP (adjusted from PPP GDP of $5100) is approximately $1020, $10 looks to be 3.5 days of work, no?



Nope, Pesos is our currency.

So 500/51 = ?  Appx 10 USD

Your Prof is a Filipino?! That's great? What's his name?

Not bad for 4 hours of wor for each ASM job eh?  Actuall, I told them how much they would pay, they said 500 so it's 500 php. :*)
Logged

y smiley is 24 bit.


Genso's Junkyard:
http://rel.betterwebber.com/
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #11 on: March 30, 2006, 01:36:12 PM »

She. Cheesy
Her first name is "Laarni".
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!