MOV# 37777777, R1  ; closest so far: R0 is index, R1 is square distance
    MOV# 30, R2   ; number of points left to consider
    MOV# 500, R3  ; pointer into 'A'
    MOV# 560, R4  ; pointer into 'B'

L:  MOV (R3)+, R5  ; A[i].x
    MOV (R4)+, R6  ; B[i].x
    SUB R6, R5
    MUL R5, R5     ; (A[i].x - B[i].x) ** 2
    MOV (R3)+, R6  ; A[i].y
    MOV (R4)+, R7  ; B[i].y
    SUB R7, R6
    MUL R6, R6     ; (A[i].y - B[i].y) ** 2
    ADD R5, R6
    CMP R6, R1
    BLE L2

    ; it's our new closest point
    MOV R6, R1
    MOV #30, R0
    SUB R2, R0

L2: DEC R2
    TST R2
    BGT L
    HALT


[on to problem #8]