UwUBot
UwUBot

Reputation: 11

Running into error A1010 while working with x86 Assembly

First off sorry for the long code block, however I have no clue where the error is in here, I've been looking for the past 2 hours, granted still learning the language, I did remove the contents of the subroutines as the error was still occurring without the code inside.

As the title states I'm running into error A1010: unmatched block nesting : main

from what I've gathered from researching the issue I shouldn't be running into it, so I've turned to the experts ... SOS


INCLUDE Irvine32.inc

.data
buffersize equ 41
bytecount dword ?
buffer byte buffersize dup(0)
null equ 0
tab equ 9

stacksize equ 8
stackindex sdword -4
numstack sdword stacksize dup(0)

.code
main PROC

MLOOP:
    ;whitespace skipping to recieve useable input
    MOV EDX, offset buffer                          ;read from command line
    MOV ECX, sizeof buffer
    CALL ReadString
    MOV bytecount, EAX                              ;keep the byte count
    MOV EDI, 0                                      ;init the index register to 0
SKIP:
    CMP EDI, bytecount                              ;test for eol
    JGE ENDLOOP                                     ;nothing in buffer to process
    MOV AL, buffer[EDI]                             ;get char at buffer location EDI for testing
    CMP AL, NULL                                    ;test if the char is null
    JE ENDLOOP                                      ;nothing in buffer to process
    CMP AL, ' '                                     ;test for a space
    JE NEXTCHAR                                     ;skips the space
    CMP AL, TAB                                     ;test for a tab
    JNE ENDSKIP                                     ;process the command
NEXTCHAR:
    INC EDI                                         ;updates the index for the next char
    JMP SKIP
ENDLOOP:        
    MOV AL, -1                                      ;nothing in buffer, identified by setting AL to -1
ENDSKIP:

;input handling, and menu processing
SWITCH:
    CMP AL, -1                                      ;test if we dont have anything to process
    JE ENDCASE
CASE1:
    CMP AL, '-'                                     ;test if the char is a -
    JNE CASE2                                       ;process next case if not a -
    INC EDI                                         ;move to next location in the buffer
    CMP EDI, bytecount                              ;test if within input string
    JGE CASESUB                                     ;nothing after, - is a subtraction
    MOV AL, buffer[EDI]                             ;get next char, and assign to register AL
    CMP AL, NULL                                    ;test for null
    JE CASESUB                                      ;nothing after, - is a subtraction
    CMP AL, '0'                                     ;test for a digit
    JL CASESUB                                      ;not a digit, then its subtraction
    CMP AL, '9'                                     ;test for a digit
    JG CASESUB                                      ;not a digit, then its subtraction
    CALL NEGNUMBER                                  ;process the negitive number
    JMP ENDCASE
CASESUB:
    CALL SUBTRACT                                   ;process subtraction in subtraction subprocess
    JMP ENDCASE
CASE2:
    CMP AL, '+'                                     ;test if the char is a +
    JNE CASE3                                       ;process the next case
    CALL ADDITION                                   ;process addition
    JMP ENDCASE
CASE3:
    CMP AL, '*'                                     ;test if character is a *
    JNE CASE4                                       ;process the next case
    CALL MULTIPLICATION                             ;process multiplication
    JMP ENDCASE
CASE4:
    CMP AL, '/'                                     ;test if character is a /
    JNE CASE5                                       ;process the next case
    CALL DIVISION                                   ;process division
    JMP ENDCASE
CASE5:
    CMP AL, 'x'                                     ;test if character is a lowercase X     
    JE CASE5A                                       ;process current case
    CMP AL, 'X'                                     ;test if character is a uppercase X
    JNE CASE6                                       ;process the next case
CASE5A:
    CALL EXCHANGE                                   ;process exchanging
    JMP ENDCASE
CASE6:
    CMP AL, 'n'                                     ;test if character is a lowercase N
    JE CASE6A                                       ;process current case
    CMP AL, 'N'                                     ;test if character is a uppercase N
    JNE CASE7                                       ;process the next case
CASE6A:                                                 
    CALL NEGATE                                     ;process negating
    JMP ENDCASE
CASE7:
    CMP AL, 'u'                                     ;test if character is a lowercase U
    JE CASE7A                                       ;process current case
    CMP AL, 'U'                                     ;test if character is a uppercase U
    JNE CASE8                                       ;process the next case
CASE7A:
    CALL ROLLUP                                     ;processing rolling up
    JMP ENDCASE
CASE8:
    CMP AL, 'd'                                     ;test if character is a lowercase D
    JE CSAE8A                                       ;process current case
    CMP AL, 'D'                                     ;test if character is a uppercase D
    JNE CASE9                                       ;process next case
CASE8A:
    CALL ROLLDOWN                                   ;processing rolling down
    JMP ENDCASE
CASE9:
    CMP AL, 'v'                                     ;test if character is a lowercase V
    JE CASE9A                                       ;process current case
    CMP AL, 'V'                                     ;test if character is a uppercase V
    JNE CASE10                                      ;processing next case
CASE9A:
    CALL VIEW                                       ;processing view stack
    JMP ENDCASE
CASE10:
    CMP AL, 'c'                                     ;test if character is a lowercase C
    JE CASE10A                                      ;process current case
    CMP AL, 'C'                                     ;test if character is a uppercase C
    JNE CASE11                                      ;processing next case
CASE10A:
    CALL CLEAR                                      ;processing clear stack
    JMP ENDCASE
CASE11:
    CMP AL, 'q'                                     ;test if character is a lowercase Q
    JE CASE11A                                      ;process current case
    CMP AL, 'Q'                                     ;test if character is a uppercase Q
    JNE CASE12                                      ;processing next case
CASE11A:
    END                                             ;exits program
CASE12:
    CMP AL, '0'                                     ;test if character is less then 0
    JL DEFAULT                                      ;if less then 0 goes to default case
    CMP AL, '9'                                     ;test if character is greater then 9
    JG DEFAULT                                      ; if greater then 0 case goes to default case
    CALL NUMBER                                     ;processing number handeling
    JMP ENDCASE 
DEFAULT:
    ;MOV EDX, OFFSET invalid                            ;invalid command line
    ;CALL WriteString
    ;CALL Crlf
ENDCASE:

JMP MLOOP

main ENDP

NEGNUMBER PROC
    
NEGNUMBER ENDP

SUBTRACT PROC
    
SUBTRACT ENDP

ADDITION PROC
    
ADDITION ENDP

MULTIPLICATION PROC
    
MULTIPLICATION ENDP

DIVISION PROC
    
DIVISION ENDP

EXCHANGE PROC
    
EXCHANGE ENDP

NEGATE PROC
    
NEGATE ENDP

ROLLUP PROC
    
ROLLUP ENDP

ROLLDOWN PROC
    
ROLLDOWN ENDP

VIEW PROC
    
VIEW ENDP

CLEAR PROC
    
CLEAR ENDP

NUMBER PROC
    
NUMBER ENDP

END

Upvotes: 0

Views: 72

Answers (1)

UwUBot
UwUBot

Reputation: 11

I've figured it out, it would seem I just had a poor understanding of some of the Irvine functionality, and cant use the END process how I thought I could.

Upvotes: 1

Related Questions