Skip to content

Instantly share code, notes, and snippets.

@ProfAndreaPollini
Last active November 16, 2018 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ProfAndreaPollini/47ab5b4ba4ac4a0bbd8627bcfa2e968f to your computer and use it in GitHub Desktop.
Save ProfAndreaPollini/47ab5b4ba4ac4a0bbd8627bcfa2e968f to your computer and use it in GitHub Desktop.
ASSEMBLY: array_compare (emulatore: https://schweigi.github.io/assembler-simulator/ )
JMP start
v1len: DB 3
v1: DB 2
DB 5
DB 10
v2len: DB 3
v2: DB 2
DB 5
DB 10
start:
;mi assicuro che v1 e v2 abbiano la stessa lunghezza
MOV A, [v1len]
CMP A, [v2len]
JNZ notequals
; inizializzo
MOV A, v1
MOV C, v2
MOV D, [v1len]
ADD D, A
;DEC D
;MOV C, 0
.loop:
;MOV C, [A+]
PUSH D
MOV B,[A]
MOV D,[C]
CMP B,D
JNZ notequals
;MOV C,
INC A
INC C
POP D
CMP A,D
JNZ .loop
equals:
MOV [232],49
HLT
notequals:
MOV [232], 48
HLT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment